Class MultiRegisterOperations
- All Implemented Interfaces:
Factory
MultiRegisterOperations
instance can narrow the search to a single registry,
a specific version of that registry, or to a domain of validity.
Each instance is immutable and thread-safe.
This class delegates its work to static methods or to
MultiAuthoritiesFactory
. It does not provide new services compared to the above,
but provides a more high-level API with the most important registry-based
services in a single place. RegisterOperations
can also be used as en entry point,
with accesses to the low-level API granted by getFactory(Class)
.
User-defined geodetic registries
User-defined authorities can be added to the SIS environment by creatingCRSAuthorityFactory
implementations with a public no-argument constructor or a public static provider()
method,
and declaring the name of those classes in the module-info.java
file as a provider of the
org.opengis.referencing.crs.CRSAuthorityFactory
service.- Since:
- 1.5
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
MultiRegisterOperations
(MultiRegisterOperations source, String authority, String version) Creates an instance which will use the registry of the specified authority, optionally at a specified version.protected
MultiRegisterOperations
(MultiRegisterOperations source, GeographicBoundingBox areaOfInterest) Creates an instance with the same register than the given instance, but a different AOI. -
Method Summary
Modifier and TypeMethodDescriptionExtracts coordinate operation details from the registry.Finds or infers any coordinate operations for which the given CRSs are the source and target, in that order.Extracts CRS details from the registry.getFactory
(Class<? extends T> type) Returns a factory used for building components of CRS or coordinate operations.static MultiRegisterOperations
provider()
Returns an instance which will search CRS definitions in all registries that are known to SIS.withAreaOfInterest
(GeographicBoundingBox newValue) Returns an instance for the specified area of interest (AOI).withAuthority
(String newValue) Returns an instance for a geodetic registry of the specified authority, such as "EPSG".withVersion
(String newValue) Returns an instance for the specified version of the geodetic registry.Methods inherited from class AbstractFactory
getVendor, toString
-
Constructor Details
-
MultiRegisterOperations
protected MultiRegisterOperations(MultiRegisterOperations source, GeographicBoundingBox areaOfInterest) Creates an instance with the same register than the given instance, but a different AOI.- Parameters:
source
- the register from which to copy the authority and version.areaOfInterest
- the new area of interest (AOI), ornull
if none.- See Also:
-
MultiRegisterOperations
protected MultiRegisterOperations(MultiRegisterOperations source, String authority, String version) throws FactoryException Creates an instance which will use the registry of the specified authority, optionally at a specified version.- Parameters:
source
- the register from which to copy the area of interest.authority
- identification of the registry to use (e.g., "EPSG").version
- the registry version to use, ornull
for the default version.- Throws:
NoSuchAuthorityFactoryException
- if the specified registry has not been found.FactoryException
- if an error occurred while initializing this factory.- See Also:
-
-
Method Details
-
provider
Returns an instance which will search CRS definitions in all registries that are known to SIS. Because this instance is not for a specific registry, the authority will need to be part of thecode
argument given tocreate(String)
methods. For example,"EPSG:4326"
instead of"4326"
. The registry can be made implicit by a call towithAuthority(String)
.- Returns:
- the default instance for all registries known to SIS.
-
withAuthority
Returns an instance for a geodetic registry of the specified authority, such as "EPSG". If a version number was specified previously, that version is cleared. If an area of interest was specified, the same area of interest is reused.User-defined geodetic registries
A user-defined authority can be specified if the implementation is declared in amodule-info
file as aCRSAuthorityFactory
service. See class javadoc for more information.- Parameters:
newValue
- the desired authority, ornull
for all of them.- Returns:
- register operations for the specified authority.
- Throws:
NoSuchAuthorityFactoryException
- if the given authority is unknown to SIS.FactoryException
- if the factory cannot be created for another reason.- See Also:
-
withVersion
Returns an instance for the specified version of the geodetic registry. A non-null authority must have been specified before to invoke this method. If an area of interest was specified, the same area of interest is reused.- Parameters:
newValue
- the desired version, ornull
for the default version.- Returns:
- register operations for the specified version of the geodetic registry.
- Throws:
IllegalStateException
- if the version is non-null and no authority has been specified previously.NoSuchAuthorityFactoryException
- if the given version is unknown to SIS.FactoryException
- if the factory cannot be created for another reason.
-
withAreaOfInterest
Returns an instance for the specified area of interest (AOI). The area of interest is used for filtering coordinate operations between a between a pair of CRSs.- Parameters:
newValue
- the desired area of interest, ornull
for the world.- Returns:
- register operations for the specified area of interest.
-
findCoordinateReferenceSystem
Extracts CRS details from the registry. If thisRegisterOperations
has not been restricted to a specific authority by a call towithAuthority(String)
, then the given code must contain the authority (e.g.,"EPSG:4326"
instead of"4326"
. Otherwise, this method delegates toCRS.forCode(jString)
.By default, this method recognizes the
"EPSG"
and"OGC"
authorities. In the"EPSG"
case, whether the full set of EPSG codes is supported or not depends on whether a connection to the database can be established. If no connection can be established, then this method uses a small embedded EPSG factory containing at least the CRS defined in theinvalid reference
#forCode(String)
- Parameters:
code
- CRS identifier allocated by the authority.- Returns:
- the CRS for the given authority code.
- See Also:
-
findCoordinateOperation
Extracts coordinate operation details from the registry. If thisRegisterOperations
has not been restricted to a specific authority by a call towithAuthority(String)
, then the given code must contain the authority.- Parameters:
code
- operation identifier allocated by the authority.- Returns:
- the operation for the given authority code.
-
findCoordinateOperations
public Set<CoordinateOperation> findCoordinateOperations(CoordinateReferenceSystem source, CoordinateReferenceSystem target) throws FactoryException Finds or infers any coordinate operations for which the given CRSs are the source and target, in that order. This method searches for operation paths defined in the registry. If none are found, this method tries to infer a path itself.- Parameters:
source
- the source CRS.target
- the target CRS.- Returns:
- coordinate operations found or inferred between the given pair CRSs. May be an empty set.
- Throws:
FactoryException
- if an error occurred while searching for coordinate operations.
-
getFactory
Returns a factory used for building components of CRS or coordinate operations. The factories returned by this method provide accesses to the low-level services used by thisRegisterOperations
instance for implementing its high-level services.- Type Parameters:
T
- compile-time value of thetype
argument.- Parameters:
type
- the desired type of factory.- Returns:
- factory of the specified type.
- Throws:
NullPointerException
- if the specified type is null.IllegalArgumentException
- if the specified type is not one of the above-cited values.FactoryException
- if an error occurred while searching or preparing the requested factory.
-