00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GEOS_IDX_CHAIN_MONOTONECHAIN_H
00021 #define GEOS_IDX_CHAIN_MONOTONECHAIN_H
00022
00023 #include <geos/export.h>
00024 #include <geos/geom/Envelope.h>
00025
00026 #include <memory>
00027
00028
00029 namespace geos {
00030 namespace geom {
00031 class Envelope;
00032 class LineSegment;
00033 class CoordinateSequence;
00034 }
00035 namespace index {
00036 namespace chain {
00037 class MonotoneChainSelectAction;
00038 class MonotoneChainOverlapAction;
00039 }
00040 }
00041 }
00042
00043 namespace geos {
00044 namespace index {
00045 namespace chain {
00046
00086 class GEOS_DLL MonotoneChain
00087 {
00088 public:
00089
00100 MonotoneChain(const geom::CoordinateSequence& pts,
00101 size_t start, size_t end, void* context);
00102
00103 ~MonotoneChain();
00104
00106 const geom::Envelope& getEnvelope() const;
00107
00108 size_t getStartIndex() const { return start; }
00109
00110 size_t getEndIndex() const { return end; }
00111
00116 void getLineSegment(size_t index, geom::LineSegment& ls) const;
00117
00123 std::auto_ptr<geom::CoordinateSequence> getCoordinates() const;
00124
00129 void select(const geom::Envelope& searchEnv,
00130 MonotoneChainSelectAction& mcs);
00131
00132 void computeOverlaps(MonotoneChain *mc,
00133 MonotoneChainOverlapAction *mco);
00134
00135 void setId(int nId) { id=nId; }
00136
00137 inline int getId() const { return id; }
00138
00139 void* getContext() { return context; }
00140
00141 private:
00142
00143 void computeSelect(const geom::Envelope& searchEnv,
00144 size_t start0,
00145 size_t end0,
00146 MonotoneChainSelectAction& mcs);
00147
00148 void computeOverlaps(size_t start0, size_t end0, MonotoneChain& mc,
00149 size_t start1, size_t end1,
00150 MonotoneChainOverlapAction& mco);
00151
00153 const geom::CoordinateSequence& pts;
00154
00156 mutable geom::Envelope* env;
00157
00159 void* context;
00160
00162 size_t start;
00163
00165 size_t end;
00166
00168 int id;
00169
00170
00171 MonotoneChain(const MonotoneChain& other);
00172 MonotoneChain& operator=(const MonotoneChain& rhs);
00173 };
00174
00175 }
00176 }
00177 }
00178
00179 #endif // GEOS_IDX_CHAIN_MONOTONECHAIN_H
00180
00181
00182
00183
00184
00185
00186
00187