GEOS  3.8.0dev
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.
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 {
31 namespace linearref {
32
51 public:
57  LinearIterator(const geom::Geometry* linear);
58
66  LinearIterator(const geom::Geometry* linear, const LinearLocation& start);
67
76  LinearIterator(const geom::Geometry* linear, size_t componentIndex, size_t vertexIndex);
77
82  bool hasNext() const;
83
84
88  void next();
89
96  bool isEndOfLine() const;
97
102  size_t getComponentIndex() const;
103
108  size_t getVertexIndex() const;
109
114  const geom::LineString* getLine() const;
115
122
131
132 private:
133
134  static size_t segmentEndVertexIndex(const LinearLocation& loc);
135
136  const geom::LineString* currentLine;
137  size_t vertexIndex;
138  size_t componentIndex;
139  const geom::Geometry* linear;
140  const size_t numLines;
141
149
150  // Declare type as noncopyable
151  LinearIterator(const LinearIterator& other) = delete;
152  LinearIterator& operator=(const LinearIterator& rhs) = delete;
153 };
154
155 }
156 } // namespace geos::linearref
157
158 #endif // GEOS_LINEARREF_LINEARITERATOR_H
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
size_t getVertexIndex() const
The vertex index of the vertex the iterator is currently at.
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
void next()
Moves the iterator ahead to the next vertex and (possibly) linear component.
Definition: LineString.h:68
Represents a location along a LineString or MultiLineString.
Definition: LinearLocation.h:44
bool hasNext() const
Tests whether there are any vertices left to iterator over.
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
bool isEndOfLine() const
Checks whether the iterator cursor is pointing to the endpoint of a component geom::LineString.
const geom::LineString * getLine() const
Gets the geom::LineString component the iterator is current at.
size_t getComponentIndex() const
The component index of the vertex the iterator is currently at.
geom::Coordinate getSegmentEnd() const
Gets the second geom::Coordinate of the current segment. (the coordinate of the next vertex)...
geom::Coordinate getSegmentStart() const
Gets the first geom::Coordinate of the current segment. (the coordinate of the current vertex)...
LinearIterator(const geom::Geometry *linear)
Creates an iterator initialized to the start of a linear Geometry.
An iterator over the components and coordinates of a linear geometry (LineString or MultiLineString)...
Definition: LinearIterator.h:50