org.geotools.referencing.factory
Class ReferencingFactoryContainer

Object
  extended by AbstractFactory
      extended by ReferencingFactory
          extended by ReferencingFactoryContainer
All Implemented Interfaces:
RegisterableService, Factory

public class ReferencingFactoryContainer
extends ReferencingFactory

A set of utilities methods working on factories. Many of those methods requires more than one factory. Consequently, they can't be a method in a single factory. Furthermore, since they are helper methods and somewhat implementation-dependent, they are not part of GeoAPI.

Since:
2.4
Author:
Martin Desruisseaux (IRD)

Field Summary
 
Fields inherited from class ReferencingFactory
LOGGER
 
Fields inherited from class AbstractFactory
hints, MAXIMUM_PRIORITY, MINIMUM_PRIORITY, NORMAL_PRIORITY, priority
 
Constructor Summary
ReferencingFactoryContainer(Hints userHints)
          Creates an instance from the specified hints.
 
Method Summary
 MathTransform createBaseToDerived(CoordinateReferenceSystem baseCRS, ParameterValueGroup parameters, CoordinateSystem derivedCS)
          Deprecated. Moved to the MathTransformFactory interface.
 MathTransform createParameterizedTransform(ParameterValueGroup parameters)
          Deprecated. Use the MathTransformFactory interface instead.
 ProjectedCRS createProjectedCRS(Map<String,?> properties, GeographicCRS baseCRS, Conversion conversionFromBase, CartesianCS derivedCS)
          Deprecated. Moved to the CRSFactory interface.
 ProjectedCRS createProjectedCRS(Map<String,?> properties, GeographicCRS baseCRS, OperationMethod method, ParameterValueGroup parameters, CartesianCS derivedCS)
          Deprecated. Use CRSFactory#createDefiningConversion followed by CRSFactory.createProjectedCRS(java.util.Map, org.opengis.referencing.crs.GeographicCRS, org.opengis.referencing.operation.Conversion, org.opengis.referencing.cs.CartesianCS) instead.
 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.
 OperationMethod getLastUsedMethod()
          Deprecated. Moved to the MathTransformFactory interface.
 MathTransformFactory getMathTransformFactory()
          Returns the math transform factory.
 OperationMethod getOperationMethod(String name)
          Deprecated. Use DefaultMathTransformFactory.getOperationMethod(java.lang.String). This method was inefficient for other implementations.
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)
          Converts a 2D + 1D compound CRS into a 3D CRS, if possible.
 
Methods inherited from class ReferencingFactory
ensureNonNull, getVendor
 
Methods inherited from class AbstractFactory
addImplementationHints, equals, getPriority, hashCode, onDeregistration, onRegistration, 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 FactoryCreator usage. Consider invoking createInstance(userHints) instead.

Parameters:
userHints - The hints, or null if none.
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 if none.
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.

Specified by:
getImplementationHints in interface Factory
Overrides:
getImplementationHints in class AbstractFactory
Returns:
The map of hints, or an empty map if none.

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.

getOperationMethod

@Deprecated
public OperationMethod getOperationMethod(String name)
                                   throws NoSuchIdentifierException
Deprecated. Use DefaultMathTransformFactory.getOperationMethod(java.lang.String). This method was inefficient for other implementations.

Returns the operation method for the specified name. If the underlying math transform factory is the Geotools implementation, then this method just delegates the call to it. Otherwise this method scans all operations registered in the math transform factory until a match is found.

Parameters:
name - The case insensitive identifier code of the operation method to search for (e.g. "Transverse_Mercator").
Returns:
The operation method.
Throws:
NoSuchIdentifierException - if there is no operation method registered for the specified name.
See Also:
DefaultMathTransformFactory.getOperationMethod(java.lang.String)

getLastUsedMethod

@Deprecated
public OperationMethod getLastUsedMethod()
Deprecated. Moved to the MathTransformFactory interface.

Returns the operation method for the last call to a create method in the currently running thread. This method may be invoked after any of the following methods:

Returns:
The operation method for the last call to a create method, or null if none.
See Also:
MathTransformFactory.getLastMethodUsed()

createParameterizedTransform

@Deprecated
public MathTransform createParameterizedTransform(ParameterValueGroup parameters)
                                           throws NoSuchIdentifierException,
                                                  FactoryException
Deprecated. Use the MathTransformFactory interface instead.

Creates a transform from a group of parameters. This method delegates the work to the underlying math transform factory and keep trace of the operation method used. The later can be obtained by a call to getLastUsedMethod().

Parameters:
parameters - The parameter values.
Returns:
The parameterized transform.
Throws:
NoSuchIdentifierException - if there is no transform registered for the method.
FactoryException - if the object creation failed. This exception is thrown if some required parameter has not been supplied, or has illegal value.
See Also:
MathTransformFactory.createParameterizedTransform(org.opengis.parameter.ParameterValueGroup)

createBaseToDerived

@Deprecated
public MathTransform createBaseToDerived(CoordinateReferenceSystem baseCRS,
                                                    ParameterValueGroup parameters,
                                                    CoordinateSystem derivedCS)
                                  throws NoSuchIdentifierException,
                                         FactoryException
Deprecated. Moved to the MathTransformFactory interface.

Creates a parameterized transform from a base CRS to a derived CS. If the "semi_major" and "semi_minor" parameters are not explicitly specified, they will be inferred from the ellipsoid and added to parameters. In addition, this method performs axis switch as needed.

The operation method used can be obtained by a call to getLastUsedMethod().

Parameters:
baseCRS - The source coordinate reference system.
parameters - The parameter values for the transform.
derivedCS - the target coordinate system.
Returns:
The parameterized transform.
Throws:
NoSuchIdentifierException - if there is no transform registered for the method.
FactoryException - if the object creation failed. This exception is thrown if some required parameter has not been supplied, or has illegal value.
See Also:
MathTransformFactory.createBaseToDerived(org.opengis.referencing.crs.CoordinateReferenceSystem, org.opengis.parameter.ParameterValueGroup, org.opengis.referencing.cs.CoordinateSystem)

createProjectedCRS

@Deprecated
public ProjectedCRS createProjectedCRS(Map<String,?> properties,
                                                  GeographicCRS baseCRS,
                                                  Conversion conversionFromBase,
                                                  CartesianCS derivedCS)
                                throws FactoryException
Deprecated. Moved to the CRSFactory interface.

Creates a projected coordinate reference system from a conversion.

Parameters:
properties - Name and other properties to give to the new object.
baseCRS - Geographic coordinate reference system to base projection on.
conversionFromBase - The defining conversion.
derivedCS - The coordinate system for the projected CRS.
Throws:
FactoryException - if the object creation failed.

createProjectedCRS

@Deprecated
public ProjectedCRS createProjectedCRS(Map<String,?> properties,
                                                  GeographicCRS baseCRS,
                                                  OperationMethod method,
                                                  ParameterValueGroup parameters,
                                                  CartesianCS derivedCS)
                                throws FactoryException
Deprecated. Use CRSFactory#createDefiningConversion followed by CRSFactory.createProjectedCRS(java.util.Map, org.opengis.referencing.crs.GeographicCRS, org.opengis.referencing.operation.Conversion, org.opengis.referencing.cs.CartesianCS) instead.

Creates a projected coordinate reference system from a set of parameters. If the "semi_major" and "semi_minor" parameters are not explicitly specified, they will be inferred from the ellipsoid and added to the parameters. This method also checks for axis order and unit conversions.

Parameters:
properties - Name and other properties to give to the new object.
baseCRS - Geographic coordinate reference system to base projection on.
method - The operation method, or null for a default one.
parameters - The parameter values to give to the projection.
derivedCS - The coordinate system for the projected CRS.
Throws:
FactoryException - if the object creation failed.

toGeodetic3D

public CoordinateReferenceSystem toGeodetic3D(CompoundCRS crs)
                                       throws FactoryException
Converts a 2D + 1D compound CRS into a 3D CRS, if possible. More specifically, if the specified compound CRS is made of a geographic (or projected) and a vertical CRS, and if the vertical CRS datum type is height above the ellipsoid, then this method converts the compound CRS in a single 3D CRS. Otherwise, the crs argument is returned unchanged.

Parameters:
crs - The compound CRS to converts in a 3D geographic or projected CRS.
Returns:
The 3D geographic or projected CRS, or crs if the change can't be applied.
Throws:
FactoryException - if the object creation failed.

separate

public CoordinateReferenceSystem separate(CoordinateReferenceSystem crs,
                                          int[] dimensions)
                                   throws FactoryException
Returns a new coordinate reference system with only the specified dimension. This method is 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.


Copyright © 1996-2014 Geotools. All Rights Reserved.