Package org.geotools.geometry
Class Position3D
- Object
- 
- Position3D
 
- 
- All Implemented Interfaces:
- Serializable,- Cloneable,- Position,- Cloneable
 
 public class Position3D extends Object implements Position, Serializable, Cloneable Holds the coordinates for a three-dimensional position within some coordinate reference system.- Author:
- Niels Charlier
- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description Position3D()Constructs a position initialized to (0,0,0) with anullcoordinate reference system.Position3D(double x, double y, double z)Constructs a 3D position from the specified ordinates.Position3D(Position point)Constructs a position initialized to the same values than the specified point.Position3D(CoordinateReferenceSystem crs)Constructs a position with the specified coordinate reference system.Position3D(CoordinateReferenceSystem crs, double x, double y, double z)Constructs a 2D position from the specified ordinates in the specified CRS.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description Position3Dclone()Returns a clone of this point.booleanequals(Object object)Compares this point with the specified object for equality.double[]getCoordinate()Returns a sequence of numbers that hold the coordinate of this position in its reference system.CoordinateReferenceSystemgetCoordinateReferenceSystem()Returns the coordinate reference system in which the coordinate is given.intgetDimension()The length of coordinate sequence (the number of entries).PositiongetDirectPosition()Returns alwaysthis, the direct position for this position.doublegetOrdinate(int dimension)Returns the ordinate at the specified dimension.inthashCode()Returns a hash value for this coordinate.voidsetCoordinateReferenceSystem(CoordinateReferenceSystem crs)Set the coordinate reference system in which the coordinate is given.voidsetLocation(Position position)Set this coordinate to the specified direct position.voidsetOrdinate(int dimension, double value)Sets the ordinate value along the specified dimension.StringtoString()Returns a string representation of this coordinate.
 
- 
- 
- 
Constructor Detail- 
Position3Dpublic Position3D() Constructs a position initialized to (0,0,0) with anullcoordinate reference system.
 - 
Position3Dpublic Position3D(CoordinateReferenceSystem crs) Constructs a position with the specified coordinate reference system.- Parameters:
- crs- The coordinate reference system, or- null.
 
 - 
Position3Dpublic Position3D(double x, double y, double z)Constructs a 3D position from the specified ordinates.- Parameters:
- x- The x value.
- y- The y value.
- z- The z value.
 
 - 
Position3Dpublic Position3D(CoordinateReferenceSystem crs, double x, double y, double z) Constructs a 2D position from the specified ordinates in the specified CRS.- Parameters:
- crs- The coordinate reference system, or- null.
- x- The x value.
- y- The y value.
- z- The z value.
 
 - 
Position3Dpublic Position3D(Position point) Constructs a position initialized to the same values than the specified point.- Parameters:
- point- The point to copy.
 
 
- 
 - 
Method Detail- 
getDirectPositionpublic Position getDirectPosition() Returns alwaysthis, the direct position for this position.- Specified by:
- getDirectPositionin interface- Position
- Returns:
- The direct position (may be this).
 
 - 
getCoordinateReferenceSystempublic final CoordinateReferenceSystem 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 interface- Position
- Returns:
- The coordinate reference system, or null.
 
 - 
setCoordinateReferenceSystempublic void setCoordinateReferenceSystem(CoordinateReferenceSystem crs) Set the coordinate reference system in which the coordinate is given.- Parameters:
- crs- The new coordinate reference system, or- null.
 
 - 
getDimensionpublic final int getDimension() The length of coordinate sequence (the number of entries). This is always 3 forDirectPosition3Dobjects.- Specified by:
- getDimensionin interface- Position
- Returns:
- The dimensionality of this position.
 
 - 
getCoordinatepublic double[] getCoordinate() Returns a sequence of numbers that hold the coordinate of this position in its reference system.- Specified by:
- getCoordinatein interface- Position
- Returns:
- The coordinates
 
 - 
getOrdinatepublic final double getOrdinate(int dimension) throws IndexOutOfBoundsExceptionReturns the ordinate at the specified dimension.- Specified by:
- getOrdinatein interface- Position
- Parameters:
- dimension- The dimension in the range 0 to 2 inclusive.
- Returns:
- The coordinate at the specified dimension.
- Throws:
- IndexOutOfBoundsException- if the specified dimension is out of bounds.
 
 - 
setOrdinatepublic final void setOrdinate(int dimension, double value) throws IndexOutOfBoundsExceptionSets the ordinate value along the specified dimension.- Specified by:
- setOrdinatein interface- Position
- Parameters:
- dimension- the dimension for the ordinate of interest.
- value- the ordinate value of interest.
- Throws:
- IndexOutOfBoundsException- if the specified dimension is out of bounds.
 
 - 
setLocationpublic void setLocation(Position position) throws MismatchedDimensionException 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.
 
 - 
toStringpublic String toString() Returns a string representation of this coordinate.
 - 
hashCodepublic int hashCode() Returns a hash value for this coordinate. This method implements thePosition.hashCode()contract.
 - 
equalspublic boolean equals(Object object) Compares this point with the specified object for equality. If the given object implements thePositioninterface, then the comparison is performed as specified in itsPosition.equals(java.lang.Object)contract.
 - 
clonepublic Position3D clone() Returns a clone of this point.- Specified by:
- clonein interface- Cloneable
- Overrides:
- clonein class- Object
- Returns:
- A clone of this position.
- See Also:
- Object.clone()
 
 
- 
 
-