com.vividsolutions.jts.geom.impl
Class PackedCoordinateSequence
java.lang.Object
com.vividsolutions.jts.geom.impl.PackedCoordinateSequence
- Cloneable, CoordinateSequence
public abstract class PackedCoordinateSequence
extends java.lang.Object
A
CoordinateSequence
implementation based on a packed arrays.
In this implementation,
Coordinate
s returned by #toArray and #get are copies
of the internal values.
To change the actual values, use the provided setters.
For efficiency, created Coordinate arrays
are cached using a soft reference.
The cache is cleared each time the coordinate sequence contents are
modified through a setter method.
protected SoftReference | coordRef - A soft reference to the Coordinate[] representation of this sequence.
|
protected int | dimension - The dimensions of the coordinates hold in the packed array
|
coordRef
protected SoftReference coordRef
A soft reference to the Coordinate[] representation of this sequence.
Makes repeated coordinate array accesses more efficient.
dimension
protected int dimension
The dimensions of the coordinates hold in the packed array
getCoordinateInternal
protected abstract Coordinate getCoordinateInternal(int index)
Returns a Coordinate representation of the specified coordinate, by always
building a new Coordinate object
setOrdinate
public abstract void setOrdinate(int index,
int ordinate,
double value)
Sets the ordinate of a coordinate in this sequence.
Warning: for performance reasons the ordinate index is not checked
- if it is over dimensions you may not get an exception but a meaningless value.
- setOrdinate in interface CoordinateSequence
index
- the coordinate indexordinate
- the ordinate index in the coordinate, 0 based, smaller than the
number of dimensionsvalue
- the new ordinate value
setX
public void setX(int index,
double value)
Sets the first ordinate of a coordinate in this sequence.
index
- the coordinate indexvalue
- the new ordinate value
setY
public void setY(int index,
double value)
Sets the second ordinate of a coordinate in this sequence.
index
- the coordinate indexvalue
- the new ordinate value