public abstract class PackedCoordinateSequence extends Object implements CoordinateSequence
CoordinateSequence implementation based on a packed arrays.
In this implementation, Coordinates 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.
| Modifier and Type | Class and Description |
|---|---|
static class |
PackedCoordinateSequence.Double
Packed coordinate sequence implementation based on doubles
|
static class |
PackedCoordinateSequence.Float
Packed coordinate sequence implementation based on floats
|
| Modifier and Type | Field and Description |
|---|---|
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
|
M, X, Y, Z| Constructor and Description |
|---|
PackedCoordinateSequence() |
| Modifier and Type | Method and Description |
|---|---|
abstract Object |
clone()
Returns a deep copy of this collection.
|
Coordinate |
getCoordinate(int i)
Returns (possibly a copy of) the i'th coordinate in this sequence.
|
void |
getCoordinate(int i,
Coordinate coord)
Copies the i'th coordinate in the sequence to the supplied
Coordinate. |
Coordinate |
getCoordinateCopy(int i)
Returns a copy of the i'th coordinate in this sequence.
|
protected abstract Coordinate |
getCoordinateInternal(int index)
Returns a Coordinate representation of the specified coordinate, by always
building a new Coordinate object
|
int |
getDimension()
Returns the dimension (number of ordinates in each coordinate)
for this sequence.
|
abstract double |
getOrdinate(int index,
int ordinateIndex)
Returns the ordinate of a coordinate in this sequence.
|
double |
getX(int index)
Returns ordinate X (0) of the specified coordinate.
|
double |
getY(int index)
Returns ordinate Y (1) of the specified coordinate.
|
abstract void |
setOrdinate(int index,
int ordinate,
double value)
Sets the ordinate of a coordinate in this sequence.
|
void |
setX(int index,
double value)
Sets the first ordinate of a coordinate in this sequence.
|
void |
setY(int index,
double value)
Sets the second ordinate of a coordinate in this sequence.
|
Coordinate[] |
toCoordinateArray()
Returns (possibly copies of) the Coordinates in this collection.
|
String |
toString() |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitexpandEnvelope, sizeprotected int dimension
protected SoftReference coordRef
public int getDimension()
CoordinateSequencegetDimension in interface CoordinateSequenceCoordinateSequence.getDimension()public Coordinate getCoordinate(int i)
CoordinateSequenceNote that in the future the semantics of this method may change to guarantee that the Coordinate returned is always a copy. Callers should not to assume that they can modify a CoordinateSequence by modifying the object returned by this method.
getCoordinate in interface CoordinateSequencei - the index of the coordinate to retrieveCoordinateSequence.getCoordinate(int)public Coordinate getCoordinateCopy(int i)
CoordinateSequencegetCoordinateCopy in interface CoordinateSequencei - the index of the coordinate to retrieveCoordinateSequence.getCoordinate(int)public void getCoordinate(int i,
Coordinate coord)
CoordinateSequenceCoordinate. Only the first two dimensions are copied.getCoordinate in interface CoordinateSequencei - the index of the coordinate to copycoord - a Coordinate to receive the valueCoordinateSequence.getCoordinate(int)public Coordinate[] toCoordinateArray()
CoordinateSequencetoCoordinateArray in interface CoordinateSequenceCoordinateSequence.toCoordinateArray()public double getX(int index)
CoordinateSequencegetX in interface CoordinateSequenceCoordinateSequence.getX(int)public double getY(int index)
CoordinateSequencegetY in interface CoordinateSequenceCoordinateSequence.getY(int)public abstract double getOrdinate(int index,
int ordinateIndex)
CoordinateSequencegetOrdinate in interface CoordinateSequenceindex - the coordinate index in the sequenceordinateIndex - the ordinate index in the coordinate (in range [0, dimension-1])CoordinateSequence.getOrdinate(int, int)public void setX(int index,
double value)
index - the coordinate indexvalue - the new ordinate valuepublic void setY(int index,
double value)
index - the coordinate indexvalue - the new ordinate valueprotected abstract Coordinate getCoordinateInternal(int index)
index - public abstract Object clone()
CoordinateSequenceclone in interface CoordinateSequenceclone in class ObjectObject.clone()public abstract void setOrdinate(int index,
int ordinate,
double value)
setOrdinate in interface CoordinateSequenceindex - the coordinate indexordinate - the ordinate index in the coordinate, 0 based, smaller than the
number of dimensionsvalue - the new ordinate valueCopyright © 2015. All rights reserved.