org.geotools.referencing.operation
Class AbstractCoordinateOperationFactory

java.lang.Object
  extended byorg.geotools.factory.AbstractFactory
      extended byorg.geotools.referencing.factory.AbstractFactory
          extended byorg.geotools.referencing.operation.AbstractCoordinateOperationFactory
All Implemented Interfaces:
org.opengis.referencing.operation.CoordinateOperationFactory, Factory, org.opengis.referencing.Factory, org.opengis.referencing.ObjectFactory, javax.imageio.spi.RegisterableService
Direct Known Subclasses:
DefaultCoordinateOperationFactory

public abstract class AbstractCoordinateOperationFactory
extends AbstractFactory
implements org.opengis.referencing.operation.CoordinateOperationFactory

Base class for coordinate operation factories. This class provides helper methods for the construction of building blocks. It doesn't figure out any operation path by itself. This more "intelligent" job is left to subclasses.

Since:
2.1
Version:
$Id: AbstractCoordinateOperationFactory.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux

Field Summary
protected static org.opengis.metadata.Identifier AXIS_CHANGES
          The identifier for conversion using an affine transform for axis swapping and/or unit conversions.
protected static org.opengis.metadata.Identifier DATUM_SHIFT
          The identifier for a transformation which is a datum shift.
protected static org.opengis.metadata.Identifier ELLIPSOID_SHIFT
          The identifier for a transformation which is a datum shift without Bursa Wolf parameters.
protected static org.opengis.metadata.Identifier GEOCENTRIC_CONVERSION
          The identifier for a geocentric conversion.
protected static org.opengis.metadata.Identifier IDENTITY
          The identifier for an identity operation.
protected static org.opengis.metadata.Identifier INVERSE_OPERATION
          The identifier for an inverse operation.
protected  org.opengis.referencing.operation.MathTransformFactory mtFactory
          The underlying math transform factory.
 
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
AbstractCoordinateOperationFactory(Hints hints)
          Constructs a coordinate operation factory using the specified hints.
AbstractCoordinateOperationFactory(Hints hints, int priority)
          Constructs a coordinate operation factory using the specified hints and priority.
 
Method Summary
protected  org.opengis.referencing.operation.CoordinateOperation concatenate(org.opengis.referencing.operation.CoordinateOperation step1, org.opengis.referencing.operation.CoordinateOperation step2)
          Concatenate two operation steps.
protected  org.opengis.referencing.operation.CoordinateOperation concatenate(org.opengis.referencing.operation.CoordinateOperation step1, org.opengis.referencing.operation.CoordinateOperation step2, org.opengis.referencing.operation.CoordinateOperation step3)
          Concatenate three transformation steps.
 org.opengis.referencing.operation.CoordinateOperation createConcatenatedOperation(java.util.Map properties, org.opengis.referencing.operation.CoordinateOperation[] operations)
          Creates a concatenated operation from a sequence of operations.
protected  org.opengis.referencing.operation.CoordinateOperation createFromAffineTransform(org.opengis.metadata.Identifier name, org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS, org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS, org.opengis.referencing.operation.Matrix matrix)
          Creates a coordinate operation from a matrix, which usually describes an affine tranform.
protected  org.opengis.referencing.operation.CoordinateOperation createFromMathTransform(org.opengis.metadata.Identifier name, org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS, org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS, org.opengis.referencing.operation.MathTransform transform)
          Creates a coordinate operation from a math transform.
protected  org.opengis.referencing.operation.CoordinateOperation createFromMathTransform(java.util.Map properties, org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS, org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS, org.opengis.referencing.operation.MathTransform transform, org.opengis.referencing.operation.OperationMethod method, java.lang.Class type)
          Creates a coordinate operation from a math transform.
protected  org.opengis.referencing.operation.CoordinateOperation createFromParameters(org.opengis.metadata.Identifier name, org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS, org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS, org.opengis.parameter.ParameterValueGroup parameters)
          Creates a coordinate operation from a set of parameters.
protected static void ensureNonNull(java.lang.String name, java.lang.Object object)
          Makes sure an argument is non-null.
protected static java.lang.String getErrorMessage(org.opengis.referencing.IdentifiedObject source, org.opengis.referencing.IdentifiedObject target)
          Returns an error message for "No path found from sourceCRS to targetCRS".
 java.util.Map getImplementationHints()
          Returns the implementation hints for this factory.
 org.opengis.referencing.operation.MathTransformFactory getMathTransformFactory()
          Returns the underlying math transform factory.
protected  org.opengis.referencing.operation.Matrix swapAndScaleAxis(org.opengis.referencing.cs.CoordinateSystem sourceCS, org.opengis.referencing.cs.CoordinateSystem targetCS)
          Returns an affine transform between two coordinate systems.
 
Methods inherited from class org.geotools.referencing.factory.AbstractFactory
getVendor
 
Methods inherited from class org.geotools.factory.AbstractFactory
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.operation.CoordinateOperationFactory
createOperation, createOperation
 
Methods inherited from interface org.opengis.referencing.Factory
getVendor
 

Field Detail

IDENTITY

protected static final org.opengis.metadata.Identifier IDENTITY
The identifier for an identity operation.


AXIS_CHANGES

protected static final org.opengis.metadata.Identifier AXIS_CHANGES
The identifier for conversion using an affine transform for axis swapping and/or unit conversions.


DATUM_SHIFT

protected static final org.opengis.metadata.Identifier DATUM_SHIFT
The identifier for a transformation which is a datum shift.

See Also:
PositionalAccuracyImpl.DATUM_SHIFT_APPLIED

ELLIPSOID_SHIFT

protected static final org.opengis.metadata.Identifier ELLIPSOID_SHIFT
The identifier for a transformation which is a datum shift without Bursa Wolf parameters. Only the changes in ellipsoid axis-length are taken in account. Such ellipsoid shifts are approximative and may have 1 kilometer error. This transformation is allowed only if the factory was created with Hints.LENIENT_DATUM_SHIFT set to Boolean.TRUE.

See Also:
PositionalAccuracyImpl.DATUM_SHIFT_OMITTED

GEOCENTRIC_CONVERSION

protected static final org.opengis.metadata.Identifier GEOCENTRIC_CONVERSION
The identifier for a geocentric conversion.


INVERSE_OPERATION

protected static final org.opengis.metadata.Identifier INVERSE_OPERATION
The identifier for an inverse operation.


mtFactory

protected final org.opengis.referencing.operation.MathTransformFactory mtFactory
The underlying math transform factory. This factory is used for constructing MathTransform objects for all coordinate operations.

Constructor Detail

AbstractCoordinateOperationFactory

public AbstractCoordinateOperationFactory(Hints hints)
Constructs a coordinate operation factory using the specified hints. This constructor recognizes the CRS, CS, DATUM and MATH_TRANSFORM hints. In addition, the FactoryGroup.HINT_KEY hint may be used as a low-level substitute for all the above.

Parameters:
hints - The hints, or if none.

AbstractCoordinateOperationFactory

public AbstractCoordinateOperationFactory(Hints hints,
                                          int priority)
Constructs a coordinate operation factory using the specified hints and priority. This constructor recognizes the CRS, CS, DATUM and MATH_TRANSFORM hints. In addition, the FactoryGroup.HINT_KEY hint may be used as a low-level substitute for all the above.

Parameters:
hints - The hints, or if none.
priority - The priority for this factory, as a number between MINIMUM_PRIORITY and MAXIMUM_PRIORITY inclusive.
Since:
2.2
Method Detail

getImplementationHints

public java.util.Map getImplementationHints()
Returns the implementation hints for this factory. The returned map contains values for CRS, CS, DATUM and MATH_TRANSFORM hints. Other values may be provided as well, at implementation choice.

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

getMathTransformFactory

public final org.opengis.referencing.operation.MathTransformFactory getMathTransformFactory()
Returns the underlying math transform factory. This factory is used for constructing MathTransform objects for all coordinate operations.


swapAndScaleAxis

protected org.opengis.referencing.operation.Matrix swapAndScaleAxis(org.opengis.referencing.cs.CoordinateSystem sourceCS,
                                                                    org.opengis.referencing.cs.CoordinateSystem targetCS)
                                                             throws org.opengis.referencing.operation.OperationNotFoundException
Returns an affine transform between two coordinate systems. Only units and axis order (e.g. transforming from (NORTH,WEST) to (EAST,NORTH)) are taken in account.

Example: If coordinates in are (x,y) pairs in metres and coordinates in are (-y,x) pairs in centimetres, then the transformation can be performed as below:

[-y(cm)] [ 0 -100 0 ] [x(m)] [ x(cm)] = [ 100 0 0 ] [y(m)] [ 1 ] [ 0 0 1 ] [1 ]

Parameters:
sourceCS - The source coordinate system.
targetCS - The target coordinate system.
Returns:
The transformation from to as an affine transform. Only axis orientation and units are taken in account.
Throws:
org.opengis.referencing.operation.OperationNotFoundException - If the affine transform can't be constructed.
See Also:
AbstractCS.swapAndScaleAxis(org.opengis.referencing.cs.CoordinateSystem, org.opengis.referencing.cs.CoordinateSystem)

createFromAffineTransform

protected org.opengis.referencing.operation.CoordinateOperation createFromAffineTransform(org.opengis.metadata.Identifier name,
                                                                                          org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS,
                                                                                          org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS,
                                                                                          org.opengis.referencing.operation.Matrix matrix)
                                                                                   throws org.opengis.referencing.FactoryException
Creates a coordinate operation from a matrix, which usually describes an affine tranform. A default OperationMethod object is given to this transform. In the special case where the identifier is DATUM_SHIFT or ELLIPSOID_SHIFT, the operation will be an instance of Transformation instead of the usual Conversion.

Parameters:
name - The identifier for the operation to be created.
sourceCRS - The source coordinate reference system.
targetCRS - The target coordinate reference system.
matrix - The matrix which describe an affine transform operation.
Returns:
The conversion or transformation.
Throws:
org.opengis.referencing.FactoryException - if the operation can't be created.

createFromParameters

protected org.opengis.referencing.operation.CoordinateOperation createFromParameters(org.opengis.metadata.Identifier name,
                                                                                     org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS,
                                                                                     org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS,
                                                                                     org.opengis.parameter.ParameterValueGroup parameters)
                                                                              throws org.opengis.referencing.FactoryException
Creates a coordinate operation from a set of parameters. The operation method is inferred automatically, if possible.

Parameters:
name - The identifier for the operation to be created.
sourceCRS - The source coordinate reference system.
targetCRS - The target coordinate reference system.
parameters - The parameters.
Returns:
The conversion or transformation.
Throws:
org.opengis.referencing.FactoryException - if the operation can't be created.

createFromMathTransform

protected org.opengis.referencing.operation.CoordinateOperation createFromMathTransform(org.opengis.metadata.Identifier name,
                                                                                        org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS,
                                                                                        org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS,
                                                                                        org.opengis.referencing.operation.MathTransform transform)
                                                                                 throws org.opengis.referencing.FactoryException
Creates a coordinate operation from a math transform.

Parameters:
name - The identifier for the operation to be created.
sourceCRS - The source coordinate reference system.
targetCRS - The destination coordinate reference system.
transform - The math transform.
Returns:
A coordinate operation using the specified math transform.
Throws:
org.opengis.referencing.FactoryException - if the operation can't be constructed.

createFromMathTransform

protected org.opengis.referencing.operation.CoordinateOperation createFromMathTransform(java.util.Map properties,
                                                                                        org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS,
                                                                                        org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS,
                                                                                        org.opengis.referencing.operation.MathTransform transform,
                                                                                        org.opengis.referencing.operation.OperationMethod method,
                                                                                        java.lang.Class type)
                                                                                 throws org.opengis.referencing.FactoryException
Creates a coordinate operation from a math transform. If the specified math transform is already a coordinate operation, and if source and target CRS match, then is returned with no change. Otherwise, a new coordinate operation is created.

Parameters:
properties - The properties to give to the operation.
sourceCRS - The source coordinate reference system.
targetCRS - The destination coordinate reference system.
transform - The math transform.
method - The operation method, or .
type - The required super-class (e.g. Transformation.class).
Returns:
A coordinate operation using the specified math transform.
Throws:
org.opengis.referencing.FactoryException - if the operation can't be constructed.

createConcatenatedOperation

public org.opengis.referencing.operation.CoordinateOperation createConcatenatedOperation(java.util.Map properties,
                                                                                         org.opengis.referencing.operation.CoordinateOperation[] operations)
                                                                                  throws org.opengis.referencing.FactoryException
Creates a concatenated operation from a sequence of operations.

Specified by:
createConcatenatedOperation in interface org.opengis.referencing.operation.CoordinateOperationFactory
Parameters:
properties - Set of properties. Should contains at least .
operations - The sequence of operations.
Returns:
The concatenated operation.
Throws:
org.opengis.referencing.FactoryException - if the object creation failed.

concatenate

protected org.opengis.referencing.operation.CoordinateOperation concatenate(org.opengis.referencing.operation.CoordinateOperation step1,
                                                                            org.opengis.referencing.operation.CoordinateOperation step2)
                                                                     throws org.opengis.referencing.FactoryException
Concatenate two operation steps. If an operation is an AXIS_CHANGES, it will be included as part of the second operation instead of creating an ConcatenatedOperation. If a concatenated operation is created, it will get an automatically generated name.

Parameters:
step1 - The first step, or for the identity operation.
step2 - The second step, or for the identity operation.
Returns:
A concatenated operation, or if all arguments was nul.
Throws:
org.opengis.referencing.FactoryException - if the operation can't be constructed.

concatenate

protected org.opengis.referencing.operation.CoordinateOperation concatenate(org.opengis.referencing.operation.CoordinateOperation step1,
                                                                            org.opengis.referencing.operation.CoordinateOperation step2,
                                                                            org.opengis.referencing.operation.CoordinateOperation step3)
                                                                     throws org.opengis.referencing.FactoryException
Concatenate three transformation steps. If the first and/or the last operation is an AXIS_CHANGES, it will be included as part of the second operation instead of creating an ConcatenatedOperation. If a concatenated operation is created, it will get an automatically generated name.

Parameters:
step1 - The first step, or for the identity operation.
step2 - The second step, or for the identity operation.
step3 - The third step, or for the identity operation.
Returns:
A concatenated operation, or if all arguments were null.
Throws:
org.opengis.referencing.FactoryException - if the operation can't be constructed.

getErrorMessage

protected static java.lang.String getErrorMessage(org.opengis.referencing.IdentifiedObject source,
                                                  org.opengis.referencing.IdentifiedObject target)
Returns an error message for "No path found from sourceCRS to targetCRS". This is used for the construction of OperationNotFoundException.

Parameters:
source - The source CRS.
target - The target CRS.
Returns:
A default error message.

ensureNonNull

protected static void ensureNonNull(java.lang.String name,
                                    java.lang.Object object)
                             throws java.lang.IllegalArgumentException
Makes sure an argument is non-null.

Parameters:
name - Argument name.
object - User argument.
Throws:
java.lang.IllegalArgumentException - if is null.


Copyright © GeoTools. All Rights Reserved.