org.geotoolkit.referencing.factory
Class ReferencingFactoryContainer

Object
  extended by Factory
      extended by ReferencingFactory
          extended by ReferencingFactoryContainer
All Implemented Interfaces:
Factory

@ThreadSafe
public class ReferencingFactoryContainer
extends ReferencingFactory

A container of factories frequently used together, with utility methods. This class serves two purpose:

  1. A container for the following factories:
  2. Utilities methods for creating new CRS derived from an existing one.
Note: The CoordinateOperationFactory factory is intentionally excluded from this container, because CoordinateOperationFactory is more a processing class than a factory creating directly objects from the parameters.

Since:
2.1
Version:
3.16
Author:
Martin Desruisseaux (IRD, Geomatys)
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
ReferencingFactoryContainer(Hints userHints)
          Creates an instance from the specified hints.
 
Method Summary
 CRSFactory getCRSFactory()
          Returns the coordinate reference system factory.
 CSFactory getCSFactory()
          Returns the coordinate system factory.
 DatumFactory getDatumFactory()
          Returns the datum factory.
 Map<RenderingHints.Key,?> getImplementationHints()
          Returns all factories in this group.
 MathTransformFactory getMathTransformFactory()
          Returns the math transform factory.
static ReferencingFactoryContainer instance(Hints hints)
          Creates an instance from the specified hints.
 CoordinateReferenceSystem separate(CoordinateReferenceSystem crs, int... dimensions)
          Returns a new coordinate reference system with only the specified dimension.
 CoordinateReferenceSystem toGeodetic3D(CompoundCRS crs)
          Returns a CRS equivalents to the given one, with some components replaced by their 3D counterpart when possible.
 SingleCRS toGeodetic3D(SingleCRS crs)
          Adds an ellipsoidal height to the given CRS, if not already presents.
 
Methods inherited from class ReferencingFactory
ensureNonNull, getVendor
 
Methods inherited from class Factory
availability, dispose, equals, hasCompatibleHints, hashCode, setOrdering, toString
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReferencingFactoryContainer

public ReferencingFactoryContainer(Hints userHints)
Creates an instance from the specified hints. This constructor recognizes the CRS, CS, DATUM and MATH_TRANSFORM FACTORY hints.

This constructor is public mainly for DynamicFactoryRegistry usage. Consider invoking instance(userHints) instead.

Parameters:
userHints - The hints, or null if none (not the system-wide default; factory constructors consume the hints verbatism).
Method Detail

instance

public static ReferencingFactoryContainer instance(Hints hints)
Creates an instance from the specified hints. This method recognizes the CRS, CS, DATUM and MATH_TRANSFORM FACTORY hints.

Parameters:
hints - The hints, or null for the system-wide default.
Returns:
A factory group created from the specified set of hints.

getImplementationHints

public Map<RenderingHints.Key,?> getImplementationHints()
Returns all factories in this group. The returned map contains values for the CRS, CS, DATUM and MATH_TRANSFORM FACTORY hints.

Overrides:
getImplementationHints in class Factory

getDatumFactory

public DatumFactory getDatumFactory()
Returns the datum factory.

Returns:
The Datum factory.

getCSFactory

public CSFactory getCSFactory()
Returns the coordinate system factory.

Returns:
The Coordinate System factory.

getCRSFactory

public CRSFactory getCRSFactory()
Returns the coordinate reference system factory.

Returns:
The Coordinate Reference System factory.

getMathTransformFactory

public MathTransformFactory getMathTransformFactory()
Returns the math transform factory.

Returns:
The Math Transform factory.

toGeodetic3D

public SingleCRS toGeodetic3D(SingleCRS crs)
                       throws FactoryException
Adds an ellipsoidal height to the given CRS, if not already presents. This method accepts only geographic or projected CRS. If the given CRS is already three-dimensional, then it is returned unchanged. Otherwise an ellipsoidal height in the same units than the ellipsoid axis units (typically metres) is appended as the third dimension of the given CRS, and the resulting three-dimensional CRS is returned.

Parameters:
crs - The geographic or projected CRS to make three-dimensional.
Returns:
The given CRS with an ellipsoidal height.
Throws:
FactoryException - If an ellipsoidal height can not be added to the given CRS.
Since:
3.16

toGeodetic3D

public CoordinateReferenceSystem toGeodetic3D(CompoundCRS crs)
                                       throws FactoryException
Returns a CRS equivalents to the given one, with some components replaced by their 3D counterpart when possible. More specifically, if the given compound CRS contains two consecutive components CRS where:

Then this method replaces those two components by a single three-dimensional component. The other components (for example temporal CRS) are included unchanged in the returned CRS.

If there is no (2D + 1D) components that this method could replace by a 3D component, then this method returns the crs argument unchanged. In any case, the transform from the given CRS to the returned CRS shall be an identity transform.

Parameters:
crs - The CRS in which to replace (2D + 1D) components by 3D components.
Returns:
A CRS equivalents to the given one with the replacements performed, if any.
Throws:
FactoryException - If a new CRS needs to be created and the call to its factory method failed.

separate

public CoordinateReferenceSystem separate(CoordinateReferenceSystem crs,
                                          int... dimensions)
                                   throws FactoryException
Returns a new coordinate reference system with only the specified dimension. This method can be used for example in order to get a component of a compound CRS.

Parameters:
crs - The original (usually compound) CRS.
dimensions - The dimensions to keep.
Returns:
The CRS with only the specified dimensions.
Throws:
FactoryException - if the given dimensions can not be isolated in the given CRS.
See Also:
CRS.getSubCRS(CoordinateReferenceSystem, int, int)
TODO:
The current implementation does not break a 3D Geographic CRS or a 3D Projected CRS into its components. The capability may be added in a future release (see GEOTK-129).


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