[geos-commits] r2942 - in branches/3.2: source/headers/geos/operation/valid source/operation/valid tests/xmltester/tests/general

svn_geos at osgeo.org svn_geos at osgeo.org
Thu Mar 18 14:26:05 EDT 2010


Author: strk
Date: 2010-03-18 14:26:02 -0400 (Thu, 18 Mar 2010)
New Revision: 2942

Modified:
   branches/3.2/source/headers/geos/operation/valid/IsValidOp.h
   branches/3.2/source/operation/valid/IsValidOp.cpp
   branches/3.2/tests/xmltester/tests/general/TestValid.xml
Log:
Fix false-positive return from IsValidOp. This is done better than in trunk, so will backport later.


Modified: branches/3.2/source/headers/geos/operation/valid/IsValidOp.h
===================================================================
--- branches/3.2/source/headers/geos/operation/valid/IsValidOp.h	2010-03-16 13:13:37 UTC (rev 2941)
+++ branches/3.2/source/headers/geos/operation/valid/IsValidOp.h	2010-03-18 18:26:02 UTC (rev 2942)
@@ -69,6 +69,7 @@
 	// CHECKME: should this really be a pointer ?
 	TopologyValidationError* validErr;
 
+	void checkValid();
 	void checkValid(const geom::Geometry *g);
 	void checkValid(const geom::Point *g);
 	void checkValid(const geom::LinearRing *g);

Modified: branches/3.2/source/operation/valid/IsValidOp.cpp
===================================================================
--- branches/3.2/source/operation/valid/IsValidOp.cpp	2010-03-16 13:13:37 UTC (rev 2941)
+++ branches/3.2/source/operation/valid/IsValidOp.cpp	2010-03-18 18:26:02 UTC (rev 2942)
@@ -82,7 +82,7 @@
 bool
 IsValidOp::isValid()
 {
-	checkValid(parentGeometry);
+	checkValid();
 	return validErr==NULL;
 }
 
@@ -105,17 +105,22 @@
 TopologyValidationError *
 IsValidOp::getValidationError()
 {
-	checkValid(parentGeometry);
+	checkValid();
 	return validErr;
 }
 
 void
-IsValidOp::checkValid(const Geometry *g)
+IsValidOp::checkValid()
 {
 	if (isChecked) return;
+	checkValid(parentGeometry);
+        isChecked=true;
+}
 
+void
+IsValidOp::checkValid(const Geometry *g)
+{
         assert( validErr == NULL );
-	validErr=NULL;
 
 	// empty geometries are always valid!
 	if (g->isEmpty()) return;
@@ -130,7 +135,6 @@
 	else if (0 != (gc=dynamic_cast<const GeometryCollection *>(g)))
 		checkValid(gc);
 	else throw util::UnsupportedOperationException();
-        isChecked=true;
 }
 
 /*

Modified: branches/3.2/tests/xmltester/tests/general/TestValid.xml
===================================================================
--- branches/3.2/tests/xmltester/tests/general/TestValid.xml	2010-03-16 13:13:37 UTC (rev 2941)
+++ branches/3.2/tests/xmltester/tests/general/TestValid.xml	2010-03-18 18:26:02 UTC (rev 2942)
@@ -78,6 +78,14 @@
    </case>
 
    <case>
+      <desc>mL - MultiLinestring with two identical points in second component</desc>
+      <a>MULTILINESTRING((1 1, 0 0), (0 0, 0 0))</a>
+      <test>
+         <op name="isValid" arg1="A">      false      </op>
+      </test>
+   </case>
+
+   <case>
       <desc>A - zero-area polygon </desc>
       <a>POLYGON ((0 0, 0 0, 0 0, 0 0, 0 0))</a>
       <test>



More information about the geos-commits mailing list