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