GEOS  3.4.2
ConnectedInteriorTester.h
00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2005-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/valid/ConnectedInteriorTester.java rev. 1.15 (JTS-1.10)
00017  *
00018  **********************************************************************/
00019 
00020 #ifndef GEOS_OP_CONNECTEDINTERIORTESTER_H
00021 #define GEOS_OP_CONNECTEDINTERIORTESTER_H
00022 
00023 #include <geos/export.h>
00024 
00025 #include <geos/geom/Coordinate.h> // for composition
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 Coordinate;
00038                 class Geometry;
00039                 class CoordinateSequence;
00040                 class GeometryFactory;
00041                 class LineString;
00042         }
00043         namespace geomgraph {
00044                 class GeometryGraph;
00045                 class PlanarGraph;
00046                 class EdgeRing;
00047                 class DirectedEdge;
00048                 class EdgeEnd;
00049         }
00050 }
00051 
00052 namespace geos {
00053 namespace operation { // geos::operation
00054 namespace valid { // geos::operation::valid
00055 
00070 class GEOS_DLL ConnectedInteriorTester {
00071 public:
00072         ConnectedInteriorTester(geomgraph::GeometryGraph &newGeomGraph);
00073         ~ConnectedInteriorTester();
00074         geom::Coordinate& getCoordinate();
00075         bool isInteriorsConnected();
00076         static const geom::Coordinate& findDifferentPoint(
00077                         const geom::CoordinateSequence *coord,
00078                         const geom::Coordinate& pt);
00079 
00080 protected:
00081 
00082         void visitLinkedDirectedEdges(geomgraph::DirectedEdge *start);
00083 
00084 private:
00085 
00086         geom::GeometryFactory *geometryFactory;
00087 
00088         geomgraph::GeometryGraph &geomGraph;
00089 
00093         geom::Coordinate disconnectedRingcoord;
00094 
00096         std::vector<geomgraph::EdgeRing*> maximalEdgeRings;
00097 
00098         void setInteriorEdgesInResult(geomgraph::PlanarGraph &graph);
00099 
00100         
00112         void buildEdgeRings(std::vector<geomgraph::EdgeEnd*> *dirEdges,
00113                             std::vector<geomgraph::EdgeRing*>& minEdgeRings);
00114 
00119         void visitShellInteriors(const geom::Geometry *g, geomgraph::PlanarGraph &graph);
00120 
00121         void visitInteriorRing(const geom::LineString *ring, geomgraph::PlanarGraph &graph);
00122 
00133         bool hasUnvisitedShellEdge(std::vector<geomgraph::EdgeRing*> *edgeRings);
00134 
00135     // Declare type as noncopyable
00136     ConnectedInteriorTester(const ConnectedInteriorTester& other);
00137     ConnectedInteriorTester& operator=(const ConnectedInteriorTester& rhs);
00138 };
00139 
00140 } // namespace geos::operation::valid
00141 } // namespace geos::operation
00142 } // namespace geos
00143 
00144 #ifdef _MSC_VER
00145 #pragma warning(pop)
00146 #endif
00147 
00148 #endif // GEOS_OP_CONNECTEDINTERIORTESTER_H