00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GEOS_NODING_MCINDEXNODER_H
00021 #define GEOS_NODING_MCINDEXNODER_H
00022
00023 #include <geos/export.h>
00024
00025 #include <geos/inline.h>
00026
00027 #include <geos/index/chain/MonotoneChainOverlapAction.h>
00028 #include <geos/noding/SinglePassNoder.h>
00029 #include <geos/index/strtree/STRtree.h>
00030 #include <geos/util.h>
00031
00032 #include <vector>
00033 #include <iostream>
00034
00035 #ifdef _MSC_VER
00036 #pragma warning(push)
00037 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00038 #endif
00039
00040
00041 namespace geos {
00042 namespace geom {
00043 class LineSegment;
00044 }
00045 namespace noding {
00046 class SegmentString;
00047 class SegmentIntersector;
00048 }
00049 }
00050
00051 namespace geos {
00052 namespace noding {
00053
00064 class GEOS_DLL MCIndexNoder : public SinglePassNoder {
00065
00066 private:
00067 std::vector<index::chain::MonotoneChain*> monoChains;
00068 index::strtree::STRtree index;
00069 int idCounter;
00070 std::vector<SegmentString*>* nodedSegStrings;
00071
00072 int nOverlaps;
00073
00074 void intersectChains();
00075
00076 void add(SegmentString* segStr);
00077
00078 public:
00079
00080 MCIndexNoder(SegmentIntersector *nSegInt=NULL)
00081 :
00082 SinglePassNoder(nSegInt),
00083 idCounter(0),
00084 nodedSegStrings(NULL),
00085 nOverlaps(0)
00086 {}
00087
00088 ~MCIndexNoder();
00089
00091 std::vector<index::chain::MonotoneChain*>& getMonotoneChains() { return monoChains; }
00092
00093 index::SpatialIndex& getIndex();
00094
00095 std::vector<SegmentString*>* getNodedSubstrings() const;
00096
00097 void computeNodes(std::vector<SegmentString*>* inputSegmentStrings);
00098
00099 class SegmentOverlapAction : public index::chain::MonotoneChainOverlapAction {
00100 public:
00101 SegmentOverlapAction(SegmentIntersector& newSi)
00102 :
00103 index::chain::MonotoneChainOverlapAction(),
00104 si(newSi)
00105 {}
00106
00107 void overlap(index::chain::MonotoneChain& mc1, std::size_t start1,
00108 index::chain::MonotoneChain& mc2, std::size_t start2);
00109 private:
00110 SegmentIntersector& si;
00111
00112
00113 SegmentOverlapAction(const SegmentOverlapAction& other);
00114 SegmentOverlapAction& operator=(const SegmentOverlapAction& rhs);
00115 };
00116
00117 };
00118
00119 }
00120 }
00121
00122 #ifdef _MSC_VER
00123 #pragma warning(pop)
00124 #endif
00125
00126 #ifdef GEOS_INLINE
00127 # include <geos/noding/MCIndexNoder.inl>
00128 #endif
00129
00130 #endif // GEOS_NODING_MCINDEXNODER_H
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147