public abstract class PackedCoordinateSequence extends Object implements com.vividsolutions.jts.geom.CoordinateSequence, Serializable, Cloneable
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.
2009-11-25 - bdferris - This class copied from JTS (LGPL-licensed) to add Serializable
to
the class so that we can serialize it with our graphs
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<com.vividsolutions.jts.geom.Coordinate[]> |
coordRef
A soft reference to the Coordinate[] representation of this sequence.
|
protected int |
dimension
The dimensions of the coordinates hold in the packed array
|
Constructor and Description |
---|
PackedCoordinateSequence() |
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
com.vividsolutions.jts.geom.Coordinate |
getCoordinate(int i) |
void |
getCoordinate(int i,
com.vividsolutions.jts.geom.Coordinate coord) |
com.vividsolutions.jts.geom.Coordinate |
getCoordinateCopy(int i) |
protected abstract com.vividsolutions.jts.geom.Coordinate |
getCoordinateInternal(int index)
Returns a Coordinate representation of the specified coordinate, by always building a new
Coordinate object
|
int |
getDimension() |
abstract double |
getOrdinate(int index,
int ordinateIndex) |
double |
getX(int index) |
double |
getY(int index) |
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.
|
com.vividsolutions.jts.geom.Coordinate[] |
toCoordinateArray() |
String |
toString() |
protected int dimension
protected transient SoftReference<com.vividsolutions.jts.geom.Coordinate[]> coordRef
public int getDimension()
getDimension
in interface com.vividsolutions.jts.geom.CoordinateSequence
CoordinateSequence.getDimension()
public com.vividsolutions.jts.geom.Coordinate getCoordinate(int i)
getCoordinate
in interface com.vividsolutions.jts.geom.CoordinateSequence
CoordinateSequence.getCoordinate(int)
public com.vividsolutions.jts.geom.Coordinate getCoordinateCopy(int i)
getCoordinateCopy
in interface com.vividsolutions.jts.geom.CoordinateSequence
CoordinateSequence.getCoordinate(int)
public void getCoordinate(int i, com.vividsolutions.jts.geom.Coordinate coord)
getCoordinate
in interface com.vividsolutions.jts.geom.CoordinateSequence
CoordinateSequence.getCoordinate(int)
public com.vividsolutions.jts.geom.Coordinate[] toCoordinateArray()
toCoordinateArray
in interface com.vividsolutions.jts.geom.CoordinateSequence
CoordinateSequence.toCoordinateArray()
public double getX(int index)
getX
in interface com.vividsolutions.jts.geom.CoordinateSequence
CoordinateSequence.getX(int)
public double getY(int index)
getY
in interface com.vividsolutions.jts.geom.CoordinateSequence
CoordinateSequence.getY(int)
public abstract double getOrdinate(int index, int ordinateIndex)
getOrdinate
in interface com.vividsolutions.jts.geom.CoordinateSequence
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 com.vividsolutions.jts.geom.Coordinate getCoordinateInternal(int index)
index
- public Object clone()
clone
in interface com.vividsolutions.jts.geom.CoordinateSequence
clone
in class Object
Object.clone()
public abstract void setOrdinate(int index, int ordinate, double value)
setOrdinate
in interface com.vividsolutions.jts.geom.CoordinateSequence
index
- the coordinate indexordinate
- the ordinate index in the coordinate, 0 based, smaller than the number of
dimensionsvalue
- the new ordinate valueCopyright © 2018. All rights reserved.