GEOS 3.3.1
|
00001 /********************************************************************** 00002 * $Id: OverlayResultValidator.h 3255 2011-03-01 17:56:10Z mloskot $ 00003 * 00004 * GEOS - Geometry Engine Open Source 00005 * http://geos.refractions.net 00006 * 00007 * Copyright (C) 2006 Refractions Research Inc. 00008 * 00009 * This is free software; you can redistribute and/or modify it under 00010 * the terms of the GNU Lesser General Public Licence as published 00011 * by the Free Software Foundation. 00012 * See the COPYING file for more information. 00013 * 00014 *********************************************************************** 00015 * 00016 * Last port: operation/overlay/validate/OverlayResultValidator.java rev. 1.4 (JTS-1.10) 00017 * 00018 **********************************************************************/ 00019 00020 #ifndef GEOS_OP_OVERLAY_OVERLAYRESULTVALIDATOR_H 00021 #define GEOS_OP_OVERLAY_OVERLAYRESULTVALIDATOR_H 00022 00023 #include <geos/export.h> 00024 #include <geos/operation/overlay/OverlayOp.h> // for OpCode enum 00025 #include <geos/operation/overlay/validate/FuzzyPointLocator.h> // composition 00026 #include <geos/geom/Location.h> // for Location::Value type 00027 00028 #include <vector> 00029 00030 #ifdef _MSC_VER 00031 #pragma warning(push) 00032 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class 00033 #endif 00034 00035 // Forward declarations 00036 namespace geos { 00037 namespace geom { 00038 class Geometry; 00039 class Coordinate; 00040 } 00041 } 00042 00043 namespace geos { 00044 namespace operation { // geos::operation 00045 namespace overlay { // geos::operation::overlay 00046 namespace validate { // geos::operation::overlay::validate 00047 00065 class GEOS_DLL OverlayResultValidator { 00066 00067 public: 00068 00069 static bool isValid( 00070 const geom::Geometry& geom0, 00071 const geom::Geometry& geom1, 00072 OverlayOp::OpCode opCode, 00073 const geom::Geometry& result); 00074 00075 OverlayResultValidator( 00076 const geom::Geometry& geom0, 00077 const geom::Geometry& geom1, 00078 const geom::Geometry& result); 00079 00080 bool isValid(OverlayOp::OpCode opCode); 00081 00082 geom::Coordinate& getInvalidLocation() { 00083 return invalidLocation; 00084 } 00085 00086 private: 00087 00088 double boundaryDistanceTolerance; 00089 00090 const geom::Geometry& g0; 00091 00092 const geom::Geometry& g1; 00093 00094 const geom::Geometry& gres; 00095 00096 FuzzyPointLocator fpl0; 00097 00098 FuzzyPointLocator fpl1; 00099 00100 FuzzyPointLocator fplres; 00101 00102 geom::Coordinate invalidLocation; 00103 00104 std::vector<geom::Coordinate> testCoords; 00105 00106 void addTestPts(const geom::Geometry& g); 00107 00108 void addVertices(const geom::Geometry& g); 00109 00110 bool testValid(OverlayOp::OpCode overlayOp); 00111 00112 bool testValid(OverlayOp::OpCode overlayOp, const geom::Coordinate& pt); 00113 00114 bool isValidResult(OverlayOp::OpCode overlayOp, 00115 std::vector<geom::Location::Value>& location); 00116 00117 static double computeBoundaryDistanceTolerance( 00118 const geom::Geometry& g0, const geom::Geometry& g1); 00119 00120 // Declare type as noncopyable 00121 OverlayResultValidator(const OverlayResultValidator& other); 00122 OverlayResultValidator& operator=(const OverlayResultValidator& rhs); 00123 }; 00124 00125 } // namespace geos::operation::overlay::validate 00126 } // namespace geos::operation::overlay 00127 } // namespace geos::operation 00128 } // namespace geos 00129 00130 #ifdef _MSC_VER 00131 #pragma warning(pop) 00132 #endif 00133 00134 #endif // ndef GEOS_OP_OVERLAY_OVERLAYRESULTVALIDATOR_H 00135 00136 /********************************************************************** 00137 * $Log$ 00138 **********************************************************************/ 00139