[geos-commits] [SCM] GEOS branch master updated. 4ef6f82756cfc3d6bf6a85c698b0bb01b2176fff

git at osgeo.org git at osgeo.org
Thu Jul 30 11:05:30 PDT 2020


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, master has been updated
       via  4ef6f82756cfc3d6bf6a85c698b0bb01b2176fff (commit)
      from  9cc5f362f1091eaf469a582ae91bca437b7b10ec (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 4ef6f82756cfc3d6bf6a85c698b0bb01b2176fff
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Thu Jul 30 11:05:21 2020 -0700

    Tie MakeValid implementation directly to the old overlay operations

diff --git a/src/operation/valid/MakeValid.cpp b/src/operation/valid/MakeValid.cpp
index 3e4d4f0..865a11d 100644
--- a/src/operation/valid/MakeValid.cpp
+++ b/src/operation/valid/MakeValid.cpp
@@ -21,7 +21,9 @@
 
 #include <geos/operation/valid/MakeValid.h>
 #include <geos/operation/valid/IsValidOp.h>
+#include <geos/operation/overlay/OverlayOp.h>
 #include <geos/operation/polygonize/BuildArea.h>
+#include <geos/operation/union/UnaryUnionOp.h>
 #include <geos/geom/Geometry.h>
 #include <geos/geom/GeometryCollection.h>
 #include <geos/geom/GeometryFactory.h>
@@ -44,11 +46,35 @@
 #endif
 
 using namespace geos::geom;
+using geos::operation::overlay::OverlayOp;
+using geos::operation::geounion::UnaryUnionOp;
 
 namespace geos {
 namespace operation { // geos.operation
 namespace valid { // geos.operation.valid
 
+
+static std::unique_ptr<geom::Geometry>
+makeValidSymDifference(const geom::Geometry* g0, const geom::Geometry* g1)
+{
+    std::unique_ptr<Geometry> r(OverlayOp::overlayOp(g0, g1, OverlayOp::opSYMDIFFERENCE));
+    return r;
+}
+
+static std::unique_ptr<geom::Geometry>
+makeValidDifference(const geom::Geometry* g0, const geom::Geometry* g1)
+{
+    std::unique_ptr<Geometry> r(OverlayOp::overlayOp(g0, g1, OverlayOp::opDIFFERENCE));
+    return r;
+}
+
+static std::unique_ptr<geom::Geometry>
+makeValidUnion(const geom::Geometry* g0, const geom::Geometry* g1)
+{
+    std::unique_ptr<Geometry> r(OverlayOp::overlayOp(g0, g1, OverlayOp::opUNION));
+    return r;
+}
+
 /*
  * Fully node given linework
  */
@@ -81,7 +107,7 @@ nodeLineWithFirstCoordinate(const geom::Geometry* geom)
       point = line->getPointN(0);
   }
 
-  return geom->Union(point.get());
+  return makeValidUnion(geom, point.get());
 }
 
 
@@ -190,7 +216,7 @@ static std::unique_ptr<geom::Geometry> MakeValidPoly(const geom::Geometry* geom)
     *       We want to retrieve any of those */
     auto pi = extractUniquePoints(bound.get());
     auto po = extractUniquePoints(cut_edges.get());
-    std::unique_ptr<geom::Geometry> collapse_points(pi->difference(po.get()));
+    std::unique_ptr<geom::Geometry> collapse_points = makeValidDifference(pi.get(), po.get());
     assert(collapse_points);
     pi.reset();
     po.reset();
@@ -222,7 +248,7 @@ static std::unique_ptr<geom::Geometry> MakeValidPoly(const geom::Geometry* geom)
         assert(new_area_bound);
 
         // Now symdif new and old area
-        std::unique_ptr<geom::Geometry> symdif(area->symDifference(new_area.get()));
+        std::unique_ptr<geom::Geometry> symdif = makeValidSymDifference(area.get(), new_area.get());
         assert(symdif);
 
         area = std::move(symdif);
@@ -237,7 +263,7 @@ static std::unique_ptr<geom::Geometry> MakeValidPoly(const geom::Geometry* geom)
         * NOTE: this is an expensive operation.
         *
         */
-        std::unique_ptr<geom::Geometry> new_cut_edges(cut_edges->difference(new_area_bound.get()));
+        std::unique_ptr<geom::Geometry> new_cut_edges = makeValidDifference(cut_edges.get(), new_area_bound.get());
         assert(new_cut_edges);
 
         cut_edges = std::move(new_cut_edges);

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

Summary of changes:
 src/operation/valid/MakeValid.cpp | 34 ++++++++++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list