[geos-commits] r3392 - in trunk: src/operation/valid tests/xmltester tests/xmltester/tests/ticket

svn_geos at osgeo.org svn_geos at osgeo.org
Thu Jun 9 11:28:14 EDT 2011


Author: strk
Date: 2011-06-09 08:28:14 -0700 (Thu, 09 Jun 2011)
New Revision: 3392

Added:
   trunk/tests/xmltester/tests/ticket/bug449.xml
Modified:
   trunk/src/operation/valid/IndexedNestedRingTester.cpp
   trunk/tests/xmltester/Makefile.am
Log:
When checking for validity, do not abort if every vertex of an hole is also a vertex of another one. Fixes bug #449, including regress testing.

Modified: trunk/src/operation/valid/IndexedNestedRingTester.cpp
===================================================================
--- trunk/src/operation/valid/IndexedNestedRingTester.cpp	2011-06-09 07:59:31 UTC (rev 3391)
+++ trunk/src/operation/valid/IndexedNestedRingTester.cpp	2011-06-09 15:28:14 UTC (rev 3392)
@@ -50,7 +50,6 @@
 		for (size_t j=0, jn=results.size(); j<jn; ++j)
 		{
 			const geom::LinearRing* searchRing = static_cast<const geom::LinearRing*>(results[j]);
-			const geom::CoordinateSequence *searchRingPts=searchRing->getCoordinatesRO();
 
 			if (innerRing==searchRing)
 				continue;
@@ -61,15 +60,20 @@
 				continue;
 			}
 
-                        const geom::Coordinate *innerRingPt =
+			const geom::Coordinate *innerRingPt =
 				IsValidOp::findPtNotNode(innerRingPts,
 							 searchRing,
 							 graph);
 
-                        // Unable to find a ring point not a node of
-			// the search ring
-			assert(innerRingPt!=NULL);
+			// Unable to find a ring point not a node of
+			// the search ring. Can happen, see
+			// http://trac.osgeo.org/geos/ticket/449
+			// for examples.
+			if ( ! innerRingPt ) {
+			  continue;
+			}
 
+			const geom::CoordinateSequence *searchRingPts=searchRing->getCoordinatesRO();
 			bool isInside = algorithm::CGAlgorithms::isPointInRing(	
 					*innerRingPt, searchRingPts);
 

Modified: trunk/tests/xmltester/Makefile.am
===================================================================
--- trunk/tests/xmltester/Makefile.am	2011-06-09 07:59:31 UTC (rev 3391)
+++ trunk/tests/xmltester/Makefile.am	2011-06-09 15:28:14 UTC (rev 3392)
@@ -33,6 +33,7 @@
 	$(srcdir)/tests/ticket/bug392.xml \
 	$(srcdir)/tests/ticket/bug398.xml \
 	$(srcdir)/tests/ticket/bug434.xml \
+	$(srcdir)/tests/ticket/bug449.xml \
 	$(srcdir)/tests/general/TestBoundary.xml \
 	$(srcdir)/tests/general/TestBuffer.xml \
 	$(srcdir)/tests/general/TestBufferMitredJoin.xml \

Added: trunk/tests/xmltester/tests/ticket/bug449.xml
===================================================================
--- trunk/tests/xmltester/tests/ticket/bug449.xml	                        (rev 0)
+++ trunk/tests/xmltester/tests/ticket/bug449.xml	2011-06-09 15:28:14 UTC (rev 3392)
@@ -0,0 +1,21 @@
+<run>
+  <precisionModel type="FLOATING" />
+
+<case>
+  <desc>
+http://trac.osgeo.org/geos/ticket/449
+  </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>
+
+
+</run>



More information about the geos-commits mailing list