[geos-commits] [SCM] GEOS branch master updated. 0d7d79361ce96e18b51c4ed49de6830f12574cea

git at osgeo.org git at osgeo.org
Fri Jul 31 08:35:42 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  0d7d79361ce96e18b51c4ed49de6830f12574cea (commit)
      from  4ef6f82756cfc3d6bf6a85c698b0bb01b2176fff (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 0d7d79361ce96e18b51c4ed49de6830f12574cea
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Fri Jul 31 08:34:49 2020 -0700

    Use BinaryOp instead of OverlayOp in order to access old fall-back behaviour in overlay. References #1037

diff --git a/src/operation/valid/MakeValid.cpp b/src/operation/valid/MakeValid.cpp
index 865a11d..eaa10e9 100644
--- a/src/operation/valid/MakeValid.cpp
+++ b/src/operation/valid/MakeValid.cpp
@@ -24,6 +24,7 @@
 #include <geos/operation/overlay/OverlayOp.h>
 #include <geos/operation/polygonize/BuildArea.h>
 #include <geos/operation/union/UnaryUnionOp.h>
+#include <geos/geom/BinaryOp.h>
 #include <geos/geom/Geometry.h>
 #include <geos/geom/GeometryCollection.h>
 #include <geos/geom/GeometryFactory.h>
@@ -46,8 +47,7 @@
 #endif
 
 using namespace geos::geom;
-using geos::operation::overlay::OverlayOp;
-using geos::operation::geounion::UnaryUnionOp;
+using namespace geos::operation::overlay;
 
 namespace geos {
 namespace operation { // geos.operation
@@ -57,22 +57,19 @@ 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;
+    return BinaryOp(g0, g1, overlayOp(OverlayOp::opSYMDIFFERENCE));
 }
 
 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;
+    return BinaryOp(g0, g1, overlayOp(OverlayOp::opDIFFERENCE));
 }
 
 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;
+    return BinaryOp(g0, g1, overlayOp(OverlayOp::opUNION));
 }
 
 /*
diff --git a/tests/unit/capi/GEOSMakeValidTest.cpp b/tests/unit/capi/GEOSMakeValidTest.cpp
index 800da9e..319067a 100644
--- a/tests/unit/capi/GEOSMakeValidTest.cpp
+++ b/tests/unit/capi/GEOSMakeValidTest.cpp
@@ -53,8 +53,9 @@ struct test_capimakevalid_data {
 
     ~test_capimakevalid_data()
     {
-        GEOSGeom_destroy(geom1_);
-        GEOSGeom_destroy(geom2_);
+        if (geom1_) GEOSGeom_destroy(geom1_);
+        if (geom2_) GEOSGeom_destroy(geom2_);
+        if (expect_) GEOSGeom_destroy(expect_);
         GEOSWKTWriter_destroy(wktw_);
         finishGEOS();
     }
@@ -82,4 +83,23 @@ void object::test<1>
     GEOSNormalize(expect_);
     ensure(GEOSEqualsExact(geom2_, expect_, 0.01));
 }
+
+template<>
+template<>
+void object::test<2>
+()
+{
+    const char* hex = "0103000000010000000900000062105839207df640378941e09d491c41ced67431387df640c667e7d398491c4179e92631387df640d9cef7d398491c41fa7e6abcf87df640cdcccc4c70491c41e3a59bc4527df64052b81e053f491c41cdcccccc5a7ef640e3a59bc407491c4104560e2da27df640aaf1d24dd3481c41e9263108c67bf64048e17a1437491c4162105839207df640378941e09d491c41";
+    geom1_ = GEOSGeomFromHEX_buf((uint8_t*)hex, std::strlen(hex));
+    geom2_ = GEOSMakeValid(geom1_);
+    expect_ = GEOSGeomFromWKT("GEOMETRYCOLLECTION(POLYGON((92114.014 463463.469,92115.5120743171 463462.206937429,92115.512 463462.207,92127.546 463452.075,92117.173 463439.755,92133.675 463425.942,92122.136 463412.826,92092.377 463437.77,92114.014 463463.469)),MULTIPOINT(92115.5120743171 463462.206937429,92122.136 463412.826))");
+    GEOSNormalize(geom2_);
+    GEOSNormalize(expect_);
+    ensure(GEOSEqualsExact(geom2_, expect_, 0.01));
+}
+
+
+
+
+
 } // namespace tut

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

Summary of changes:
 src/operation/valid/MakeValid.cpp     | 13 +++++--------
 tests/unit/capi/GEOSMakeValidTest.cpp | 24 ++++++++++++++++++++++--
 2 files changed, 27 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list