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

Function main

tools/smooth.rs:29–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27}
28
29fn main() -> eyre::Result<()> {
30 color_eyre::install()?;
31 let args = CmdlineOptions::parse();
32
33 let filter = tracing_subscriber::EnvFilter::builder()
34 .with_default_directive(args.log_level.into())
35 .from_env_lossy();
36 tracing_subscriber::fmt()
37 .with_env_filter(filter)
38 .with_ansi(true)
39 .with_writer(std::io::stderr)
40 .init();
41
42 let reader = get_input_reader(&args.input)?;
43 let geometries = read_geometries(reader);
44 let geometries = flatten_nested_geometries(geometries);
45 let geometries = geometries.map(|g| match g {
46 Geometry::Point(_)
47 | Geometry::Line(_)
48 | Geometry::MultiPoint(_)
49 | Geometry::GeometryCollection(_)
50 | Geometry::Rect(_)
51 | Geometry::Triangle(_) => g,
52 Geometry::LineString(g) => Geometry::LineString(g.chaikin_smoothing(args.iterations)),
53 Geometry::Polygon(g) => Geometry::Polygon(g.chaikin_smoothing(args.iterations)),
54 Geometry::MultiLineString(g) => {
55 Geometry::MultiLineString(g.chaikin_smoothing(args.iterations))
56 }
57 Geometry::MultiPolygon(g) => Geometry::MultiPolygon(g.chaikin_smoothing(args.iterations)),
58 });
59
60 let writer = get_output_writer(&args.output)?;
61 write_geometries(writer, geometries)
62}

Callers

nothing calls this directly

Calls 6

get_input_readerFunction · 0.85
read_geometriesFunction · 0.85
LineStringClass · 0.85
get_output_writerFunction · 0.85
write_geometriesFunction · 0.85

Tested by

no test coverage detected