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