GEOS  3.6.1
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 
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 
123 
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
unsigned int getVertexIndex() const
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
const geom::LineString * getLine() const
geom::Coordinate getSegmentEnd() const
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:167
Definition: LineString.h:70
Represents a location along a LineString or MultiLineString.
Definition: LinearLocation.h:43
unsigned int getComponentIndex() const
geom::Coordinate getSegmentStart() const
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
LinearIterator(const geom::Geometry *linear)
An iterator over the components and coordinates of a linear geometry (LineString or MultiLineString)...
Definition: LinearIterator.h:50