|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@UML(identifier="DirectPosition", specification=ISO_19107) public interface DirectPosition
Holds the coordinates for a position within some coordinate reference system. Since
DirectPosition
s, 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.
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 |
---|
@UML(identifier="coordinateReferenceSystem", obligation=MANDATORY, specification=ISO_19107) CoordinateReferenceSystem getCoordinateReferenceSystem()
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.
null
.@UML(identifier="dimension", obligation=MANDATORY, specification=ISO_19107) int getDimension()
@UML(identifier="coordinates", obligation=MANDATORY, specification=ISO_19107) double[] getCoordinates()
To quickly access individual ordinates please use the following:
If you want to manipulate ordinates please use:final int dim = position.getDimension(); for (int i=0; i<dim; i++) { position.getOrdinate(i); // no copy overhead }
There are a couple reasons you would like a copy:position.setOrdinate(i, value); // edit in place
DirectPosition
), or we want to protect the
array from future DirectPosition
changes.DirectPosition.getOrdinates()
is garanteed to not return the backing array,
then we can work directly on this array. If we don't have this garantee, then we must
conservatively clone the array in every cases.getOrdinates()
performance.
Performance concern can be avoided with usage of getOrdinate(int)
.
DirectPosition
object.double getOrdinate(int dimension) throws IndexOutOfBoundsException
dimension
- The dimension in the range 0 to dimension-1.
IndexOutOfBoundsException
- if the specified dimension is out of bounds.void setOrdinate(int dimension, double value) throws IndexOutOfBoundsException
dimension
- the dimension for the ordinate of interest.value
- the ordinate value of interest.
IndexOutOfBoundsException
- if the specified dimension is out of bounds.boolean equals(Object object)
object
is non-null and is an instance of DirectPosition
.Double.equals(java.lang.Object)
.
In other words, Arrays.equals(getCoordinates(), object.getCoordinates())
returns true
.
equals
in class Object
int hashCode()
Arrays.hashCode(getCoordinates()) + getCoordinateReferenceSystem().hashCode()
where the right hand side of the addition is omitted if the coordinate reference
system is null.
hashCode
in class Object
Object clone()
DirectPosition
should be left
to implementors.
Object.clone()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |