org.geotoolkit.referencing.factory
Class DatumAliases

Object
  extended by Factory
      extended by ReferencingFactory
          extended by DatumAliases
All Implemented Interfaces:
DatumFactory, ObjectFactory, Factory

@ThreadSafe
public class DatumAliases
extends ReferencingFactory
implements DatumFactory

A datum factory that add aliases to a datum name before to delegates the datum creation to an other factory. Aliases are especially important for datum since their name are often the only way to differentiate them.

Two datum with different names are considered incompatible, unless some datum shift method are specified (e.g. Bursa-Wolf parameters). Unfortunately, different softwares often use different names for the same datum, which result in OperationNotFoundException when attempting to convert coordinates from one coordinate reference system to an other one. For example "Nouvelle Triangulation Française (Paris)" and "NTF (Paris meridian)" are actually the same datum. This DatumAliases class provides a way to handle that.

DatumAliases is a class that determines if a datum name is in our list of aliases and constructs a value for the aliases property (as generic names). The default implementation is backed by the "DatumAliasesTable.csv" text file. The first uncommented non-blank line in this text file must be the authority names. All other lines are the aliases.

Since DatumAliases is a datum factory, any authority factory or any WKT parser using this factory will takes advantage of the aliases table.

Since:
2.1
Version:
3.19
Author:
Rueben Schulz (UBC), Martin Desruisseaux (Geomatys, IRD)
See Also:
WKT problems
Module:
referencing/geotk-referencing (download)    View source code for this class

Nested Class Summary
 
Nested classes/interfaces inherited from class Factory
Factory.Availability, Factory.Organizer
 
Field Summary
 
Fields inherited from class ReferencingFactory
LOGGER
 
Fields inherited from class Factory
EMPTY_HINTS, hints
 
Constructor Summary
DatumAliases()
          Constructs a new datum factory with the default backing factory and alias table.
DatumAliases(DatumFactory factory)
          Constructs a new datum factory using the specified factory and the default alias table.
DatumAliases(DatumFactory factory, URL aliasURL)
          Constructs a new datum factory which delegates its work to the specified factory.
 
Method Summary
 Ellipsoid createEllipsoid(Map<String,?> properties, double semiMajorAxis, double semiMinorAxis, Unit<Length> unit)
          Creates an ellipsoid from radius values.
 EngineeringDatum createEngineeringDatum(Map<String,?> properties)
          Creates an engineering datum.
 Ellipsoid createFlattenedSphere(Map<String,?> properties, double semiMajorAxis, double inverseFlattening, Unit<Length> unit)
          Creates an ellipsoid from an major radius, and inverse flattening.
 GeodeticDatum createGeodeticDatum(Map<String,?> properties, Ellipsoid ellipsoid, PrimeMeridian primeMeridian)
          Creates geodetic datum from ellipsoid and (optionally) Bursa-Wolf parameters.
 ImageDatum createImageDatum(Map<String,?> properties, PixelInCell pixelInCell)
          Creates an image datum.
 PrimeMeridian createPrimeMeridian(Map<String,?> properties, double longitude, Unit<Angle> angularUnit)
          Creates a prime meridian, relative to Greenwich.
 TemporalDatum createTemporalDatum(Map<String,?> properties, Date origin)
          Creates a temporal datum from an enumerated type value.
 VerticalDatum createVerticalDatum(Map<String,?> properties, VerticalDatumType type)
          Creates a vertical datum from an enumerated type value.
protected  void setOrdering(Factory.Organizer organizer)
          Invoked by FactoryRegistry in order to set the ordering relative to other factories.
 
Methods inherited from class ReferencingFactory
ensureNonNull, getVendor
 
Methods inherited from class Factory
availability, dispose, equals, getImplementationHints, hasCompatibleHints, hashCode, toString
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface Factory
getVendor
 

Constructor Detail

DatumAliases

public DatumAliases()
Constructs a new datum factory with the default backing factory and alias table.


DatumAliases

public DatumAliases(DatumFactory factory)
Constructs a new datum factory using the specified factory and the default alias table.

Parameters:
factory - The factory to use for datum creation.

DatumAliases

public DatumAliases(DatumFactory factory,
                    URL aliasURL)
Constructs a new datum factory which delegates its work to the specified factory. The aliases table is read from the specified URL. The fist uncommented non-blank line in this file most be the authority names. All other names are aliases.

Parameters:
factory - The factory to use for datum creation.
aliasURL - The URL to the alias table.
Method Detail

setOrdering

protected void setOrdering(Factory.Organizer organizer)
Invoked by FactoryRegistry in order to set the ordering relative to other factories. The current implementation specifies that this factory should have precedence over ReferencingObjectFactory.

Overrides:
setOrdering in class Factory
Since:
3.00

createEngineeringDatum

public EngineeringDatum createEngineeringDatum(Map<String,?> properties)
                                        throws FactoryException
Creates an engineering datum.

Specified by:
createEngineeringDatum in interface DatumFactory
Parameters:
properties - Name and other properties to give to the new object.
Throws:
FactoryException - if the object creation failed.

createGeodeticDatum

public GeodeticDatum createGeodeticDatum(Map<String,?> properties,
                                         Ellipsoid ellipsoid,
                                         PrimeMeridian primeMeridian)
                                  throws FactoryException
Creates geodetic datum from ellipsoid and (optionally) Bursa-Wolf parameters.

Specified by:
createGeodeticDatum in interface DatumFactory
Parameters:
properties - Name and other properties to give to the new object.
ellipsoid - Ellipsoid to use in new geodetic datum.
primeMeridian - Prime meridian to use in new geodetic datum.
Throws:
FactoryException - if the object creation failed.

createImageDatum

public ImageDatum createImageDatum(Map<String,?> properties,
                                   PixelInCell pixelInCell)
                            throws FactoryException
Creates an image datum.

Specified by:
createImageDatum in interface DatumFactory
Parameters:
properties - Name and other properties to give to the new object.
pixelInCell - Specification of the way the image grid is associated with the image data attributes.
Throws:
FactoryException - if the object creation failed.

createTemporalDatum

public TemporalDatum createTemporalDatum(Map<String,?> properties,
                                         Date origin)
                                  throws FactoryException
Creates a temporal datum from an enumerated type value.

Specified by:
createTemporalDatum in interface DatumFactory
Parameters:
properties - Name and other properties to give to the new object.
origin - The date and time origin of this temporal datum.
Throws:
FactoryException - if the object creation failed.

createVerticalDatum

public VerticalDatum createVerticalDatum(Map<String,?> properties,
                                         VerticalDatumType type)
                                  throws FactoryException
Creates a vertical datum from an enumerated type value.

Specified by:
createVerticalDatum in interface DatumFactory
Parameters:
properties - Name and other properties to give to the new object.
type - The type of this vertical datum (often “geoidal”).
Throws:
FactoryException - if the object creation failed.

createEllipsoid

public Ellipsoid createEllipsoid(Map<String,?> properties,
                                 double semiMajorAxis,
                                 double semiMinorAxis,
                                 Unit<Length> unit)
                          throws FactoryException
Creates an ellipsoid from radius values. This method does not add any alias to the ellipsoid object. In Geotk implementation, ellipsoids don't need aliases because their name can be ignored during comparisons.

Specified by:
createEllipsoid in interface DatumFactory
Parameters:
properties - Name and other properties to give to the new object.
semiMajorAxis - Equatorial radius in supplied linear units.
semiMinorAxis - Polar radius in supplied linear units.
unit - Linear units of ellipsoid axes.
Throws:
FactoryException - if the object creation failed.

createFlattenedSphere

public Ellipsoid createFlattenedSphere(Map<String,?> properties,
                                       double semiMajorAxis,
                                       double inverseFlattening,
                                       Unit<Length> unit)
                                throws FactoryException
Creates an ellipsoid from an major radius, and inverse flattening. This method does not add any alias to the ellipsoid object. In Geotk implementation, ellipsoids don't need aliases because their name can be ignored during comparisons.

Specified by:
createFlattenedSphere in interface DatumFactory
Parameters:
properties - Name and other properties to give to the new object.
semiMajorAxis - Equatorial radius in supplied linear units.
inverseFlattening - Eccentricity of ellipsoid.
unit - Linear units of major axis.
Throws:
FactoryException - if the object creation failed.

createPrimeMeridian

public PrimeMeridian createPrimeMeridian(Map<String,?> properties,
                                         double longitude,
                                         Unit<Angle> angularUnit)
                                  throws FactoryException
Creates a prime meridian, relative to Greenwich. This method does not add any alias to the prime meridian object. In Geotk implementation, prime meridians don't need aliases because their name can be ignored during comparisons.

Specified by:
createPrimeMeridian in interface DatumFactory
Parameters:
properties - Name and other properties to give to the new object.
longitude - Longitude of prime meridian in supplied angular units East of Greenwich.
angularUnit - Angular units of longitude.
Throws:
FactoryException - if the object creation failed.


Copyright © 2009-2011 Geotoolkit.org. All Rights Reserved.