Package org.apache.sis.math
Class CompoundDirectPositions
java.lang.Object
org.apache.sis.math.CompoundDirectPositions
- All Implemented Interfaces:
Iterable<org.opengis.geometry.DirectPosition>,Iterator<org.opengis.geometry.DirectPosition>,org.opengis.geometry.coordinate.Position,org.opengis.geometry.DirectPosition
final class CompoundDirectPositions
extends Object
implements org.opengis.geometry.DirectPosition, Iterable<org.opengis.geometry.DirectPosition>, Iterator<org.opengis.geometry.DirectPosition>
A sequence of
DirectPositions which is a view over arrays of coordinate values.
Each dimension is stored in a separated array. For example, this class can view three
arrays (x[], y[], and z[]) as a sequence of three-dimensional DirectPosition.
Limitation
This class is also its own iterator. All calls toiterator() return the same iterator,
and all calls to next() return the same DirectPosition instance. Consequently
this class is not suitable for normal use where many objects may iterate over the sequence in
same time.- Since:
- 0.5
- Version:
- 0.8
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCompoundDirectPositions(Vector... coordinates) Wraps the given array of coordinate values. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]Not needed.org.opengis.referencing.crs.CoordinateReferenceSystemReturnsnullsince there is no CRS associated to this object.intReturns the number of dimensions.org.opengis.geometry.DirectPositionReturnsthissince this object is already a direct position.doublegetOrdinate(int dimension) Return the coordinate value at the given dimension.booleanhasNext()Returnstrueif there is more position to return.Iterator<org.opengis.geometry.DirectPosition>iterator()Starts a new iteration.org.opengis.geometry.DirectPositionnext()Sets this object to the next position and return it.voidsetOrdinate(int dimension, double value) Not needed.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opengis.geometry.DirectPosition
equals, hashCodeMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Field Details
-
coordinates
The arrays of coordinate values, for example (x[], y[], z[]). -
last
private final int lastLength of all coordinate values minus one. -
index
private int indexIndex of the next element to be returned bynext().
-
-
Constructor Details
-
CompoundDirectPositions
CompoundDirectPositions(Vector... coordinates) Wraps the given array of coordinate values.
-
-
Method Details
-
iterator
Starts a new iteration. -
hasNext
public boolean hasNext()Returnstrueif there is more position to return. -
next
public org.opengis.geometry.DirectPosition next()Sets this object to the next position and return it. -
getDirectPosition
public org.opengis.geometry.DirectPosition getDirectPosition()Returnsthissince this object is already a direct position.- Specified by:
getDirectPositionin interfaceorg.opengis.geometry.coordinate.Position- Returns:
- always
this.
-
getCoordinateReferenceSystem
public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()Returnsnullsince there is no CRS associated to this object.- Specified by:
getCoordinateReferenceSystemin interfaceorg.opengis.geometry.DirectPosition- Returns:
- always
null.
-
getDimension
public int getDimension()Returns the number of dimensions.- Specified by:
getDimensionin interfaceorg.opengis.geometry.DirectPosition
-
getOrdinate
public double getOrdinate(int dimension) Return the coordinate value at the given dimension.- Specified by:
getOrdinatein interfaceorg.opengis.geometry.DirectPosition
-
getCoordinate
public double[] getCoordinate()Not needed.- Specified by:
getCoordinatein interfaceorg.opengis.geometry.DirectPosition
-
setOrdinate
public void setOrdinate(int dimension, double value) Not needed.- Specified by:
setOrdinatein interfaceorg.opengis.geometry.DirectPosition
-