Class CoordinateXY
java.lang.Object
org.locationtech.jts.geom.Coordinate
org.locationtech.jts.geom.CoordinateXY
- All Implemented Interfaces:
Serializable, Cloneable, Comparable<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:
-
Nested Class Summary
Nested classes/interfaces inherited from class Coordinate
Coordinate.DimensionalComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intCoordinateXY does not support M measures.static final intStandard ordinate index value for Xstatic final intStandard ordinate index value for Ystatic final intCoordinateXY does not support Z values.Fields inherited from class Coordinate
NULL_ORDINATE, x, y, z -
Constructor Summary
ConstructorsConstructorDescriptionDefault 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
Modifier and TypeMethodDescriptioncopy()Creates a copy of this CoordinateXY.create()Create a new Coordinate of the same type as this Coordinate, but with no values.doublegetOrdinate(int ordinateIndex) Gets the ordinate value for the given index.doublegetZ()The z-ordinate is not supportedvoidsetCoordinate(Coordinate other) Sets thisCoordinates (x,y,z) values to that ofother.voidsetOrdinate(int ordinateIndex, double value) Sets the ordinate for the given index to a given value.voidsetZ(double z) The z-ordinate is not supportedtoString()Returns aStringof the form (x,y,z) .
-
Field Details
-
X
public static final int XStandard ordinate index value for X- See Also:
-
Y
public static final int YStandard ordinate index value for Y- See Also:
-
Z
public static final int ZCoordinateXY does not support Z values.- See Also:
-
M
public static final int MCoordinateXY does not support M measures.- See Also:
-
-
Constructor Details
-
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
Constructs a CoordinateXY instance with the x and y ordinates of the given Coordinate.- Parameters:
coord- the Coordinate providing the ordinates
-
CoordinateXY
Constructs a CoordinateXY instance with the x and y ordinates of the given CoordinateXY.- Parameters:
coord- the CoordinateXY providing the ordinates
-
-
Method Details
-
copy
Creates a copy of this CoordinateXY.- Overrides:
copyin classCoordinate- Returns:
- a copy of this CoordinateXY
-
create
Create a new Coordinate of the same type as this Coordinate, but with no values.- Overrides:
createin classCoordinate- Returns:
- a new Coordinate
-
getZ
public double getZ()The z-ordinate is not supported- Overrides:
getZin classCoordinate- Returns:
- the value of the Z ordinate, or NaN
-
setZ
public void setZ(double z) The z-ordinate is not supported- Overrides:
setZin classCoordinate- Parameters:
z- the value to set as Z
-
setCoordinate
Description copied from class:CoordinateSets thisCoordinates (x,y,z) values to that ofother.- Overrides:
setCoordinatein classCoordinate- Parameters:
other- theCoordinateto copy
-
getOrdinate
public double getOrdinate(int ordinateIndex) Description copied from class:CoordinateGets the ordinate value for the given index. The base implementation supports values for the index areCoordinate.X,Coordinate.Y, andCoordinate.Z.- Overrides:
getOrdinatein classCoordinate- Parameters:
ordinateIndex- the ordinate index- Returns:
- the value of the ordinate
-
setOrdinate
public void setOrdinate(int ordinateIndex, double value) Description copied from class:CoordinateSets 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:
setOrdinatein classCoordinate- Parameters:
ordinateIndex- the ordinate indexvalue- the value to set
-
toString
Description copied from class:CoordinateReturns aStringof the form (x,y,z) .- Overrides:
toStringin classCoordinate- Returns:
- a
Stringof the form (x,y,z)
-