00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GEOS_OP_OVERLAY_OVERLAYRESULTVALIDATOR_H
00021 #define GEOS_OP_OVERLAY_OVERLAYRESULTVALIDATOR_H
00022
00023 #include <geos/operation/overlay/OverlayOp.h>
00024 #include <geos/operation/overlay/validate/FuzzyPointLocator.h>
00025 #include <geos/geom/Location.h>
00026
00027 #include <vector>
00028
00029
00030 namespace geos {
00031 namespace geom {
00032 class Geometry;
00033 class Coordinate;
00034 }
00035 }
00036
00037 namespace geos {
00038 namespace operation {
00039 namespace overlay {
00040 namespace validate {
00041
00059 class OverlayResultValidator {
00060
00061 public:
00062
00063 static bool isValid(
00064 const geom::Geometry& geom0,
00065 const geom::Geometry& geom1,
00066 OverlayOp::OpCode opCode,
00067 const geom::Geometry& result);
00068
00069 OverlayResultValidator(
00070 const geom::Geometry& geom0,
00071 const geom::Geometry& geom1,
00072 const geom::Geometry& result);
00073
00074 bool isValid(OverlayOp::OpCode opCode);
00075
00076 geom::Coordinate& getInvalidLocation() {
00077 return invalidLocation;
00078 }
00079
00080 private:
00081
00082 double boundaryDistanceTolerance;
00083
00084 const geom::Geometry& g0;
00085
00086 const geom::Geometry& g1;
00087
00088 const geom::Geometry& gres;
00089
00090 FuzzyPointLocator fpl0;
00091
00092 FuzzyPointLocator fpl1;
00093
00094 FuzzyPointLocator fplres;
00095
00096 geom::Coordinate invalidLocation;
00097
00098 std::vector<geom::Coordinate> testCoords;
00099
00100 void addTestPts(const geom::Geometry& g);
00101
00102 void addVertices(const geom::Geometry& g);
00103
00104 bool testValid(OverlayOp::OpCode overlayOp);
00105
00106 bool testValid(OverlayOp::OpCode overlayOp, const geom::Coordinate& pt);
00107
00108 bool isValidResult(OverlayOp::OpCode overlayOp,
00109 std::vector<geom::Location::Value>& location);
00110
00111 static double computeBoundaryDistanceTolerance(
00112 const geom::Geometry& g0, const geom::Geometry& g1);
00113
00114
00115 OverlayResultValidator(const OverlayResultValidator& other);
00116 OverlayResultValidator& operator=(const OverlayResultValidator& rhs);
00117 };
00118
00119 }
00120 }
00121 }
00122 }
00123
00124 #endif // ndef GEOS_OP_OVERLAY_OVERLAYRESULTVALIDATOR_H
00125
00126
00127
00128
00129