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 #include <geos/util.h>
00025
00026 #include <vector>
00027 #include <iostream>
00028
00029
00030 namespace geos {
00031 namespace geom {
00032 class LineSegment;
00033 }
00034 namespace noding {
00035 class SegmentString;
00036 class SegmentIntersector;
00037 }
00038 }
00039
00040 namespace geos {
00041 namespace noding {
00042
00053 class MCIndexNoder : public SinglePassNoder {
00054
00055 private:
00056 std::vector<index::chain::MonotoneChain*> monoChains;
00057 index::strtree::STRtree index;
00058 int idCounter;
00059 std::vector<SegmentString*>* nodedSegStrings;
00060
00061 int nOverlaps;
00062
00063 void intersectChains();
00064
00065 void add(SegmentString* segStr);
00066
00067 public:
00068
00069 MCIndexNoder(SegmentIntersector *nSegInt=NULL)
00070 :
00071 SinglePassNoder(nSegInt),
00072 idCounter(0),
00073 nodedSegStrings(NULL),
00074 nOverlaps(0)
00075 {}
00076
00077 ~MCIndexNoder();
00078
00080 std::vector<index::chain::MonotoneChain*>& getMonotoneChains() { return monoChains; }
00081
00082 index::SpatialIndex& getIndex();
00083
00084 std::vector<SegmentString*>* getNodedSubstrings() const;
00085
00086 void computeNodes(std::vector<SegmentString*>* inputSegmentStrings);
00087
00088 class SegmentOverlapAction : public index::chain::MonotoneChainOverlapAction {
00089 private:
00090 SegmentIntersector& si;
00091 public:
00092 SegmentOverlapAction(SegmentIntersector& newSi)
00093 :
00094 si(newSi)
00095 {}
00096
00097 void overlap(index::chain::MonotoneChain* mc1, int start1,
00098 index::chain::MonotoneChain* mc2, int start2);
00099
00100 void overlap(geom::LineSegment* s1, geom::LineSegment* s2)
00101 {
00102 UNREFERENCED_PARAMETER(s1);
00103 UNREFERENCED_PARAMETER(s2);
00104 assert(0);
00105 }
00106 };
00107
00108 };
00109
00110 }
00111 }
00112
00113 #ifdef GEOS_INLINE
00114 # include <geos/noding/MCIndexNoder.inl>
00115 #endif
00116
00117 #endif // GEOS_NODING_MCINDEXNODER_H
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134