00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef GEOS_LINEARREF_LINEARITERATOR_H
00022 #define GEOS_LINEARREF_LINEARITERATOR_H
00023
00024 #include <string>
00025
00026 #include <geos/geom/Coordinate.h>
00027 #include <geos/geom/Geometry.h>
00028 #include <geos/geom/LineSegment.h>
00029 #include <geos/linearref/LinearLocation.h>
00030
00031 namespace geos { namespace linearref
00032 {
00033
00051 class LinearIterator
00052 {
00053 public:
00059 LinearIterator(const geom::Geometry *linear);
00060
00068 LinearIterator(const geom::Geometry *linear, const LinearLocation& start);
00069
00078 LinearIterator(const geom::Geometry *linear, unsigned int componentIndex, unsigned int vertexIndex);
00079
00084 bool hasNext() const;
00085
00086
00090 void next();
00091
00098 bool isEndOfLine() const;
00099
00104 unsigned int getComponentIndex() const;
00105
00110 unsigned int getVertexIndex() const;
00111
00116 const geom::LineString* getLine() const;
00117
00123 geom::Coordinate getSegmentStart() const;
00124
00132 geom::Coordinate getSegmentEnd() const;
00133
00134 private:
00135
00136 static unsigned int segmentEndVertexIndex(const LinearLocation& loc);
00137
00138 const geom::LineString *currentLine;
00139 unsigned int vertexIndex;
00140 unsigned int componentIndex;
00141 const geom::Geometry *linear;
00142 const unsigned int numLines;
00143
00148 void loadCurrentLine();
00149
00150
00151 LinearIterator(const LinearIterator& other);
00152 LinearIterator& operator=(const LinearIterator& rhs);
00153 };
00154
00155 }}
00156
00157 #endif // GEOS_LINEARREF_LINEARITERATOR_H