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