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
DirectPosition
s 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.CoordinateReferenceSystem
Returnsnull
since there is no CRS associated to this object.int
Returns the number of dimensions.org.opengis.geometry.DirectPosition
Returnsthis
since this object is already a direct position.double
getOrdinate
(int dimension) Return the coordinate value at the given dimension.boolean
hasNext()
Returnstrue
if there is more position to return.Iterator
<org.opengis.geometry.DirectPosition> iterator()
Starts a new iteration.org.opengis.geometry.DirectPosition
next()
Sets this object to the next position and return it.void
setOrdinate
(int dimension, double value) Not needed.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.opengis.geometry.DirectPosition
equals, hashCode
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods 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()Returnstrue
if 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()Returnsthis
since this object is already a direct position.- Specified by:
getDirectPosition
in interfaceorg.opengis.geometry.coordinate.Position
- Returns:
- always
this
.
-
getCoordinateReferenceSystem
public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()Returnsnull
since there is no CRS associated to this object.- Specified by:
getCoordinateReferenceSystem
in interfaceorg.opengis.geometry.DirectPosition
- Returns:
- always
null
.
-
getDimension
public int getDimension()Returns the number of dimensions.- Specified by:
getDimension
in interfaceorg.opengis.geometry.DirectPosition
-
getOrdinate
public double getOrdinate(int dimension) Return the coordinate value at the given dimension.- Specified by:
getOrdinate
in interfaceorg.opengis.geometry.DirectPosition
-
getCoordinate
public double[] getCoordinate()Not needed.- Specified by:
getCoordinate
in interfaceorg.opengis.geometry.DirectPosition
-
setOrdinate
public void setOrdinate(int dimension, double value) Not needed.- Specified by:
setOrdinate
in interfaceorg.opengis.geometry.DirectPosition
-