org.geotools.referencing.operation
Class DefaultCoordinateOperationFactory

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

public class DefaultCoordinateOperationFactory
extends AbstractCoordinateOperationFactory

Creates coordinate operations. This factory is capable to find coordinate transformations or conversions between two coordinate reference systems. It delegates most of its work to one or many of methods. Subclasses can override those methods in order to extend the factory capability to some more CRS.

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

Field Summary
 
Fields inherited from class org.geotools.referencing.operation.AbstractCoordinateOperationFactory
AXIS_CHANGES, DATUM_SHIFT, ELLIPSOID_SHIFT, GEOCENTRIC_CONVERSION, IDENTITY, INVERSE_OPERATION, mtFactory
 
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
DefaultCoordinateOperationFactory()
          Constructs a coordinate operation factory using the default factories.
DefaultCoordinateOperationFactory(Hints hints)
          Constructs a coordinate operation factory using the specified hints.
DefaultCoordinateOperationFactory(Hints hints, int priority)
          Constructs a coordinate operation factory using the specified hints and priority.
 
Method Summary
 org.opengis.referencing.operation.CoordinateOperation createOperation(org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS, org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS)
          Returns an operation for conversion or transformation between two coordinate reference systems.
 org.opengis.referencing.operation.CoordinateOperation createOperation(org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS, org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS, org.opengis.referencing.operation.OperationMethod method)
          Deprecated. Current implementation ignore the argument.
protected  org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.CompoundCRS sourceCRS, org.opengis.referencing.crs.CompoundCRS targetCRS)
          Creates an operation between two compound coordinate reference systems.
protected  org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.CompoundCRS sourceCRS, org.opengis.referencing.crs.SingleCRS targetCRS)
          Creates an operation from a compound to a single coordinate reference systems.
protected  org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.GeocentricCRS sourceCRS, org.opengis.referencing.crs.GeocentricCRS targetCRS)
          Creates an operation between two geocentric coordinate reference systems.
protected  org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.GeocentricCRS sourceCRS, org.opengis.referencing.crs.GeographicCRS targetCRS)
          Creates an operation from a geocentric to a geographic coordinate reference systems.
protected  org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.GeographicCRS sourceCRS, org.opengis.referencing.crs.GeocentricCRS targetCRS)
          Creates an operation from a geographic to a geocentric coordinate reference systems.
protected  org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.GeographicCRS sourceCRS, org.opengis.referencing.crs.GeographicCRS targetCRS)
          Creates an operation between two geographic coordinate reference systems.
protected  org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.GeographicCRS sourceCRS, org.opengis.referencing.crs.ProjectedCRS targetCRS)
          Creates an operation from a geographic to a projected coordinate reference system.
protected  org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.GeographicCRS sourceCRS, org.opengis.referencing.crs.VerticalCRS targetCRS)
          Creates an operation between a geographic and a vertical coordinate reference systems.
protected  org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.ProjectedCRS sourceCRS, org.opengis.referencing.crs.GeographicCRS targetCRS)
          Creates an operation from a projected to a geographic coordinate reference system.
protected  org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.ProjectedCRS sourceCRS, org.opengis.referencing.crs.ProjectedCRS targetCRS)
          Creates an operation between two projected coordinate reference systems.
protected  org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.SingleCRS sourceCRS, org.opengis.referencing.crs.CompoundCRS targetCRS)
          Creates an operation from a single to a compound coordinate reference system.
protected  org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.TemporalCRS sourceCRS, org.opengis.referencing.crs.TemporalCRS targetCRS)
          Creates an operation between two temporal coordinate reference systems.
protected  org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.VerticalCRS sourceCRS, org.opengis.referencing.crs.VerticalCRS targetCRS)
          Creates an operation between two vertical coordinate reference systems.
 
Methods inherited from class org.geotools.referencing.operation.AbstractCoordinateOperationFactory
concatenate, concatenate, createConcatenatedOperation, createFromAffineTransform, createFromMathTransform, createFromMathTransform, createFromParameters, ensureNonNull, getErrorMessage, getImplementationHints, getMathTransformFactory, swapAndScaleAxis
 
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.Factory
getVendor
 

Constructor Detail

DefaultCoordinateOperationFactory

public DefaultCoordinateOperationFactory()
Constructs a coordinate operation factory using the default factories.


DefaultCoordinateOperationFactory

public DefaultCoordinateOperationFactory(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.

DefaultCoordinateOperationFactory

public DefaultCoordinateOperationFactory(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

createOperation

public org.opengis.referencing.operation.CoordinateOperation createOperation(org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS,
                                                                             org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS)
                                                                      throws org.opengis.referencing.operation.OperationNotFoundException,
                                                                             org.opengis.referencing.FactoryException
Returns an operation for conversion or transformation between two coordinate reference systems. If an operation exists, it is returned. If more than one operation exists, the default is returned. If no operation exists, then the exception is thrown.

The default implementation inspects the CRS and delegates the work to one or many methods. This method fails if no path between the CRS is found.

Parameters:
sourceCRS - Input coordinate reference system.
targetCRS - Output coordinate reference system.
Returns:
A coordinate operation from to .
Throws:
org.opengis.referencing.operation.OperationNotFoundException - if no operation path was found from to .
org.opengis.referencing.FactoryException - if the operation creation failed for some other reason.

createOperation

public org.opengis.referencing.operation.CoordinateOperation createOperation(org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS,
                                                                             org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS,
                                                                             org.opengis.referencing.operation.OperationMethod method)
                                                                      throws org.opengis.referencing.operation.OperationNotFoundException,
                                                                             org.opengis.referencing.FactoryException
Deprecated. Current implementation ignore the argument.

Returns an operation using a particular method for conversion or transformation between two coordinate reference systems. If the operation exists on the implementation, then it is returned. If the operation does not exist on the implementation, then the implementation has the option of inferring the operation from the argument objects. If for whatever reason the specified operation will not be returned, then the exception is thrown.

Parameters:
sourceCRS - Input coordinate reference system.
targetCRS - Output coordinate reference system.
method - the algorithmic method for conversion or transformation
Throws:
org.opengis.referencing.operation.OperationNotFoundException - if no operation path was found from to .
org.opengis.referencing.FactoryException - if the operation creation failed for some other reason.

createOperationStep

protected org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.TemporalCRS sourceCRS,
                                                                                    org.opengis.referencing.crs.TemporalCRS targetCRS)
                                                                             throws org.opengis.referencing.FactoryException
Creates an operation between two temporal coordinate reference systems. The default implementation checks if both CRS use the same datum, and then adjusts for axis direction, units and epoch.

Parameters:
sourceCRS - Input coordinate reference system.
targetCRS - Output coordinate reference system.
Returns:
A coordinate operation from to .
Throws:
org.opengis.referencing.FactoryException - If the operation can't be constructed.

createOperationStep

protected org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.VerticalCRS sourceCRS,
                                                                                    org.opengis.referencing.crs.VerticalCRS targetCRS)
                                                                             throws org.opengis.referencing.FactoryException
Creates an operation between two vertical coordinate reference systems. The default implementation checks if both CRS use the same datum, and then adjusts for axis direction and units.

Parameters:
sourceCRS - Input coordinate reference system.
targetCRS - Output coordinate reference system.
Returns:
A coordinate operation from to .
Throws:
org.opengis.referencing.FactoryException - If the operation can't be constructed.

createOperationStep

protected org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.GeographicCRS sourceCRS,
                                                                                    org.opengis.referencing.crs.VerticalCRS targetCRS)
                                                                             throws org.opengis.referencing.FactoryException
Creates an operation between a geographic and a vertical coordinate reference systems. The default implementation accepts the conversion only if the geographic CRS is a tri dimensional one and the vertical CRS is for height above the ellipsoid. More elaborated operation, like transformation from ellipsoidal to geoidal height, should be implemented here.

Parameters:
sourceCRS - Input coordinate reference system.
targetCRS - Output coordinate reference system.
Returns:
A coordinate operation from to .
Throws:
org.opengis.referencing.FactoryException - If the operation can't be constructed.
To Do:
Implement GEOT-352 here.

createOperationStep

protected org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.GeographicCRS sourceCRS,
                                                                                    org.opengis.referencing.crs.GeographicCRS targetCRS)
                                                                             throws org.opengis.referencing.FactoryException
Creates an operation between two geographic coordinate reference systems. The default implementation can adjust axis order and orientation (e.g. transforming from to ), performs units conversion and apply datum shifts if needed.

Parameters:
sourceCRS - Input coordinate reference system.
targetCRS - Output coordinate reference system.
Returns:
A coordinate operation from to .
Throws:
org.opengis.referencing.FactoryException - If the operation can't be constructed.
To Do:
When rotating the prime meridian, we should ensure that transformed longitudes stay in the range [-180..+180?].

createOperationStep

protected org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.ProjectedCRS sourceCRS,
                                                                                    org.opengis.referencing.crs.ProjectedCRS targetCRS)
                                                                             throws org.opengis.referencing.FactoryException
Creates an operation between two projected coordinate reference systems. The default implementation can adjust axis order and orientation. It also performs units conversion if it is the only extra change needed. Otherwise, it performs three steps:

Parameters:
sourceCRS - Input coordinate reference system.
targetCRS - Output coordinate reference system.
Returns:
A coordinate operation from to .
Throws:
org.opengis.referencing.FactoryException - If the operation can't be constructed.

createOperationStep

protected org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.GeographicCRS sourceCRS,
                                                                                    org.opengis.referencing.crs.ProjectedCRS targetCRS)
                                                                             throws org.opengis.referencing.FactoryException
Creates an operation from a geographic to a projected coordinate reference system. The default implementation constructs the following operation chain:
 sourceCRS  →  baseCRS  →  targetCRS
 
where the conversion from to is obtained from targetCRS.getConversionFromBase().

Parameters:
sourceCRS - Input coordinate reference system.
targetCRS - Output coordinate reference system.
Returns:
A coordinate operation from to .
Throws:
org.opengis.referencing.FactoryException - If the operation can't be constructed.

createOperationStep

protected org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.ProjectedCRS sourceCRS,
                                                                                    org.opengis.referencing.crs.GeographicCRS targetCRS)
                                                                             throws org.opengis.referencing.FactoryException
Creates an operation from a projected to a geographic coordinate reference system. The default implementation constructs the following operation chain:
 sourceCRS  →  baseCRS  →  targetCRS
 
where the conversion from to is obtained from the inverse of sourceCRS.getConversionFromBase().

Parameters:
sourceCRS - Input coordinate reference system.
targetCRS - Output coordinate reference system.
Returns:
A coordinate operation from to .
Throws:
org.opengis.referencing.FactoryException - If the operation can't be constructed.
To Do:
Provides a non-null method.

createOperationStep

protected org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.GeocentricCRS sourceCRS,
                                                                                    org.opengis.referencing.crs.GeocentricCRS targetCRS)
                                                                             throws org.opengis.referencing.FactoryException
Creates an operation between two geocentric coordinate reference systems. The default implementation can adjust for axis order and orientation, performs units conversion and apply Bursa Wolf transformation if needed.

Parameters:
sourceCRS - Input coordinate reference system.
targetCRS - Output coordinate reference system.
Returns:
A coordinate operation from to .
Throws:
org.opengis.referencing.FactoryException - If the operation can't be constructed.
To Do:
Rotation of prime meridian not yet implemented., Transformation version set to "(unknow)". We should search this information somewhere.

createOperationStep

protected org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.GeographicCRS sourceCRS,
                                                                                    org.opengis.referencing.crs.GeocentricCRS targetCRS)
                                                                             throws org.opengis.referencing.FactoryException
Creates an operation from a geographic to a geocentric coordinate reference systems. If the source CRS doesn't have a vertical axis, height above the ellipsoid will be assumed equals to zero everywhere. The default implementation uses the math transform.

Parameters:
sourceCRS - Input coordinate reference system.
targetCRS - Output coordinate reference system.
Returns:
A coordinate operation from to .
Throws:
org.opengis.referencing.FactoryException - If the operation can't be constructed.

createOperationStep

protected org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.GeocentricCRS sourceCRS,
                                                                                    org.opengis.referencing.crs.GeographicCRS targetCRS)
                                                                             throws org.opengis.referencing.FactoryException
Creates an operation from a geocentric to a geographic coordinate reference systems. The default implementation use the "Geocentric_To_Ellipsoid" math transform.

Parameters:
sourceCRS - Input coordinate reference system.
targetCRS - Output coordinate reference system.
Returns:
A coordinate operation from to .
Throws:
org.opengis.referencing.FactoryException - If the operation can't be constructed.

createOperationStep

protected org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.CompoundCRS sourceCRS,
                                                                                    org.opengis.referencing.crs.SingleCRS targetCRS)
                                                                             throws org.opengis.referencing.FactoryException
Creates an operation from a compound to a single coordinate reference systems.

Parameters:
sourceCRS - Input coordinate reference system.
targetCRS - Output coordinate reference system.
Returns:
A coordinate operation from to .
Throws:
org.opengis.referencing.FactoryException - If the operation can't be constructed.
To Do:
(GEOT-401) This method work for some simple cases (e.g. no datum change), and give up otherwise. Before to give up at the end of this method, we should try the following:
  • Maybe uses a non-ellipsoidal height. We should replace the non-ellipsoidal height by an ellipsoidal one, create a transformation step for that (to be concatenated), and then try again this operation step.
  • Maybe contains some extra axis, like a temporal CRS. We should revisit this code in other to lets supplemental ordinates to be pass through or removed.

createOperationStep

protected org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.SingleCRS sourceCRS,
                                                                                    org.opengis.referencing.crs.CompoundCRS targetCRS)
                                                                             throws org.opengis.referencing.FactoryException
Creates an operation from a single to a compound coordinate reference system.

Parameters:
sourceCRS - Input coordinate reference system.
targetCRS - Output coordinate reference system.
Returns:
A coordinate operation from to .
Throws:
org.opengis.referencing.FactoryException - If the operation can't be constructed.

createOperationStep

protected org.opengis.referencing.operation.CoordinateOperation createOperationStep(org.opengis.referencing.crs.CompoundCRS sourceCRS,
                                                                                    org.opengis.referencing.crs.CompoundCRS targetCRS)
                                                                             throws org.opengis.referencing.FactoryException
Creates an operation between two compound coordinate reference systems.

Parameters:
sourceCRS - Input coordinate reference system.
targetCRS - Output coordinate reference system.
Returns:
A coordinate operation from to .
Throws:
org.opengis.referencing.FactoryException - If the operation can't be constructed.


Copyright © GeoTools. All Rights Reserved.