LinearIterator.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************
*
* Last port: linearref/LinearIterator.java r463
*
**********************************************************************/
#pragma once
#include <string>
#include <geos/geom/Coordinate.h>
#include <geos/geom/Geometry.h>
#include <geos/geom/LineSegment.h>
#include <geos/linearref/LinearLocation.h>
namespace geos {
namespace linearref {
class LinearIterator {
public:
LinearIterator(const geom::Geometry* linear);
LinearIterator(const geom::Geometry* linear, const LinearLocation& start);
LinearIterator(const geom::Geometry* linear, std::size_t componentIndex, std::size_t vertexIndex);
bool hasNext() const;
void next();
bool isEndOfLine() const;
std::size_t getComponentIndex() const;
std::size_t getVertexIndex() const;
const geom::LineString* getLine() const;
geom::Coordinate getSegmentStart() const;
geom::Coordinate getSegmentEnd() const;
private:
static std::size_t segmentEndVertexIndex(const LinearLocation& loc);
const geom::LineString* currentLine;
std::size_t vertexIndex;
std::size_t componentIndex;
const geom::Geometry* linear;
const std::size_t numLines;
void loadCurrentLine();
// Declare type as noncopyable
LinearIterator(const LinearIterator& other) = delete;
LinearIterator& operator=(const LinearIterator& rhs) = delete;
};
}
} // namespace geos::linearref
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:217
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:196
geos::geom::LineString
Definition LineString.h:66
geos::linearref::LinearIterator::hasNext
bool hasNext() const
Tests whether there are any vertices left to iterator over.
geos::linearref::LinearIterator::getSegmentEnd
geom::Coordinate getSegmentEnd() const
Gets the second geom::Coordinate of the current segment. (the coordinate of the next vertex)....
geos::linearref::LinearIterator::getVertexIndex
std::size_t getVertexIndex() const
The vertex index of the vertex the iterator is currently at.
geos::linearref::LinearIterator::LinearIterator
LinearIterator(const geom::Geometry *linear)
Creates an iterator initialized to the start of a linear Geometry.
geos::linearref::LinearIterator::getSegmentStart
geom::Coordinate getSegmentStart() const
Gets the first geom::Coordinate of the current segment. (the coordinate of the current vertex).
geos::linearref::LinearIterator::getComponentIndex
std::size_t getComponentIndex() const
The component index of the vertex the iterator is currently at.
geos::linearref::LinearIterator::isEndOfLine
bool isEndOfLine() const
Checks whether the iterator cursor is pointing to the endpoint of a component geom::LineString.
geos::linearref::LinearIterator::LinearIterator
LinearIterator(const geom::Geometry *linear, const LinearLocation &start)
Creates an iterator starting at a LinearLocation on a linear geom::Geometry.
geos::linearref::LinearIterator::LinearIterator
LinearIterator(const geom::Geometry *linear, std::size_t componentIndex, std::size_t vertexIndex)
Creates an iterator starting at a component and vertex in a linear geom::Geometry.
geos::linearref::LinearIterator::getLine
const geom::LineString * getLine() const
Gets the geom::LineString component the iterator is current at.
geos::linearref::LinearIterator::next
void next()
Moves the iterator ahead to the next vertex and (possibly) linear component.
geos::linearref::LinearLocation
Represents a location along a LineString or MultiLineString.
Definition LinearLocation.h:43
geos::linearref
Contains classes and interfaces implementing linear referencing on linear geometries.
Definition ExtractLineByLocation.h:27
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38