GEOS  3.12.0
LengthIndexedLine.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
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/LengthIndexedLine.java r463
18  *
19  **********************************************************************/
20 
21 #pragma once
22 
23 #include <geos/export.h>
24 #include <geos/geom/Coordinate.h>
25 #include <geos/geom/Geometry.h>
26 #include <geos/linearref/LinearLocation.h>
27 
28 namespace geos {
29 namespace linearref { // geos::linearref
30 
43 class GEOS_DLL LengthIndexedLine {
44 private:
45  const geom::Geometry* linearGeom;
46  LinearLocation locationOf(double index) const;
47  LinearLocation locationOf(double index, bool resolveLower) const;
48  double positiveIndex(double index) const;
49 
50 public:
51 
59  LengthIndexedLine(const geom::Geometry* linearGeom);
60 
73  geom::Coordinate extractPoint(double index) const;
74 
75 
94  geom::Coordinate extractPoint(double index, double offsetDistance) const;
95 
107  std::unique_ptr<geom::Geometry> extractLine(double startIndex, double endIndex) const;
108 
109 
128  double indexOf(const geom::Coordinate& pt) const;
129 
153  double indexOfAfter(const geom::Coordinate& pt, double minIndex) const;
154 
165  double* indicesOf(const geom::Geometry* subLine) const;
166 
167 
178  double project(const geom::Coordinate& pt) const;
179 
184  double getStartIndex() const;
185 
190  double getEndIndex() const;
191 
198  bool isValidIndex(double index) const;
199 
200 
207  double clampIndex(double index) const;
208 };
209 
210 }
211 }
geos::linearref::LinearLocation
Represents a location along a LineString or MultiLineString.
Definition: LinearLocation.h:43
geos
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25
geos::linearref::LengthIndexedLine::clampIndex
double clampIndex(double index) const
Computes a valid index for this line by clamping the given index to the valid range of index values.
geos::linearref::LengthIndexedLine::getEndIndex
double getEndIndex() const
Returns the index of the end of the line.
geos::linearref::LengthIndexedLine::indicesOf
double * indicesOf(const geom::Geometry *subLine) const
Computes the indices for a subline of the line.
geos::linearref::LengthIndexedLine::LengthIndexedLine
LengthIndexedLine(const geom::Geometry *linearGeom)
Constructs an object which allows a linear Geometry to be linearly referenced using length as an inde...
geos::linearref::LengthIndexedLine::indexOfAfter
double indexOfAfter(const geom::Coordinate &pt, double minIndex) const
Finds the index for a point on the line which is greater than the given index.
geos::linearref::LengthIndexedLine::extractPoint
geom::Coordinate extractPoint(double index) const
Computes the Coordinate for the point on the line at the given index.
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:216
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:186
geos::linearref::LengthIndexedLine::extractPoint
geom::Coordinate extractPoint(double index, double offsetDistance) const
Computes the Coordinate for the point on the line at the given index, offset by the given distance.
geos::linearref::LengthIndexedLine
Supports linear referencing along a linear geom::Geometry using the length along the line as the inde...
Definition: LengthIndexedLine.h:43
geos::linearref::LengthIndexedLine::project
double project(const geom::Coordinate &pt) const
Computes the index for the closest point on the line to the given point.
geos::linearref::LengthIndexedLine::isValidIndex
bool isValidIndex(double index) const
Tests whether an index is in the valid index range for the line.
geos::linearref::LengthIndexedLine::getStartIndex
double getStartIndex() const
Returns the index of the start of the line.
geos::linearref::LengthIndexedLine::indexOf
double indexOf(const geom::Coordinate &pt) const
Computes the minimum index for a point on the line.
geos::linearref::LengthIndexedLine::extractLine
std::unique_ptr< geom::Geometry > extractLine(double startIndex, double endIndex) const
Computes the LineString for the interval on the line between the given indices.