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.
|
Envelope |
expandEnvelope(Envelope env)
Returns an envelope which contains
env and all points
in this sequence. |
Coordinate |
getCoordinate(int index)
Gets coordinate values at the specified index.
|
void |
getCoordinate(int index,
Coordinate coord)
Copies the requested coordinate in the sequence to the supplied
Coordinate object. |
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() |
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 CoordinateSequence
public Coordinate getCoordinate(int index)
getCoordinate
in interface CoordinateSequence
index
- an index ≥0 and < size()
Coordinate
objectpublic Coordinate getCoordinateCopy(int index)
getCoordinate(int)
.getCoordinateCopy
in interface CoordinateSequence
index
- an index ≥0 and < size()
Coordinate
objectpublic void getCoordinate(int index, Coordinate coord)
Coordinate
object.getCoordinate
in interface CoordinateSequence
index
- 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 CoordinateSequence
index
- an index ≥0 and < size()
public double getY(int index)
getY
in interface CoordinateSequence
index
- an index ≥0 and < size()
public double getOrdinate(int index, int ordinateIndex)
getOrdinate
in interface CoordinateSequence
index
- 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 CoordinateSequence
public void setOrdinate(int index, int ordinateIndex, double value)
setOrdinate
in interface CoordinateSequence
index
- 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 Coordinate[] toCoordinateArray()
Coordinate
objects for the point values
in this sequence.toCoordinateArray
in interface CoordinateSequence
public Envelope expandEnvelope(Envelope env)
env
and all points
in this sequence. If env
contains all points it is
returned unchanged.expandEnvelope
in interface CoordinateSequence
env
- the test envelope; if null
a new Envelope
is createdenv
plus all points
in this sequenceCopyright © 2006–2018 GeoSolutions. All rights reserved.