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 public:
00079
00080 SegmentOverlapAction(SegmentIntersector & si)
00081 :
00082 index::chain::MonotoneChainOverlapAction(),
00083 si(si)
00084 {}
00085
00086 void overlap(index::chain::MonotoneChain& mc1, size_t start1,
00087 index::chain::MonotoneChain& mc2, size_t start2);
00088 };
00089
00090 private:
00091
00092 std::vector<index::chain::MonotoneChain *> * monoChains;
00093
00094
00095
00096
00097
00098
00099 index::SpatialIndex * index;
00100 int indexCounter;
00101 int processCounter;
00102
00103 int nOverlaps;
00104
00105
00106 typedef std::vector<std::vector<index::chain::MonotoneChain*>*> chainstore_mm_type;
00107 chainstore_mm_type chainStore;
00108
00109 void addToIndex( SegmentString * segStr);
00110
00111 void intersectChains();
00112
00113 void addToMonoChains( SegmentString * segStr);
00114
00115 };
00116
00117 }
00118 }
00119
00120 #endif // GEOS_NODING_MCINDEXSEGMENTSETMUTUALINTERSECTOR_H
00121
00122
00123
00124