GEOS  3.9.1
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 #ifndef GEOS_LINEARREF_LENGTHINDEXEDLINE_H
22 #define GEOS_LINEARREF_LENGTHINDEXEDLINE_H
23 
24 #include <geos/export.h>
25 #include <geos/geom/Coordinate.h>
26 #include <geos/geom/Geometry.h>
27 #include <geos/linearref/LinearLocation.h>
28 
29 namespace geos {
30 namespace linearref { // geos::linearref
31 
44 class GEOS_DLL LengthIndexedLine {
45 private:
46  const geom::Geometry* linearGeom;
47  LinearLocation locationOf(double index) const;
48  LinearLocation locationOf(double index, bool resolveLower) const;
49  double positiveIndex(double index) const;
50 
51 public:
52 
60  LengthIndexedLine(const geom::Geometry* linearGeom);
61 
74  geom::Coordinate extractPoint(double index) const;
75 
76 
95  geom::Coordinate extractPoint(double index, double offsetDistance) const;
96 
108  std::unique_ptr<geom::Geometry> extractLine(double startIndex, double endIndex) const;
109 
110 
129  double indexOf(const geom::Coordinate& pt) const;
130 
154  double indexOfAfter(const geom::Coordinate& pt, double minIndex) const;
155 
166  double* indicesOf(const geom::Geometry* subLine) const;
167 
168 
179  double project(const geom::Coordinate& pt) const;
180 
185  double getStartIndex() const;
186 
191  double getEndIndex() const;
192 
199  bool isValidIndex(double index) const;
200 
201 
208  double clampIndex(double index) const;
209 };
210 }
211 }
212 #endif
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
Supports linear referencing along a linear geom::Geometry using the length along the line as the inde...
Definition: LengthIndexedLine.h:44
double * indicesOf(const geom::Geometry *subLine) const
Computes the indices for a subline of the line.
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.
std::unique_ptr< geom::Geometry > extractLine(double startIndex, double endIndex) const
Computes the LineString for the interval on the line between the given indices.
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.
double project(const geom::Coordinate &pt) const
Computes the index for the closest point on the line to the given point.
LengthIndexedLine(const geom::Geometry *linearGeom)
Constructs an object which allows a linear Geometry to be linearly referenced using length as an inde...
bool isValidIndex(double index) const
Tests whether an index is in the valid index range for the line.
double getEndIndex() const
Returns the index of the end of the line.
double getStartIndex() const
Returns the index of the start of the line.
double indexOf(const geom::Coordinate &pt) const
Computes the minimum index for a point on the line.
geom::Coordinate extractPoint(double index) const
Computes the Coordinate for the point on the line at the given index.
double clampIndex(double index) const
Computes a valid index for this line by clamping the given index to the valid range of index values.
Represents a location along a LineString or MultiLineString.
Definition: LinearLocation.h:44
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26