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 public:
00082
00083 MonotoneChain(const geom::CoordinateSequence *newPts,
00084 int nstart, int nend, void* nContext);
00085
00086 ~MonotoneChain();
00087
00088 geom::Envelope* getEnvelope();
00089
00090 int getStartIndex() { return start; }
00091
00092 int getEndIndex() { return end; }
00093
00094 void getLineSegment(unsigned int index, geom::LineSegment *ls);
00095
00100 geom::CoordinateSequence* getCoordinates();
00101
00106 void select(const geom::Envelope& searchEnv,
00107 MonotoneChainSelectAction& mcs);
00108
00109 void computeOverlaps(MonotoneChain *mc,
00110 MonotoneChainOverlapAction *mco);
00111
00112 void setId(int nId) { id=nId; }
00113
00114 inline int getId() { return id; }
00115
00116 void* getContext() { return context; }
00117
00118 private:
00119
00120 void computeSelect(const geom::Envelope& searchEnv,
00121 unsigned int start0,
00122 unsigned int end0,
00123 MonotoneChainSelectAction& mcs);
00124
00125 void computeOverlaps(int start0, int end0, MonotoneChain* mc,
00126 int start1, int end1, MonotoneChainOverlapAction* mco);
00127
00128 const geom::CoordinateSequence* pts;
00129 geom::Envelope* env;
00131 void* context;
00132 int start;
00133 int end;
00135 int id;
00136
00137 };
00138
00139 }
00140 }
00141 }
00142
00143 #endif // GEOS_IDX_CHAIN_MONOTONECHAIN_H
00144
00145
00146
00147
00148
00149
00150
00151