00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GEOS_OP_OVERLAY_OVERLAYRESULTVALIDATOR_H
00020 #define GEOS_OP_OVERLAY_OVERLAYRESULTVALIDATOR_H
00021
00022 #include <geos/export.h>
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 #ifdef _MSC_VER
00030 #pragma warning(push)
00031 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00032 #endif
00033
00034
00035 namespace geos {
00036 namespace geom {
00037 class Geometry;
00038 class Coordinate;
00039 }
00040 }
00041
00042 namespace geos {
00043 namespace operation {
00044 namespace overlay {
00045 namespace validate {
00046
00064 class GEOS_DLL OverlayResultValidator {
00065
00066 public:
00067
00068 static bool isValid(
00069 const geom::Geometry& geom0,
00070 const geom::Geometry& geom1,
00071 OverlayOp::OpCode opCode,
00072 const geom::Geometry& result);
00073
00074 OverlayResultValidator(
00075 const geom::Geometry& geom0,
00076 const geom::Geometry& geom1,
00077 const geom::Geometry& result);
00078
00079 bool isValid(OverlayOp::OpCode opCode);
00080
00081 geom::Coordinate& getInvalidLocation() {
00082 return invalidLocation;
00083 }
00084
00085 private:
00086
00087 double boundaryDistanceTolerance;
00088
00089 const geom::Geometry& g0;
00090
00091 const geom::Geometry& g1;
00092
00093 const geom::Geometry& gres;
00094
00095 FuzzyPointLocator fpl0;
00096
00097 FuzzyPointLocator fpl1;
00098
00099 FuzzyPointLocator fplres;
00100
00101 geom::Coordinate invalidLocation;
00102
00103 std::vector<geom::Coordinate> testCoords;
00104
00105 void addTestPts(const geom::Geometry& g);
00106
00107 void addVertices(const geom::Geometry& g);
00108
00109 bool testValid(OverlayOp::OpCode overlayOp);
00110
00111 bool testValid(OverlayOp::OpCode overlayOp, const geom::Coordinate& pt);
00112
00113 bool isValidResult(OverlayOp::OpCode overlayOp,
00114 std::vector<geom::Location::Value>& location);
00115
00116 static double computeBoundaryDistanceTolerance(
00117 const geom::Geometry& g0, const geom::Geometry& g1);
00118
00119
00120 OverlayResultValidator(const OverlayResultValidator& other);
00121 OverlayResultValidator& operator=(const OverlayResultValidator& rhs);
00122 };
00123
00124 }
00125 }
00126 }
00127 }
00128
00129 #ifdef _MSC_VER
00130 #pragma warning(pop)
00131 #endif
00132
00133 #endif // ndef GEOS_OP_OVERLAY_OVERLAYRESULTVALIDATOR_H