PositionCoords class abstract

A position as an iterable collection of coordinate values.

Such position is a valid Position implementation and represents coordinate values also as a collection of Iterable<double> (containing 2, 3, or 4 items).

An instance of PositionCoords can be typed using extension methods:

  • asProjected: returned as a Projected position
  • asGeographic: returned as a Geographic position

See Position for description about supported coordinate values.

See also specialized extension getters on List<double> to create instances of PositionCoords:

Getter 2D/3D Coords Values x y z m
.xy 2D 2 double + +
.xyz 3D 3 double + + +
.xym 2D 3 double + + +
.xyzm 3D 4 double + + + +

For geographic coordinates same getters on List<double> are used:

Getter 2D/3D Coords Values lon (x) lat (y) elev (z) m
.xy 2D 2 double + +
.xyz 3D 3 double + + +
.xym 2D 3 double + + +
.xyzm 3D 4 double + + + +
Inheritance
Implemented types
Available extensions
Annotations

Constructors

PositionCoords(Iterable<double> source, {Coords type = Coords.xy})
A geospatial position with coordinate values of type from source.
const
PositionCoords.create({required double x, required double y, double? z, double? m})
A position as an iterable collection of x, y, and optional z and m values.
factory
PositionCoords.parse(String text, {Pattern? delimiter = ',', Coords? type})
Parses a position as an iterable collection parsed from text.
factory
PositionCoords.view(Iterable<double> source, {Coords type})
A position with coordinate values as a view backed by source.
factory

Properties

coordinateDimension int
The number of coordinate values (2, 3 or 4) on a position.
no setterinherited
first double
The first element.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
is3D bool
True for 3D positions (with z or elevation coordinate).
no setterinherited
isEmpty bool
Whether this collection has no elements.
no setterinherited
isMeasured bool
True if a measure value is available (or the m coordinate for a position).
no setterinherited
isNotEmpty bool
Whether this collection has at least one element.
no setterinherited
iterator Iterator<double>
Returns a new iterator that allows iterating coordinate values of this position.
no setter
last double
The last element.
no setterinherited
length int
The number of coordinate values (2, 3 or 4) for this position.
no setter
m double
The m ("measure") coordinate value. Returns zero if not available.
no setteroverride
optM double?
The m ("measure") coordinate optionally. Returns null if not available.
no setteroverride
optZ double?
The z coordinate value optionally. Returns null if not available.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
single double
Checks that this iterable has only one element, and returns that element.
no setterinherited
spatialDimension int
The number of spatial coordinate values (2 for 2D or 3 for 3D) on a position.
no setterinherited
type Coords
The coordinate type of coordinates values in this view.
no setterinherited
values Iterable<double>
Coordinate values of this position as an iterable of 2, 3 or 4 items.
no setterinherited
x double
The x coordinate value.
no setteroverride
y double
The y coordinate value.
no setteroverride
z double
The z coordinate value. Returns zero if not available.
no setteroverride

Methods

any(bool test(double element)) bool
Checks whether any element of this iterable satisfies test.
inherited
cast<R>() Iterable<R>
A view of this iterable as an iterable of R instances.
inherited
contains(Object? element) bool
Whether the collection contains an element equal to element.
inherited
copyByType(Coords type) Position
Copies this position as another position by the given coordinate type.
inherited
copyTo<R extends Position>(CreatePosition<R> factory) → R
Copies this position to a new position created by the factory.
inherited
copyWith({double? x, double? y, double? z, double? m}) Position
Copies the position with optional x, y, z and m overriding values.
inherited
elementAt(int index) double
A coordinate value by the coordinate axis index.
equals2D(Position other, {double toleranceHoriz = defaultEpsilon}) bool
True if this position equals with other by testing 2D coordinates only.
inherited
equals3D(Position other, {double toleranceHoriz = defaultEpsilon, double toleranceVert = defaultEpsilon}) bool
True if this position equals with other by testing 3D coordinates only.
inherited
every(bool test(double element)) bool
Checks whether every element of this iterable satisfies test.
inherited
expand<T>(Iterable<T> toElements(double element)) Iterable<T>
Expands each element of this Iterable into zero or more elements.
inherited
firstWhere(bool test(double element), {double orElse()?}) double
The first element that satisfies the given predicate test.
inherited
fold<T>(T initialValue, T combine(T previousValue, double element)) → T
Reduces a collection to a single value by iteratively combining each element of the collection with an existing value
inherited
followedBy(Iterable<double> other) Iterable<double>
Creates the lazy concatenation of this iterable and other.
inherited
forEach(void action(double element)) → void
Invokes action on each element of this iterable in iteration order.
inherited
join([String separator = '']) String
Converts each element to a String and concatenates the strings.
inherited
lastWhere(bool test(double element), {double orElse()?}) double
The last element that satisfies the given predicate test.
inherited
map<T>(T toElement(double e)) Iterable<T>
The current elements of this iterable modified by toElement.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
packed() Position
Returns a position instance whose coordinate storage contains only coordinate values represented by this position.
inherited
project(Projection projection) Position
Projects this position to another position using projection.
inherited
reduce(double combine(double value, double element)) double
Reduces a collection to a single value by iteratively combining elements of the collection using the provided function.
inherited
singleWhere(bool test(double element), {double orElse()?}) double
The single element that satisfies test.
inherited
skip(int count) Iterable<double>
Creates an Iterable that provides all but the first count elements.
inherited
skipWhile(bool test(double value)) Iterable<double>
Creates an Iterable that skips leading elements while test is satisfied.
inherited
take(int count) Iterable<double>
Creates a lazy iterable of the count first elements of this iterable.
inherited
takeWhile(bool test(double value)) Iterable<double>
Creates a lazy iterable of the leading elements satisfying test.
inherited
toList({bool growable = true}) List<double>
Creates a List containing the elements of this Iterable.
inherited
toSet() Set<double>
Creates a Set containing the same elements as this iterable.
inherited
toString() String
A string representation of this object.
inherited
toText({String delimiter = ',', int? decimals, bool swapXY = false}) String
A string representation of coordinate values separated by delimiter.
inherited
transform(TransformPosition transform) Position
Returns a position transformed from this position using transform.
inherited
valuesByType(Coords type) Iterable<double>
Coordinate values of this position as an iterable of 2, 3 or 4 items according to the given type.
inherited
where(bool test(double element)) Iterable<double>
Creates a new lazy Iterable with all elements that satisfy the predicate test.
inherited
whereType<T>() Iterable<T>
Creates a new lazy Iterable with all elements that have type T.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](int index) double
A coordinate value by the coordinate axis index.
override