public final class CoordinateSequence2D extends Object implements org.locationtech.jts.geom.CoordinateSequence, Cloneable
CoordinateSequence for 2D points.| Constructor and Description |
|---|
CoordinateSequence2D(double... xy)
Creates a new
CoordinateSequence2D object from a sequence of
(x,y) pairs. |
CoordinateSequence2D(int n)
Creates a new
CoordinateSequence2D object with the given
size. |
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
Creates a deep copy of this sequence.
|
org.locationtech.jts.geom.CoordinateSequence |
copy() |
org.locationtech.jts.geom.Envelope |
expandEnvelope(org.locationtech.jts.geom.Envelope env)
Returns an envelope which contains
env and all points
in this sequence. |
org.locationtech.jts.geom.Coordinate |
getCoordinate(int index)
Gets coordinate values at the specified index.
|
void |
getCoordinate(int index,
org.locationtech.jts.geom.Coordinate coord)
Copies the requested coordinate in the sequence to the supplied
Coordinate object. |
org.locationtech.jts.geom.Coordinate |
getCoordinateCopy(int index)
Equivalent to
getCoordinate(int). |
int |
getDimension()
Gets the dimension of points stored by this
CoordinateSequence2D. |
double |
getOrdinate(int index,
int ordinateIndex)
Returns the ordinate of a coordinate in this sequence.
|
double |
getX(int index) |
double |
getY(int index) |
void |
setOrdinate(int index,
int ordinateIndex,
double value)
Sets the ordinate of a coordinate in this sequence.
|
void |
setX(int index,
double value)
Sets the X ordinate of the point at the given index.
|
void |
setXY(int index,
double x,
double y)
Sets the coordinate at the given index.
|
void |
setY(int index,
double value)
Sets the Y ordinate of the point at the given index.
|
int |
size() |
org.locationtech.jts.geom.Coordinate[] |
toCoordinateArray()
Returns an array of new
Coordinate objects for the point values
in this sequence. |
public CoordinateSequence2D(int n)
CoordinateSequence2D object with the given
size.n - capacity (number of coordinates)public CoordinateSequence2D(double... xy)
CoordinateSequence2D object from a sequence of
(x,y) pairs.
// Example: create an object with 3 coordinates specified
// as xy pairs
CoordinateSequence cs = new CoordinateSequence2D(1.1, 1.2, 2.1, 2.2, 3.1, 3.2);
xy - x and y values ordered as x0, y0, x1, y1...;
if null an empty object is createdIllegalArgumentException - if the number of values in xy is
greater than 0 but not evenpublic int getDimension()
CoordinateSequence2D.getDimension in interface org.locationtech.jts.geom.CoordinateSequencepublic org.locationtech.jts.geom.Coordinate getCoordinate(int index)
getCoordinate in interface org.locationtech.jts.geom.CoordinateSequenceindex - an index ≥0 and < size()Coordinate objectpublic org.locationtech.jts.geom.Coordinate getCoordinateCopy(int index)
getCoordinate(int).getCoordinateCopy in interface org.locationtech.jts.geom.CoordinateSequenceindex - an index ≥0 and < size()Coordinate objectpublic void getCoordinate(int index,
org.locationtech.jts.geom.Coordinate coord)
Coordinate object.getCoordinate in interface org.locationtech.jts.geom.CoordinateSequenceindex - an index ≥0 and < size()coord - the destination object; ff null a new
Coordinate will e created.public double getX(int index)
getX in interface org.locationtech.jts.geom.CoordinateSequenceindex - an index ≥0 and < size()public double getY(int index)
getY in interface org.locationtech.jts.geom.CoordinateSequenceindex - an index ≥0 and < size()public double getOrdinate(int index,
int ordinateIndex)
getOrdinate in interface org.locationtech.jts.geom.CoordinateSequenceindex - an index ≥0 and < size()ordinateIndex - 0 for the X ordinate or 1 for the Y ordinateIllegalArgumentException - if ordinateIndex is not
either 0 or 1public int size()
size in interface org.locationtech.jts.geom.CoordinateSequencepublic void setOrdinate(int index,
int ordinateIndex,
double value)
setOrdinate in interface org.locationtech.jts.geom.CoordinateSequenceindex - an index ≥0 and < size()ordinateIndex - 0 for the X ordinate or 1 for the Y ordinatevalue - the new ordinate valueIllegalArgumentException - if ordinateIndex is not
either 0 or 1public void setX(int index,
double value)
setOrdinate(int, int, double)(index, 0, value).index - an index ≥0 and < size()value - the new valuepublic void setY(int index,
double value)
setOrdinate(int, int, double)(index, 1, value).index - an index ≥0 and < size()value - the new valuepublic void setXY(int index,
double x,
double y)
index - an index ≥0 and < size()x - the new X ordinate valuey - the new Y ordinate valuepublic org.locationtech.jts.geom.Coordinate[] toCoordinateArray()
Coordinate objects for the point values
in this sequence.toCoordinateArray in interface org.locationtech.jts.geom.CoordinateSequencepublic org.locationtech.jts.geom.Envelope expandEnvelope(org.locationtech.jts.geom.Envelope env)
env and all points
in this sequence. If env contains all points it is
returned unchanged.expandEnvelope in interface org.locationtech.jts.geom.CoordinateSequenceenv - the test envelope; if null a new Envelope
is createdenv plus all points
in this sequencepublic Object clone()
public org.locationtech.jts.geom.CoordinateSequence copy()
copy in interface org.locationtech.jts.geom.CoordinateSequenceCopyright © 2009–2018. All rights reserved.