public abstract class PackedCoordinateSequence extends Objectimplements 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
Packed coordinate sequence implementation based on doubles
|
static class |
PackedCoordinateSequence
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
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.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexpandEnvelope, sizeprotected int dimension
protected SoftReferencecoordRef
public int getDimension()
CoordinateSequence
getDimension in interface
CoordinateSequence
CoordinateSequence.getDimension()
public CoordinategetCoordinate(int i)
CoordinateSequence
Note 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
CoordinateSequence
i - the index of the coordinate to retrieve
CoordinateSequence.getCoordinate(int)
public CoordinategetCoordinateCopy(int i)
CoordinateSequence
getCoordinateCopy in interface
CoordinateSequence
i - the index of the coordinate to retrieve
CoordinateSequence.getCoordinate(int)
public void getCoordinate(int i,
Coordinate coord)
CoordinateSequence
Coordinate. Only the first two dimensions are copied.
getCoordinate in interface
CoordinateSequence
i - the index of the coordinate to copy
coord - a
Coordinate to receive the value
CoordinateSequence.getCoordinate(int)
public Coordinate[] toCoordinateArray()
CoordinateSequence
toCoordinateArray in interface
CoordinateSequence
CoordinateSequence.toCoordinateArray()
public double getX(int index)
CoordinateSequence
getX in interface
CoordinateSequence
CoordinateSequence.getX(int)
public double getY(int index)
CoordinateSequence
getY in interface
CoordinateSequence
CoordinateSequence.getY(int)
public abstract double getOrdinate(int index,
int ordinateIndex)
CoordinateSequence
getOrdinate in interface
CoordinateSequence
index - the coordinate index in the sequence
ordinateIndex - 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 index
value - the new ordinate value
public void setY(int index,
double value)
index - the coordinate index
value - the new ordinate value
protected abstract CoordinategetCoordinateInternal(int index)
index -
public abstract Objectclone()
CoordinateSequence
clone in interface
CoordinateSequence
clone in class
Object
Object.clone()
public abstract void setOrdinate(int index,
int ordinate,
double value)
setOrdinate in interface
CoordinateSequence
index - the coordinate index
ordinate - the ordinate index in the coordinate, 0 based, smaller than the number of dimensions
value - the new ordinate value