Class MultiRegisterOperations

Object
AbstractFactory
MultiRegisterOperations
All Implemented Interfaces:
Factory

public class MultiRegisterOperations extends AbstractFactory
Finds CRSs or coordinate operations in one or many geodetic registries. Each Multi­Register­Operations 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 Multi­Authorities­Factory. 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. Register­Operations can also be used as en entry point, with accesses to the low-level API granted by get­Factory(Class).

User-defined geodetic registries

User-defined authorities can be added to the SIS environment by creating CRSAuthority­Factory 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​.CRSAuthority­Factory service.
Since:
1.5
  • Constructor Details

  • Method Details

    • provider

      public static MultiRegisterOperations 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 the code argument given to create(String) methods. For example, "EPSG:4326" instead of "4326". The registry can be made implicit by a call to with­Authority(String).
      Returns:
      the default instance for all registries known to SIS.
    • withAuthority

      public MultiRegisterOperations withAuthority(String newValue) throws FactoryException
      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 a module-info file as a CRSAuthority­Factory service. See class javadoc for more information.
      Parameters:
      new­Value - the desired authority, or null for all of them.
      Returns:
      register operations for the specified authority.
      Throws:
      No­Such­Authority­Factory­Exception - if the given authority is unknown to SIS.
      Factory­Exception - if the factory cannot be created for another reason.
      See Also:
    • withVersion

      public MultiRegisterOperations withVersion(String newValue) throws FactoryException
      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:
      new­Value - the desired version, or null for the default version.
      Returns:
      register operations for the specified version of the geodetic registry.
      Throws:
      Illegal­State­Exception - if the version is non-null and no authority has been specified previously.
      No­Such­Authority­Factory­Exception - if the given version is unknown to SIS.
      Factory­Exception - if the factory cannot be created for another reason.
    • withAreaOfInterest

      public MultiRegisterOperations withAreaOfInterest(GeographicBoundingBox newValue)
      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:
      new­Value - the desired area of interest, or null for the world.
      Returns:
      register operations for the specified area of interest.
    • findCoordinateReferenceSystem

      public CoordinateReferenceSystem findCoordinateReferenceSystem(String code) throws FactoryException
      Extracts CRS details from the registry. If this Register­Operations has not been restricted to a specific authority by a call to with­Authority(String), then the given code must contain the authority (e.g., "EPSG:4326" instead of "4326". Otherwise, this method delegates to CRS​.for­Code(j­String).

      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 the

      invalid reference
      #for­Code(String)
      method javadoc.

      Parameters:
      code - CRS identifier allocated by the authority.
      Returns:
      the CRS for the given authority code.
      See Also:
    • findCoordinateOperation

      public CoordinateOperation findCoordinateOperation(String code) throws FactoryException
      Extracts coordinate operation details from the registry. If this Register­Operations has not been restricted to a specific authority by a call to with­Authority(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:
      Factory­Exception - if an error occurred while searching for coordinate operations.
    • getFactory

      public <T extends Factory> Optional<T> getFactory(Class<? extends T> type) throws FactoryException
      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 this Register­Operations instance for implementing its high-level services.
      Type Parameters:
      T - compile-time value of the type argument.
      Parameters:
      type - the desired type of factory.
      Returns:
      factory of the specified type.
      Throws:
      Null­Pointer­Exception - if the specified type is null.
      Illegal­Argument­Exception - if the specified type is not one of the above-cited values.
      Factory­Exception - if an error occurred while searching or preparing the requested factory.