org.geotools.referencing.factory
Class FactoryGroup

java.lang.Object
  extended byorg.geotools.referencing.factory.FactoryGroup

public class FactoryGroup
extends java.lang.Object

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.1
Version:
$Id: FactoryGroup.java 17902 2006-02-07 09:50:07Z desruisseaux $
Author:
Martin Desruisseaux

Field Summary
static Hints.Key HINT_KEY
          Hint for the instance to use.
 
Constructor Summary
FactoryGroup()
          Constructs an instance using the default factories.
FactoryGroup(org.opengis.referencing.datum.DatumFactory datumFactory, org.opengis.referencing.cs.CSFactory csFactory, org.opengis.referencing.crs.CRSFactory crsFactory, org.opengis.referencing.operation.MathTransformFactory mtFactory)
          Constructs an instance using the specified factories.
FactoryGroup(Hints hints)
          Constructs an instance using the factories initialized with the specified hints.
 
Method Summary
 org.opengis.referencing.operation.MathTransform createBaseToDerived(org.opengis.referencing.crs.CoordinateReferenceSystem baseCRS, org.opengis.parameter.ParameterValueGroup parameters, org.opengis.referencing.cs.CoordinateSystem derivedCS, java.util.Collection methods)
          Creates a parameterized transform from a base CRS to a derived CS.
static FactoryGroup createInstance(Hints hints)
          Creates an instance from the specified hints.
 org.opengis.referencing.operation.MathTransform createParameterizedTransform(org.opengis.parameter.ParameterValueGroup parameters, java.util.Collection methods)
          Creates a transform from a group of parameters and add the method used to a list.
 org.opengis.referencing.crs.ProjectedCRS createProjectedCRS(java.util.Map properties, org.opengis.referencing.crs.GeographicCRS baseCRS, org.opengis.referencing.operation.Conversion conversionFromBase, org.opengis.referencing.cs.CartesianCS derivedCS)
          Creates a projected coordinate reference system from a conversion.
 org.opengis.referencing.crs.ProjectedCRS createProjectedCRS(java.util.Map properties, org.opengis.referencing.crs.GeographicCRS baseCRS, org.opengis.referencing.operation.OperationMethod method, org.opengis.parameter.ParameterValueGroup parameters, org.opengis.referencing.cs.CartesianCS derivedCS)
          Creates a projected coordinate reference system from a set of parameters.
 org.opengis.referencing.operation.CoordinateOperationFactory getCoordinateOperationFactory()
          Returns the coordinate operation factory.
 org.opengis.referencing.crs.CRSFactory getCRSFactory()
          Returns the coordinate reference system factory.
 org.opengis.referencing.cs.CSFactory getCSFactory()
          Returns the coordinate system factory.
 org.opengis.referencing.datum.DatumFactory getDatumFactory()
          Returns the datum factory.
 void getHints(java.util.Map hints)
          Copies in the specified map all values for the CRS, CS, DATUM and MATH_TRANSFORM hints.
 org.opengis.referencing.operation.MathTransformFactory getMathTransformFactory()
          Returns the math transform factory.
 org.opengis.referencing.operation.OperationMethod getOperationMethod(java.lang.String name)
          Returns the operation method for the specified name.
 org.opengis.referencing.crs.CoordinateReferenceSystem separate(org.opengis.referencing.crs.CoordinateReferenceSystem crs, int[] dimensions)
          Returns a new coordinate reference system with only the specified dimension.
 org.opengis.referencing.crs.CoordinateReferenceSystem toGeodetic3D(org.opengis.referencing.crs.CompoundCRS crs)
          Converts a 2D + 1D compound CRS into a 3D CRS, if possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HINT_KEY

public static final Hints.Key HINT_KEY
Hint for the instance to use. This hint is a somewhat low-level details of Geotools implementation, which is why this hint is not listed in the Hints class. The CRS_FACTORY hint and its friend should be suffisient in most cases.

Since:
2.2
See Also:
createInstance(org.geotools.factory.Hints)
Constructor Detail

FactoryGroup

public FactoryGroup()
Constructs an instance using the default factories. Default factories are:
 FactoryFinder.getDatumFactory(null);
 FactoryFinder.getCSFactory(null);
 FactoryFinder.getCRSFactory(null);
 FactoryFinder.MathTransformFactory(null);
 


FactoryGroup

public FactoryGroup(org.opengis.referencing.datum.DatumFactory datumFactory,
                    org.opengis.referencing.cs.CSFactory csFactory,
                    org.opengis.referencing.crs.CRSFactory crsFactory,
                    org.opengis.referencing.operation.MathTransformFactory mtFactory)
Constructs an instance using the specified factories. If any factory is null, a default instance will be created by FactoryFinder when first needed.

Parameters:
datumFactory - The datum factory.
csFactory - The coordinate system factory.
crsFactory - The coordinate reference system factory.
mtFactory - The math transform factory.

FactoryGroup

public FactoryGroup(Hints hints)
Constructs an instance using the factories initialized with the specified hints.

See Also:
createInstance(org.geotools.factory.Hints)
Method Detail

createInstance

public static FactoryGroup createInstance(Hints hints)
Creates an instance from the specified hints. If the hints contains a HINT_KEY value, then the specified factory group will be returned. Otherwise, a new one will be created.

Parameters:
hints - The hints, or if none.
Returns:
A factory group created from the specified set of hints.
Since:
2.2

getHints

public void getHints(java.util.Map hints)
Copies in the specified map all values for the CRS, CS, DATUM and MATH_TRANSFORM hints. A HINT_KEY is put in addition for this instance, but it should be considered as low-level detail. This method is provided as a helper for implementation of Factory.getImplementationHints() methods.

Parameters:
hints - The map to put hints into.
Since:
2.2

getDatumFactory

public org.opengis.referencing.datum.DatumFactory getDatumFactory()
Returns the datum factory.


getCSFactory

public org.opengis.referencing.cs.CSFactory getCSFactory()
Returns the coordinate system factory.


getCRSFactory

public org.opengis.referencing.crs.CRSFactory getCRSFactory()
Returns the coordinate reference system factory.


getCoordinateOperationFactory

public org.opengis.referencing.operation.CoordinateOperationFactory getCoordinateOperationFactory()
Returns the coordinate operation factory.

Since:
2.2

getMathTransformFactory

public org.opengis.referencing.operation.MathTransformFactory getMathTransformFactory()
Returns the math transform factory.


getOperationMethod

public org.opengis.referencing.operation.OperationMethod getOperationMethod(java.lang.String name)
                                                                     throws org.opengis.referencing.NoSuchIdentifierException
Returns the operation method for the specified name. This method scans all operations registered in the current math transform factory.

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

createParameterizedTransform

public org.opengis.referencing.operation.MathTransform createParameterizedTransform(org.opengis.parameter.ParameterValueGroup parameters,
                                                                                    java.util.Collection methods)
                                                                             throws org.opengis.referencing.NoSuchIdentifierException,
                                                                                    org.opengis.referencing.FactoryException
Creates a transform from a group of parameters and add the method used to a list. This variant of provide a way for the client to keep trace of any operation method used by this factory.

Parameters:
parameters - The parameter values.
methods - A collection where to add the operation method that apply to the transform, or if none.
Returns:
The parameterized transform.
Throws:
org.opengis.referencing.NoSuchIdentifierException - if there is no transform registered for the method.
org.opengis.referencing.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

public org.opengis.referencing.operation.MathTransform createBaseToDerived(org.opengis.referencing.crs.CoordinateReferenceSystem baseCRS,
                                                                           org.opengis.parameter.ParameterValueGroup parameters,
                                                                           org.opengis.referencing.cs.CoordinateSystem derivedCS,
                                                                           java.util.Collection methods)
                                                                    throws org.opengis.referencing.NoSuchIdentifierException,
                                                                           org.opengis.referencing.FactoryException
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 . In addition, this method performs axis switch as needed.

Parameters:
baseCRS - The source coordinate reference system.
parameters - The parameter values for the transform.
derivedCS - the target coordinate system.
methods - A collection where to add the operation method that apply to the transform, or if none.
Returns:
The parameterized transform.
Throws:
org.opengis.referencing.NoSuchIdentifierException - if there is no transform registered for the method.
org.opengis.referencing.FactoryException - if the object creation failed. This exception is thrown if some required parameter has not been supplied, or has illegal value.

createProjectedCRS

public org.opengis.referencing.crs.ProjectedCRS createProjectedCRS(java.util.Map properties,
                                                                   org.opengis.referencing.crs.GeographicCRS baseCRS,
                                                                   org.opengis.referencing.operation.Conversion conversionFromBase,
                                                                   org.opengis.referencing.cs.CartesianCS derivedCS)
                                                            throws org.opengis.referencing.FactoryException
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:
org.opengis.referencing.FactoryException - if the object creation failed.
To Do:
Current implementation creates directly a Geotools implementation, because there is not yet a suitable method in GeoAPI interfaces.

createProjectedCRS

public org.opengis.referencing.crs.ProjectedCRS createProjectedCRS(java.util.Map properties,
                                                                   org.opengis.referencing.crs.GeographicCRS baseCRS,
                                                                   org.opengis.referencing.operation.OperationMethod method,
                                                                   org.opengis.parameter.ParameterValueGroup parameters,
                                                                   org.opengis.referencing.cs.CartesianCS derivedCS)
                                                            throws org.opengis.referencing.FactoryException
Creates a projected coordinate reference system from a set of parameters. If the and parameters are not explicitly specified, they will be inferred from the ellipsoid and added to the . 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 for a default one.
parameters - The parameter values to give to the projection.
derivedCS - The coordinate system for the projected CRS.
Throws:
org.opengis.referencing.FactoryException - if the object creation failed.

toGeodetic3D

public org.opengis.referencing.crs.CoordinateReferenceSystem toGeodetic3D(org.opengis.referencing.crs.CompoundCRS crs)
                                                                   throws org.opengis.referencing.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 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 if the change can't be applied.
Throws:
org.opengis.referencing.FactoryException - if the object creation failed.

separate

public org.opengis.referencing.crs.CoordinateReferenceSystem separate(org.opengis.referencing.crs.CoordinateReferenceSystem crs,
                                                                      int[] dimensions)
                                                               throws org.opengis.referencing.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:
org.opengis.referencing.FactoryException


Copyright © GeoTools. All Rights Reserved.