Skip to content

Commit

Permalink
Merge pull request #61 from quantifyearth/mwd-adjust-dot
Browse files Browse the repository at this point in the history
Make dot renderer indicate files vs directory
  • Loading branch information
mdales authored Jul 10, 2024
2 parents ad633bb + a83f36f commit 61ee628
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 31 deletions.
7 changes: 5 additions & 2 deletions src/lib/dotrenderer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ let render_import_to_dot ppf command =
Format.fprintf ppf "\n"

let datafile_to_dot ppf datafile =
Format.fprintf ppf "\tn%d[shape=\"cylinder\",label=\"%s\"];\n"
(Datafile.id datafile)
let shape =
match Datafile.is_dir datafile with true -> "tab" | false -> "note"
in
Format.fprintf ppf "\tn%d[shape=\"%s\",label=\"%s\"];\n"
(Datafile.id datafile) shape
(Fpath.to_string (Datafile.path datafile))

let render_ast_to_dot ppf hyperblocks : unit =
Expand Down
58 changes: 29 additions & 29 deletions src/test/expect/test_dot.expected
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
digraph{
n0[shape="cylinder",label="/data/tmf/project_boundaries/123.geojson"];
n2[shape="cylinder",label="/data/tmf/project_boundaries"];
n4[shape="cylinder",label="/data/tmf/jrc/zips"];
n5[shape="cylinder",label="/data/tmf/jrc/tif"];
n7[shape="cylinder",label="/data/tmf/fcc-cpcs"];
n9[shape="cylinder",label="/data/tmf/ecoregions/ecoregions.geojson"];
n11[shape="cylinder",label="/data/tmf/ecoregions"];
n13[shape="cylinder",label="/data/tmf/access/raw.tif"];
n15[shape="cylinder",label="/data/tmf/access"];
n17[shape="cylinder",label="/data/tmf/osm_borders.geojson"];
n19[shape="cylinder",label="/data/tmf/123/buffer.geojson"];
n21[shape="cylinder",label="/data/tmf/123/leakage.geojson"];
n23[shape="cylinder",label="/data/tmf/123/luc.tif"];
n25[shape="cylinder",label="/data/tmf/gedi"];
n28[shape="cylinder",label="/data/tmf/123/carbon-density.csv"];
n30[shape="cylinder",label="/data/tmf/123/country-list.json"];
n32[shape="cylinder",label="/data/tmf/123/matching-area.geojson"];
n34[shape="cylinder",label="/data/tmf/srtm/zip"];
n35[shape="cylinder",label="/data/tmf/srtm/tif"];
n37[shape="cylinder",label="/data/tmf/slopes"];
n39[shape="cylinder",label="/data/tmf/rescaled-elevation"];
n41[shape="cylinder",label="/data/tmf/rescaled-slopes"];
n43[shape="cylinder",label="/data/tmf/123/countries.tif"];
n45[shape="cylinder",label="/data/tmf/123/k.parquet"];
n47[shape="cylinder",label="/data/tmf/123/matches"];
n49[shape="cylinder",label="/data/tmf/123/matches.tif"];
n51[shape="cylinder",label="/data/tmf/123/matches.parquet"];
n53[shape="cylinder",label="/data/tmf/123/pairs"];
n55[shape="cylinder",label="/data/tmf/123/additionality.csv"];
n0[shape="note",label="/data/tmf/project_boundaries/123.geojson"];
n2[shape="note",label="/data/tmf/project_boundaries"];
n4[shape="note",label="/data/tmf/jrc/zips"];
n5[shape="note",label="/data/tmf/jrc/tif"];
n7[shape="note",label="/data/tmf/fcc-cpcs"];
n9[shape="note",label="/data/tmf/ecoregions/ecoregions.geojson"];
n11[shape="note",label="/data/tmf/ecoregions"];
n13[shape="note",label="/data/tmf/access/raw.tif"];
n15[shape="note",label="/data/tmf/access"];
n17[shape="note",label="/data/tmf/osm_borders.geojson"];
n19[shape="note",label="/data/tmf/123/buffer.geojson"];
n21[shape="note",label="/data/tmf/123/leakage.geojson"];
n23[shape="note",label="/data/tmf/123/luc.tif"];
n25[shape="note",label="/data/tmf/gedi"];
n28[shape="note",label="/data/tmf/123/carbon-density.csv"];
n30[shape="note",label="/data/tmf/123/country-list.json"];
n32[shape="note",label="/data/tmf/123/matching-area.geojson"];
n34[shape="note",label="/data/tmf/srtm/zip"];
n35[shape="note",label="/data/tmf/srtm/tif"];
n37[shape="note",label="/data/tmf/slopes"];
n39[shape="note",label="/data/tmf/rescaled-elevation"];
n41[shape="note",label="/data/tmf/rescaled-slopes"];
n43[shape="note",label="/data/tmf/123/countries.tif"];
n45[shape="note",label="/data/tmf/123/k.parquet"];
n47[shape="note",label="/data/tmf/123/matches"];
n49[shape="note",label="/data/tmf/123/matches.tif"];
n51[shape="note",label="/data/tmf/123/matches.parquet"];
n53[shape="note",label="/data/tmf/123/pairs"];
n55[shape="note",label="/data/tmf/123/additionality.csv"];
subgraph "cluster_0" {
style = solid
label = "imports"
Expand Down

0 comments on commit 61ee628

Please sign in to comment.