org.deegree.cs.persistence.deegree.d3
Class DeegreeCRSStore

java.lang.Object
  extended by org.deegree.cs.persistence.AbstractCRSStore
      extended by org.deegree.cs.persistence.deegree.d3.DeegreeCRSStore
Type Parameters:
T - The return type of the XLinkResolver.getURIAsType(String) method
All Implemented Interfaces:
CRSStore

public class DeegreeCRSStore
extends AbstractCRSStore

The DeegreeCRSStore reads the deegree crs-config (based on it's own xml-schema) and creates the CRS's (and their datums, conversion info's, ellipsoids and projections) if requested.

Attention, although urn's are case-sensitive, the deegreeCRSProvider is not. All incoming id's are toLowerCased!

Automatic loading of projection/transformation classes

It is possible to create your own projection/transformation classes, which can be automatically loaded.

You can achieve this loading by supplying the class attribute to a crs:projectedCRS/crs:projection or crs:coordinateSystem/crs:transformation element in the 'deegree-crs-configuration.xml'. This attribute must contain the full class name (with package), e.g. <crs:projection class='my.package.and.projection.Implementation'>

Because the loading is done with reflections your classes must sustain following criteria:

Projections

  1. It must be a sub class of Projection
  2. A constructor with following signature must be supplied:
    public MyProjection(
        GeographicCRS underlyingCRS,
        double falseNorthing,
        double falseEasting,
        javax.vecmath.Point2d naturalOrigin,
        Unit units,
        double scale,
        java.util.List<org.w3c.dom.Element> yourProjectionElements
    );

    The first six parameters are common to all projections (for an explanation of their meaning take a look at Projection). The last list, will contain all xml-dom elements you supplied in the deegree configuration (child elements of the crs:projection/crs:MyProjection), thus relieving you of the parsing of the deegree-crs-configuration.xml document.

Transformations

  1. It must be a sub class of PolynomialTransformation
  2. A constructor with following signature must be supplied:
    public MyTransformation(
        java.util.list<Double> aValues,
        java.util.list<Double> bValues,
        CRS targetCRS,
        java.util.List<org.w3c.dom.Element> yourTransformationElements
    );

    The first three parameters are common to all polynomial values (for an explanation of their meaning take a look at PolynomialTransformation). Again, the last list, will contain all xml-dom elements you supplied in the deegree configuration (child elements of the crs:transformation/crs:MyTransformation), thus relieving you of the parsing of the deegree-crs-configuration.xml document.

Version:
$Revision: 31619 $, $Date: 2011-08-23 14:56:28 +0200 (Tue, 23 Aug 2011) $
Author:
Rutger Bezema, last edited by: $Author: mschneider $

Nested Class Summary
 
Nested classes/interfaces inherited from class org.deegree.cs.persistence.AbstractCRSStore
AbstractCRSStore.RESOURCETYPE
 
Field Summary
static String CRS_NS
          Default namespace of the crs configuration
 
Constructor Summary
DeegreeCRSStore(TransformationFactory.DSTransform prefTransformType, URL resolvedURL)
           
 
Method Summary
 List<CRSCodeType[]> getAvailableCRSCodes()
          This method should be called if one is only interested in the available identifiers and not in the coordinatesystems themselves.
 List<ICRS> getAvailableCRSs()
          This method should be called to see if the provider is able to create all defined crs's, thus verifying the correctness of the configuration.
 ICRS getCoordinateSystem(String id)
           
 CRSResource getCRSResource(CRSCodeType id)
          This method is more general than the CRSStore.getCRSByCode(CRSCodeType), because it represents a possibility to return an arbitrary CRSResource Object from the providers backend.
 CRSResource getCRSResource(String id, AbstractCRSStore.RESOURCETYPE resourceType)
          Returns an CRSResource with the given ID and from the given RESOURCETYPE.
 Transformation getDirectTransformation(ICRS sourceCRS, ICRS targetCRS)
          This method is should retrieve a transformation which transforms coordinates from the given source into the given target crs.
 Transformation getDirectTransformation(String id)
          This method should retrieve a transformation with the given id.
 DeegreeReferenceResolver getResolver(AbstractCRSStore.RESOURCETYPE resourceType)
           
 void init()
          Called by the manager to indicate that this CRSStore instance is being registered.
 
Methods inherited from class org.deegree.cs.persistence.AbstractCRSStore
addIdToCache, clearCache, getCachedIdentifiable, getCachedIdentifiable, getCachedIdentifiable, getCachedIdentifiable, getCachedIdentifiable, getCachedIdentifiable, getCRSByCode, getCRSByCode, getPreferedTransformationType, resolve
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CRS_NS

public static final String CRS_NS
Default namespace of the crs configuration

See Also:
Constant Field Values
Constructor Detail

DeegreeCRSStore

public DeegreeCRSStore(TransformationFactory.DSTransform prefTransformType,
                       URL resolvedURL)
Parameters:
properties - containing information about the crs resource class and the file location of the crs configuration. If either is null the default mechanism is using the DeegreeReferenceResolver and the deegree-crs-configuration.xml
Throws:
CRSConfigurationException - if the give file or the default-crs-configuration.xml file could not be loaded.
Method Detail

getResolver

public DeegreeReferenceResolver getResolver(AbstractCRSStore.RESOURCETYPE resourceType)

init

public void init()
Description copied from interface: CRSStore
Called by the manager to indicate that this CRSStore instance is being registered.


getAvailableCRSs

public List<ICRS> getAvailableCRSs()
                            throws CRSConfigurationException
Description copied from interface: CRSStore
This method should be called to see if the provider is able to create all defined crs's, thus verifying the correctness of the configuration.

Returns:
all configured CRSs.
Throws:
CRSConfigurationException - if the implementation was confronted by an exception and could not deliver the requested crs. This exception should not be thrown if no CoordinateSystems were found, in the latter case an empty List ( a list with size == 0 ) should be returned.

getAvailableCRSCodes

public List<CRSCodeType[]> getAvailableCRSCodes()
                                         throws CRSConfigurationException
Description copied from interface: CRSStore
This method should be called if one is only interested in the available identifiers and not in the coordinatesystems themselves.

Returns:
the identifiers of all configured CRSs.
Throws:
CRSConfigurationException - if the implementation was confronted by an exception and could not deliver the requested crs. This exception should not be thrown if no CoordinateSystems were found, in the latter case an empty List ( a list with size == 0 ) should be returned.

getCRSResource

public CRSResource getCRSResource(String id,
                                  AbstractCRSStore.RESOURCETYPE resourceType)
Returns an CRSResource with the given ID and from the given RESOURCETYPE. IF resourceType is null the an arbitrary CRSResource with the id will be returned. If no such an CRSResource could be found null will be returned.

Parameters:
id - id the resource, must not benull
resourceType - the type of the resource to return or null all for all types should be looked
Returns:
the CRSResource Object or null if no such Object was found.

getCoordinateSystem

public ICRS getCoordinateSystem(String id)
Specified by:
getCoordinateSystem in class AbstractCRSStore
Returns:

getDirectTransformation

public Transformation getDirectTransformation(ICRS sourceCRS,
                                              ICRS targetCRS)
                                       throws CRSConfigurationException
Description copied from interface: CRSStore
This method is should retrieve a transformation which transforms coordinates from the given source into the given target crs. If no such transformation could be found or the implementation does not support inverse lookup of transformations null should be returned.

Parameters:
sourceCRS - start of the transformation (chain)
targetCRS - end point of the transformation (chain).
Returns:
the Transformation Object or null if no such Object was found.
Throws:
CRSConfigurationException - if the implementation was confronted by an exception and could not deliver the requested Object. This exception should not be thrown no Transformation was found, in this case null should be returned.

getDirectTransformation

public Transformation getDirectTransformation(String id)
                                       throws CRSConfigurationException
Description copied from interface: CRSStore
This method should retrieve a transformation with the given id. If a transformation with the given id could not be found null should be returned.

Parameters:
id - the id of the transformation
Returns:
the Transformation Object or null if no such Object was found.
Throws:
CRSConfigurationException - if the implementation was confronted by an exception and could not deliver the requested Object. This exception should not be thrown no Transformation was found, in this case null should be returned.

getCRSResource

public CRSResource getCRSResource(CRSCodeType id)
                           throws CRSConfigurationException
Description copied from interface: CRSStore
This method is more general than the CRSStore.getCRSByCode(CRSCodeType), because it represents a possibility to return an arbitrary CRSResource Object from the providers backend.

Parameters:
id - string representation of the resource to retrieve
Returns:
the CRSResource Object or null if no such Object was found.
Throws:
CRSConfigurationException - if the implementation was confronted by an exception and could not deliver the requested Object. This exception should not be thrown if the given id wasn't found, in this case null should be returned.


Copyright © 2011. All Rights Reserved.