| 15 | #include <memory> |
| 16 | |
| 17 | [[nodiscard]] inline std::unique_ptr<GeometryGraphShim> |
| 18 | node(const GeometryCollectionShim& rust_geoms, double tolerance) noexcept |
| 19 | { |
| 20 | const auto geos_geoms = copy_rust_collection_to_geos(rust_geoms); |
| 21 | auto noded = std::unique_ptr<geos::geom::Geometry>(nullptr); |
| 22 | if (tolerance == 0.0) |
| 23 | { |
| 24 | noded = generative::noding::GeometryNoder::node(*geos_geoms, nullptr); |
| 25 | } else |
| 26 | { |
| 27 | auto noder = std::make_unique<geos::noding::snap::SnappingNoder>(tolerance); |
| 28 | noded = generative::noding::GeometryNoder::node(*geos_geoms, std::move(noder)); |
| 29 | } |
| 30 | if (!noded) |
| 31 | { |
| 32 | return nullptr; |
| 33 | } |
| 34 | |
| 35 | auto graph = generative::noding::GeometryGraph(*noded); |
| 36 | |
| 37 | auto graph_shim = std::make_unique<GeometryGraphShim>(std::move(graph)); |
| 38 | |
| 39 | return graph_shim; |
| 40 | } |
| 41 | |
| 42 | [[nodiscard]] inline PolygonizationResult polygonize(const GeometryGraphShim& graph) noexcept |
| 43 | { |