GEOS
3.8.0dev

Supports linear referencing along a linear geom::Geometry using the length along the line as the index. More...
#include <LengthIndexedLine.h>
Public Member Functions  
LengthIndexedLine (const geom::Geometry *linearGeom)  
Constructs an object which allows a linear Geometry to be linearly referenced using length as an index. More...  
geom::Coordinate  extractPoint (double index) const 
Computes the Coordinate for the point on the line at the given index. More...  
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. More...  
std::unique_ptr< geom::Geometry >  extractLine (double startIndex, double endIndex) const 
Computes the LineString for the interval on the line between the given indices. More...  
double  indexOf (const geom::Coordinate &pt) const 
Computes the minimum index for a point on the line. More...  
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. More...  
double *  indicesOf (const geom::Geometry *subLine) const 
Computes the indices for a subline of the line. More...  
double  project (const geom::Coordinate &pt) const 
Computes the index for the closest point on the line to the given point. More...  
double  getStartIndex () const 
Returns the index of the start of the line. More...  
double  getEndIndex () const 
Returns the index of the end of the line. More...  
bool  isValidIndex (double index) const 
Tests whether an index is in the valid index range for the line. More...  
double  clampIndex (double index) const 
Computes a valid index for this line by clamping the given index to the valid range of index values. More...  
Supports linear referencing along a linear geom::Geometry using the length along the line as the index.
Negative length values are taken as measured in the reverse direction from the end of the geometry. Outofrange index values are handled by clamping them to the valid range of values. Nonsimple lines (i.e. which loop back to cross or touch themselves) are supported.
geos::linearref::LengthIndexedLine::LengthIndexedLine  (  const geom::Geometry *  linearGeom  ) 
Constructs an object which allows a linear Geometry to be linearly referenced using length as an index.
linearGeom  the linear geometry to reference along 
double geos::linearref::LengthIndexedLine::clampIndex  (  double  index  )  const 
Computes a valid index for this line by clamping the given index to the valid range of index values.
std::unique_ptr<geom::Geometry> geos::linearref::LengthIndexedLine::extractLine  (  double  startIndex, 
double  endIndex  
)  const 
Computes the LineString for the interval on the line between the given indices.
If the endIndex lies before the startIndex, the computed geometry is reversed.
startIndex  the index of the start of the interval 
endIndex  the index of the end of the interval 
geom::Coordinate geos::linearref::LengthIndexedLine::extractPoint  (  double  index  )  const 
Computes the Coordinate for the point on the line at the given index.
If the index is out of range the first or last point on the line will be returned. The Zordinate of the computed point will be interpolated from the Zordinates of the line segment containing it, if they exist.
index  the index of the desired point 
geom::Coordinate geos::linearref::LengthIndexedLine::extractPoint  (  double  index, 
double  offsetDistance  
)  const 
Computes the Coordinate for the point on the line at the given index, offset by the given distance.
If the index is out of range the first or last point on the line will be returned. The computed point is offset to the left of the line if the offset distance is positive, to the right if negative.
The Zordinate of the computed point will be interpolated from the Zordinates of the line segment containing it, if they exist.
index  the index of the desired point 
offsetDistance  the distance the point is offset from the segment (positive is to the left, negative is to the right) 
double geos::linearref::LengthIndexedLine::getEndIndex  (  )  const 
Returns the index of the end of the line.
double geos::linearref::LengthIndexedLine::getStartIndex  (  )  const 
Returns the index of the start of the line.
double geos::linearref::LengthIndexedLine::indexOf  (  const geom::Coordinate &  pt  )  const 
Computes the minimum index for a point on the line.
If the line is not simple (i.e. loops back on itself) a single point may have more than one possible index. In this case, the smallest index is returned.
The supplied point does not necessarily have to lie precisely on the line, but if it is far from the line the accuracy and performance of this function is not guaranteed. Use project to compute a guaranteed result for points which may be far from the line.
pt  a point on the line 
double geos::linearref::LengthIndexedLine::indexOfAfter  (  const geom::Coordinate &  pt, 
double  minIndex  
)  const 
Finds the index for a point on the line which is greater than the given index.
If no such index exists, returns minIndex
. This method can be used to determine all indexes for a point which occurs more than once on a nonsimple line. It can also be used to disambiguate cases where the given point lies slightly off the line and is equidistant from two different points on the line.
The supplied point does not `*necessarily* have to lie precisely on the line, but if it is far from the line the accuracy and performance of this function is not guaranteed. Use project to compute a guaranteed result for points which may be far from the line.
pt  a point on the line 
minIndex  the value the returned index must be greater than 
double* geos::linearref::LengthIndexedLine::indicesOf  (  const geom::Geometry *  subLine  )  const 
Computes the indices for a subline of the line.
(The subline must conform to the line; that is, all vertices in the subline (except possibly the first and last) must be vertices of the line and occcur in the same order).
subLine  a subLine of the line 
bool geos::linearref::LengthIndexedLine::isValidIndex  (  double  index  )  const 
Tests whether an index is in the valid index range for the line.
index  the index to test 
true
if the index is in the valid range double geos::linearref::LengthIndexedLine::project  (  const geom::Coordinate &  pt  )  const 
Computes the index for the closest point on the line to the given point.
If more than one point has the closest distance the first one along the line is returned. (The point does not necessarily have to lie precisely on the line.)
pt  a point on the line 