[geos-commits] [SCM] GEOS branch main updated. 178183a7d89b823b7c166573ba3781288528fe06

git at osgeo.org git at osgeo.org
Fri May 30 15:22:16 PDT 2025


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".

The branch, main has been updated
       via  178183a7d89b823b7c166573ba3781288528fe06 (commit)
      from  cd8275eb1f6e81885cf7483ed4f5c24df6c12512 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 178183a7d89b823b7c166573ba3781288528fe06
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Fri May 30 15:21:39 2025 -0700

    Change CoverageGapFinder to return polygons

diff --git a/src/coverage/CoverageGapFinder.cpp b/src/coverage/CoverageGapFinder.cpp
index b4de0fc50..3cd6b6583 100644
--- a/src/coverage/CoverageGapFinder.cpp
+++ b/src/coverage/CoverageGapFinder.cpp
@@ -47,7 +47,6 @@ CoverageGapFinder::findGaps(std::vector<const Geometry*>& coverage, double gapWi
     return finder.findGaps(gapWidth);
 }
 
-
 /* public */
 std::unique_ptr<Geometry>
 CoverageGapFinder::findGaps(double gapWidth)
@@ -56,21 +55,21 @@ CoverageGapFinder::findGaps(double gapWidth)
     std::vector<const Polygon*> polygons;
     PolygonExtracter::getPolygons(*geomUnion, polygons);
 
-    std::vector<std::unique_ptr<LineString>> gapLines;
+    std::vector<std::unique_ptr<Geometry>> gapLines;
     for (const Polygon* poly : polygons) {
         for (std::size_t i = 0; i < poly->getNumInteriorRing(); i++) {
             const LinearRing* hole = poly->getInteriorRingN(i);
             if (isGap(hole, gapWidth)) {
-                auto pts = hole->getCoordinatesRO()->clone();
-                auto ls = geomUnion->getFactory()->createLineString(std::move(pts));
-                gapLines.emplace_back(ls.release());
+                //auto pts = hole->getCoordinatesRO()->clone();
+                //auto ls = geomUnion->getFactory()->createLineString(std::move(pts));
+                auto polygon = geomUnion->getFactory()->createPolygon(hole->clone());
+                gapLines.emplace_back(polygon.release());
             }
         }
     }
     return geomUnion->getFactory()->buildGeometry(std::move(gapLines));
 }
 
-
 /* private */
 bool
 CoverageGapFinder::isGap(const LinearRing* hole, double gapWidth)
diff --git a/tests/unit/coverage/CoverageGapFinderTest.cpp b/tests/unit/coverage/CoverageGapFinderTest.cpp
index 5a345e18a..2c25c4c2c 100644
--- a/tests/unit/coverage/CoverageGapFinderTest.cpp
+++ b/tests/unit/coverage/CoverageGapFinderTest.cpp
@@ -69,7 +69,7 @@ void object::test<1> ()
     checkGaps(
         "MULTIPOLYGON (((1 5, 1 9, 5 9, 5 6, 3 5, 1 5)), ((5 9, 9 9, 9 5, 7 5, 5 6, 5 9)), ((1 1, 1 5, 3 5, 7 5, 9 5, 9 1, 1 1)))",
         1,
-        "LINESTRING (3 5, 7 5, 5 6, 3 5)"
+        "POLYGON ((3 5, 7 5, 5 6, 3 5))"
         );
 }
 

-----------------------------------------------------------------------

Summary of changes:
 src/coverage/CoverageGapFinder.cpp            | 11 +++++------
 tests/unit/coverage/CoverageGapFinderTest.cpp |  2 +-
 2 files changed, 6 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list