org.geotools.geometry.iso.coordinate
Class DirectPositionImpl

java.lang.Object
  extended by org.geotools.geometry.iso.coordinate.DirectPositionImpl
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, org.opengis.geometry.coordinate.Position, org.opengis.geometry.DirectPosition

public class DirectPositionImpl
extends java.lang.Object
implements org.opengis.geometry.DirectPosition, org.opengis.util.Cloneable, java.io.Serializable

Author:
Jackson Roehrig & Sanjay Jena
See Also:
Serialized Form

Constructor Summary
DirectPositionImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
           
DirectPositionImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs, double[] coord)
          Creates a direct Position by using coordinates of another direct Position
DirectPositionImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs, double x, double y, double z)
           
DirectPositionImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs, double x, double y, double z, double m)
           
DirectPositionImpl(org.opengis.geometry.DirectPosition position)
          Creates a direct Position by using coordinates of another direct Position
DirectPositionImpl(org.opengis.geometry.coordinate.Position position)
           
 
Method Summary
 void add(DirectPositionImpl otherDP)
          Adds the ordinates of another direct position to the ordinates of this direct position.
 void add(double[] values)
          Adds certain value to each ordinate of this direct position.
 DirectPositionImpl clone()
           
 double distance(org.opengis.geometry.DirectPosition p)
          Calculates the distance to another direct position
 double distanceSquare(org.opengis.geometry.DirectPosition p)
          Calculates the square of the distance to another direct position
 void divideBy(double factor)
          Divides the ordinates of the DirectPosition by a factor: newOrdinate = oldOrdinate / factor
 boolean equals(org.opengis.geometry.DirectPosition position, double tol)
          Compares coodinates of Direct Positions and allows a tolerance value in the comparison
 boolean equals(java.lang.Object o)
          Compares coodinates of DirectPosition Implementation Note: Parameter has to be of Type DirectPosition (not DirectPositionImpl), so that the equals method is found for DirectPosition´s and DirectPositionImpl´s
 double[] getCoordinate()
           
 org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
           
 double[] getCoordinates()
          Deprecated. 
 int getDimension()
           
 org.opengis.geometry.DirectPosition getDirectPosition()
           
 double getOrdinate(int dimension)
           
 org.opengis.geometry.DirectPosition getPosition()
          Deprecated. 
 double getX()
          Returns the x value of the coordinate represented by this DirectPosition
 double getY()
          Returns the y value of the coordinate represented by this DirectPosition
 double getZ()
          Returns the z value of the coordinate represented by this DirectPosition
 int hashCode()
           
 void scale(double factor)
          Scales the ordinates of the DirectPosition by a factor: newOrdinate = oldOrdinate * factor
 void setCoordinate(double[] coord)
           
 void setOrdinate(int dimension, double value)
           
 void setX(double x)
          Sets the x value of the coordinate represented by this DirectPosition
 void setY(double y)
          Sets the y value of the coordinate represented by this DirectPosition
 void setZ(double z)
          Sets the z value of the coordinate represented by this DirectPosition
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DirectPositionImpl

public DirectPositionImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs)

DirectPositionImpl

public DirectPositionImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs,
                          double[] coord)
Creates a direct Position by using coordinates of another direct Position

Parameters:
crs -
coord -

DirectPositionImpl

public DirectPositionImpl(org.opengis.geometry.coordinate.Position position)

DirectPositionImpl

public DirectPositionImpl(org.opengis.geometry.DirectPosition position)
Creates a direct Position by using coordinates of another direct Position

Parameters:
position -

DirectPositionImpl

public DirectPositionImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs,
                          double x,
                          double y,
                          double z)
Parameters:
crs -
x -
y -
z -

DirectPositionImpl

public DirectPositionImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs,
                          double x,
                          double y,
                          double z,
                          double m)
Parameters:
crs -
x -
y -
z -
m -
Method Detail

getDimension

public int getDimension()
Specified by:
getDimension in interface org.opengis.geometry.DirectPosition

getCoordinate

public double[] getCoordinate()
Specified by:
getCoordinate in interface org.opengis.geometry.DirectPosition

getCoordinates

@Deprecated
public double[] getCoordinates()
Deprecated. 

Specified by:
getCoordinates in interface org.opengis.geometry.DirectPosition

getOrdinate

public double getOrdinate(int dimension)
                   throws java.lang.IndexOutOfBoundsException
Specified by:
getOrdinate in interface org.opengis.geometry.DirectPosition
Throws:
java.lang.IndexOutOfBoundsException

setOrdinate

public void setOrdinate(int dimension,
                        double value)
                 throws java.lang.IndexOutOfBoundsException
Specified by:
setOrdinate in interface org.opengis.geometry.DirectPosition
Throws:
java.lang.IndexOutOfBoundsException

getCoordinateReferenceSystem

public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
Specified by:
getCoordinateReferenceSystem in interface org.opengis.geometry.DirectPosition

clone

public DirectPositionImpl clone()
Overrides:
clone in class java.lang.Object

setCoordinate

public void setCoordinate(double[] coord)
Parameters:
coord -

getX

public double getX()
Returns the x value of the coordinate represented by this DirectPosition

Returns:
x

getY

public double getY()
Returns the y value of the coordinate represented by this DirectPosition

Returns:
y

getZ

public double getZ()
Returns the z value of the coordinate represented by this DirectPosition

Returns:
z

setX

public void setX(double x)
Sets the x value of the coordinate represented by this DirectPosition

Parameters:
x -

setY

public void setY(double y)
Sets the y value of the coordinate represented by this DirectPosition

Parameters:
y -

setZ

public void setZ(double z)
Sets the z value of the coordinate represented by this DirectPosition

Parameters:
z -

equals

public boolean equals(org.opengis.geometry.DirectPosition position,
                      double tol)
Compares coodinates of Direct Positions and allows a tolerance value in the comparison

Parameters:
position - Direct Position to compare with
tol - Epsilon tolerance value
Returns:
TRUE, if coordinates accord concording to the tolerance value, FALSE if they dont.

equals

public boolean equals(java.lang.Object o)
Compares coodinates of DirectPosition Implementation Note: Parameter has to be of Type DirectPosition (not DirectPositionImpl), so that the equals method is found for DirectPosition´s and DirectPositionImpl´s

Specified by:
equals in interface org.opengis.geometry.DirectPosition
Overrides:
equals in class java.lang.Object
Parameters:
p - DirectPosition
Returns:
TRUE, if the two DirectPositions describe the same point in the Euclidian Space

hashCode

public int hashCode()
Specified by:
hashCode in interface org.opengis.geometry.DirectPosition
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

distance

public double distance(org.opengis.geometry.DirectPosition p)
Calculates the distance to another direct position

Parameters:
p - direct Position
Returns:
Distance

distanceSquare

public double distanceSquare(org.opengis.geometry.DirectPosition p)
Calculates the square of the distance to another direct position

Parameters:
p - another direct Position
Returns:
Distance

add

public void add(double[] values)
Adds certain value to each ordinate of this direct position.

Parameters:
values - Array of doubles. values[0] will be added to the X ordinate, values[1] to the Y value and an optional values[2] to the Z value.

add

public void add(DirectPositionImpl otherDP)
Adds the ordinates of another direct position to the ordinates of this direct position.

Parameters:
otherDP - DirectPosition which ordinates shall be added to this DirectPosition

scale

public void scale(double factor)
Scales the ordinates of the DirectPosition by a factor: newOrdinate = oldOrdinate * factor

Parameters:
factor - Scaling factor

divideBy

public void divideBy(double factor)
Divides the ordinates of the DirectPosition by a factor: newOrdinate = oldOrdinate / factor

Parameters:
factor - Value of divisor

getPosition

@Deprecated
public org.opengis.geometry.DirectPosition getPosition()
Deprecated. 

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

getDirectPosition

public org.opengis.geometry.DirectPosition getDirectPosition()
Specified by:
getDirectPosition in interface org.opengis.geometry.coordinate.Position


Copyright © 1996-2010 Geotools. All Rights Reserved.