Package org.locationtech.jts.geom
Class CoordinateXY
- java.lang.Object
-
- org.locationtech.jts.geom.Coordinate
-
- org.locationtech.jts.geom.CoordinateXY
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<Coordinate>
public class CoordinateXY extends Coordinate
Coordinate subclass supporting XY ordinates.This data object is suitable for use with coordinate sequences with dimension = 2.
The
Coordinate.z
field is visible, but intended to be ignored.- Since:
- 1.16
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.locationtech.jts.geom.Coordinate
Coordinate.DimensionalComparator
-
-
Field Summary
Fields Modifier and Type Field Description static int
M
CoordinateXY does not support M measures.static int
X
Standard ordinate index value for Xstatic int
Y
Standard ordinate index value for Ystatic int
Z
CoordinateXY does not support Z values.-
Fields inherited from class org.locationtech.jts.geom.Coordinate
NULL_ORDINATE, x, y, z
-
-
Constructor Summary
Constructors Constructor Description CoordinateXY()
Default constructorCoordinateXY(double x, double y)
Constructs a CoordinateXY instance with the given ordinates.CoordinateXY(Coordinate coord)
Constructs a CoordinateXY instance with the x and y ordinates of the given Coordinate.CoordinateXY(CoordinateXY coord)
Constructs a CoordinateXY instance with the x and y ordinates of the given CoordinateXY.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CoordinateXY
copy()
Creates a copy of this CoordinateXY.double
getOrdinate(int ordinateIndex)
Gets the ordinate value for the given index.double
getZ()
The z-ordinate is not supportedvoid
setCoordinate(Coordinate other)
Sets thisCoordinate
s (x,y,z) values to that ofother
.void
setOrdinate(int ordinateIndex, double value)
Sets the ordinate for the given index to a given value.void
setZ(double z)
The z-ordinate is not supportedjava.lang.String
toString()
Returns aString
of the form (x,y,z) .
-
-
-
Field Detail
-
X
public static final int X
Standard ordinate index value for X- See Also:
- Constant Field Values
-
Y
public static final int Y
Standard ordinate index value for Y- See Also:
- Constant Field Values
-
Z
public static final int Z
CoordinateXY does not support Z values.- See Also:
- Constant Field Values
-
M
public static final int M
CoordinateXY does not support M measures.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CoordinateXY
public CoordinateXY()
Default constructor
-
CoordinateXY
public CoordinateXY(double x, double y)
Constructs a CoordinateXY instance with the given ordinates.- Parameters:
x
- the X ordinatey
- the Y ordinate
-
CoordinateXY
public CoordinateXY(Coordinate coord)
Constructs a CoordinateXY instance with the x and y ordinates of the given Coordinate.- Parameters:
coord
- the Coordinate providing the ordinates
-
CoordinateXY
public CoordinateXY(CoordinateXY coord)
Constructs a CoordinateXY instance with the x and y ordinates of the given CoordinateXY.- Parameters:
coord
- the CoordinateXY providing the ordinates
-
-
Method Detail
-
copy
public CoordinateXY copy()
Creates a copy of this CoordinateXY.- Overrides:
copy
in classCoordinate
- Returns:
- a copy of this CoordinateXY
-
getZ
public double getZ()
The z-ordinate is not supported- Overrides:
getZ
in classCoordinate
- Returns:
- the value of the Z ordinate, or NaN
-
setZ
public void setZ(double z)
The z-ordinate is not supported- Overrides:
setZ
in classCoordinate
- Parameters:
z
- the value to set as Z
-
setCoordinate
public void setCoordinate(Coordinate other)
Description copied from class:Coordinate
Sets thisCoordinate
s (x,y,z) values to that ofother
.- Overrides:
setCoordinate
in classCoordinate
- Parameters:
other
- theCoordinate
to copy
-
getOrdinate
public double getOrdinate(int ordinateIndex)
Description copied from class:Coordinate
Gets the ordinate value for the given index. The base implementation supports values for the index areCoordinate.X
,Coordinate.Y
, andCoordinate.Z
.- Overrides:
getOrdinate
in classCoordinate
- Parameters:
ordinateIndex
- the ordinate index- Returns:
- the value of the ordinate
-
setOrdinate
public void setOrdinate(int ordinateIndex, double value)
Description copied from class:Coordinate
Sets the ordinate for the given index to a given value. The base implementation supported values for the index areCoordinate.X
,Coordinate.Y
, andCoordinate.Z
.- Overrides:
setOrdinate
in classCoordinate
- Parameters:
ordinateIndex
- the ordinate indexvalue
- the value to set
-
toString
public java.lang.String toString()
Description copied from class:Coordinate
Returns aString
of the form (x,y,z) .- Overrides:
toString
in classCoordinate
- Returns:
- a
String
of the form (x,y,z)
-
-