Package org.geotools.geometry
Class Position1D
Object
AbstractPosition
Position1D
- All Implemented Interfaces:
Serializable,Cloneable,Position,Cloneable
Holds the coordinates for a one-dimensional position within some coordinate reference system.
- Since:
- 2.0
- Author:
- Martin Desruisseaux (IRD)
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a position initialized to (0) with anullcoordinate reference system.Position1D(double ordinate) Constructs a 1D position from the specified ordinate.Position1D(Position point) Constructs a position initialized to the same values than the specified point.Constructs a position with the specified coordinate reference system. -
Method Summary
Modifier and TypeMethodDescriptionclone()Returns a copy of this position.booleandouble[]Returns a sequence of numbers that hold the coordinate of this position in its reference system.Returns the coordinate reference system in which the coordinate is given.final intThe length of coordinate sequence (the number of entries).final doublegetOrdinate(int dimension) Returns the ordinate at the specified dimension.inthashCode()Returns a hash value for this coordinate.voidSet the coordinate reference system in which the coordinate is given.voidsetLocation(Position position) Set this coordinate to the specified direct position.final voidsetOrdinate(int dimension, double value) Sets the ordinate value along the specified dimension.Methods inherited from class AbstractPosition
checkCoordinateReferenceSystemDimension, getDirectPosition, setPosition, toString
-
Field Details
-
ordinate
public double ordinateThe ordinate value.
-
-
Constructor Details
-
Position1D
public Position1D()Constructs a position initialized to (0) with anullcoordinate reference system. -
Position1D
Constructs a position with the specified coordinate reference system.- Parameters:
crs- The coordinate reference system.
-
Position1D
public Position1D(double ordinate) Constructs a 1D position from the specified ordinate.- Parameters:
ordinate- The ordinate value.
-
Position1D
Constructs a position initialized to the same values than the specified point.- Parameters:
point- The position to copy.
-
-
Method Details
-
getCoordinateReferenceSystem
Returns the coordinate reference system in which the coordinate is given. May benullif this particularDirectPositionis included in a larger object with such a reference to a coordinate reference system.- Specified by:
getCoordinateReferenceSystemin interfacePosition- Returns:
- The coordinate reference system, or
null.
-
setCoordinateReferenceSystem
Set the coordinate reference system in which the coordinate is given.- Parameters:
crs- The new coordinate reference system, ornull.
-
getDimension
public final int getDimension()The length of coordinate sequence (the number of entries). This is always 1 forDirectPosition1Dobjects.- Specified by:
getDimensionin interfacePosition- Returns:
- The dimensionality of this position.
-
getCoordinate
public double[] getCoordinate()Returns a sequence of numbers that hold the coordinate of this position in its reference system.- Specified by:
getCoordinatein interfacePosition- Overrides:
getCoordinatein classAbstractPosition- Returns:
- The coordinates.
-
getOrdinate
Returns the ordinate at the specified dimension.- Specified by:
getOrdinatein interfacePosition- Parameters:
dimension- The dimension, which must be 0.- Returns:
- The ordinate.
- Throws:
IndexOutOfBoundsException- if the specified dimension is out of bounds.
-
setOrdinate
Sets the ordinate value along the specified dimension.- Specified by:
setOrdinatein interfacePosition- Parameters:
dimension- The dimension, which must be 0.value- the ordinate value.- Throws:
IndexOutOfBoundsException- if the specified dimension is out of bounds.
-
setLocation
Set this coordinate to the specified direct position. If the specified position contains a coordinate reference system, then the CRS for this position will be set to the CRS of the specified position.- Parameters:
position- The new position for this point.- Throws:
MismatchedDimensionException- if this point doesn't have the expected dimension.
-
hashCode
public int hashCode()Returns a hash value for this coordinate.- Specified by:
hashCodein interfacePosition- Overrides:
hashCodein classAbstractPosition- Returns:
- A hash code value for this position.
-
equals
Description copied from class:AbstractPosition- Specified by:
equalsin interfacePosition- Overrides:
equalsin classAbstractPosition- Parameters:
o- The object to compare with this position.- Returns:
trueif the given object is equals to this position.
-
clone
Returns a copy of this position.
-