[geos-commits] r2944 - in trunk: include/geos/operation/valid
src/operation/valid
svn_geos at osgeo.org
svn_geos at osgeo.org
Thu Mar 18 14:40:00 EDT 2010
Author: strk
Date: 2010-03-18 14:39:55 -0400 (Thu, 18 Mar 2010)
New Revision: 2944
Modified:
trunk/include/geos/operation/valid/IsValidOp.h
trunk/src/operation/valid/IsValidOp.cpp
Log:
Forw-port a better fix for #333 (false positive valid geoms)
Modified: trunk/include/geos/operation/valid/IsValidOp.h
===================================================================
--- trunk/include/geos/operation/valid/IsValidOp.h 2010-03-18 18:28:59 UTC (rev 2943)
+++ trunk/include/geos/operation/valid/IsValidOp.h 2010-03-18 18:39:55 UTC (rev 2944)
@@ -65,9 +65,14 @@
/// the base Geometry to be validated
const geom::Geometry *parentGeometry;
+ bool isChecked;
+
// CHECKME: should this really be a pointer ?
TopologyValidationError* validErr;
+ // This is the version using 'isChecked' flag
+ void checkValid();
+
void checkValid(const geom::Geometry *g);
void checkValid(const geom::Point *g);
void checkValid(const geom::LinearRing *g);
@@ -212,6 +217,7 @@
IsValidOp(const geom::Geometry *geom)
:
parentGeometry(geom),
+ isChecked(false),
validErr(NULL),
isSelfTouchingRingFormingHoleValid(false)
{}
Modified: trunk/src/operation/valid/IsValidOp.cpp
===================================================================
--- trunk/src/operation/valid/IsValidOp.cpp 2010-03-18 18:28:59 UTC (rev 2943)
+++ trunk/src/operation/valid/IsValidOp.cpp 2010-03-18 18:39:55 UTC (rev 2944)
@@ -85,7 +85,7 @@
bool
IsValidOp::isValid()
{
- checkValid(parentGeometry);
+ checkValid();
return validErr==NULL;
}
@@ -108,15 +108,22 @@
TopologyValidationError *
IsValidOp::getValidationError()
{
- checkValid(parentGeometry);
+ checkValid();
return validErr;
}
void
+IsValidOp::checkValid()
+{
+ if (isChecked) return;
+ checkValid(parentGeometry);
+ isChecked=true;
+}
+
+void
IsValidOp::checkValid(const Geometry *g)
{
- //assert( validErr == NULL );
- validErr=NULL;
+ assert( validErr == NULL );
// empty geometries are always valid!
if (g->isEmpty()) return;
More information about the geos-commits
mailing list