00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GEOS_NODING_SEGMENTNODELIST_H
00020 #define GEOS_NODING_SEGMENTNODELIST_H
00021
00022 #include <geos/export.h>
00023
00024 #include <geos/inline.h>
00025
00026 #include <cassert>
00027 #include <iostream>
00028 #include <vector>
00029 #include <set>
00030
00031 #include <geos/noding/SegmentNode.h>
00032
00033 #ifdef _MSC_VER
00034 #pragma warning(push)
00035 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00036 #endif
00037
00038
00039 namespace geos {
00040 namespace geom {
00041 class CoordinateSequence;
00042 }
00043 namespace noding {
00044 class SegmentString;
00045 class NodedSegmentString;
00046 }
00047 }
00048
00049 namespace geos {
00050 namespace noding {
00051
00056 class GEOS_DLL SegmentNodeList {
00057 private:
00058 std::set<SegmentNode*,SegmentNodeLT> nodeMap;
00059
00060
00061 const NodedSegmentString& edge;
00062
00069 void checkSplitEdgesCorrectness(std::vector<SegmentString*>& splitEdges);
00070
00079 SegmentString* createSplitEdge(SegmentNode *ei0, SegmentNode *ei1);
00080
00089 void addCollapsedNodes();
00090
00095 void findCollapsesFromExistingVertices(
00096 std::vector<std::size_t>& collapsedVertexIndexes);
00097
00105 void findCollapsesFromInsertedNodes(
00106 std::vector<std::size_t>& collapsedVertexIndexes);
00107
00108 bool findCollapseIndex(SegmentNode& ei0, SegmentNode& ei1,
00109 size_t& collapsedVertexIndex);
00110
00111
00112 SegmentNodeList(const SegmentNodeList& other);
00113 SegmentNodeList& operator=(const SegmentNodeList& rhs);
00114
00115 public:
00116
00117 friend std::ostream& operator<< (std::ostream& os, const SegmentNodeList& l);
00118
00119 typedef std::set<SegmentNode*,SegmentNodeLT> container;
00120 typedef container::iterator iterator;
00121 typedef container::const_iterator const_iterator;
00122
00123 SegmentNodeList(const NodedSegmentString* newEdge): edge(*newEdge) {}
00124
00125 SegmentNodeList(const NodedSegmentString& newEdge): edge(newEdge) {}
00126
00127 const NodedSegmentString& getEdge() const { return edge; }
00128
00129
00130
00131 virtual ~SegmentNodeList();
00132
00143 SegmentNode* add(const geom::Coordinate& intPt, std::size_t segmentIndex);
00144
00145 SegmentNode* add(const geom::Coordinate *intPt, std::size_t segmentIndex) {
00146 return add(*intPt, segmentIndex);
00147 }
00148
00149
00150
00151
00152
00153
00154 std::set<SegmentNode*,SegmentNodeLT>* getNodes() { return &nodeMap; }
00155
00157 size_t size() const { return nodeMap.size(); }
00158
00159 container::iterator begin() { return nodeMap.begin(); }
00160 container::const_iterator begin() const { return nodeMap.begin(); }
00161 container::iterator end() { return nodeMap.end(); }
00162 container::const_iterator end() const { return nodeMap.end(); }
00163
00167 void addEndpoints();
00168
00175 void addSplitEdges(std::vector<SegmentString*>& edgeList);
00176
00177 void addSplitEdges(std::vector<SegmentString*>* edgeList) {
00178 assert(edgeList);
00179 addSplitEdges(*edgeList);
00180 }
00181
00182
00183 };
00184
00185 std::ostream& operator<< (std::ostream& os, const SegmentNodeList& l);
00186
00187 }
00188 }
00189
00190 #ifdef _MSC_VER
00191 #pragma warning(pop)
00192 #endif
00193
00194 #endif