00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GEOS_IDX_CHAIN_MONOTONECHAIN_H
00017 #define GEOS_IDX_CHAIN_MONOTONECHAIN_H
00018
00019 #include <geos/geom/Envelope.h>
00020
00021
00022 namespace geos {
00023 namespace geom {
00024 class Envelope;
00025 class LineSegment;
00026 class CoordinateSequence;
00027 }
00028 namespace index {
00029 namespace chain {
00030 class MonotoneChainSelectAction;
00031 class MonotoneChainOverlapAction;
00032 }
00033 }
00034 }
00035
00036 namespace geos {
00037 namespace index {
00038 namespace chain {
00039
00079 class MonotoneChain {
00080
00081 private:
00082
00083 void computeSelect(const geom::Envelope& searchEnv,
00084 unsigned int start0,
00085 unsigned int end0,
00086 MonotoneChainSelectAction& mcs);
00087
00088 void computeOverlaps(int start0, int end0, MonotoneChain* mc,
00089 int start1, int end1, MonotoneChainOverlapAction* mco);
00090
00091 const geom::CoordinateSequence* pts;
00092
00093 int start, end;
00094
00095 geom::Envelope* env;
00096
00098 void* context;
00099
00101 int id;
00102
00103 public:
00104 MonotoneChain(const geom::CoordinateSequence *newPts,
00105 int nstart, int nend,
00106 void* nContext)
00107 :
00108 pts(newPts),
00109 start(nstart),
00110 end(nend),
00111 env(NULL),
00112 context(nContext)
00113 {
00114 }
00115
00116 ~MonotoneChain() {
00117 delete env;
00118 }
00119
00120 geom::Envelope* getEnvelope();
00121
00122 int getStartIndex() { return start; }
00123
00124 int getEndIndex() { return end; }
00125
00126 void getLineSegment(unsigned int index, geom::LineSegment *ls);
00127
00132 geom::CoordinateSequence* getCoordinates();
00133
00138 void select(const geom::Envelope& searchEnv,
00139 MonotoneChainSelectAction& mcs);
00140
00141 void computeOverlaps(MonotoneChain *mc,
00142 MonotoneChainOverlapAction *mco);
00143
00144 void setId(int nId) { id=nId; }
00145
00146 inline int getId() { return id; }
00147
00148 void* getContext() { return context; }
00149
00150 };
00151
00152 }
00153 }
00154 }
00155
00156 #endif // GEOS_IDX_CHAIN_MONOTONECHAIN_H
00157
00158
00159
00160
00161
00162
00163
00164