MCPcopy Create free account
hub / github.com/Notgnoshi/generative / main

Function main

tools/snap.rs:75–107  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

73}
74
75fn main() -> eyre::Result<()> {
76 color_eyre::install()?;
77 let args = CmdlineOptions::parse();
78
79 let filter = tracing_subscriber::EnvFilter::builder()
80 .with_default_directive(args.log_level.into())
81 .from_env_lossy();
82 tracing_subscriber::fmt()
83 .with_env_filter(filter)
84 .with_ansi(true)
85 .with_writer(std::io::stderr)
86 .init();
87
88 let reader = get_input_reader(&args.input)?;
89 let mut writer = get_output_writer(&args.output)?;
90 let strategy = match args.strategy {
91 CliSnappingStrategy::ClosestPoint => SnappingStrategy::ClosestPoint(args.tolerance),
92 CliSnappingStrategy::RegularGrid => SnappingStrategy::RegularGrid(args.tolerance),
93 };
94
95 match args.input_format {
96 InputFormat::Wkt => {
97 let geometries = read_geometries(reader);
98 let geometries = snap_geoms(geometries, strategy);
99 write_geometries(writer, geometries)
100 }
101 InputFormat::Tgf => {
102 let graph: GeometryGraph<Undirected> = read_tgf_graph(reader);
103 let graph = snap_graph(graph, strategy);
104 write_tgf_graph(&mut writer, &graph)
105 }
106 }
107}

Callers

nothing calls this directly

Calls 8

get_input_readerFunction · 0.85
get_output_writerFunction · 0.85
read_geometriesFunction · 0.85
snap_geomsFunction · 0.85
write_geometriesFunction · 0.85
read_tgf_graphFunction · 0.85
snap_graphFunction · 0.85
write_tgf_graphFunction · 0.85

Tested by

no test coverage detected