#include <LinearLocation.h>
Public Member Functions | |
LinearLocation (unsigned int segmentIndex=0, double segmentFraction=0.0) | |
LinearLocation (unsigned int componentIndex, unsigned int segmentIndex, double segmentFraction) | |
void | clamp (const geom::Geometry *linear) |
void | snapToVertex (const geom::Geometry *linearGeom, double minDistance) |
double | getSegmentLength (const geom::Geometry *linearGeom) const |
void | setToEnd (const geom::Geometry *linear) |
unsigned int | getComponentIndex () const |
unsigned int | getSegmentIndex () const |
double | getSegmentFraction () const |
bool | isVertex () const |
geom::Coordinate | getCoordinate (const geom::Geometry *linearGeom) const |
std::auto_ptr< geom::LineSegment > | getSegment (const geom::Geometry *linearGeom) const |
bool | isValid (const geom::Geometry *linearGeom) const |
int | compareTo (const LinearLocation &other) const |
int | compareLocationValues (unsigned int componentIndex1, unsigned int segmentIndex1, double segmentFraction1) const |
bool | isOnSameSegment (const LinearLocation &loc) const |
Static Public Member Functions | |
static LinearLocation | getEndLocation (const geom::Geometry *linear) |
static geom::Coordinate | pointAlongSegmentByFraction (const geom::Coordinate &p0, const geom::Coordinate &p1, double frac) |
static int | compareLocationValues (unsigned int componentIndex0, unsigned int segmentIndex0, double segmentFraction0, unsigned int componentIndex1, unsigned int segmentIndex1, double segmentFraction1) |
Friends | |
std::ostream & | operator<< (std::ostream &out, const LinearLocation &obj) |
The referenced geometry is not maintained within this location, but must be provided for operations which require it. Various methods are provided to manipulate the location value and query the geometry it references.
geos::linearref::LinearLocation::LinearLocation | ( | unsigned int | segmentIndex = 0 , |
|
double | segmentFraction = 0.0 | |||
) |
Creates a location referring to the start of a linear geometry
static LinearLocation geos::linearref::LinearLocation::getEndLocation | ( | const geom::Geometry * | linear | ) | [static] |
Gets a location which refers to the end of a linear Geometry.
linear | the linear geometry |
LinearLocation
static geom::Coordinate geos::linearref::LinearLocation::pointAlongSegmentByFraction | ( | const geom::Coordinate & | p0, | |
const geom::Coordinate & | p1, | |||
double | frac | |||
) | [static] |
Computes the Coordinate of a point a given fraction along the line segment (p0, p1)
. If the fraction is greater than 1.0 the last point of the segment is returned. If the fraction is less than or equal to 0.0 the first point of the segment is returned. The Z ordinate is interpolated from the Z-ordinates of the given points, if they are specified.
p0 | the first point of the line segment | |
p1 | the last point of the line segment | |
frac | the length to the desired point |
Coordinate
of the desired point void geos::linearref::LinearLocation::clamp | ( | const geom::Geometry * | linear | ) |
void geos::linearref::LinearLocation::snapToVertex | ( | const geom::Geometry * | linearGeom, | |
double | minDistance | |||
) |
Snaps the value of this location to the nearest vertex on the given linear Geometry, if the vertex is closer than minDistance
.
linearGeom | a linear geometry | |
minDistance | the minimum allowable distance to a vertex |
double geos::linearref::LinearLocation::getSegmentLength | ( | const geom::Geometry * | linearGeom | ) | const |
Gets the length of the segment in the given Geometry containing this location.
linearGeom | a linear geometry |
void geos::linearref::LinearLocation::setToEnd | ( | const geom::Geometry * | linear | ) |
Sets the value of this location to refer the end of a linear geometry
linear | the linear geometry to set |
unsigned int geos::linearref::LinearLocation::getComponentIndex | ( | ) | const |
unsigned int geos::linearref::LinearLocation::getSegmentIndex | ( | ) | const |
double geos::linearref::LinearLocation::getSegmentFraction | ( | ) | const |
Gets the segment fraction for this location
bool geos::linearref::LinearLocation::isVertex | ( | ) | const |
Tests whether this location refers to a vertex
geom::Coordinate geos::linearref::LinearLocation::getCoordinate | ( | const geom::Geometry * | linearGeom | ) | const |
Gets the Coordinate along the given linear Geometry which is referenced by this location.
linearGeom | a linear geometry |
Coordinate
at the location std::auto_ptr<geom::LineSegment> geos::linearref::LinearLocation::getSegment | ( | const geom::Geometry * | linearGeom | ) | const |
Gets a LineSegment representing the segment of the given linear Geometry which contains this location.
linearGeom | a linear geometry |
LineSegment
containing the location bool geos::linearref::LinearLocation::isValid | ( | const geom::Geometry * | linearGeom | ) | const |
Tests whether this location refers to a valid location on the given linear Geometry.
linearGeom | a linear geometry |
int geos::linearref::LinearLocation::compareTo | ( | const LinearLocation & | other | ) | const |
Compares this object with the specified object for order.
o | the LineStringLocation with which this Coordinate is being compared |
LineStringLocation
is less than, equal to, or greater than the specified LineStringLocation
int geos::linearref::LinearLocation::compareLocationValues | ( | unsigned int | componentIndex1, | |
unsigned int | segmentIndex1, | |||
double | segmentFraction1 | |||
) | const |
Compares this object with the specified index values for order.
componentIndex1 | a component index | |
segmentIndex1 | a segment index | |
segmentFraction1 | a segment fraction |
LineStringLocation
is less than, equal to, or greater than the specified locationValues static int geos::linearref::LinearLocation::compareLocationValues | ( | unsigned int | componentIndex0, | |
unsigned int | segmentIndex0, | |||
double | segmentFraction0, | |||
unsigned int | componentIndex1, | |||
unsigned int | segmentIndex1, | |||
double | segmentFraction1 | |||
) | [static] |
Compares two sets of location values for order.
componentIndex0 | a component index | |
segmentIndex0 | a segment index | |
segmentFraction0 | a segment fraction | |
componentIndex1 | another component index | |
segmentIndex1 | another segment index | |
segmentFraction1 | another segment fraction |
bool geos::linearref::LinearLocation::isOnSameSegment | ( | const LinearLocation & | loc | ) | const |
Tests whether two locations are on the same segment in the parent Geometry.
loc | a location on the same geometry |