00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef GEOS_GEOMGRAPH_EDGERING_H
00023 #define GEOS_GEOMGRAPH_EDGERING_H
00024
00025 #include <geos/export.h>
00026 #include <geos/geomgraph/Label.h>
00027
00028 #include <geos/inline.h>
00029
00030 #include <vector>
00031 #include <cassert>
00032 #include <iosfwd>
00033
00034 #ifdef _MSC_VER
00035 #pragma warning(push)
00036 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00037 #endif
00038
00039
00040 namespace geos {
00041 namespace geom {
00042 class GeometryFactory;
00043 class LinearRing;
00044 class Polygon;
00045 class Coordinate;
00046 class CoordinateSequence;
00047 }
00048 namespace geomgraph {
00049 class DirectedEdge;
00050
00051 class Edge;
00052 }
00053 }
00054
00055 namespace geos {
00056 namespace geomgraph {
00057
00058 class GEOS_DLL EdgeRing {
00059
00060 public:
00061 friend std::ostream& operator<< (std::ostream& os, const EdgeRing& er);
00062
00063 EdgeRing(DirectedEdge *newStart,
00064 const geom::GeometryFactory *newGeometryFactory);
00065
00066 virtual ~EdgeRing();
00067
00068 bool isIsolated();
00069
00070 bool isHole();
00071
00072
00073
00074
00075
00076
00077 geom::LinearRing* getLinearRing();
00078
00079 Label& getLabel();
00080
00081 bool isShell();
00082
00083 EdgeRing *getShell();
00084
00085 void setShell(EdgeRing *newShell);
00086
00087 void addHole(EdgeRing *edgeRing);
00088
00094 geom::Polygon* toPolygon(const geom::GeometryFactory* geometryFactory);
00095
00101 void computeRing();
00102
00103 virtual DirectedEdge* getNext(DirectedEdge *de)=0;
00104
00105 virtual void setEdgeRing(DirectedEdge *de, EdgeRing *er)=0;
00106
00110 std::vector<DirectedEdge*>& getEdges();
00111
00112 int getMaxNodeDegree();
00113
00114 void setInResult();
00115
00120 bool containsPoint(const geom::Coordinate& p);
00121
00122 void testInvariant()
00123 {
00124
00125 assert(pts);
00126
00127 #ifndef NDEBUG
00128
00129
00130
00131 if ( ! shell )
00132 {
00133 for (std::vector<EdgeRing*>::const_iterator
00134 it=holes.begin(), itEnd=holes.end();
00135 it != itEnd;
00136 ++it)
00137 {
00138 EdgeRing* hole=*it;
00139 assert(hole);
00140 assert(hole->getShell()==this);
00141 }
00142 }
00143 #endif // ndef NDEBUG
00144 }
00145
00146 protected:
00147
00148 DirectedEdge *startDe;
00149
00150 const geom::GeometryFactory *geometryFactory;
00151
00153 void computePoints(DirectedEdge *newStart);
00154
00155 void mergeLabel(Label& deLabel);
00156
00169 void mergeLabel(Label& deLabel, int geomIndex);
00170
00171 void addPoints(Edge *edge, bool isForward, bool isFirstEdge);
00172
00174 std::vector<EdgeRing*> holes;
00175
00176 private:
00177
00178 int maxNodeDegree;
00179
00181 std::vector<DirectedEdge*> edges;
00182
00183 geom::CoordinateSequence* pts;
00184
00185
00186
00187 Label label;
00188
00189 geom::LinearRing *ring;
00190
00191 bool isHoleVar;
00192
00194 EdgeRing *shell;
00195
00196 void computeMaxNodeDegree();
00197
00198 };
00199
00200 std::ostream& operator<< (std::ostream& os, const EdgeRing& er);
00201
00202 }
00203 }
00204
00205 #ifdef _MSC_VER
00206 #pragma warning(pop)
00207 #endif
00208
00209
00210
00211
00212
00213 #endif // ifndef GEOS_GEOMGRAPH_EDGERING_H
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256