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 * Copyright (C) 2001-2002 Vivid Solutions 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/polygonize/EdgeRing.java rev. 109/138 (JTS-1.10) 00017 * 00018 **********************************************************************/ 00019 00020 00021 #ifndef GEOS_OP_POLYGONIZE_EDGERING_H 00022 #define GEOS_OP_POLYGONIZE_EDGERING_H 00023 00024 #include <geos/export.h> 00025 00026 #include <vector> 00027 00028 #ifdef _MSC_VER 00029 #pragma warning(push) 00030 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class 00031 #endif 00032 00033 // Forward declarations 00034 namespace geos { 00035 namespace geom { 00036 class LineString; 00037 class LinearRing; 00038 class Polygon; 00039 class CoordinateSequence; 00040 class Geometry; 00041 class GeometryFactory; 00042 class Coordinate; 00043 } 00044 namespace planargraph { 00045 class DirectedEdge; 00046 } 00047 } 00048 00049 namespace geos { 00050 namespace operation { // geos::operation 00051 namespace polygonize { // geos::operation::polygonize 00052 00057 class GEOS_DLL EdgeRing { 00058 private: 00059 const geom::GeometryFactory *factory; 00060 00061 typedef std::vector<const planargraph::DirectedEdge*> DeList; 00062 DeList deList; 00063 00064 // cache the following data for efficiency 00065 geom::LinearRing *ring; 00066 geom::CoordinateSequence *ringPts; 00067 00068 typedef std::vector<geom::Geometry*> GeomVect; 00069 GeomVect *holes; 00070 00077 geom::CoordinateSequence* getCoordinates(); 00078 00079 static void addEdge(const geom::CoordinateSequence *coords, 00080 bool isForward, 00081 geom::CoordinateSequence *coordList); 00082 00083 public: 00102 static EdgeRing* findEdgeRingContaining( 00103 EdgeRing *testEr, 00104 std::vector<EdgeRing*> *shellList); 00105 00116 static const geom::Coordinate& ptNotInList( 00117 const geom::CoordinateSequence *testPts, 00118 const geom::CoordinateSequence *pts); 00119 00128 static bool isInList(const geom::Coordinate &pt, 00129 const geom::CoordinateSequence *pts); 00130 00131 EdgeRing(const geom::GeometryFactory *newFactory); 00132 00133 ~EdgeRing(); 00134 00140 void add(const planargraph::DirectedEdge *de); 00141 00149 bool isHole(); 00150 00156 void addHole(geom::LinearRing *hole); 00157 00166 geom::Polygon* getPolygon(); 00167 00172 bool isValid(); 00173 00182 geom::LineString* getLineString(); 00183 00191 geom::LinearRing* getRingInternal(); 00192 00200 geom::LinearRing* getRingOwnership(); 00201 }; 00202 00203 } // namespace geos::operation::polygonize 00204 } // namespace geos::operation 00205 } // namespace geos 00206 00207 #ifdef _MSC_VER 00208 #pragma warning(pop) 00209 #endif 00210 00211 #endif // GEOS_OP_POLYGONIZE_EDGERING_H