|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vividsolutions.jts.geom.impl.PackedCoordinateSequence
A 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.
| Nested Class Summary | |
static class |
PackedCoordinateSequence.Double
Packed coordinate sequence implementation based on doubles |
static class |
PackedCoordinateSequence.Float
Packed coordinate sequence implementation based on floats |
| Field Summary | |
protected java.lang.ref.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 |
| Fields inherited from interface com.vividsolutions.jts.geom.CoordinateSequence |
M, X, Y, Z |
| Constructor Summary | |
PackedCoordinateSequence()
|
|
| Method Summary | |
abstract java.lang.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. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.vividsolutions.jts.geom.CoordinateSequence |
expandEnvelope, size |
| Field Detail |
protected int dimension
protected java.lang.ref.SoftReference coordRef
| Constructor Detail |
public PackedCoordinateSequence()
| Method Detail |
public int getDimension()
CoordinateSequence
getDimension 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 retrieve
CoordinateSequence.getCoordinate(int)public Coordinate getCoordinateCopy(int i)
CoordinateSequence
getCoordinateCopy in interface CoordinateSequencei - the index of the coordinate to retrieve
CoordinateSequence.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()
CoordinateSequence
toCoordinateArray in interface CoordinateSequenceCoordinateSequence.toCoordinateArray()public double getX(int index)
CoordinateSequence
getX in interface CoordinateSequenceindex -
CoordinateSequence.getX(int)public double getY(int index)
CoordinateSequence
getY in interface CoordinateSequenceindex -
CoordinateSequence.getY(int)
public abstract double getOrdinate(int index,
int ordinateIndex)
CoordinateSequence
getOrdinate 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 value
public void setY(int index,
double value)
index - the coordinate indexvalue - the new ordinate valueprotected abstract Coordinate getCoordinateInternal(int index)
index -
public abstract java.lang.Object clone()
CoordinateSequence
clone in interface CoordinateSequenceObject.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 value
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||