Class BufferedCoordinateOperationFactory
Object
AbstractFactory
ReferencingFactory
AbstractCoordinateOperationFactory
BufferedCoordinateOperationFactory
- All Implemented Interfaces:
Factory,ObjectFactory,CoordinateOperationFactory,BufferedFactory,Factory,RegistrableFactory
public class BufferedCoordinateOperationFactory
extends AbstractCoordinateOperationFactory
implements BufferedFactory
Caches the coordinate operations created by an other factory. Those coordinate
operations may be expensive to create. During rendering and during data I/O, some implementations make use a lof of
coordinate transformations, hence caching them might help.
In most cases, users should not need to create an instance of this class explicitly. An instance of
BufferedCoordinateOperationFactory should be automatically registered and returned by
ReferencingFactoryFinder in default Geotools configuration.
- Since:
- 2.3
- Author:
- Simone Giannecchini, Martin Desruisseaux
-
Field Summary
Fields inherited from class AbstractCoordinateOperationFactory
AXIS_CHANGES, DATUM_SHIFT, ELLIPSOID_SHIFT, GEOCENTRIC_CONVERSION, IDENTITY, INVERSE_OPERATIONFields inherited from class ReferencingFactory
LOGGERFields inherited from class AbstractFactory
hints, MAXIMUM_PRIORITY, MINIMUM_PRIORITY, NORMAL_PRIORITY, priority -
Constructor Summary
ConstructorsConstructorDescriptionCreates a buffered factory wrapping the default one.BufferedCoordinateOperationFactory(CoordinateOperationFactory factory, int priority) Wraps the specified factory.BufferedCoordinateOperationFactory(CoordinateOperationFactory factory, Hints userHints, int priority) Work around for RFE #4093999 in Sun's bug database ("Relax constraint on placement of this()/super() call in constructors").Creates a buffered factory wrapping the specified factory.BufferedCoordinateOperationFactory(Hints userHints) Creates a buffered factory wrapping an other factory selected according the specified hints.BufferedCoordinateOperationFactory(Hints userHints, int priority) Creates a buffered factory wrapping an other factory selected according the specified hints. -
Method Summary
Modifier and TypeMethodDescriptioncreateOperation(CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS) Returns an operation for conversion or transformation between two coordinate reference systems.createOperation(CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS, OperationMethod method) Returns an operation for conversion or transformation between two coordinate reference systems using the specified method.findFromDatabase(CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS, int limit) Returns a list of available coordinate operations explicitly defined in some database (typically EPSG), for the provided CRS pair.findOperations(CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS) Returns all available operations for conversion or transformation between two coordinate reference systems.Returns the backing factory.Methods inherited from class AbstractCoordinateOperationFactory
concatenate, concatenate, concatenate, concatenate, createConcatenatedOperation, createDefiningConversion, createFromAffineTransform, createFromMathTransform, createFromMathTransform, createFromParameters, ensureNonNull, getErrorMessage, getImplementationHints, getMathTransformFactory, inverse, swapAndScaleAxisMethods inherited from class ReferencingFactory
getVendorMethods inherited from class AbstractFactory
addImplementationHints, equals, getPriority, hashCode, onDeregistration, onRegistration, toStringMethods inherited from interface Factory
getImplementationHints
-
Constructor Details
-
BufferedCoordinateOperationFactory
public BufferedCoordinateOperationFactory()Creates a buffered factory wrapping the default one. -
BufferedCoordinateOperationFactory
Creates a buffered factory wrapping an other factory selected according the specified hints.- Parameters:
userHints- The hints to use for choosing a backing factory.
-
BufferedCoordinateOperationFactory
Creates a buffered factory wrapping the specified factory. -
BufferedCoordinateOperationFactory
Creates a buffered factory wrapping an other factory selected according the specified hints.- Parameters:
userHints- The hints to use for choosing a backing factory.priority- The priority for this factory, as a number betweenMINIMUM_PRIORITYandMAXIMUM_PRIORITYinclusive.
-
BufferedCoordinateOperationFactory
Wraps the specified factory.- Parameters:
factory- The factory to wrap.priority- The priority for this factory, as a number betweenMINIMUM_PRIORITYandMAXIMUM_PRIORITYinclusive.
-
BufferedCoordinateOperationFactory
public BufferedCoordinateOperationFactory(CoordinateOperationFactory factory, Hints userHints, int priority) Work around for RFE #4093999 in Sun's bug database ("Relax constraint on placement of this()/super() call in constructors").
-
-
Method Details
-
getBackingFactory
Returns the backing factory. Coordinate operation creation will be delegated to this factory when not available in the cache. -
createOperation
public CoordinateOperation createOperation(CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS) throws OperationNotFoundException, FactoryException Returns an operation for conversion or transformation between two coordinate reference systems. If an operation was already created and still in the cache, the cached operation is returned. Otherwise the operation creation is delegated to the coordinate operation factory specified at construction time and the result is cached.- Specified by:
createOperationin interfaceCoordinateOperationFactory- Parameters:
sourceCRS- Input coordinate reference system.targetCRS- Output coordinate reference system.- Returns:
- A coordinate operation from
sourceCRStotargetCRS. - Throws:
OperationNotFoundException- if no operation path was found fromsourceCRStotargetCRS.FactoryException- if the operation creation failed for some other reason.
-
findOperations
public Set<CoordinateOperation> findOperations(CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS) throws FactoryException Returns all available operations for conversion or transformation between two coordinate reference systems. The operation creation is delegated to the coordinate operation factory specified at construction time and the result is not cached.- Specified by:
findOperationsin interfaceCoordinateOperationFactory- Parameters:
sourceCRS- Input coordinate reference system.targetCRS- Output coordinate reference system.- Returns:
- A Set of coordinate operations from
sourceCRStotargetCRS. - Throws:
FactoryException- if there was a failure retrieving or creating the operations.
-
createOperation
public CoordinateOperation createOperation(CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS, OperationMethod method) throws OperationNotFoundException, FactoryException Returns an operation for conversion or transformation between two coordinate reference systems using the specified method. The current implementation delegates to the coordinate operation factory specified at construction time with no caching.- Specified by:
createOperationin interfaceCoordinateOperationFactory- Parameters:
sourceCRS- Input coordinate reference system.targetCRS- Output coordinate reference system.method- The algorithmic method for conversion or transformation.- Returns:
- A coordinate operation from
sourceCRStotargetCRS. - Throws:
OperationNotFoundException- if no operation path was found fromsourceCRStotargetCRS.FactoryException- if the operation creation failed for some other reason.
-
findFromDatabase
public Set<CoordinateOperation> findFromDatabase(CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS, int limit) Description copied from interface:CoordinateOperationFactoryReturns a list of available coordinate operations explicitly defined in some database (typically EPSG), for the provided CRS pair. Otherwise (if there is no database, or if the database doesn't contains any explicit operation fromsourceCRStotargetCRS, or if this method failed to create the operations from the database), returns an emptySet.The default implementation always returns an empty
Set. Subclasses should override this method if they can fetch a more accurate operation from some database.This method is normally invoked by
findOperations(sourceCRS, targetCRS)before to try to figure out a transformation path by itself.The default implementation returns an empty set, subclasses working with an actual transformation database can override
- Specified by:
findFromDatabasein interfaceCoordinateOperationFactory- 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 oflimitis undefined.- Returns:
- A set of coordinate operations from
sourceCRStotargetCRSif and only if one is explicitly defined in some underlying database, or an emptySetotherwise.
-