[geos-commits] [SCM] GEOS branch master updated. ab1e0351984663da5852d1c05df86d175baf54bd

git at osgeo.org git at osgeo.org
Tue Sep 15 09:06:16 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  ab1e0351984663da5852d1c05df86d175baf54bd (commit)
      from  64c8540bfd7d0d95adf3efe5807abb0ffcde7ec1 (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 ab1e0351984663da5852d1c05df86d175baf54bd
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Sep 14 18:56:49 2020 -0700

    Add SR fallback to snapifneeded NG, https://github.com/dr-jts/jts/commit/a81078568f0c78ab2c7fadbfa0936669d9f09256

diff --git a/src/operation/overlayng/OverlayNGSnapIfNeeded.cpp b/src/operation/overlayng/OverlayNGSnapIfNeeded.cpp
index a95efb6..dbcd43f 100644
--- a/src/operation/overlayng/OverlayNGSnapIfNeeded.cpp
+++ b/src/operation/overlayng/OverlayNGSnapIfNeeded.cpp
@@ -132,6 +132,16 @@ OverlayNGSnapIfNeeded::Overlay(const Geometry* geom0, const Geometry* geom1, int
     if (result != nullptr)
         return result;
 
+    /**
+     * On failure retry using snap-rounding with a heuristic scale factor (grid size).
+     */
+    result = overlaySR(geom0, geom1, opCode);
+    if (result != nullptr)
+        return result;
+
+    /**
+     * Just can't get overlay to work, so throw original error.
+     */
     throw exOriginal;
 }
 
@@ -179,7 +189,7 @@ OverlayNGSnapIfNeeded::overlaySnapping(const Geometry* geom0, const Geometry* ge
 #endif
     )
     {
-        //---- ignore this exception, just return a nullptr result
+        //---- ignore exception, return null result to indicate failure
 #if GEOS_DEBUG
         std::cout << std::endl << "overlaySnapping(tol " << snapTol << ") FAILURE: " << ex.what() << std::endl;
 #endif
@@ -202,7 +212,7 @@ OverlayNGSnapIfNeeded::overlaySnapBoth(const Geometry* geom0, const Geometry* ge
 #endif
     )
     {
-        //---- ignore this exception, just return a nullptr result
+        //---- ignore this exception, just return a nullptr result to indicate failure
 #if GEOS_DEBUG
         std::cout << std::endl << "overlaySnapBoth(tol " << snapTol << ") FAILURE: " << ex.what() << std::endl;
 #endif
@@ -261,29 +271,24 @@ OverlayNGSnapIfNeeded::overlaySR(const Geometry* geom0, const Geometry* geom1, i
 {
     std::unique_ptr<Geometry> result;
     try {
-        // start with operation using floating PM
-        geom::PrecisionModel PM_FLOAT;
-        result = OverlayNG::overlay(geom0, geom1, opCode, &PM_FLOAT);
+        double scaleSafe = PrecisionUtil::safeScale(geom0, geom1);
+        PrecisionModel pmSafe(scaleSafe);
+        result = OverlayNG::overlay(geom0, geom1, opCode, &pmSafe);
         return result;
     }
     catch (const geos::util::TopologyException &
 #if GEOS_DEBUG
-            ex
+        //---- ignore exception, return null result to indicate failure
+        ex
 #endif
     )
     {
         // ignore this exception, since the operation will be rerun
-        //System.out.println("Overlay failed");
 #if GEOS_DEBUG
-        std::cout << std::endl << "overlaySR FAILURE: " << ex.what() << std::endl;
+        std::cout << std::endl << "OverlayNGSnapIfNeeded::overlaySR FAILURE: " << ex.what() << std::endl;
 #endif
     }
-    // on failure retry with a "safe" fixed PM
-    // this should not throw an exception, but if it does just let it go
-    double scaleSafe = PrecisionUtil::safeScale(geom0, geom1);
-    PrecisionModel pmSafe(scaleSafe);
-    result = OverlayNG::overlay(geom0, geom1, opCode, &pmSafe);
-    return result;
+    return nullptr;
 }
 
 

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

Summary of changes:
 src/operation/overlayng/OverlayNGSnapIfNeeded.cpp | 33 +++++++++++++----------
 1 file changed, 19 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list