Class CoordinateArraySequence

Hierarchy: Object , CoordinateArraySequence
All Implemented Interfaces: Cloneable , CoordinateSequence, Serializable
public class CoordinateArraySequence
implements Serializable , CoordinateSequence
A CoordinateSequence backed by an array of Coordinates. This is the implementation that Geometrys use by default. Coordinates returned by #toArray and #getCoordinate are live -- modifications to them are actually changing the CoordinateSequence's underlying data. A dimension may be specified for the coordinates in the sequence, which may be 2 or 3. The actual coordinates will always have 3 ordinates, but the dimension is useful as metadata in some situations.

Other

  • version: 1.7
public CoordinateArraySequence(Coordinate[] coordinates)
Constructs a sequence based on the given array of Coordinates (the array is not copied). The coordinate dimension defaults to 3.
Parameters:
coordinates - coordinates the coordinate array that will be referenced.
public CoordinateArraySequence(Coordinate[] coordinates, int dimension)
Constructs a sequence based on the given array of Coordinates (the array is not copied).
Parameters:
coordinates - coordinates the coordinate array that will be referenced.
dimension - dimension the dimension of the coordinates
public CoordinateArraySequence(Coordinate[] coordinates, int dimension, int measures)
Constructs a sequence based on the given array of Coordinates (the array is not copied).

It is your responsibility to ensure the array contains Coordinates of the indicated dimension and measures (See CoordinateArrays.enforceConsistency(Coordinate[]) ).

Parameters:
coordinates - coordinates the coordinate array that will be referenced.
dimension - dimension the dimension of the coordinates
public CoordinateArraySequence(int size)
Constructs a sequence of a given size, populated with new Coordinates.
Parameters:
size - size the size of the sequence to create
public CoordinateArraySequence(int size, int dimension)
Constructs a sequence of a given size, populated with new Coordinates.
Parameters:
size - size the size of the sequence to create
dimension - dimension the dimension of the coordinates
public CoordinateArraySequence(int size, int dimension, int measures)
Constructs a sequence of a given size, populated with new Coordinates.
Parameters:
size - size the size of the sequence to create
dimension - dimension the dimension of the coordinates
public CoordinateArraySequence(CoordinateSequence coordSeq)
Creates a new sequence based on a deep copy of the given CoordinateSequence. The coordinate dimension is set to equal the dimension of the input.
Parameters:
coordSeq - coordSeq the coordinate sequence that will be copied.
public int getDimension()
See also:
org.locationtech.jts.geom.CoordinateSequence#getDimension()
public int getMeasures()
public Coordinate getCoordinate(int i)
Get the Coordinate with index i.
Parameters:
i - i the index of the coordinate
Returns:
the requested Coordinate instance
public Coordinate getCoordinateCopy(int i)
Get a copy of the Coordinate with index i.
Parameters:
i - i the index of the coordinate
Returns:
a copy of the requested Coordinate
public void getCoordinate(int index, Coordinate coord)
See also:
org.locationtech.jts.geom.CoordinateSequence#getX(int)
public double getX(int index)
See also:
org.locationtech.jts.geom.CoordinateSequence#getX(int)
public double getY(int index)
See also:
org.locationtech.jts.geom.CoordinateSequence#getY(int)
public double getZ(int index)
See also:
org.locationtech.jts.geom.CoordinateSequence#getZ(int)
public double getM(int index)
See also:
org.locationtech.jts.geom.CoordinateSequence#getM(int)
public double getOrdinate(int index, int ordinateIndex)
See also:
org.locationtech.jts.geom.CoordinateSequence#getOrdinate(int, int)
public Object clone()
Creates a deep copy of the Object
Returns:
The deep copy
public CoordinateArraySequence copy()
Creates a deep copy of the CoordinateArraySequence
Returns:
The deep copy
public int size()
Returns the size of the coordinate sequence
Returns:
the number of coordinates
public void setOrdinate(int index, int ordinateIndex, double value)
See also:
org.locationtech.jts.geom.CoordinateSequence#setOrdinate(int, int, double)
public Coordinate[] toCoordinateArray()
This method exposes the internal Array of Coordinate Objects
Returns:
the Coordinate[] array.
public Envelope expandEnvelope(Envelope env)
public String toString()
Returns the string Representation of the coordinate array
Returns:
The string