()
| 27 | } |
| 28 | |
| 29 | fn 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 | } |
nothing calls this directly
no test coverage detected