Class ReferencingFactoryContainer
java.lang.Object
org.apache.sis.internal.referencing.ReferencingFactoryContainer
- Direct Known Subclasses:
CRSBuilder
A container of factories frequently used together.
Provides also some utility methods working with factories.
This class may be temporary until we choose a dependency injection framework
See SIS-102.
This class is not thread safe. Synchronization, if needed, is caller's responsibility.
- Since:
- 1.0
- Version:
- 1.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The key for specifying aCRSFactory
instance to use for geodetic object constructions.private org.opengis.referencing.crs.CRSAuthorityFactory
The factory for creating coordinate reference systems from authority codes.private org.opengis.referencing.crs.CRSFactory
The coordinate reference system factory.static final String
The key for specifying aCSFactory
instance to use for geodetic object constructions.private org.opengis.referencing.cs.CSFactory
The coordinate system factory.static final String
The key for specifying aDatumFactory
instance to use for geodetic object constructions.private org.opengis.referencing.datum.DatumFactory
The datum factory.The default properties, or an empty map if none.static final String
The key for specifying aMathTransformFactory
instance to use for geodetic object constructions.private org.opengis.referencing.operation.MathTransformFactory
The math transform factory.Factory for fetching operation methods and creating defining conversions. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance for the default factories.ReferencingFactoryContainer
(Map<String, ?> defaultProperties, org.opengis.referencing.crs.CRSFactory crsFactory, org.opengis.referencing.cs.CSFactory csFactory, org.opengis.referencing.datum.DatumFactory datumFactory, org.opengis.referencing.operation.CoordinateOperationFactory operationFactory, org.opengis.referencing.operation.MathTransformFactory mtFactory) Creates a new instance which will use the given factories. -
Method Summary
Modifier and TypeMethodDescriptionfinal org.opengis.referencing.operation.CoordinateOperationAuthorityFactory
Returns the factory for creating coordinate operations from authority codes.Returns the factory for fetching operation methods and creating defining conversions.final org.opengis.referencing.crs.CRSAuthorityFactory
Returns the factory for creating coordinate reference systems from authority codes.final org.opengis.referencing.crs.CRSFactory
Returns the factory for creating coordinate reference systems.final org.opengis.referencing.cs.CSAuthorityFactory
Returns the factory for creating coordinate systems from authority codes.final org.opengis.referencing.cs.CSFactory
Returns the factory for creating coordinate systems and their axes.final org.opengis.referencing.datum.DatumAuthorityFactory
Returns the factory for creating datum from authority codes.final org.opengis.referencing.datum.DatumFactory
Returns the factory for creating datum, prime meridians and ellipsoids.final <T extends org.opengis.util.Factory>
TgetFactory
(Class<T> type) Returns one of the factories managed by this container.final org.opengis.referencing.operation.MathTransformFactory
Returns the factory for creating parameterized transforms.final org.opengis.referencing.cs.CartesianCS
Returns the a coordinate system for map projections with (easting, northing) axes in metres.final <T extends org.opengis.util.Factory>
booleansetFactory
(Class<T> type, T factory) Sets one of the factories managed by this container.
-
Field Details
-
MT_FACTORY
The key for specifying aMathTransformFactory
instance to use for geodetic object constructions. This is usually not needed for CRS construction, except in the special case of a derived CRS created from a defining conversion.- See Also:
-
CRS_FACTORY
The key for specifying aCRSFactory
instance to use for geodetic object constructions.- See Also:
-
CS_FACTORY
The key for specifying aCSFactory
instance to use for geodetic object constructions.- See Also:
-
DATUM_FACTORY
The key for specifying aDatumFactory
instance to use for geodetic object constructions.- See Also:
-
crsAuthorityFactory
private org.opengis.referencing.crs.CRSAuthorityFactory crsAuthorityFactoryThe factory for creating coordinate reference systems from authority codes. If null, then a default factory will be created only when first needed. -
datumFactory
private org.opengis.referencing.datum.DatumFactory datumFactoryThe datum factory. If null, then a default factory will be created only when first needed. -
csFactory
private org.opengis.referencing.cs.CSFactory csFactoryThe coordinate system factory. If null, then a default factory will be created only when first needed. -
crsFactory
private org.opengis.referencing.crs.CRSFactory crsFactoryThe coordinate reference system factory. If null, then a default factory will be created only when first needed. -
operationFactory
Factory for fetching operation methods and creating defining conversions. This is needed only for user-defined projected coordinate reference system. -
mtFactory
private org.opengis.referencing.operation.MathTransformFactory mtFactoryThe math transform factory. If null, then a default factory will be created only when first needed. -
defaultProperties
The default properties, or an empty map if none. This map shall not be modified since its reference may be shared without cloning. This field will be cleared when no longer needed.
-
-
Constructor Details
-
ReferencingFactoryContainer
public ReferencingFactoryContainer()Creates a new instance for the default factories. -
ReferencingFactoryContainer
public ReferencingFactoryContainer(Map<String, ?> defaultProperties, org.opengis.referencing.crs.CRSFactory crsFactory, org.opengis.referencing.cs.CSFactory csFactory, org.opengis.referencing.datum.DatumFactory datumFactory, org.opengis.referencing.operation.CoordinateOperationFactory operationFactory, org.opengis.referencing.operation.MathTransformFactory mtFactory) Creates a new instance which will use the given factories. Any factory given in argument may benull
if lazy instantiation is desired.- Parameters:
defaultProperties
- default properties to give to the objects to create (will not be cloned).crsFactory
- the factory to use for creating coordinate reference systems.csFactory
- the factory to use for creating coordinate systems.datumFactory
- the factory to use for creating datum.operationFactory
- the factory to use for creating (defining) conversions.mtFactory
- the factory to use for creating transform objects.
-
-
Method Details
-
setFactory
Sets one of the factories managed by this container. The giventype
argument can be one of the following values:CRSFactory.class
CSFactory.class
DatumFactory.class
CoordinateOperationFactory.class
MathTransformFactory.class
getFactory(Class)
.- Type Parameters:
T
- the compile-time type of thetype
argument.- Parameters:
type
- the factory type.factory
- the factory to use for the given type, ornull
for the default.- Returns:
true
if the factory changed as a result of this method call.- Throws:
IllegalArgumentException
- if thetype
argument is not one of the valid values.
-
getFactory
Returns one of the factories managed by this container. The giventype
argument can be one of the following values:CRSFactory.class
CSFactory.class
DatumFactory.class
CoordinateOperationFactory.class
MathTransformFactory.class
FactoryException
.- Type Parameters:
T
- the compile-time type of thetype
argument.- Parameters:
type
- the factory type.- Returns:
- the factory for the given type.
- Throws:
IllegalArgumentException
- if thetype
argument is not one of the valid values.
-
getCRSAuthorityFactory
public final org.opengis.referencing.crs.CRSAuthorityFactory getCRSAuthorityFactory() throws org.opengis.util.FactoryExceptionReturns the factory for creating coordinate reference systems from authority codes. Currently only EPSG codes are supported.- Returns:
- the Coordinate Reference System authority factory (never
null
). - Throws:
org.opengis.util.FactoryException
- if the authority factory cannot be obtained.
-
getCSAuthorityFactory
public final org.opengis.referencing.cs.CSAuthorityFactory getCSAuthorityFactory() throws org.opengis.util.FactoryExceptionReturns the factory for creating coordinate systems from authority codes. Currently only EPSG codes are supported.- Returns:
- the Coordinate System authority factory (never
null
). - Throws:
org.opengis.util.FactoryException
- if the authority factory cannot be obtained.
-
getDatumAuthorityFactory
public final org.opengis.referencing.datum.DatumAuthorityFactory getDatumAuthorityFactory() throws org.opengis.util.FactoryExceptionReturns the factory for creating datum from authority codes. Currently only EPSG codes are supported.- Returns:
- the Datum authority factory (never
null
). - Throws:
org.opengis.util.FactoryException
- if the authority factory cannot be obtained.
-
getCoordinateOperationAuthorityFactory
public final org.opengis.referencing.operation.CoordinateOperationAuthorityFactory getCoordinateOperationAuthorityFactory() throws org.opengis.util.FactoryExceptionReturns the factory for creating coordinate operations from authority codes. Currently only EPSG codes are supported.- Returns:
- the Coordinate Operation authority factory (never
null
). - Throws:
org.opengis.util.FactoryException
- if the authority factory cannot be obtained.
-
getCRSFactory
public final org.opengis.referencing.crs.CRSFactory getCRSFactory()Returns the factory for creating coordinate reference systems.- Returns:
- the Coordinate Reference System factory (never
null
).
-
getCSFactory
public final org.opengis.referencing.cs.CSFactory getCSFactory()Returns the factory for creating coordinate systems and their axes.- Returns:
- the Coordinate System factory (never
null
).
-
getDatumFactory
public final org.opengis.referencing.datum.DatumFactory getDatumFactory()Returns the factory for creating datum, prime meridians and ellipsoids.- Returns:
- the Datum factory (never
null
).
-
getCoordinateOperationFactory
Returns the factory for fetching operation methods and creating defining conversions. This is needed only for user-defined projected coordinate reference system. The factory is fetched when first needed.- Returns:
- the Coordinate Operation factory (never
null
).
-
getMathTransformFactory
public final org.opengis.referencing.operation.MathTransformFactory getMathTransformFactory()Returns the factory for creating parameterized transforms.- Returns:
- the Math Transform factory (never
null
).
-
getStandardProjectedCS
public final org.opengis.referencing.cs.CartesianCS getStandardProjectedCS() throws org.opengis.util.FactoryExceptionReturns the a coordinate system for map projections with (easting, northing) axes in metres. EPSG::4400 — Cartesian 2D CS. Axes: easting, northing (E,N). Orientations: east, north. UoM: m.- Returns:
- a coordinate system with (easting, northing) axes in metres.
- Throws:
org.opengis.util.FactoryException
- if an error occurred while creating the coordinate system.
-