org.geotools.geometry
Class AbstractDirectPosition

Object
  extended by AbstractDirectPosition
All Implemented Interfaces:
Position, DirectPosition
Direct Known Subclasses:
DirectPosition1D, GeneralDirectPosition

public abstract class AbstractDirectPosition
extends Object
implements DirectPosition

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)
Module:

Constructor Summary
protected AbstractDirectPosition()
          Constructs a direct position.
 
Method Summary
 boolean equals(Object object)
          Returns true if the specified object is also a direct position with equals coordinate and CRS.
 double[] getCoordinate()
          Returns a sequence of numbers that hold the coordinate of this position in its reference system.
 double[] getCoordinates()
          Deprecated. Renamed as getCoordinate() for consistency with ISO 19107.
 DirectPosition getDirectPosition()
          Returns always this, the direct position for this position.
 DirectPosition getPosition()
          Deprecated. Renamed as getDirectPosition().
 int hashCode()
          Returns a hash value for this coordinate.
 void setPosition(DirectPosition position)
          Sets this direct position to the given position.
 String toString()
          Returns a string representation of this coordinate.
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface DirectPosition
getCoordinateReferenceSystem, getDimension, getOrdinate, setOrdinate
 

Constructor Detail

AbstractDirectPosition

protected AbstractDirectPosition()
Constructs a direct position.

Method Detail

getPosition

@Deprecated
public DirectPosition getPosition()
Deprecated. Renamed as getDirectPosition().

Specified by:
getPosition in interface Position

getDirectPosition

public DirectPosition getDirectPosition()
Returns always this, the direct position for this position.

Specified by:
getDirectPosition in interface Position
Since:
2.5

setPosition

public void setPosition(DirectPosition position)
Sets this direct position to the given position. If the given position is null, 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:
getCoordinate in interface DirectPosition
Returns:
The coordinates.

getCoordinates

@Deprecated
public double[] getCoordinates()
Deprecated. Renamed as getCoordinate() for consistency with ISO 19107.

Specified by:
getCoordinates in interface DirectPosition
Returns:
A copy of the coordinates.

toString

public 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 of CoordinateFormat.

Overrides:
toString in class Object

hashCode

public int hashCode()
Returns a hash value for this coordinate.

Specified by:
hashCode in interface DirectPosition
Overrides:
hashCode in class Object
Returns:
A hash code value for this position.

equals

public boolean equals(Object object)
Returns true if the specified object is also a direct position with equals coordinate and CRS.

Specified by:
equals in interface DirectPosition
Overrides:
equals in class Object
Parameters:
object - The object to compare with this position.
Returns:
true if the given object is equals to this position.


Copyright © 1996-2009 Geotools. All Rights Reserved.