| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.geotools.geometry.GeneralDirectPosition
Holds the coordinates for a position within some coordinate reference system. Since
 s, as data types, will often be included in larger objects
 (such as geometries) that have references
 to CoordinateReferenceSystem, the getCoordinateReferenceSystem() method
 may returns  if this particular  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 CoordinateReferenceSystem.
 
 This particular implementation of  is said "General" because it
 uses an array of ordinates of an arbitrary length. If the direct
 position is know to be always two-dimensional, then DirectPosition2D may provides
 a more efficient implementation.
 
Most methods in this implementation are final for performance reason.
Point2D, 
Serialized Form| Field Summary | |
|  double[] | ordinatesThe ordinates of the direct position. | 
| Constructor Summary | |
| GeneralDirectPosition(org.opengis.referencing.crs.CoordinateReferenceSystem crs)Constructs a position using the specified coordinate reference system. | |
| GeneralDirectPosition(org.opengis.spatialschema.geometry.DirectPosition point)Constructs a position initialized to the same values than the specified point. | |
| GeneralDirectPosition(double[] ordinates)Constructs a position with the specified ordinates. | |
| GeneralDirectPosition(double x,
                      double y)Constructs a 2D position from the specified ordinates. | |
| GeneralDirectPosition(double x,
                      double y,
                      double z)Constructs a 3D position from the specified ordinates. | |
| GeneralDirectPosition(int numDim)Constructs a position with the specified number of dimensions. | |
| GeneralDirectPosition(java.awt.geom.Point2D point)Constructs a position from the specified Point2D. | |
| Method Summary | |
|  java.lang.Object | clone()Returns a deep copy of this position. | 
|  org.opengis.referencing.crs.CoordinateReferenceSystem | getCoordinateReferenceSystem()Returns the coordinate reference system in which the coordinate is given. | 
|  double[] | getCoordinates()Returns a sequence of numbers that hold the coordinate of this position in its reference system. | 
|  int | getDimension()The length of coordinate sequence (the number of entries). | 
|  double | getOrdinate(int dimension)Returns the ordinate at the specified dimension. | 
|  org.opengis.spatialschema.geometry.DirectPosition | getPosition()Returns always , the direct position for this position. | 
|  int | hashCode()Returns a hash value for this coordinate. | 
|  void | setCoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem crs)Set the coordinate reference system in which the coordinate is given. | 
|  void | setLocation(org.opengis.spatialschema.geometry.DirectPosition position)Set this coordinate to the specified direct position. | 
|  void | setLocation(GeneralDirectPosition position)Set this coordinate to the specified direct position. | 
|  void | setLocation(java.awt.geom.Point2D point)Set this coordinate to the specified Point2D. | 
|  void | setOrdinate(int dimension,
            double value)Sets the ordinate value along the specified dimension. | 
|  java.awt.geom.Point2D | toPoint2D()Returns a Point2Dwith the same coordinate as this direct position. | 
|  java.lang.String | toString()Returns a string representation of this coordinate. | 
| Methods inherited from class java.lang.Object | 
| equals, finalize, getClass, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
public final double[] ordinates
| Constructor Detail | 
public GeneralDirectPosition(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
public GeneralDirectPosition(int numDim)
                      throws java.lang.NegativeArraySizeException
numDim - Number of dimensions.
java.lang.NegativeArraySizeException - if  is negative.public GeneralDirectPosition(double[] ordinates)
public GeneralDirectPosition(double x,
                             double y)
DirectPosition2D javadoc for details.
public GeneralDirectPosition(double x,
                             double y,
                             double z)
public GeneralDirectPosition(java.awt.geom.Point2D point)
Point2D.
public GeneralDirectPosition(org.opengis.spatialschema.geometry.DirectPosition point)
| Method Detail | 
public org.opengis.spatialschema.geometry.DirectPosition getPosition()
getPosition in interface org.opengis.spatialschema.geometry.geometry.Positionpublic final org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
getCoordinateReferenceSystem in interface org.opengis.spatialschema.geometry.DirectPosition
public void setCoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
                                  throws org.opengis.spatialschema.geometry.MismatchedDimensionException
crs - The new coordinate reference system, or .
org.opengis.spatialschema.geometry.MismatchedDimensionException - if the specified CRS doesn't have the expected
         number of dimensions.public final int getDimension()
getDimension in interface org.opengis.spatialschema.geometry.DirectPositionpublic final double[] getCoordinates()
getCoordinates in interface org.opengis.spatialschema.geometry.DirectPosition
public final double getOrdinate(int dimension)
                         throws java.lang.IndexOutOfBoundsException
getOrdinate in interface org.opengis.spatialschema.geometry.DirectPositiondimension - The dimension in the range 0 to dimension-1.
java.lang.IndexOutOfBoundsException - if the specified dimension is out of bounds.
public final void setOrdinate(int dimension,
                              double value)
                       throws java.lang.IndexOutOfBoundsException
setOrdinate in interface org.opengis.spatialschema.geometry.DirectPositiondimension - the dimension for the ordinate of interest.value - the ordinate value of interest.
java.lang.IndexOutOfBoundsException - if the specified dimension is out of bounds.
public final void setLocation(org.opengis.spatialschema.geometry.DirectPosition position)
                       throws org.opengis.spatialschema.geometry.MismatchedDimensionException
position - The new position for this point.
org.opengis.spatialschema.geometry.MismatchedDimensionException - if this point doesn't have the expected dimension.
public final void setLocation(GeneralDirectPosition position)
                       throws org.opengis.spatialschema.geometry.MismatchedDimensionException
setLocation(DirectPosition), but is slightly faster in the special case
 of an  implementation.
position - The new position for this point.
org.opengis.spatialschema.geometry.MismatchedDimensionException - if this point doesn't have the expected dimension.
public final void setLocation(java.awt.geom.Point2D point)
                       throws org.opengis.spatialschema.geometry.MismatchedDimensionException
Point2D.
 This coordinate must be two-dimensional.
point - The new coordinate for this point.
org.opengis.spatialschema.geometry.MismatchedDimensionException - if this coordinate point is not two-dimensional.
public java.awt.geom.Point2D toPoint2D()
                                throws java.lang.IllegalStateException
Point2D with the same coordinate as this direct position.
 This is a convenience method for interoperability with Java2D.
java.lang.IllegalStateException - if this coordinate point is not two-dimensional.public java.lang.String toString()
CoordinateFormat.
 This is okay for occasional formatting (for example for debugging purpose). But if there
 is a lot of positions to format, users will get better performance and more control by
 using their own instance of CoordinateFormat.
public int hashCode()
public java.lang.Object clone()
clone in interface org.opengis.spatialschema.geometry.DirectPosition| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||