com.vividsolutions.jts.geom.impl

Class CoordinateArraySequence

Implemented Interfaces:
Cloneable, CoordinateSequence, Serializable

public class CoordinateArraySequence
extends java.lang.Object
implements CoordinateSequence, Serializable

The CoordinateSequence implementation that Geometrys use by default. In this implementation, Coordinates returned by #toArray and #getCoordinate are live -- modifications to them are actually changing the CoordinateSequence's underlying data.
Version:
1.6

Fields inherited from interface com.vividsolutions.jts.geom.CoordinateSequence

M, X, Y, Z

Constructor Summary

CoordinateArraySequence(CoordinateSequence coordSeq)
Constructs a sequence based on the given array (the array is not copied).
CoordinateArraySequence(Coordinate[] coordinates)
Constructs a sequence based on the given array (the array is not copied).
CoordinateArraySequence(int size)
Constructs a sequence of a given size, populated with new Coordinates.

Method Summary

Object
clone()
Creates a deep copy of the Object
Envelope
expandEnvelope(Envelope env)
Expands the given Envelope to include the coordinates in the sequence.
Coordinate
getCoordinate(int i)
Get the Coordinate with index i.
void
getCoordinate(int index, Coordinate coord)
Coordinate
getCoordinateCopy(int i)
Get a copy of the Coordinate with index i.
double
getOrdinate(int index, int ordinateIndex)
double
getX(int index)
double
getY(int index)
void
setOrdinate(int index, int ordinateIndex, double value)
int
size()
Returns the size of the coordinate sequence
Coordinate[]
toCoordinateArray()
This method exposes the internal Array of Coordinate Objects
String
toString()
Returns the string Representation of the coordinate array

Constructor Details

CoordinateArraySequence

public CoordinateArraySequence(CoordinateSequence coordSeq)
Constructs a sequence based on the given array (the array is not copied).
Parameters:

CoordinateArraySequence

public CoordinateArraySequence(Coordinate[] coordinates)
Constructs a sequence based on the given array (the array is not copied).
Parameters:
coordinates - the coordinate array that will be referenced.

CoordinateArraySequence

public CoordinateArraySequence(int size)
Parameters:
size - the size of the sequence to create

Method Details

clone

public Object clone()
Creates a deep copy of the Object
Specified by:
clone in interface CoordinateSequence
Returns:
The deep copy

expandEnvelope

public Envelope expandEnvelope(Envelope env)
Expands the given Envelope to include the coordinates in the sequence. Allows implementing classes to optimize access to coordinate values.
Specified by:
expandEnvelope in interface CoordinateSequence
Parameters:
env - the envelope to expand
Returns:
a ref to the expanded envelope

getCoordinate

public Coordinate getCoordinate(int i)
Get the Coordinate with index i.
Specified by:
getCoordinate in interface CoordinateSequence
Parameters:
i - the index of the coordinate
Returns:
the requested Coordinate instance

getCoordinate

public void getCoordinate(int index,
                          Coordinate coord)
Specified by:
getCoordinate in interface CoordinateSequence

getCoordinateCopy

public Coordinate getCoordinateCopy(int i)
Get a copy of the Coordinate with index i.
Specified by:
getCoordinateCopy in interface CoordinateSequence
Parameters:
i - the index of the coordinate
Returns:
a copy of the requested Coordinate

getOrdinate

public double getOrdinate(int index,
                          int ordinateIndex)
Specified by:
getOrdinate in interface CoordinateSequence

getX

public double getX(int index)
Specified by:
getX in interface CoordinateSequence

getY

public double getY(int index)
Specified by:
getY in interface CoordinateSequence

setOrdinate

public void setOrdinate(int index,
                        int ordinateIndex,
                        double value)
Specified by:
setOrdinate in interface CoordinateSequence

size

public int size()
Returns the size of the coordinate sequence
Specified by:
size in interface CoordinateSequence
Returns:
the number of coordinates

toCoordinateArray

public Coordinate[] toCoordinateArray()
This method exposes the internal Array of Coordinate Objects
Specified by:
toCoordinateArray in interface CoordinateSequence
Returns:
the Coordinate[] array.

toString

public String toString()
Returns the string Representation of the coordinate array
Returns:
The string