Class AuthorityBackedFactory
- Object
-
- AbstractFactory
-
- ReferencingFactory
-
- AbstractCoordinateOperationFactory
-
- DefaultCoordinateOperationFactory
-
- AuthorityBackedFactory
-
- All Implemented Interfaces:
Factory
,ObjectFactory
,CoordinateOperationFactory
,Factory
,OptionalFactory
,RegistrableFactory
public class AuthorityBackedFactory extends DefaultCoordinateOperationFactory implements OptionalFactory
A coordinate operation factory extended with the extra informations provided by an authority factory. Such authority factory may help to find transformation paths not available otherwise (often determined from empirical parameters). Authority factories can also provide additional informations like the area of validity, scope and positional accuracy.When
createOperation(sourceCRS, targetCRS)
is invoked,AuthorityBackedFactory
fetch the authority codes for source and target CRS and submits them to the underlying authority factory through a call to itscreateFromCoordinateReferenceSystemCodes(sourceCode, targetCode)
method. If the authority factory doesn't know about the specified CRS, then the default (standalone) process from the super-class is used as a fallback.- Since:
- 2.2
- Author:
- Martin Desruisseaux (IRD)
-
-
Field Summary
-
Fields inherited from class AbstractCoordinateOperationFactory
AXIS_CHANGES, DATUM_SHIFT, ELLIPSOID_SHIFT, GEOCENTRIC_CONVERSION, IDENTITY, INVERSE_OPERATION
-
Fields inherited from class ReferencingFactory
LOGGER
-
Fields inherited from class AbstractFactory
hints, MAXIMUM_PRIORITY, MINIMUM_PRIORITY, NORMAL_PRIORITY, priority
-
-
Constructor Summary
Constructors Constructor Description AuthorityBackedFactory()
Creates a new factory backed by a default EPSG authority factory.AuthorityBackedFactory(Hints userHints)
Creates a new factory backed by an authority factory fetched using the specified hints.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
accept(CoordinateOperation operation)
Returnstrue
if the specified operation is acceptable.protected CoordinateOperation
createFromDatabase(CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS)
Returns an operation for conversion or transformation between two coordinate reference systems.protected Set<CoordinateOperation>
findFromDatabase(CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS, int limit)
Returns the list of available operations for conversion or transformation between two coordinate reference systems.protected CoordinateOperationAuthorityFactory
getAuthorityFactory()
Returns the underlying coordinate operation authority factory.boolean
isAvailable()
Returnstrue
if this factory and its underlying authority factory are available for use.protected CoordinateOperation
validateCandidate(CoordinateOperation candidate, CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS, boolean inverse)
Selects a valid operation from a set of candidates.-
Methods inherited from class DefaultCoordinateOperationFactory
createOperation, createOperation, createOperationStep, createOperationStep, createOperationStep, createOperationStep, createOperationStep, createOperationStep, createOperationStep, createOperationStep, createOperationStep, createOperationStep, createOperationStep, createOperationStep, createOperationStep, findOperations, findOperations, findOperationSteps, findOperationSteps, findOperationSteps, findOperationSteps, findOperationSteps, findOperationSteps
-
Methods inherited from class AbstractCoordinateOperationFactory
concatenate, concatenate, concatenate, concatenate, createConcatenatedOperation, createDefiningConversion, createFromAffineTransform, createFromMathTransform, createFromMathTransform, createFromParameters, ensureNonNull, getErrorMessage, getImplementationHints, getMathTransformFactory, inverse, swapAndScaleAxis
-
Methods inherited from class ReferencingFactory
getVendor
-
Methods inherited from class AbstractFactory
addImplementationHints, equals, getPriority, hashCode, onDeregistration, onRegistration, toString
-
Methods inherited from interface Factory
getImplementationHints
-
-
-
-
Constructor Detail
-
AuthorityBackedFactory
public AuthorityBackedFactory()
Creates a new factory backed by a default EPSG authority factory. This factory will uses a priority slightly higher than the default (standalone) factory.
-
AuthorityBackedFactory
public AuthorityBackedFactory(Hints userHints)
Creates a new factory backed by an authority factory fetched using the specified hints. This constructor recognizes theCRS
,CS
,DATUM
andMATH_TRANSFORM
FACTORY
hints.- Parameters:
userHints
- The hints, ornull
if none.
-
-
Method Detail
-
getAuthorityFactory
protected CoordinateOperationAuthorityFactory getAuthorityFactory()
Returns the underlying coordinate operation authority factory.
-
createFromDatabase
protected CoordinateOperation createFromDatabase(CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS)
Returns an operation for conversion or transformation between two coordinate reference systems. The default implementation extracts the authority code from the suppliedsourceCRS
andtargetCRS
, and submit them to thecreateFromCoordinateReferenceSystemCodes(sourceCode, targetCode)
methods. If no operation is found for those codes, then this method returnsnull
.Note that this method may be invoked recursively. For example no operation may be available from the underlying authority factory between two compound CRS, but an operation may be available between two components of those compound CRS.
- Overrides:
createFromDatabase
in classDefaultCoordinateOperationFactory
- Parameters:
sourceCRS
- Input coordinate reference system.targetCRS
- Output coordinate reference system.- Returns:
- A coordinate operation from
sourceCRS
totargetCRS
, ornull
if no such operation is explicitly defined in the underlying database. - Since:
- 2.3
-
validateCandidate
protected CoordinateOperation validateCandidate(CoordinateOperation candidate, CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS, boolean inverse)
Selects a valid operation from a set of candidates. Currently, it returns the first operation which is a valid transformation from the sourceCRS to targetCRs and that is accepted by this authority.- Parameters:
candidate
- A set of candidate operationssourceCRS
- Source CRStargetCRS
- Target CRSinverse
- whether the inverse operation has to be applied
-
findFromDatabase
protected Set<CoordinateOperation> findFromDatabase(CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS, int limit)
Returns the list of available operations for conversion or transformation between two coordinate reference systems. The default implementation extracts the authority code from the suppliedsourceCRS
andtargetCRS
, and submit them to thecreateFromCoordinateReferenceSystemCodes(sourceCode, targetCode)
methods. If no operation is found for those codes, then this method returns an emptySet
.Note that this method may be invoked recursively. For example no operation may be available from the underlying authority factory between two compound CRS, but an operation may be available between two components of those compound CRS.
- Overrides:
findFromDatabase
in classDefaultCoordinateOperationFactory
- Parameters:
sourceCRS
- Input coordinate reference system.targetCRS
- Output coordinate reference system.limit
- The maximum number of operations to be returned. Use -1 to return all the available operations. Use 1 to return just one operation. Currently, the behavior for other values oflimit
is undefined.- Returns:
- A set of coordinate operations from
sourceCRS
totargetCRS
, or an emptySet
if no operation is explicitly defined in the underlying database for that CRS pair. - Since:
- 19
-
accept
protected boolean accept(CoordinateOperation operation)
Returnstrue
if the specified operation is acceptable. This method is invoked automatically bycreateFromDatabase(...)
for every operation candidates found. The default implementation returns alwaystrue
. Subclasses should override this method if they wish to filter the coordinate operations to be returned.- Since:
- 2.3
-
isAvailable
public boolean isAvailable()
Returnstrue
if this factory and its underlying authority factory are available for use.- Specified by:
isAvailable
in interfaceOptionalFactory
-
-