org.deegree.cs.refs.coordinatesystem
Class CRSRef

java.lang.Object
  extended by org.deegree.commons.tom.Reference<T>
      extended by org.deegree.cs.refs.CRSResourceRef<ICRS>
          extended by org.deegree.cs.refs.coordinatesystem.CRSRef
All Implemented Interfaces:
Serializable, Object, TypedObjectNode, ICRS, CRSResource
Direct Known Subclasses:
CompoundCRSRef, GeocentricCRSRef, GeographicCRSRef, ProjectedCRSRef, VerticalCRSRef

public class CRSRef
extends CRSResourceRef<ICRS>
implements Serializable, ICRS

Represents a CRSRef that is not necessarily resolved or resolvable.

Their are two aspects that this class takes care of:

  • In most use cases, coordinate reference system are identified using strings (such as 'EPSG:4326'). However, there are multiple equivalent ways to encode coordinate reference system identifications (another one would be 'urn:ogc:def:crs:EPSG::4326'). By using this class to represent a CRS, the original spelling is maintained.
  • A coordinate reference system may be specified which is not known to the CRSStore. However, for some operations this is not a necessarily a problem, e.g. a GML document may be read and transformed into Feature and Geometry objects.
  • Version:
    $Revision: $, $Date: $
    Author:
    Andrei Ionita, last edited by: $Author: ionita $
    See Also:
    Serialized Form

    Constructor Summary
    CRSRef(ReferenceResolver resolver, String uri, String baseURL)
              Creates a new CRSRef instance.
    CRSRef(ReferenceResolver resolver, String uri, String baseURL, boolean forceXY)
              Creates a new CRSRef instance with a coordinate reference system name.
     
    Method Summary
     javax.vecmath.Point3d convertToAxis(javax.vecmath.Point3d coordinates, IUnit[] units, boolean invert)
              Converts the given coordinates in given to the unit of the respective axis.
     boolean equals(Object obj)
               
     boolean equalsWithFlippedAxis(Object other)
              TODO: this methode should become redundant with the reworked identifer concept!
     String getAlias()
               
     String getAreaOfUse()
               
     double[] getAreaOfUseBBox()
              Returns the area of use, i.e. the domain where this CRSIdentifiable is valid.
     IAxis[] getAxis()
               
     IDatum getDatum()
               
     int getDimension()
               
     Transformation getDirectTransformation(ICRS targetCRS)
               
     int getEasting()
              Return the axis index associated with an easting value, if the axis could not be determined Axis.AO_OTHER 0 will be returned.
     IGeodeticDatum getGeodeticDatum()
               
     String getName()
              Returns the string that identifies the CRSRef which is the URI of the Reference.
     int getNorthing()
              Return the axis index associated with a northing value, if the axis could not be determined (e.g not is Axis.AO_NORTH Axis.AO_SOUTH or Axis.AO_UP or Axis.AO_DOWN) 1 will be returned.
     ICRS getReferencedObject()
              Returns the referenced Object instance (may trigger resolving and fetching it).
     List<Transformation> getTransformations()
               
     CRS.CRSType getType()
               
     IUnit[] getUnits()
               
     double[] getValidDomain()
              Returns the approximate domain of validity of this coordinate system.
     boolean hasDirectTransformation(ICRS targetCRS)
               
     int hashCode()
               
     boolean isXYForced()
               
     String toString()
               
     
    Methods inherited from class org.deegree.cs.refs.CRSResourceRef
    addAreaOfUse, addName, getAreasOfUse, getCode, getCodeAndName, getCodes, getDescription, getDescriptions, getNames, getOrignalCodeStrings, getVersion, getVersions, hasCode, hasId, hasIdOrName, setDefaultAreaOfUse, setDefaultDescription, setDefaultId, setDefaultName, setDefaultVersion
     
    Methods inherited from class org.deegree.commons.tom.Reference
    getId, getURI, isLocal, isResolved, resolve
     
    Methods inherited from class java.lang.Object
    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
     
    Methods inherited from interface org.deegree.cs.CRSResource
    addAreaOfUse, addName, getAreasOfUse, getCode, getCodeAndName, getCodes, getDescription, getDescriptions, getNames, getOrignalCodeStrings, getVersion, getVersions, hasCode, hasId, hasIdOrName, setDefaultAreaOfUse, setDefaultDescription, setDefaultId, setDefaultName, setDefaultVersion
     
    Methods inherited from interface org.deegree.commons.tom.Object
    getId
     

    Constructor Detail

    CRSRef

    public CRSRef(ReferenceResolver resolver,
                  String uri,
                  String baseURL)
    Creates a new CRSRef instance.

    Parameters:
    resolver - used for resolving the reference, must not be null
    uri - the object's uri, must not be null
    baseURL - base URL for resolving the uri, may be null (no resolving of relative URLs)

    CRSRef

    public CRSRef(ReferenceResolver resolver,
                  String uri,
                  String baseURL,
                  boolean forceXY)
    Creates a new CRSRef instance with a coordinate reference system name.

    Parameters:
    resolver - used for resolving the reference, must not be null
    uri - the object's uri, must not be null
    baseURL - base URL for resolving the uri, may be null (no resolving of relative URLs)
    forceXY - true if the axis order of the coordinate system should be x/y (EAST/NORTH; WEST/SOUTH); false id the defined axis order should be taken
    Method Detail

    getName

    public String getName()
    Returns the string that identifies the CRSRef which is the URI of the Reference.

    Specified by:
    getName in interface CRSResource
    Overrides:
    getName in class CRSResourceRef<ICRS>
    Returns:
    the string that identifies the coordinate reference system

    getAlias

    public String getAlias()
    Specified by:
    getAlias in interface ICRS
    Returns:
    the alias of a CRS reference is the id

    equals

    public boolean equals(Object obj)
    Overrides:
    equals in class CRSResourceRef<ICRS>

    hashCode

    public int hashCode()
    Overrides:
    hashCode in class Object

    getAreaOfUse

    public String getAreaOfUse()
    Specified by:
    getAreaOfUse in interface CRSResource
    Overrides:
    getAreaOfUse in class CRSResourceRef<ICRS>
    Returns:
    the first of all areasOfUse or null if no areasOfUse were given.

    toString

    public String toString()
    Overrides:
    toString in class Object

    getAxis

    public IAxis[] getAxis()
    Specified by:
    getAxis in interface ICRS
    Returns:
    (all) axis' in their defined order.

    getGeodeticDatum

    public IGeodeticDatum getGeodeticDatum()
    Specified by:
    getGeodeticDatum in interface ICRS
    Returns:
    the usedDatum or null if the datum was not a Geodetic one.

    getDatum

    public IDatum getDatum()
    Specified by:
    getDatum in interface ICRS
    Returns:
    the datum of this coordinate system.

    getUnits

    public IUnit[] getUnits()
    Specified by:
    getUnits in interface ICRS
    Returns:
    the units of all axis of the ICoordinateSystem.

    hasDirectTransformation

    public boolean hasDirectTransformation(ICRS targetCRS)
    Specified by:
    hasDirectTransformation in interface ICRS
    Parameters:
    targetCRS - to get the alternative Transformation for.
    Returns:
    true if this crs has an alternative transformation for the given ICoordinateSystem, false otherwise.

    getDirectTransformation

    public Transformation getDirectTransformation(ICRS targetCRS)
    Specified by:
    getDirectTransformation in interface ICRS
    Parameters:
    targetCRS - to get the alternative transformation for.
    Returns:
    the transformation associated with the given crs, null otherwise.

    convertToAxis

    public javax.vecmath.Point3d convertToAxis(javax.vecmath.Point3d coordinates,
                                               IUnit[] units,
                                               boolean invert)
    Description copied from interface: ICRS
    Converts the given coordinates in given to the unit of the respective axis.

    Specified by:
    convertToAxis in interface ICRS
    Parameters:
    coordinates - to convert to.
    units - in which the coordinates were given.
    invert - if the operation should be inverted, e.g. the coordinates are given in the axis units and should be converted to the given units.
    Returns:
    the converted coordinates.

    getTransformations

    public List<Transformation> getTransformations()
    Specified by:
    getTransformations in interface ICRS
    Returns:
    the polynomial transformations.

    getEasting

    public int getEasting()
    Description copied from interface: ICRS
    Return the axis index associated with an easting value, if the axis could not be determined Axis.AO_OTHER 0 will be returned.

    Specified by:
    getEasting in interface ICRS
    Returns:
    the index of the axis which represents the easting/westing component of a coordinate tuple.

    getNorthing

    public int getNorthing()
    Description copied from interface: ICRS
    Return the axis index associated with a northing value, if the axis could not be determined (e.g not is Axis.AO_NORTH Axis.AO_SOUTH or Axis.AO_UP or Axis.AO_DOWN) 1 will be returned.

    Specified by:
    getNorthing in interface ICRS
    Returns:
    the index of the axis which represents the easting/westing component of a coordinate tuple.

    getValidDomain

    public double[] getValidDomain()
    Description copied from interface: ICRS
    Returns the approximate domain of validity of this coordinate system. The returned array will contain the values in the appropriate coordinate system and with the appropriate axis order.

    Specified by:
    getValidDomain in interface ICRS
    Returns:
    the real world coordinates of the domain of validity of this crs, or null if the valid domain could not be determined

    getAreaOfUseBBox

    public double[] getAreaOfUseBBox()
    Description copied from interface: CRSResource
    Returns the area of use, i.e. the domain where this CRSIdentifiable is valid.

    Specified by:
    getAreaOfUseBBox in interface CRSResource
    Overrides:
    getAreaOfUseBBox in class CRSResourceRef<ICRS>
    Returns:
    the domain of validity (EPSG:4326 coordinates), order: minX, minY, maxX, maxY, never null (-180,-90,180,90) if no such information is available

    getDimension

    public int getDimension()
    Specified by:
    getDimension in interface ICRS
    Returns:
    the dimension of this CRS.

    getType

    public CRS.CRSType getType()
    Specified by:
    getType in interface ICRS
    Returns:
    one of the *_CRS types defined in this class.

    isXYForced

    public boolean isXYForced()

    getReferencedObject

    public ICRS getReferencedObject()
                             throws ReferenceResolvingException
    Description copied from class: Reference
    Returns the referenced Object instance (may trigger resolving and fetching it).

    Overrides:
    getReferencedObject in class Reference<ICRS>
    Returns:
    the referenced Object instance
    Throws:
    ReferenceResolvingException - if the reference cannot be resolved

    equalsWithFlippedAxis

    public boolean equalsWithFlippedAxis(Object other)
    Description copied from interface: ICRS
    TODO: this methode should become redundant with the reworked identifer concept!

    Specified by:
    equalsWithFlippedAxis in interface ICRS
    Returns:
    true, if this and other are from the same type differes only in a flipped axis order.


    Copyright © 2011. All Rights Reserved.