Class DefaultMathTransformFactory

  • All Implemented Interfaces:
    Parser, Math­Transform­Factory, Factory

    public class DefaultMathTransformFactory
    extends AbstractFactory
    implements MathTransformFactory, Parser
    Low level factory for creating math transforms. The objects created by this factory do not know what the source and target coordinate systems mean. Because of this low semantic value, high level GIS applications usually do not need to use this factory directly. They can use the static convenience methods in the CRS or Math­Transforms classes instead.
    Standard parameters
    Math­Transform instances are created from parameter values. The parameters expected by each operation available in a default Apache SIS installation is listed here. The set of parameters varies for each operation or projection, but the following can be considered typical:
    • A semi-major and semi-minor axis length in metres.
    • A central meridian and latitude of origin in decimal degrees.
    • A scale factor, which default to 1.
    • A false easting and false northing in metres, which default to 0.

    Each descriptor has many aliases, and those aliases may vary between different projections. For example the false easting parameter is usually called "false_easting" by OGC, while EPSG uses various names like "False easting" or "Easting at false origin".

    Dynamic parameters
    A few non-standard parameters are defined for compatibility reasons, but delegates their work to standard parameters. Those dynamic parameters are not listed in the parameter values. Dynamic parameters are:
    • "earth_radius", which copy its value to the "semi_major" and "semi_minor" parameter values.
    • "inverse_flattening", which compute the "semi_minor" value from the "semi_major" parameter value.
    • "standard_parallel" expecting an array of type double[], which copy its elements to the "standard_parallel_1" and "standard_parallel_2" parameter scalar values.

    The main purpose of those dynamic parameters is to support some less commonly used conventions without duplicating the most commonly used conventions. The alternative ways are used in netCDF files for example, which often use spherical models instead than ellipsoidal ones.

    Parameters are flagged as either mandatory or optional. A parameter may be mandatory and still have a default value. In the context of this package, "mandatory" means that the parameter is an essential part of the projection defined by standards. Such mandatory parameters will always appears in any Well Known Text (WKT) formatting, even if not explicitly set by the user. For example the central meridian is typically a mandatory parameter with a default value of 0° (the Greenwich meridian).

    Optional parameters, on the other hand, are often non-standard extensions. They will appear in WKT formatting only if the user defined explicitly a value which is different than the default value.

    Operation methods discovery
    Operation­Method describes all the parameters expected for instantiating a particular kind of math transform. The set of operation methods known to this factory can be obtained in two ways: The default way is to scan the classpath. See Math­Transform­Provider for indications about how to add custom coordinate operation methods in a default Apache SIS installation.
    Thread safety
    This class is safe for multi-thread usage if all referenced Operation­Method instances are thread-safe. There is typically only one Math­Transform­Factory instance for the whole application.
    Since:
    0.6
    See Also:
    Math­Transform­Provider, Abstract­Math­Transform

    Defined in the sis-referencing module

    • Constructor Detail

      • DefaultMathTransformFactory

        public DefaultMathTransformFactory()
        Creates a new factory which will discover operation methods with a Service­Loader. The Operation­Method implementations shall be listed in the following file:
        META-INF/services/org.opengis.referencing.operation.OperationMethod
        Default­Math­Transform­Factory parses the above-cited files in all JAR files in order to find all available operation methods. By default, only operation methods that implement the Math­Transform­Provider interface can be used by the create(…) methods in this class.
        See Also:
        reload()
      • DefaultMathTransformFactory

        public DefaultMathTransformFactory​(Iterable<? extends OperationMethod> methods)
        Creates a new factory which will use the given operation methods. The given iterable is stored by reference — its content is not copied — in order to allow deferred Operation­Method constructions. Note that by default, only operation methods that implement the Math­Transform­Provider interface can be used by the create(…) methods in this class.

        Requirements:

        • The given iterable should not contain duplicated elements.
        • The given iterable shall be stable: all elements returned by the first iteration must also be returned by any subsequent iterations, unless reload() has been invoked.
        • Operation­Method instances should also implement Math­Transform­Provider.
        • All Operation­Method instances shall be thread-safe.
        • The Iterable itself does not need to be thread-safe since all usages will be synchronized as below:
          synchronized (methods) {
              for (OperationMethod method : methods) {
                  // Use the method here.
              }
          }
        Parameters:
        methods - the operation methods to use, stored by reference (not copied).