Package org.geotools.geometry
Class AbstractPosition
Object
AbstractPosition
- All Implemented Interfaces:
Position
- Direct Known Subclasses:
GeneralPosition,Position1D
Base class for direct position implementations. This base class provides default
implementations for
toString(), equals(java.lang.Object) and hashCode() methods.
This class do not holds any state. The decision to implement Serializable or
org.geotools.util.Cloneable interfaces is left to implementors.
- Since:
- 2.4
- Author:
- Martin Desruisseaux (IRD)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckCoordinateReferenceSystemDimension(CoordinateReferenceSystem crs, int expected) Convenience method for checking coordinate reference system validity.booleandouble[]Returns a sequence of numbers that hold the coordinate of this position in its reference system.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.toString()Returns a string representation of this coordinate.Methods inherited from interface Position
getCoordinateReferenceSystem, getDimension, getOrdinate, setOrdinate
-
Constructor Details
-
AbstractPosition
protected AbstractPosition()Constructs a direct position.
-
-
Method Details
-
getDirectPosition
Returns alwaysthis, the direct position for this position.- Specified by:
getDirectPositionin interfacePosition- Returns:
- The direct position (may be
this). - Since:
- 2.5
-
setPosition
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
-
getCoordinate
public double[] getCoordinate()Returns a sequence of numbers that hold the coordinate of this position in its reference system.- Specified by:
getCoordinatein interfacePosition- Returns:
- The coordinates.
-
checkCoordinateReferenceSystemDimension
public 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.
-
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. -
hashCode
public int hashCode()Returns a hash value for this coordinate. -
equals
-