LinearLocation class

Represents a location along a {@link LineString} or {@link MultiLineString}. 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.

Implemented types

Constructors

LinearLocation()
Creates a location referring to the start of a linear geometry
LinearLocation.fromComponentSegmentIndexFraction(int componentIndex, int segmentIndex, double segmentFraction)
LinearLocation.fromComponentSegmentIndexFractionNorm(int componentIndex, int segmentIndex, double segmentFraction, bool doNormalize)
LinearLocation.fromLocation(LinearLocation loc)
Creates a new location equal to a given one.
LinearLocation.fromSegmentIndexFraction(int segmentIndex, double segmentFraction)

Properties

componentIndex int
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
segmentFraction double
getter/setter pair
segmentIndex int
getter/setter pair

Methods

clamp(Geometry linear) → void
Ensures the indexes are valid for a given linear {@link Geometry}.
clone() Object
Copies this location
compareLocationValues(int componentIndex1, int segmentIndex1, double segmentFraction1) int
Compares this object with the specified index values for order.
compareTo(dynamic o) int
Compares this object with the specified object for order.
override
copy() LinearLocation
Copies this location
getComponentIndex() int
Gets the component index for this location.
getCoordinate(Geometry linearGeom) Coordinate
Gets the {@link Coordinate} along the given linear {@link Geometry} which is referenced by this location.
getSegment(Geometry linearGeom) LineSegment
Gets a {@link LineSegment} representing the segment of the given linear {@link Geometry} which contains this location.
getSegmentFraction() double
Gets the segment fraction for this location
getSegmentIndex() int
Gets the segment index for this location
getSegmentLength(Geometry linearGeom) double
Gets the length of the segment in the given Geometry containing this location.
isEndpoint(Geometry linearGeom) bool
Tests whether this location is an endpoint of the linear component it refers to.
isOnSameSegment(LinearLocation loc) bool
Tests whether two locations are on the same segment in the parent {@link Geometry}.
isValid(Geometry linearGeom) bool
Tests whether this location refers to a valid location on the given linear {@link Geometry}.
isVertex() bool
Tests whether this location refers to a vertex
normalize() → void
Ensures the individual values are locally valid. Does not ensure that the indexes are valid for a particular linear geometry.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setToEnd(Geometry linear) → void
Sets the value of this location to refer to the end of a linear geometry.
snapToVertex(Geometry linearGeom, double minDistance) → void
Snaps the value of this location to the nearest vertex on the given linear {@link Geometry}, if the vertex is closer than minDistance.
toLowest(Geometry linearGeom) LinearLocation
Converts a linear location to the lowest equivalent location index. The lowest index has the lowest possible component and segment indices.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

compareLocationValuesStatic(int componentIndex0, int segmentIndex0, double segmentFraction0, int componentIndex1, int segmentIndex1, double segmentFraction1) int
Compares two sets of location values for order.
getEndLocation(Geometry linear) LinearLocation
Gets a location which refers to the end of a linear {@link Geometry}. @param linear the linear geometry @return a new LinearLocation
numSegments(LineString line) int
Gets the count of the number of line segments in a {@link LineString}. This is one less than the number of coordinates.
pointAlongSegmentByFraction(Coordinate p0, Coordinate p1, double frac) Coordinate
Computes the {@link 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.