org.geotools.referencing.operation
Class AbstractCoordinateOperationFactory

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

public abstract class AbstractCoordinateOperationFactory
extends ReferencingFactory
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 30760 2008-06-18 14:28:24Z desruisseaux $
Author:
Martin Desruisseaux (IRD)

Field Summary
protected static org.opengis.referencing.ReferenceIdentifier AXIS_CHANGES
          The identifier for conversion using an affine transform for axis swapping and/or unit conversions.
protected static org.opengis.referencing.ReferenceIdentifier DATUM_SHIFT
          The identifier for a transformation which is a datum shift.
protected static org.opengis.referencing.ReferenceIdentifier ELLIPSOID_SHIFT
          The identifier for a transformation which is a datum shift without Bursa Wolf parameters.
protected static org.opengis.referencing.ReferenceIdentifier GEOCENTRIC_CONVERSION
          The identifier for a geocentric conversion.
protected static org.opengis.referencing.ReferenceIdentifier IDENTITY
          The identifier for an identity operation.
protected static org.opengis.referencing.ReferenceIdentifier INVERSE_OPERATION
          The identifier for an inverse operation.
 
Fields inherited from class org.geotools.referencing.factory.ReferencingFactory
LOGGER
 
Fields inherited from class org.geotools.factory.AbstractFactory
hints, MAXIMUM_PRIORITY, MINIMUM_PRIORITY, NORMAL_PRIORITY, priority
 
Constructor Summary
AbstractCoordinateOperationFactory(Hints userHints)
          Constructs a coordinate operation factory using the specified hints.
AbstractCoordinateOperationFactory(Hints userHints, 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<java.lang.String,?> properties, org.opengis.referencing.operation.CoordinateOperation[] operations)
          Creates a concatenated operation from a sequence of operations.
 org.opengis.referencing.operation.Conversion createDefiningConversion(java.util.Map<java.lang.String,?> properties, org.opengis.referencing.operation.OperationMethod method, org.opengis.parameter.ParameterValueGroup parameters)
          Constructs a defining conversion from a set of properties.
protected  org.opengis.referencing.operation.CoordinateOperation createFromAffineTransform(org.opengis.referencing.ReferenceIdentifier 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(java.util.Map<java.lang.String,?> 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<? extends org.opengis.referencing.operation.CoordinateOperation> type)
          Creates a coordinate operation from a math transform.
protected  org.opengis.referencing.operation.CoordinateOperation createFromMathTransform(org.opengis.referencing.ReferenceIdentifier 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 createFromParameters(org.opengis.referencing.ReferenceIdentifier 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<java.awt.RenderingHints.Key,?> 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.CoordinateOperation inverse(org.opengis.referencing.operation.CoordinateOperation operation)
          Returns the inverse of the specified operation.
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.ReferencingFactory
getVendor
 
Methods inherited from class org.geotools.factory.AbstractFactory
addImplementationHints, equals, getPriority, hashCode, onDeregistration, onRegistration, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, 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.referencing.ReferenceIdentifier IDENTITY
The identifier for an identity operation.


AXIS_CHANGES

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


DATUM_SHIFT

protected static final org.opengis.referencing.ReferenceIdentifier 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.referencing.ReferenceIdentifier 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.referencing.ReferenceIdentifier GEOCENTRIC_CONVERSION
The identifier for a geocentric conversion.


INVERSE_OPERATION

protected static final org.opengis.referencing.ReferenceIdentifier INVERSE_OPERATION
The identifier for an inverse operation.

Constructor Detail

AbstractCoordinateOperationFactory

public AbstractCoordinateOperationFactory(Hints userHints)
Constructs a coordinate operation factory using the specified hints. This constructor recognizes the CRS, CS, DATUM and MATH_TRANSFORM FACTORY hints.

Parameters:
userHints - The hints, or null if none.

AbstractCoordinateOperationFactory

public AbstractCoordinateOperationFactory(Hints userHints,
                                          int priority)
Constructs a coordinate operation factory using the specified hints and priority. This constructor recognizes the CRS, CS, DATUM and MATH_TRANSFORM FACTORY hints.

Parameters:
userHints - The hints, or null 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<java.awt.RenderingHints.Key,?> getImplementationHints()
Returns the implementation hints for this factory. The returned map contains values for CRS, CS, DATUM and MATH_TRANSFORM FACTORY 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.

Returns:
The underlying math transform factory.

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 sourceCS are (x,y) pairs in metres and coordinates in targetCS 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 sourceCS to targetCS 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.referencing.ReferenceIdentifier 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 name 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.referencing.ReferenceIdentifier 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.referencing.ReferenceIdentifier 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<java.lang.String,?> 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<? extends org.opengis.referencing.operation.CoordinateOperation> 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 transform 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 null.
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.

createDefiningConversion

public org.opengis.referencing.operation.Conversion createDefiningConversion(java.util.Map<java.lang.String,?> properties,
                                                                             org.opengis.referencing.operation.OperationMethod method,
                                                                             org.opengis.parameter.ParameterValueGroup parameters)
                                                                      throws org.opengis.referencing.FactoryException
Constructs a defining conversion from a set of properties.

Specified by:
createDefiningConversion in interface org.opengis.referencing.operation.CoordinateOperationFactory
Parameters:
properties - Set of properties. Should contains at least "name".
method - The operation method.
parameters - The parameter values.
Returns:
The defining conversion.
Throws:
org.opengis.referencing.FactoryException - if the object creation failed.
Since:
2.5
See Also:
DefiningConversion

createConcatenatedOperation

public org.opengis.referencing.operation.CoordinateOperation createConcatenatedOperation(java.util.Map<java.lang.String,?> 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 "name".
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 null for the identity operation.
step2 - The second step, or null for the identity operation.
Returns:
A concatenated operation, or null 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 null for the identity operation.
step2 - The second step, or null for the identity operation.
step3 - The third step, or null for the identity operation.
Returns:
A concatenated operation, or null if all arguments were null.
Throws:
org.opengis.referencing.FactoryException - if the operation can't be constructed.

inverse

protected org.opengis.referencing.operation.CoordinateOperation inverse(org.opengis.referencing.operation.CoordinateOperation operation)
                                                                 throws org.opengis.referencing.operation.NoninvertibleTransformException,
                                                                        org.opengis.referencing.FactoryException
Returns the inverse of the specified operation.

Parameters:
operation - The operation to invert.
Returns:
The inverse of operation.
Throws:
org.opengis.referencing.operation.NoninvertibleTransformException - if the operation is not invertible.
org.opengis.referencing.FactoryException - if the operation creation failed for an other reason.
Since:
2.3

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 object is null.


Copyright © 1996-2010 Geotools. All Rights Reserved.