org.opengis.geometry
Interface DirectPosition

All Superinterfaces:
Cloneable, Position

@UML(identifier="DirectPosition",
     specification=ISO_19107)
public interface DirectPosition
extends Position, Cloneable

Holds the coordinates for a position within some coordinate reference system. Since DirectPositions, as data types, will often be included in larger objects (such as geometries) that have references to coordinate reference system, the getCoordinateReferenceSystem() method may returns null if this particular DirectPosition is included in a larger object with such a reference to a coordinate reference system. In this case, the cordinate reference system is implicitly assumed to take on the value of the containing object's coordinate reference system.

Since:
GeoAPI 1.0
Version:
ISO 19107

Method Summary
 Object clone()
          Deprecated. The Cloneable status of DirectPosition should be left to implementors.
 boolean equals(Object object)
          Compares this direct position with the specified object for equality.
 CoordinateReferenceSystem getCoordinateReferenceSystem()
          The coordinate reference system in which the coordinate is given.
 double[] getCoordinates()
          A copy of the ordinates presented as a double array.
 int getDimension()
          The length of coordinate sequence (the number of entries).
 double getOrdinate(int dimension)
          Returns the ordinate at the specified dimension.
 int hashCode()
          Returns a hash code value for this direct position.
 void setOrdinate(int dimension, double value)
          Sets the ordinate value along the specified dimension.
 
Methods inherited from interface Position
getPosition
 

Method Detail

getCoordinateReferenceSystem

@UML(identifier="coordinateReferenceSystem",
     obligation=MANDATORY,
     specification=ISO_19107)
CoordinateReferenceSystem getCoordinateReferenceSystem()
The coordinate reference system in which the coordinate is given. May be null if this particular DirectPosition is included in a larger object with such a reference to a coordinate reference system. In this case, the cordinate reference system is implicitly assumed to take on the value of the containing object's coordinate reference system.

Returns:
The coordinate reference system, or null.

getDimension

@UML(identifier="dimension",
     obligation=MANDATORY,
     specification=ISO_19107)
int getDimension()
The length of coordinate sequence (the number of entries). This is determined by the coordinate reference system.

Returns:
The dimensionality of this position.

getCoordinates

@UML(identifier="coordinates",
     obligation=MANDATORY,
     specification=ISO_19107)
double[] getCoordinates()
A copy of the ordinates presented as a double array. Please note that this is only a copy (the real values may be stored in another format).

To quickly access individual ordinates please use the following:

 final int dim = position.getDimension();
 for (int i=0; i<dim; i++) {
     position.getOrdinate(i); // no copy overhead
 }
 
If you want to manipulate ordinates please use:
 position.setOrdinate(i, value); // edit in place
 
There are a couple reasons you would like a copy: Precedence is given to data integrity over getOrdinates() performance. Performance concern can be avoided with usage of getOrdinate(int).

Returns:
A copy of the coordinates. Changes in the returned array will not be reflected back in this DirectPosition object.

getOrdinate

double getOrdinate(int dimension)
                   throws IndexOutOfBoundsException
Returns the ordinate at the specified dimension.

Parameters:
dimension - The dimension in the range 0 to dimension-1.
Returns:
The coordinate at the specified dimension.
Throws:
IndexOutOfBoundsException - if the specified dimension is out of bounds.

setOrdinate

void setOrdinate(int dimension,
                 double value)
                 throws IndexOutOfBoundsException
Sets the ordinate value along the specified dimension.

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.

equals

boolean equals(Object object)
Compares this direct position with the specified object for equality. Two direct positions are considered equal if the following conditions are meet:

Overrides:
equals in class Object
Since:
GeoAPI 2.1

hashCode

int hashCode()
Returns a hash code value for this direct position. This method should returns the same value as: Arrays.hashCode(getCoordinates()) + getCoordinateReferenceSystem().hashCode() where the right hand side of the addition is omitted if the coordinate reference system is null.

Overrides:
hashCode in class Object
Since:
GeoAPI 2.1

clone

Object clone()
Deprecated. The Cloneable status of DirectPosition should be left to implementors.

Makes an exact copy of this coordinate.

See Also:
Object.clone()


Copyright © 1994-2008 Open Geospatial Consortium. All Rights Reserved.