GEOS
3.4.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2006 Refractions Research Inc. 00007 * 00008 * This is free software; you can redistribute and/or modify it under 00009 * the terms of the GNU Lesser General Public Licence as published 00010 * by the Free Software Foundation. 00011 * See the COPYING file for more information. 00012 * 00013 *********************************************************************** 00014 * 00015 * Last port: operation/overlay/validate/OverlayResultValidator.java rev. 1.4 (JTS-1.10) 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> // for OpCode enum 00024 #include <geos/operation/overlay/validate/FuzzyPointLocator.h> // composition 00025 #include <geos/geom/Location.h> // for Location::Value type 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 // Forward declarations 00035 namespace geos { 00036 namespace geom { 00037 class Geometry; 00038 class Coordinate; 00039 } 00040 } 00041 00042 namespace geos { 00043 namespace operation { // geos::operation 00044 namespace overlay { // geos::operation::overlay 00045 namespace validate { // geos::operation::overlay::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 // Declare type as noncopyable 00120 OverlayResultValidator(const OverlayResultValidator& other); 00121 OverlayResultValidator& operator=(const OverlayResultValidator& rhs); 00122 }; 00123 00124 } // namespace geos::operation::overlay::validate 00125 } // namespace geos::operation::overlay 00126 } // namespace geos::operation 00127 } // namespace geos 00128 00129 #ifdef _MSC_VER 00130 #pragma warning(pop) 00131 #endif 00132 00133 #endif // ndef GEOS_OP_OVERLAY_OVERLAYRESULTVALIDATOR_H