[geos-commits] [SCM] GEOS branch master updated. 70cd8d043d196626f5ef10781f18ac7b2ef1bc27

git at osgeo.org git at osgeo.org
Wed Apr 24 14:10:54 PDT 2019


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  70cd8d043d196626f5ef10781f18ac7b2ef1bc27 (commit)
      from  d97b0e5cdb075bd61b73096e75915880d3b000de (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 70cd8d043d196626f5ef10781f18ac7b2ef1bc27
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed Apr 24 14:10:26 2019 -0700

    Fill in the exception error point when a eHoleOutsideShell occurs.
    Closes #963

diff --git a/src/operation/valid/IsValidOp.cpp b/src/operation/valid/IsValidOp.cpp
index a91e90e..387218a 100644
--- a/src/operation/valid/IsValidOp.cpp
+++ b/src/operation/valid/IsValidOp.cpp
@@ -460,7 +460,7 @@ IsValidOp::checkHolesInShell(const Polygon* p, GeometryGraph* graph)
         bool outside = isShellEmpty || (Location::EXTERIOR == ipial.locate(holePt));
         if (outside) {
             validErr = new TopologyValidationError(
-                TopologyValidationError::eHoleOutsideShell);
+                TopologyValidationError::eHoleOutsideShell, *holePt);
             return;
         }
     }
diff --git a/tests/unit/operation/valid/IsValidTest.cpp b/tests/unit/operation/valid/IsValidTest.cpp
index e366eea..1dd5982 100644
--- a/tests/unit/operation/valid/IsValidTest.cpp
+++ b/tests/unit/operation/valid/IsValidTest.cpp
@@ -4,7 +4,7 @@
 
 #include <tut/tut.hpp>
 // geos
-#include <geos/constants.h>
+#include <geos/constants.h> // for std::isnan
 #include <geos/operation/valid/IsValidOp.h>
 #include <geos/geom/Coordinate.h>
 #include <geos/geom/CoordinateArraySequence.h>
@@ -13,15 +13,14 @@
 #include <geos/geom/LineString.h>
 #include <geos/geom/GeometryFactory.h>
 #include <geos/geom/PrecisionModel.h>
+#include <geos/io/WKTReader.h>
 #include <geos/operation/valid/TopologyValidationError.h>
-#include <geos/constants.h> // for std::isnan
 // std
 #include <cmath>
 #include <string>
 #include <memory>
 
 using namespace geos::geom;
-//using namespace geos::operation;
 using namespace geos::operation::valid;
 
 namespace tut {
@@ -30,6 +29,7 @@ namespace tut {
 //
 
 struct test_isvalidop_data {
+    geos::io::WKTReader wktreader;
     typedef std::unique_ptr<Geometry> GeomPtr;
     typedef geos::geom::GeometryFactory GeometryFactory;
 
@@ -76,5 +76,28 @@ void object::test<1>
     ensure_equals(valid, false);
 }
 
+template<>
+template<>
+void object::test<2>
+()
+{
+    std::string wkt0("POLYGON((25495445.625 6671632.625,25495445.625 6671711.375,25495555.375 6671711.375,25495555.375 6671632.625,25495445.625 6671632.625),(25495368.0441 6671726.9312,25495368.3959388 6671726.93601515,25495368.7478 6671726.9333,25495368.0441 6671726.9312))");
+    GeomPtr g0(wktreader.read(wkt0));
+
+    IsValidOp isValidOp(g0.get());
+    bool valid = isValidOp.isValid();
+
+    TopologyValidationError* err = isValidOp.getValidationError();
+    ensure(nullptr != err);
+    const Coordinate& errCoord = err->getCoordinate();
+
+    ensure_equals(err->getErrorType(),
+                  TopologyValidationError::eHoleOutsideShell);
+
+    ensure(fabs(errCoord.y - 6671726.9) < 1.0);
+    ensure(fabs(errCoord.x - 25495368.0) < 1.0);
+    ensure_equals(valid, false);
+}
+
 
 } // namespace tut

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

Summary of changes:
 src/operation/valid/IsValidOp.cpp          |  2 +-
 tests/unit/operation/valid/IsValidTest.cpp | 29 ++++++++++++++++++++++++++---
 2 files changed, 27 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list