[geos-commits] r3423 - in trunk: src/operation/valid
tests/xmltester/tests/general
svn_geos at osgeo.org
svn_geos at osgeo.org
Tue Jul 5 06:56:49 EDT 2011
Author: strk
Date: 2011-07-05 03:56:49 -0700 (Tue, 05 Jul 2011)
New Revision: 3423
Modified:
trunk/src/operation/valid/IndexedNestedRingTester.cpp
trunk/tests/xmltester/tests/general/TestValid.xml
Log:
Fix #449 (Assertion fails checking validity of polygon) the JTS way.
Modified: trunk/src/operation/valid/IndexedNestedRingTester.cpp
===================================================================
--- trunk/src/operation/valid/IndexedNestedRingTester.cpp 2011-07-05 10:56:39 UTC (rev 3422)
+++ trunk/src/operation/valid/IndexedNestedRingTester.cpp 2011-07-05 10:56:49 UTC (rev 3423)
@@ -66,6 +66,18 @@
searchRing,
graph);
+ /**
+ * If no non-node pts can be found, this means
+ * that the searchRing touches ALL of the innerRing vertices.
+ * This indicates an invalid polygon, since either
+ * the two holes create a disconnected interior,
+ * or they touch in an infinite number of points
+ * (i.e. along a line segment).
+ * Both of these cases are caught by other tests,
+ * so it is safe to simply skip this situation here.
+ */
+ if ( ! innerRingPt ) continue;
+
// Unable to find a ring point not a node of
// the search ring
assert(innerRingPt!=NULL);
Modified: trunk/tests/xmltester/tests/general/TestValid.xml
===================================================================
--- trunk/tests/xmltester/tests/general/TestValid.xml 2011-07-05 10:56:39 UTC (rev 3422)
+++ trunk/tests/xmltester/tests/general/TestValid.xml 2011-07-05 10:56:49 UTC (rev 3423)
@@ -540,6 +540,28 @@
</case>
<case>
+ <desc>A - one holes touches another at all vertices </desc>
+ <a>
+POLYGON( (0 0, 0 5, 6 5, 6 0, 0 0), (2 1, 4 1, 3 2, 2 1), (2 1, 1 4, 5 4, 4 1, 4 3, 3 2, 2 3, 2 1) )
+</a>
+ <test>
+ <op name="isValid" arg1="A"> false </op>
+ </test>
+ </case>
+
+ <case>
+ <desc>A - one holes touches another at several vertices </desc>
+ <a>
+POLYGON ((0 0, 0 5, 6 5, 6 0, 0 0),
+ (2.5 1, 3.5 1, 3.5 2, 2.5 2, 2.5 1),
+ (2.5 1.5, 1 4, 5 4, 3.5 1.5, 4 3, 3 2, 2 3, 2.5 1.5))
+ </a>
+ <test>
+ <op name="isValid" arg1="A"> false </op>
+ </test>
+ </case>
+
+ <case>
<desc>A - hole disconnects interiors </desc>
<a>
POLYGON ((0 0, 10 10, 10 0, 0 0),
More information about the geos-commits
mailing list