org.geotools.geometry
Class AbstractDirectPosition

java.lang.Object
  extended by org.geotools.geometry.AbstractDirectPosition
All Implemented Interfaces:
org.opengis.geometry.coordinate.Position, org.opengis.geometry.DirectPosition
Direct Known Subclasses:
DirectPosition1D, GeneralDirectPosition

public abstract class AbstractDirectPosition
extends java.lang.Object
implements org.opengis.geometry.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
Version:
$Id: AbstractDirectPosition.java 30939 2008-07-07 21:02:31Z desruisseaux $
Author:
Martin Desruisseaux (IRD)

Constructor Summary
protected AbstractDirectPosition()
          Constructs a direct position.
 
Method Summary
 boolean equals(java.lang.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.
 org.opengis.geometry.DirectPosition getDirectPosition()
          Returns always this, the direct position for this position.
 org.opengis.geometry.DirectPosition getPosition()
          Deprecated. Renamed as getDirectPosition().
 int hashCode()
          Returns a hash value for this coordinate.
 void setPosition(org.opengis.geometry.DirectPosition position)
          Sets this direct position to the given position.
 java.lang.String toString()
          Returns a string representation of this coordinate.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opengis.geometry.DirectPosition
getCoordinateReferenceSystem, getDimension, getOrdinate, setOrdinate
 

Constructor Detail

AbstractDirectPosition

protected AbstractDirectPosition()
Constructs a direct position.

Method Detail

getPosition

@Deprecated
public org.opengis.geometry.DirectPosition getPosition()
Deprecated. Renamed as getDirectPosition().

Specified by:
getPosition in interface org.opengis.geometry.coordinate.Position

getDirectPosition

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

Specified by:
getDirectPosition in interface org.opengis.geometry.coordinate.Position
Since:
2.5

setPosition

public void setPosition(org.opengis.geometry.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 org.opengis.geometry.DirectPosition
Returns:
The coordinates.

getCoordinates

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

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

toString

public java.lang.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 java.lang.Object

hashCode

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

Specified by:
hashCode in interface org.opengis.geometry.DirectPosition
Overrides:
hashCode in class java.lang.Object
Returns:
A hash code value for this position.

equals

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

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


Copyright © 1996-2010 Geotools. All Rights Reserved.