[geos-commits] r2566 - in trunk/source:
headers/geos/operation/overlay/validate operation/overlay/validate
svn_geos at osgeo.org
svn_geos at osgeo.org
Mon Jun 8 12:46:33 EDT 2009
Author: strk
Date: 2009-06-08 12:46:33 -0400 (Mon, 08 Jun 2009)
New Revision: 2566
Modified:
trunk/source/headers/geos/operation/overlay/validate/FuzzyPointLocator.h
trunk/source/headers/geos/operation/overlay/validate/OffsetPointGenerator.h
trunk/source/headers/geos/operation/overlay/validate/OverlayResultValidator.h
trunk/source/operation/overlay/validate/FuzzyPointLocator.cpp
trunk/source/operation/overlay/validate/OffsetPointGenerator.cpp
trunk/source/operation/overlay/validate/OverlayResultValidator.cpp
Log:
Port info and sync for operation::overlay::validate
Modified: trunk/source/headers/geos/operation/overlay/validate/FuzzyPointLocator.h
===================================================================
--- trunk/source/headers/geos/operation/overlay/validate/FuzzyPointLocator.h 2009-06-08 16:26:36 UTC (rev 2565)
+++ trunk/source/headers/geos/operation/overlay/validate/FuzzyPointLocator.h 2009-06-08 16:46:33 UTC (rev 2566)
@@ -13,8 +13,7 @@
*
***********************************************************************
*
- * Last port: operation/overlay/validate/FuzzyPointLocator.java rev. 1.1
- * (we should move in GEOS too, probably)
+ * Last port: operation/overlay/validate/FuzzyPointLocator.java rev. 1.1 (JTS-1.10)
*
**********************************************************************/
Modified: trunk/source/headers/geos/operation/overlay/validate/OffsetPointGenerator.h
===================================================================
--- trunk/source/headers/geos/operation/overlay/validate/OffsetPointGenerator.h 2009-06-08 16:26:36 UTC (rev 2565)
+++ trunk/source/headers/geos/operation/overlay/validate/OffsetPointGenerator.h 2009-06-08 16:46:33 UTC (rev 2566)
@@ -13,7 +13,7 @@
*
***********************************************************************
*
- * Last port: operation/overlay/validate/OffsetPointGenerator.java rev. 1.1
+ * Last port: operation/overlay/validate/OffsetPointGenerator.java rev. 1.1 (JTS-1.10)
*
**********************************************************************/
Modified: trunk/source/headers/geos/operation/overlay/validate/OverlayResultValidator.h
===================================================================
--- trunk/source/headers/geos/operation/overlay/validate/OverlayResultValidator.h 2009-06-08 16:26:36 UTC (rev 2565)
+++ trunk/source/headers/geos/operation/overlay/validate/OverlayResultValidator.h 2009-06-08 16:46:33 UTC (rev 2566)
@@ -13,7 +13,7 @@
*
***********************************************************************
*
- * Last port: operation/overlay/validate/OverlayResultValidator.java rev. 1.1
+ * Last port: operation/overlay/validate/OverlayResultValidator.java rev. 1.4 (JTS-1.10)
*
**********************************************************************/
@@ -41,15 +41,19 @@
/** \brief
* Validates that the result of an overlay operation is
- * geometrically correct within a given tolerance.
+ * geometrically correct within a determined tolerance.
*
- * Uses fuzzy point location, which only works with polygonal
- * components of geometries.
+ * Uses fuzzy point location to find points which are
+ * definitely in either the interior or exterior of the result
+ * geometry, and compares these results with the expected ones.
*
- * This is a heuristic test, and may return incorrect results.
+ * This algorithm is only useful where the inputs are polygonal.
+ *
+ * This is a heuristic test, and may return false positive results
+ * (I.e. it may fail to detect an invalid result.)
* It should never return a false negative result, however
- * (I.e. reporting a valid result as invalid.)
- *
+ * (I.e. it should never report a valid result as invalid.)
+ *
* @see OverlayOp
*/
class OverlayResultValidator {
@@ -75,6 +79,8 @@
private:
+ double boundaryDistanceTolerance;
+
const geom::Geometry& g0;
const geom::Geometry& g1;
@@ -89,8 +95,6 @@
geom::Coordinate invalidLocation;
- static double _TOLERANCE; // 0.000001
-
std::vector<geom::Coordinate> testCoords;
void addTestPts(const geom::Geometry& g);
@@ -103,6 +107,10 @@
bool isValidResult(OverlayOp::OpCode overlayOp,
std::vector<geom::Location::Value>& location);
+
+ static double computeBoundaryDistanceTolerance(
+ const geom::Geometry& g0, const geom::Geometry& g1);
+
};
} // namespace geos::operation::overlay::validate
Modified: trunk/source/operation/overlay/validate/FuzzyPointLocator.cpp
===================================================================
--- trunk/source/operation/overlay/validate/FuzzyPointLocator.cpp 2009-06-08 16:26:36 UTC (rev 2565)
+++ trunk/source/operation/overlay/validate/FuzzyPointLocator.cpp 2009-06-08 16:46:33 UTC (rev 2566)
@@ -13,7 +13,7 @@
*
***********************************************************************
*
- * Last port: operation/overlay/validate/FuzzyPointLocator.java rev. 1.1
+ * Last port: operation/overlay/validate/FuzzyPointLocator.java rev. 1.1 (JTS-1.10)
*
**********************************************************************/
Modified: trunk/source/operation/overlay/validate/OffsetPointGenerator.cpp
===================================================================
--- trunk/source/operation/overlay/validate/OffsetPointGenerator.cpp 2009-06-08 16:26:36 UTC (rev 2565)
+++ trunk/source/operation/overlay/validate/OffsetPointGenerator.cpp 2009-06-08 16:46:33 UTC (rev 2566)
@@ -13,7 +13,7 @@
*
***********************************************************************
*
- * Last port: operation/overlay/validate/OffsetPointGenerator.java rev. 1.1
+ * Last port: operation/overlay/validate/OffsetPointGenerator.java rev. 1.1 (JTS-1.10)
*
**********************************************************************/
Modified: trunk/source/operation/overlay/validate/OverlayResultValidator.cpp
===================================================================
--- trunk/source/operation/overlay/validate/OverlayResultValidator.cpp 2009-06-08 16:26:36 UTC (rev 2565)
+++ trunk/source/operation/overlay/validate/OverlayResultValidator.cpp 2009-06-08 16:46:33 UTC (rev 2566)
@@ -13,13 +13,14 @@
*
***********************************************************************
*
- * Last port: operation/overlay/validate/OverlayResultValidator.java rev. 1.1
+ * Last port: operation/overlay/validate/OverlayResultValidator.java rev. 1.4 (JTS-1.10)
*
**********************************************************************/
#include <geos/operation/overlay/validate/OverlayResultValidator.h>
#include <geos/operation/overlay/validate/FuzzyPointLocator.h>
#include <geos/operation/overlay/validate/OffsetPointGenerator.h>
+#include <geos/operation/overlay/snap/GeometrySnapper.h>
#include <geos/geom/CoordinateSequence.h>
#include <geos/geom/MultiPoint.h>
#include <geos/geom/GeometryFactory.h>
@@ -29,7 +30,7 @@
#include <functional>
#include <vector>
#include <memory> // for auto_ptr
-#include <algorithm>
+#include <algorithm> // for std::min etc.
#ifndef GEOS_DEBUG
#define GEOS_DEBUG 0
@@ -53,8 +54,6 @@
namespace overlay { // geos.operation.overlay
namespace validate { // geos.operation.overlay.validate
-double OverlayResultValidator::_TOLERANCE = 0.000001;
-
namespace { // anonymous namespace
bool
@@ -103,12 +102,15 @@
const Geometry& geom1,
const Geometry& result)
:
+ boundaryDistanceTolerance(
+ computeBoundaryDistanceTolerance(geom0, geom1)
+ ),
g0(geom0),
g1(geom1),
gres(result),
- fpl0(g0, _TOLERANCE),
- fpl1(g1, _TOLERANCE),
- fplres(gres, _TOLERANCE),
+ fpl0(g0, boundaryDistanceTolerance),
+ fpl1(g1, boundaryDistanceTolerance),
+ fplres(gres, boundaryDistanceTolerance),
invalidLocation()
{
}
@@ -151,7 +153,7 @@
void
OverlayResultValidator::addTestPts(const Geometry& g)
{
- OffsetPointGenerator ptGen(g, 5 * _TOLERANCE);
+ OffsetPointGenerator ptGen(g, 5 * boundaryDistanceTolerance);
auto_ptr< vector<geom::Coordinate> > pts = ptGen.getPoints();
testCoords.insert(testCoords.end(), pts->begin(), pts->end());
}
@@ -230,7 +232,17 @@
return isValid;
}
+/*private static*/
+double
+OverlayResultValidator::computeBoundaryDistanceTolerance(
+ const geom::Geometry& g0, const geom::Geometry& g1)
+{
+ using geos::operation::overlay::snap::GeometrySnapper;
+ return std::min(GeometrySnapper::computeSizeBasedSnapTolerance(g0),
+ GeometrySnapper::computeSizeBasedSnapTolerance(g1));
+}
+
} // namespace geos.operation.overlay.validate
} // namespace geos.operation.overlay
} // namespace geos.operation
More information about the geos-commits
mailing list