00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GEOS_NODING_SEGMENTNODELIST_H
00017 #define GEOS_NODING_SEGMENTNODELIST_H
00018
00019 #include <geos/inline.h>
00020
00021 #include <cassert>
00022 #include <iostream>
00023 #include <vector>
00024 #include <set>
00025
00026 #include <geos/noding/SegmentNode.h>
00027
00028
00029 namespace geos {
00030 namespace geom {
00031 class CoordinateSequence;
00032 }
00033 namespace noding {
00034 class SegmentString;
00035 }
00036 }
00037
00038 namespace geos {
00039 namespace noding {
00040
00047 class SegmentNodeList {
00048 private:
00049 std::set<SegmentNode*,SegmentNodeLT> nodeMap;
00050
00051
00052 const SegmentString& edge;
00053
00054
00055
00056
00057
00058 std::vector<SegmentString*> splitEdges;
00059
00060
00061 std::vector<geom::CoordinateSequence*> splitCoordLists;
00062
00069 void checkSplitEdgesCorrectness(std::vector<SegmentString*>& splitEdges);
00070
00077 SegmentString* createSplitEdge(SegmentNode *ei0, SegmentNode *ei1);
00078
00087 void addCollapsedNodes();
00088
00093 void findCollapsesFromExistingVertices(
00094 std::vector<size_t>& collapsedVertexIndexes);
00095
00103 void findCollapsesFromInsertedNodes(
00104 std::vector<size_t>& collapsedVertexIndexes);
00105
00106 bool findCollapseIndex(SegmentNode& ei0, SegmentNode& ei1,
00107 size_t& collapsedVertexIndex);
00108 public:
00109
00110 friend std::ostream& operator<< (std::ostream& os, const SegmentNodeList& l);
00111
00112 typedef std::set<SegmentNode*,SegmentNodeLT> container;
00113 typedef container::iterator iterator;
00114 typedef container::const_iterator const_iterator;
00115
00116 SegmentNodeList(const SegmentString* newEdge): edge(*newEdge) {}
00117
00118 SegmentNodeList(const SegmentString& newEdge): edge(newEdge) {}
00119
00120 const SegmentString& getEdge() const { return edge; }
00121
00122
00123
00124 virtual ~SegmentNodeList();
00125
00136 SegmentNode* add(const geom::Coordinate& intPt, size_t segmentIndex);
00137
00138 SegmentNode* add(const geom::Coordinate *intPt, size_t segmentIndex) {
00139 return add(*intPt, segmentIndex);
00140 }
00141
00142
00143
00144
00145
00146
00147 std::set<SegmentNode*,SegmentNodeLT>* getNodes() { return &nodeMap; }
00148
00150 size_t size() const { return nodeMap.size(); }
00151
00152 container::iterator begin() { return nodeMap.begin(); }
00153 container::const_iterator begin() const { return nodeMap.begin(); }
00154 container::iterator end() { return nodeMap.end(); }
00155 container::const_iterator end() const { return nodeMap.end(); }
00156
00160 void addEndpoints();
00161
00168 void addSplitEdges(std::vector<SegmentString*>& edgeList);
00169
00170 void addSplitEdges(std::vector<SegmentString*>* edgeList) {
00171 assert(edgeList);
00172 addSplitEdges(*edgeList);
00173 }
00174
00175
00176 };
00177
00178 std::ostream& operator<< (std::ostream& os, const SegmentNodeList& l);
00179
00180 }
00181 }
00182
00183
00184
00185
00186
00187 #endif
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204