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