GEOS: LinearIterator.h Source File

GEOS 3.3.8

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

- File List

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