org.geotools.referencing.factory
Class DatumAliases

java.lang.Object
  extended byorg.geotools.factory.AbstractFactory
      extended byorg.geotools.referencing.factory.AbstractFactory
          extended byorg.geotools.referencing.factory.DatumAliases
All Implemented Interfaces:
org.opengis.referencing.datum.DatumFactory, Factory, org.opengis.referencing.Factory, org.opengis.referencing.ObjectFactory, javax.imageio.spi.RegisterableService

public class DatumAliases
extends AbstractFactory
implements org.opengis.referencing.datum.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). Unfortunatly, 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 class provides a way to handle that.

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) for a name. The default implementation is backed by the text file "". The first line in this text file must be the authority names. All other lines are the aliases.

Since 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:
$Id: DatumAliases.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Rueben Schulz, Martin Desruisseaux
To Do:
Invokes freeUnused() automatically after some amount of time, in order to release memory for unusued aliases. A timer should be set in method.

Field Summary
 
Fields inherited from class org.geotools.referencing.factory.AbstractFactory
LOGGER
 
Fields inherited from class org.geotools.factory.AbstractFactory
hints, MAXIMUM_PRIORITY, MINIMUM_PRIORITY, NORMAL_PRIORITY, priority
 
Constructor Summary
DatumAliases()
          Constructs a new datum factory with the default backing factory and alias table.
DatumAliases(org.opengis.referencing.datum.DatumFactory factory)
          Constructs a new datum factory using the specified factory and the default alias table.
DatumAliases(org.opengis.referencing.datum.DatumFactory factory, java.net.URL aliasURL)
          Constructs a new datum factory which delegates its work to the specified factory.
 
Method Summary
 org.opengis.referencing.datum.Ellipsoid createEllipsoid(java.util.Map properties, double semiMajorAxis, double semiMinorAxis, javax.units.Unit unit)
          Creates an ellipsoid from radius values.
 org.opengis.referencing.datum.EngineeringDatum createEngineeringDatum(java.util.Map properties)
          Creates an engineering datum.
 org.opengis.referencing.datum.Ellipsoid createFlattenedSphere(java.util.Map properties, double semiMajorAxis, double inverseFlattening, javax.units.Unit unit)
          Creates an ellipsoid from an major radius, and inverse flattening.
 org.opengis.referencing.datum.GeodeticDatum createGeodeticDatum(java.util.Map properties, org.opengis.referencing.datum.Ellipsoid ellipsoid, org.opengis.referencing.datum.PrimeMeridian primeMeridian)
          Creates geodetic datum from ellipsoid and (optionaly) Bursa-Wolf parameters.
 org.opengis.referencing.datum.ImageDatum createImageDatum(java.util.Map properties, org.opengis.referencing.datum.PixelInCell pixelInCell)
          Creates an image datum.
 org.opengis.referencing.datum.PrimeMeridian createPrimeMeridian(java.util.Map properties, double longitude, javax.units.Unit angularUnit)
          Creates a prime meridian, relative to Greenwich.
 org.opengis.referencing.datum.TemporalDatum createTemporalDatum(java.util.Map properties, java.util.Date origin)
          Creates a temporal datum from an enumerated type value.
 org.opengis.referencing.datum.VerticalDatum createVerticalDatum(java.util.Map properties, org.opengis.referencing.datum.VerticalDatumType type)
          Creates a vertical datum from an enumerated type value.
 void freeUnused()
          Free all aliases that have been unused up to date.
 
Methods inherited from class org.geotools.referencing.factory.AbstractFactory
ensureNonNull, getVendor
 
Methods inherited from class org.geotools.factory.AbstractFactory
getImplementationHints, onDeregistration, onRegistration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opengis.referencing.Factory
getVendor
 

Constructor Detail

DatumAliases

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


DatumAliases

public DatumAliases(org.opengis.referencing.datum.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(org.opengis.referencing.datum.DatumFactory factory,
                    java.net.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 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

createEngineeringDatum

public org.opengis.referencing.datum.EngineeringDatum createEngineeringDatum(java.util.Map properties)
                                                                      throws org.opengis.referencing.FactoryException
Creates an engineering datum.

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

createGeodeticDatum

public org.opengis.referencing.datum.GeodeticDatum createGeodeticDatum(java.util.Map properties,
                                                                       org.opengis.referencing.datum.Ellipsoid ellipsoid,
                                                                       org.opengis.referencing.datum.PrimeMeridian primeMeridian)
                                                                throws org.opengis.referencing.FactoryException
Creates geodetic datum from ellipsoid and (optionaly) Bursa-Wolf parameters.

Specified by:
createGeodeticDatum in interface org.opengis.referencing.datum.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:
org.opengis.referencing.FactoryException - if the object creation failed.

createImageDatum

public org.opengis.referencing.datum.ImageDatum createImageDatum(java.util.Map properties,
                                                                 org.opengis.referencing.datum.PixelInCell pixelInCell)
                                                          throws org.opengis.referencing.FactoryException
Creates an image datum.

Specified by:
createImageDatum in interface org.opengis.referencing.datum.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:
org.opengis.referencing.FactoryException - if the object creation failed.

createTemporalDatum

public org.opengis.referencing.datum.TemporalDatum createTemporalDatum(java.util.Map properties,
                                                                       java.util.Date origin)
                                                                throws org.opengis.referencing.FactoryException
Creates a temporal datum from an enumerated type value.

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

createVerticalDatum

public org.opengis.referencing.datum.VerticalDatum createVerticalDatum(java.util.Map properties,
                                                                       org.opengis.referencing.datum.VerticalDatumType type)
                                                                throws org.opengis.referencing.FactoryException
Creates a vertical datum from an enumerated type value.

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

createEllipsoid

public org.opengis.referencing.datum.Ellipsoid createEllipsoid(java.util.Map properties,
                                                               double semiMajorAxis,
                                                               double semiMinorAxis,
                                                               javax.units.Unit unit)
                                                        throws org.opengis.referencing.FactoryException
Creates an ellipsoid from radius values.

Specified by:
createEllipsoid in interface org.opengis.referencing.datum.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:
org.opengis.referencing.FactoryException - if the object creation failed.

createFlattenedSphere

public org.opengis.referencing.datum.Ellipsoid createFlattenedSphere(java.util.Map properties,
                                                                     double semiMajorAxis,
                                                                     double inverseFlattening,
                                                                     javax.units.Unit unit)
                                                              throws org.opengis.referencing.FactoryException
Creates an ellipsoid from an major radius, and inverse flattening.

Specified by:
createFlattenedSphere in interface org.opengis.referencing.datum.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:
org.opengis.referencing.FactoryException - if the object creation failed.

createPrimeMeridian

public org.opengis.referencing.datum.PrimeMeridian createPrimeMeridian(java.util.Map properties,
                                                                       double longitude,
                                                                       javax.units.Unit angularUnit)
                                                                throws org.opengis.referencing.FactoryException
Creates a prime meridian, relative to Greenwich.

Specified by:
createPrimeMeridian in interface org.opengis.referencing.datum.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:
org.opengis.referencing.FactoryException - if the object creation failed.

freeUnused

public void freeUnused()
Free all aliases that have been unused up to date. If one of those alias is needed at a later time, the aliases table will be reloaded.



Copyright © GeoTools. All Rights Reserved.