|
JTS Topology Suite version 1.12 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vividsolutions.jts.geom.impl.PackedCoordinateSequence
public abstract class PackedCoordinateSequence
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.
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 CoordinateSequence
CoordinateSequence.getDimension()
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 retrieve
CoordinateSequence.getCoordinate(int)
public Coordinate getCoordinateCopy(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 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
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 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 java.lang.Object clone()
CoordinateSequence
clone
in interface CoordinateSequence
clone
in class java.lang.Object
Object.clone()
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 value
|
JTS Topology Suite version 1.12 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |