Class CoordinateOperations

java.lang.Object
org.apache.sis.internal.system.SystemListener
org.apache.sis.internal.referencing.CoordinateOperations
All Implemented Interfaces:
EventListener

public final class CoordinateOperations extends SystemListener
The default coordinate operation factory, provided in a separated class for deferring class loading until first needed. Contains also utility methods related to coordinate operations.
Since:
0.7
Version:
1.1
  • Field Details

    • BURSA_WOLF_KEY

      public static final String BURSA_WOLF_KEY
      See Also:
    • PARAMETERS_KEY

      public static final String PARAMETERS_KEY
      The key for specifying explicitly the value to be returned by AbstractSingleOperation.getParameterValues(). It is usually not necessary to specify those parameters because they are inferred either from the MathTransform, or specified explicitly in a DefiningConversion. However, there is a few cases, for example the Molodenski transform, where none of the above can apply, because SIS implements those operations as a concatenation of math transforms, and such concatenations do not have ParameterValueGroup.
      See Also:
    • OPERATION_TYPE_KEY

      public static final String OPERATION_TYPE_KEY
      The key for specifying the base type of the coordinate operation to create. This optional entry is used by DefaultCoordinateOperationFactory.createSingleOperation(…). Apache SIS tries to infer this value automatically, but this entry may help SIS to perform a better choice in some cases. For example, an "Affine" operation can be both a conversion or a transformation (the latter is used in datum shift in geocentric coordinates).
      See Also:
    • CONSTANT_COORDINATES

      public static final ThreadLocal<Supplier<double[]>> CONSTANT_COORDINATES
      Value of CoordinateOperationContext.getConstantCoordinates(). This thread-local is used as a workaround for the fact that we do not yet provide a public API for this functionality. This workaround should be deleted after a public API is defined.
    • CACHE

      private static final Set<Integer>[] CACHE
      Cached values or wrapAroundChanges(…), created when first needed. Indices are bit masks computed by changes(…). Since the most common "wrap around" axes are longitude at dimension 0 or 1, and some measurement of time (in climatology) at dimension 2 or 3, then the most likely values are (binary digits): The last decimal value is 10 (binary 1010); we don't need to cache more.
    • factory

      private static volatile DefaultCoordinateOperationFactory factory
      The system-wide default factory.
  • Constructor Details

    • CoordinateOperations

      private CoordinateOperations()
      For system listener only.
  • Method Details

    • classpathChanged

      protected void classpathChanged()
      Invoked when the classpath changed.
      Specified by:
      classpathChanged in class SystemListener
    • factory

      public static DefaultCoordinateOperationFactory factory()
      Returns the factory.
      Returns:
      the system-wide factory.
    • factoryMT

      public static DefaultMathTransformFactory factoryMT()
      Returns the SIS implementation of MathTransformFactory.
      Returns:
      SIS implementation of transform factory.
    • getCoordinateOperationFactory

      public static org.opengis.referencing.operation.CoordinateOperationFactory getCoordinateOperationFactory(Map<String,?> properties, org.opengis.referencing.operation.MathTransformFactory mtFactory, org.opengis.referencing.crs.CRSFactory crsFactory, org.opengis.referencing.cs.CSFactory csFactory)
      Returns the coordinate operation factory to use for the given properties and math transform factory. If the given properties are empty and the mtFactory is the system default, then this method returns the system default CoordinateOperationFactory instead of creating a new one.

      It is okay to set all parameters to null in order to get the system default factory.

      Parameters:
      properties - the default properties.
      mtFactory - the math transform factory to use.
      crsFactory - the factory to use if the operation factory needs to create CRS for intermediate steps.
      csFactory - the factory to use if the operation factory needs to create CS for intermediate steps.
      Returns:
      the coordinate operation factory to use.
    • getOperationMethod

      public static org.opengis.referencing.operation.OperationMethod getOperationMethod(Iterable<? extends org.opengis.referencing.operation.OperationMethod> methods, String identifier)
      Returns the operation method for the specified name or identifier. The given argument shall be either a method name (e.g. "Transverse Mercator") or one of its identifiers (e.g. "EPSG:9807").
      Parameters:
      methods - the method candidates.
      identifier - the name or identifier of the operation method to search.
      Returns:
      the coordinate operation method for the given name or identifier, or null if none.
      See Also:
    • isWrapAround

      public static boolean isWrapAround(org.opengis.referencing.cs.CoordinateSystemAxis axis)
      Returns true if the given axis is of kind "Wrap Around". Defined here because used together with wrapAroundChanges(…).
      Parameters:
      axis - the axis to test.
      Returns:
      true if the given axis has "wrap around" range meaning.
    • wrapAroundChanges

      public static Set<Integer> wrapAroundChanges(org.opengis.referencing.operation.CoordinateOperation op)
      Returns indices of target dimensions where "wrap around" may happen as a result of a coordinate operation. This is usually the longitude axis when the source CRS uses the [-180 … +180]° range and the target CRS uses the [0 … 360]° range, or the converse.
      Parameters:
      op - the coordinate operation for which to get "wrap around" target dimensions.
      Returns:
      target dimensions where "wrap around" may happen, or an empty set if none.
      See Also:
    • wrapAroundChanges

      public static Set<Integer> wrapAroundChanges(org.opengis.referencing.crs.CoordinateReferenceSystem source, org.opengis.referencing.cs.CoordinateSystem target)
      Computes indices of target dimensions where "wrap around" may happen as a result of a coordinate operation. This is usually the longitude axis when the source CRS uses the [-180 … +180]° range and the target CRS uses the [0 … 360]° range, or the converse.
      Parameters:
      source - the source of the coordinate operation.
      target - the target of the coordinate operation.
      Returns:
      target dimensions where "wrap around" may happen, or an empty set if none.
    • changes

      private static long changes(org.opengis.referencing.cs.CoordinateSystem source, org.opengis.referencing.cs.CoordinateSystem target)
      Returns the packed indices of target dimensions where coordinate values may need to be wrapped around. This method matches target coordinate system axes having RangeMeaning.WRAPAROUND with source axes, then verifies if the range of values changed (taking unit conversions in account). A target dimension i may need to "wrap around" the coordinate values if the 1 << i bit is set. If there is no change, then the value is zero.