GEOS 3.2.2
|
00001 /********************************************************************** 00002 * $Id: EdgeRing.h 2567 2009-06-08 16:58:42Z strk $ 00003 * 00004 * GEOS - Geometry Engine Open Source 00005 * http://geos.refractions.net 00006 * 00007 * Copyright (C) 2006 Refractions Research Inc. 00008 * Copyright (C) 2001-2002 Vivid Solutions Inc. 00009 * 00010 * This is free software; you can redistribute and/or modify it under 00011 * the terms of the GNU Lesser General Public Licence as published 00012 * by the Free Software Foundation. 00013 * See the COPYING file for more information. 00014 * 00015 ********************************************************************** 00016 * 00017 * Last port: operation/polygonize/EdgeRing.java rev. 1.8 (JTS-1.10) 00018 * 00019 **********************************************************************/ 00020 00021 00022 #ifndef GEOS_OP_POLYGONIZE_EDGERING_H 00023 #define GEOS_OP_POLYGONIZE_EDGERING_H 00024 00025 #include <geos/export.h> 00026 00027 #include <vector> 00028 00029 // Forward declarations 00030 namespace geos { 00031 namespace geom { 00032 class LineString; 00033 class LinearRing; 00034 class Polygon; 00035 class CoordinateSequence; 00036 class Geometry; 00037 class GeometryFactory; 00038 class Coordinate; 00039 } 00040 namespace planargraph { 00041 class DirectedEdge; 00042 } 00043 } 00044 00045 namespace geos { 00046 namespace operation { // geos::operation 00047 namespace polygonize { // geos::operation::polygonize 00048 00053 class GEOS_DLL EdgeRing { 00054 private: 00055 const geom::GeometryFactory *factory; 00056 std::vector<const planargraph::DirectedEdge*> *deList; 00057 00058 // cache the following data for efficiency 00059 geom::LinearRing *ring; 00060 geom::CoordinateSequence *ringPts; 00061 std::vector<geom::Geometry*> *holes; 00062 00069 geom::CoordinateSequence* getCoordinates(); 00070 00071 static void addEdge(const geom::CoordinateSequence *coords, 00072 bool isForward, 00073 geom::CoordinateSequence *coordList); 00074 00075 public: 00092 static EdgeRing* findEdgeRingContaining( 00093 EdgeRing *testEr, 00094 std::vector<EdgeRing*> *shellList); 00095 00106 static const geom::Coordinate& ptNotInList( 00107 const geom::CoordinateSequence *testPts, 00108 const geom::CoordinateSequence *pts); 00109 00118 static bool isInList(const geom::Coordinate &pt, 00119 const geom::CoordinateSequence *pts); 00120 00121 EdgeRing(const geom::GeometryFactory *newFactory); 00122 00123 ~EdgeRing(); 00124 00130 void add(const planargraph::DirectedEdge *de); 00131 00139 bool isHole(); 00140 00146 void addHole(geom::LinearRing *hole); 00147 00156 geom::Polygon* getPolygon(); 00157 00162 bool isValid(); 00163 00172 geom::LineString* getLineString(); 00173 00181 geom::LinearRing* getRingInternal(); 00182 00190 geom::LinearRing* getRingOwnership(); 00191 }; 00192 00193 } // namespace geos::operation::polygonize 00194 } // namespace geos::operation 00195 } // namespace geos 00196 00197 #endif // GEOS_OP_POLYGONIZE_EDGERING_H 00198 00199 /********************************************************************** 00200 * $Log$ 00201 * Revision 1.2 2006/05/02 14:32:49 strk 00202 * Added port info for polygonize/EdgeRing class, polygonize/EdgeRing.h header 00203 * not installed. 00204 * 00205 * Revision 1.1 2006/03/22 11:19:06 strk 00206 * opPolygonize.h headers split. 00207 * 00208 **********************************************************************/