EdgeRing.h

00001 /**********************************************************************
00002  * $Id: EdgeRing.h 1820 2006-09-06 16:54:23Z 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. 1.6
00018  *
00019  **********************************************************************/
00020 
00021 
00022 #ifndef GEOS_OP_POLYGONIZE_EDGERING_H
00023 #define GEOS_OP_POLYGONIZE_EDGERING_H
00024 
00025 #include <vector>
00026 
00027 // Forward declarations
00028 namespace geos {
00029         namespace geom { 
00030                 class LineString;
00031                 class LinearRing;
00032                 class Polygon;
00033                 class CoordinateSequence;
00034                 class Geometry;
00035                 class GeometryFactory;
00036                 class Coordinate;
00037         }
00038         namespace planargraph { 
00039                 class DirectedEdge;
00040         }
00041 }
00042 
00043 namespace geos {
00044 namespace operation { // geos::operation
00045 namespace polygonize { // geos::operation::polygonize
00046 
00051 class EdgeRing {
00052 private:
00053         const geom::GeometryFactory *factory; 
00054         std::vector<const planargraph::DirectedEdge*> *deList;
00055 
00056         // cache the following data for efficiency
00057         geom::LinearRing *ring;
00058         geom::CoordinateSequence *ringPts;
00059         std::vector<geom::Geometry*> *holes;
00060 
00067         geom::CoordinateSequence* getCoordinates();
00068 
00069         static void addEdge(const geom::CoordinateSequence *coords,
00070                         bool isForward,
00071                         geom::CoordinateSequence *coordList);
00072 
00073 public:
00090         static EdgeRing* findEdgeRingContaining(
00091                         EdgeRing *testEr,
00092                         std::vector<EdgeRing*> *shellList);
00093 
00104         static const geom::Coordinate& ptNotInList(
00105                         const geom::CoordinateSequence *testPts,
00106                         const geom::CoordinateSequence *pts);
00107 
00116         static bool isInList(const geom::Coordinate &pt,
00117                         const geom::CoordinateSequence *pts);
00118 
00119         EdgeRing(const geom::GeometryFactory *newFactory);
00120 
00121         ~EdgeRing();
00122 
00128         void add(const planargraph::DirectedEdge *de);
00129 
00137         bool isHole();
00138 
00144         void addHole(geom::LinearRing *hole);
00145 
00154         geom::Polygon* getPolygon();
00155 
00160         bool isValid();
00161 
00170         geom::LineString* getLineString();
00171 
00179         geom::LinearRing* getRingInternal();
00180 
00188         geom::LinearRing* getRingOwnership();
00189 };
00190 
00191 } // namespace geos::operation::polygonize
00192 } // namespace geos::operation
00193 } // namespace geos
00194 
00195 #endif // GEOS_OP_POLYGONIZE_EDGERING_H
00196 
00197 /**********************************************************************
00198  * $Log$
00199  * Revision 1.2  2006/05/02 14:32:49  strk
00200  * Added port info for polygonize/EdgeRing class, polygonize/EdgeRing.h header
00201  * not installed.
00202  *
00203  * Revision 1.1  2006/03/22 11:19:06  strk
00204  * opPolygonize.h headers split.
00205  *
00206  **********************************************************************/

Generated on Fri Mar 27 04:52:41 2009 for GEOS by  doxygen 1.5.4