00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GEOS_NODING_MCINDEXSEGMENTSETMUTUALINTERSECTOR_H
00021 #define GEOS_NODING_MCINDEXSEGMENTSETMUTUALINTERSECTOR_H
00022
00023 #include <geos/noding/SegmentSetMutualIntersector.h>
00024 #include <geos/index/chain/MonotoneChainOverlapAction.h>
00025
00026 namespace geos {
00027 namespace index {
00028 class SpatialIndex;
00029
00030 namespace chain {
00031 class MonotoneChain;
00032 }
00033 namespace strtree {
00034
00035 }
00036 }
00037 namespace noding {
00038 class SegmentString;
00039 class SegmentIntersector;
00040 }
00041 }
00042
00043
00044
00045 namespace geos {
00046 namespace noding {
00047
00054 class MCIndexSegmentSetMutualIntersector : public SegmentSetMutualIntersector
00055 {
00056 public:
00057
00058 MCIndexSegmentSetMutualIntersector();
00059
00060 ~MCIndexSegmentSetMutualIntersector();
00061
00062
00063
00064
00065
00066 std::vector<index::chain::MonotoneChain *>& getMonotoneChains()
00067 {
00068 return monoChains;
00069 }
00070
00071 index::SpatialIndex* getIndex()
00072 {
00073 return index;
00074 }
00075
00076 void setBaseSegments(SegmentString::ConstVect* segStrings);
00077
00078
00079 void process(SegmentString::ConstVect* segStrings);
00080
00081 class SegmentOverlapAction : public index::chain::MonotoneChainOverlapAction
00082 {
00083 private:
00084 SegmentIntersector & si;
00085
00086
00087 SegmentOverlapAction(const SegmentOverlapAction& other);
00088 SegmentOverlapAction& operator=(const SegmentOverlapAction& rhs);
00089
00090 public:
00091 SegmentOverlapAction(SegmentIntersector & si) :
00092 index::chain::MonotoneChainOverlapAction(), si(si)
00093 {}
00094
00095 void overlap(index::chain::MonotoneChain& mc1, std::size_t start1,
00096 index::chain::MonotoneChain& mc2, std::size_t start2);
00097 };
00098
00099 private:
00100
00101 typedef std::vector<index::chain::MonotoneChain *> MonoChains;
00102 MonoChains monoChains;
00103
00104
00105
00106
00107
00108
00109 index::SpatialIndex * index;
00110 int indexCounter;
00111 int processCounter;
00112
00113 int nOverlaps;
00114
00115
00116
00117
00118 MonoChains chainStore;
00119
00120 void addToIndex( SegmentString * segStr);
00121
00122 void intersectChains();
00123
00124 void addToMonoChains( SegmentString * segStr);
00125
00126 };
00127
00128 }
00129 }
00130
00131 #endif // GEOS_NODING_MCINDEXSEGMENTSETMUTUALINTERSECTOR_H