Package org.geotools.geometry
Class AbstractPosition
- Object
- 
- AbstractPosition
 
- 
- All Implemented Interfaces:
- Position
 - Direct Known Subclasses:
- GeneralPosition,- Position1D
 
 public abstract class AbstractPosition extends Object implements Position Base class for direct position implementations. This base class provides default implementations fortoString(),equals(java.lang.Object)andhashCode()methods.This class do not holds any state. The decision to implement Serializableororg.geotools.util.Cloneableinterfaces is left to implementors.- Since:
- 2.4
- Author:
- Martin Desruisseaux (IRD)
 
- 
- 
Constructor SummaryConstructors Modifier Constructor Description protectedAbstractPosition()Constructs a direct position.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidcheckCoordinateReferenceSystemDimension(CoordinateReferenceSystem crs, int expected)Convenience method for checking coordinate reference system validity.booleanequals(Object object)double[]getCoordinate()Returns a sequence of numbers that hold the coordinate of this position in its reference system.PositiongetDirectPosition()Returns alwaysthis, the direct position for this position.inthashCode()Returns a hash value for this coordinate.voidsetPosition(Position position)Sets this direct position to the given position.StringtoString()Returns a string representation of this coordinate.- 
Methods inherited from interface PositiongetCoordinateReferenceSystem, getDimension, getOrdinate, setOrdinate
 
- 
 
- 
- 
- 
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).
- Since:
- 2.5
 
 - 
setPositionpublic void setPosition(Position position) Sets this direct position to the given position. If the given position isnull, then all ordinate values are set to NaN.- Parameters:
- position- The new position.
- Since:
- 2.5
 
 - 
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.
 
 - 
checkCoordinateReferenceSystemDimensionpublic static void checkCoordinateReferenceSystemDimension(CoordinateReferenceSystem crs, int expected) throws MismatchedDimensionException Convenience method for checking coordinate reference system validity.- Parameters:
- crs- The coordinate reference system to check.
- expected- the dimension expected.
- Throws:
- MismatchedDimensionException- if the CRS dimension is not valid.
 
 - 
toStringpublic String toString() Returns a string representation of this coordinate. The default implementation is okay for occasional formatting (for example for debugging purpose). But if there is a lot of positions to format, users will get more control by using their own instance ofCoordinateFormat.
 - 
hashCodepublic int hashCode() Returns a hash value for this coordinate.
 
- 
 
-