GEOS  3.3.1
EdgeRing.h
00001 /**********************************************************************
00002  * $Id: EdgeRing.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  * 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. 109/138 (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 #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 LineString;
00038                 class LinearRing;
00039                 class Polygon;
00040                 class CoordinateSequence;
00041                 class Geometry;
00042                 class GeometryFactory;
00043                 class Coordinate;
00044         }
00045         namespace planargraph { 
00046                 class DirectedEdge;
00047         }
00048 }
00049 
00050 namespace geos {
00051 namespace operation { // geos::operation
00052 namespace polygonize { // geos::operation::polygonize
00053 
00058 class GEOS_DLL EdgeRing {
00059 private:
00060         const geom::GeometryFactory *factory; 
00061 
00062         typedef std::vector<const planargraph::DirectedEdge*> DeList;
00063         DeList deList;
00064 
00065         // cache the following data for efficiency
00066         geom::LinearRing *ring;
00067         geom::CoordinateSequence *ringPts;
00068 
00069         typedef std::vector<geom::Geometry*> GeomVect;
00070         GeomVect *holes;
00071 
00078         geom::CoordinateSequence* getCoordinates();
00079 
00080         static void addEdge(const geom::CoordinateSequence *coords,
00081                         bool isForward,
00082                         geom::CoordinateSequence *coordList);
00083 
00084 public:
00103         static EdgeRing* findEdgeRingContaining(
00104                         EdgeRing *testEr,
00105                         std::vector<EdgeRing*> *shellList);
00106 
00117         static const geom::Coordinate& ptNotInList(
00118                         const geom::CoordinateSequence *testPts,
00119                         const geom::CoordinateSequence *pts);
00120 
00129         static bool isInList(const geom::Coordinate &pt,
00130                         const geom::CoordinateSequence *pts);
00131 
00132         EdgeRing(const geom::GeometryFactory *newFactory);
00133 
00134         ~EdgeRing();
00135 
00141         void add(const planargraph::DirectedEdge *de);
00142 
00150         bool isHole();
00151 
00157         void addHole(geom::LinearRing *hole);
00158 
00167         geom::Polygon* getPolygon();
00168 
00173         bool isValid();
00174 
00183         geom::LineString* getLineString();
00184 
00192         geom::LinearRing* getRingInternal();
00193 
00201         geom::LinearRing* getRingOwnership();
00202 };
00203 
00204 } // namespace geos::operation::polygonize
00205 } // namespace geos::operation
00206 } // namespace geos
00207 
00208 #ifdef _MSC_VER
00209 #pragma warning(pop)
00210 #endif
00211 
00212 #endif // GEOS_OP_POLYGONIZE_EDGERING_H
00213 
00214 /**********************************************************************
00215  * $Log$
00216  * Revision 1.2  2006/05/02 14:32:49  strk
00217  * Added port info for polygonize/EdgeRing class, polygonize/EdgeRing.h header
00218  * not installed.
00219  *
00220  * Revision 1.1  2006/03/22 11:19:06  strk
00221  * opPolygonize.h headers split.
00222  *
00223  **********************************************************************/