public abstract class PackedCoordinateSequence extends Object implements CoordinateSequence, Serializable
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.
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
|
M, X, Y, Z
Modifier and Type | Method and Description |
---|---|
abstract Object |
clone()
Deprecated.
|
abstract PackedCoordinateSequence |
copy()
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.
|
int |
getDimension()
Returns the dimension (number of ordinates in each coordinate) for this sequence.
|
int |
getMeasures()
Returns the number of measures included in
CoordinateSequence.getDimension() for 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, getClass, hashCode, notify, notifyAll, wait, wait, wait
createCoordinate, expandEnvelope, getM, getZ, hasM, hasZ, size
public int getDimension()
CoordinateSequence
This total includes any measures, indicated by non-zero CoordinateSequence.getMeasures()
.
getDimension
in interface CoordinateSequence
CoordinateSequence.getDimension()
public int getMeasures()
CoordinateSequence
CoordinateSequence.getDimension()
for each coordinate for this
sequence.
For a measured coordinate sequence a non-zero value is returned.
getMeasures
in interface CoordinateSequence
CoordinateSequence.getMeasures()
public Coordinate getCoordinate(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 retrieveCoordinateSequence.getCoordinate(int)
public Coordinate getCoordinateCopy(int i)
CoordinateSequence
getCoordinateCopy
in interface CoordinateSequence
i
- the index of the coordinate to retrieveCoordinateSequence.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 copycoord
- a Coordinate
to receive the valueCoordinateSequence.getCoordinate(int)
public Coordinate[] toCoordinateArray()
CoordinateSequence
toCoordinateArray
in interface CoordinateSequence
CoordinateSequence.toCoordinateArray()
public double getX(int index)
CoordinateSequence
getX
in interface CoordinateSequence
index
- the coordinate index in the sequenceCoordinateSequence.getX(int)
public double getY(int index)
CoordinateSequence
getY
in interface CoordinateSequence
index
- the coordinate index in the sequenceCoordinateSequence.getY(int)
public abstract double getOrdinate(int index, int ordinateIndex)
CoordinateSequence
Ordinates indices greater than 1 have user-defined semantics
(for instance, they may contain other dimensions or measure
values as described by CoordinateSequence.getDimension()
and CoordinateSequence.getMeasures()
).
getOrdinate
in interface CoordinateSequence
index
- 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 valuepublic abstract Object clone()
CoordinateSequence
clone
in interface CoordinateSequence
clone
in class Object
Object.clone()
,
CoordinateSequence.clone()
public abstract PackedCoordinateSequence copy()
CoordinateSequence
copy
in interface CoordinateSequence
public abstract void setOrdinate(int index, int ordinate, double 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 valueCopyright © 2024. All rights reserved.