00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GEOS_NODING_MCINDEXNODER_H
00017 #define GEOS_NODING_MCINDEXNODER_H
00018
00019 #include <geos/inline.h>
00020
00021 #include <geos/index/chain/MonotoneChainOverlapAction.h>
00022 #include <geos/noding/SinglePassNoder.h>
00023 #include <geos/index/strtree/STRtree.h>
00024
00025 #include <vector>
00026 #include <iostream>
00027
00028
00029 namespace geos {
00030 namespace geom {
00031 class LineSegment;
00032 }
00033 namespace noding {
00034 class SegmentString;
00035 class SegmentIntersector;
00036 }
00037 }
00038
00039 namespace geos {
00040 namespace noding {
00041
00052 class MCIndexNoder : public SinglePassNoder {
00053
00054 private:
00055 std::vector<index::chain::MonotoneChain*> monoChains;
00056 index::strtree::STRtree index;
00057 int idCounter;
00058 std::vector<SegmentString*>* nodedSegStrings;
00059
00060 int nOverlaps;
00061
00062 void intersectChains();
00063
00064 void add(SegmentString* segStr);
00065
00066 public:
00067
00068 MCIndexNoder(SegmentIntersector *nSegInt=NULL)
00069 :
00070 SinglePassNoder(nSegInt),
00071 idCounter(0),
00072 nodedSegStrings(NULL),
00073 nOverlaps(0)
00074 {}
00075
00076 ~MCIndexNoder();
00077
00079 std::vector<index::chain::MonotoneChain*>& getMonotoneChains() { return monoChains; }
00080
00081 index::SpatialIndex& getIndex();
00082
00083 std::vector<SegmentString*>* getNodedSubstrings() const;
00084
00085 void computeNodes(std::vector<SegmentString*>* inputSegmentStrings);
00086
00087 class SegmentOverlapAction : public index::chain::MonotoneChainOverlapAction {
00088 private:
00089 SegmentIntersector& si;
00090 public:
00091 SegmentOverlapAction(SegmentIntersector& newSi)
00092 :
00093 si(newSi)
00094 {}
00095
00096 void overlap(index::chain::MonotoneChain* mc1, int start1,
00097 index::chain::MonotoneChain* mc2, int start2);
00098
00099 void overlap(geom::LineSegment* s1, geom::LineSegment* s2) { assert(0); }
00100 };
00101
00102 };
00103
00104 }
00105 }
00106
00107 #ifdef GEOS_INLINE
00108 # include <geos/noding/MCIndexNoder.inl>
00109 #endif
00110
00111 #endif // GEOS_NODING_MCINDEXNODER_H
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128