GEOS 3.4.2

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

LinearIterator.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2005-2006 Refractions Research Inc.
7 * Copyright (C) 2001-2002 Vivid Solutions Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************
15 *
16 * Last port: linearref/LinearIterator.java r463
17 *
18 **********************************************************************/
19
20 #ifndef GEOS_LINEARREF_LINEARITERATOR_H
21 #define GEOS_LINEARREF_LINEARITERATOR_H
22
23 #include <string>
24
25 #include <geos/geom/Coordinate.h>
26 #include <geos/geom/Geometry.h>
27 #include <geos/geom/LineSegment.h>
28 #include <geos/linearref/LinearLocation.h>
29
30 namespace geos { namespace linearref
31 {
32
50 class LinearIterator
51 {
52 public:
58 LinearIterator(const geom::Geometry *linear);
59
67 LinearIterator(const geom::Geometry *linear, const LinearLocation& start);
68
77 LinearIterator(const geom::Geometry *linear, unsigned int componentIndex, unsigned int vertexIndex);
78
83 bool hasNext() const;
84
85
89 void next();
90
97 bool isEndOfLine() const;
98
103 unsigned int getComponentIndex() const;
104
109 unsigned int getVertexIndex() const;
110
115 const geom::LineString* getLine() const;
116
122 geom::Coordinate getSegmentStart() const;
123
131 geom::Coordinate getSegmentEnd() const;
132
133 private:
134
135 static unsigned int segmentEndVertexIndex(const LinearLocation& loc);
136
137 const geom::LineString *currentLine;
138 unsigned int vertexIndex;
139 unsigned int componentIndex;
140 const geom::Geometry *linear;
141 const unsigned int numLines;
142
149 void loadCurrentLine();
150
151 // Declare type as noncopyable
152 LinearIterator(const LinearIterator& other);
153 LinearIterator& operator=(const LinearIterator& rhs);
154 };
155
156 }} // namespace geos::linearref
157
158 #endif // GEOS_LINEARREF_LINEARITERATOR_H