Class AbstractProvider

All Implemented Interfaces:
Serializable, Formattable, MathTransformProvider, Deprecable, LenientComparable, org.opengis.referencing.IdentifiedObject, org.opengis.referencing.operation.OperationMethod
Direct Known Subclasses:
Affine, AxisOrderReversal, Equirectangular, GeocentricToTopocentric, GeodeticOperation, GeographicToTopocentric, Interpolation1D, MapProjection, MapProjection3D, NADCON, NorthPoleRotation, NTv1, NTv2, PseudoPlateCarree, SouthPoleRotation, Wraparound, ZonedTransverseMercator

public abstract class AbstractProvider extends DefaultOperationMethod implements MathTransformProvider
Base class for all providers defined in this package.
Since:
0.6
Version:
1.3
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
    • operationType

      private final Class<? extends org.opengis.referencing.operation.SingleOperation> operationType
      The base interface of the CoordinateOperation instances that use this method.
      See Also:
    • sourceCSType

      public final Class<? extends org.opengis.referencing.cs.CoordinateSystem> sourceCSType
      The base interface of the coordinate system of source/target coordinates. This is used for resolving some ambiguities at WKT parsing time.
    • targetCSType

      public final Class<? extends org.opengis.referencing.cs.CoordinateSystem> targetCSType
      The base interface of the coordinate system of source/target coordinates. This is used for resolving some ambiguities at WKT parsing time.
    • sourceOnEllipsoid

      public final boolean sourceOnEllipsoid
      Flags whether the source and/or target ellipsoid are concerned by this operation. Those flags are read by DefaultMathTransformFactory for determining if this operation has "semi_major", "semi_minor", "src_semi_major", "src_semi_minor" parameters that may need to be filled with values inferred from the source or target DefaultGeodeticDatum. Meaning of return values:
      • (false,false) if neither the source coordinate system or the destination coordinate system is ellipsoidal. There are no parameters that need to be completed.
      • (true,false) if this operation has "semi_major" and "semi_minor" parameters that need to be set to the axis lengths of the source ellipsoid.
      • (false,true) if this operation has "semi_major" and "semi_minor" parameters that need to be set to the axis lengths of the target ellipsoid.
      • (true,true) if this operation has "src_semi_major", "src_semi_minor", "tgt_semi_major" and "tgt_semi_minor" parameters that need to be set to the axis lengths of the source and target ellipsoids.
      Those flags are only hints. If the information is not provided, DefaultMathTransformFactory will try to infer it from the type of user-specified source and target CRS.
    • targetOnEllipsoid

      public final boolean targetOnEllipsoid
      Flags whether the source and/or target ellipsoid are concerned by this operation. Those flags are read by DefaultMathTransformFactory for determining if this operation has "semi_major", "semi_minor", "src_semi_major", "src_semi_minor" parameters that may need to be filled with values inferred from the source or target DefaultGeodeticDatum. Meaning of return values:
      • (false,false) if neither the source coordinate system or the destination coordinate system is ellipsoidal. There are no parameters that need to be completed.
      • (true,false) if this operation has "semi_major" and "semi_minor" parameters that need to be set to the axis lengths of the source ellipsoid.
      • (false,true) if this operation has "semi_major" and "semi_minor" parameters that need to be set to the axis lengths of the target ellipsoid.
      • (true,true) if this operation has "src_semi_major", "src_semi_minor", "tgt_semi_major" and "tgt_semi_minor" parameters that need to be set to the axis lengths of the source and target ellipsoids.
      Those flags are only hints. If the information is not provided, DefaultMathTransformFactory will try to infer it from the type of user-specified source and target CRS.
  • Constructor Details

    • AbstractProvider

      protected AbstractProvider(Map<String,?> properties, int sourceDimension, int targetDimension, org.opengis.parameter.ParameterDescriptorGroup parameters)
      Constructs a math transform provider from the given properties and a set of parameters.
      Parameters:
      properties - set of properties. Shall contain at least "name".
      sourceDimension - number of dimensions in the source CRS of this operation method.
      targetDimension - number of dimensions in the target CRS of this operation method.
      parameters - the set of parameters (never null).
    • AbstractProvider

      AbstractProvider(Class<? extends org.opengis.referencing.operation.SingleOperation> operationType, org.opengis.parameter.ParameterDescriptorGroup parameters, Class<? extends org.opengis.referencing.cs.CoordinateSystem> sourceCSType, int sourceDimensions, boolean sourceOnEllipsoid, Class<? extends org.opengis.referencing.cs.CoordinateSystem> targetCSType, int targetDimensions, boolean targetOnEllipsoid)
      Constructs a math transform provider from a set of parameters. The provider name and identifiers will be the same than the parameter ones.
      Parameters:
      operationType - base interface of the CoordinateOperation instances that use this method.
      parameters - description of parameters expected by this operation.
      sourceDimensions - number of dimensions in the source CRS of this operation method.
      sourceCSType - base interface of the coordinate system of source coordinates.
      sourceOnEllipsoid - whether the operation needs source ellipsoid axis lengths.
      targetDimensions - number of dimensions in the target CRS of this operation method.
      targetCSType - base interface of the coordinate system of target coordinates.
      targetOnEllipsoid - whether the operation needs target ellipsoid axis lengths.
  • Method Details

    • toMap

      @Workaround(library="JDK", version="1.7") private static Map<String,Object> toMap(org.opengis.referencing.IdentifiedObject parameters)
      Work around for RFE #4093999 in Sun's bug database ("Relax constraint on placement of this()/super() call in constructors").
    • builder

      static ParameterBuilder builder()
      Creates the parameter builder with the default namespace set to EPSG.
    • addNameAndLegacy

      static ParameterBuilder addNameAndLegacy(ParameterBuilder builder, String name, String legacy)
      Adds a name together with its previous (legacy) name. The legacy name will be added as a deprecated alias.
    • addIdentifierAndLegacy

      static ParameterBuilder addIdentifierAndLegacy(ParameterBuilder builder, String code, String legacy)
      Adds an identifier code together with its previous (legacy) code. The legacy code will be added as a deprecated identifier.
    • createZeroConstant

      static org.opengis.parameter.ParameterDescriptor<Double> createZeroConstant(ParameterBuilder builder)
      Creates a descriptor for a 0 constant value in degrees.
      See Also:
    • createMandatoryLatitude

      static org.opengis.parameter.ParameterDescriptor<Double> createMandatoryLatitude(ParameterBuilder builder)
      Creates a descriptor for a latitude parameter in degrees without default value. This method is used for latitude of origin that cannot be zero, of for standard parallels where the default value should be the value of another parameter instead of 0°.
    • createLatitude

      static org.opengis.parameter.ParameterDescriptor<Double> createLatitude(ParameterBuilder builder, boolean includePoles)
      Creates a descriptor for a latitude parameter in degrees with a default value of 0°.
    • createLongitude

      static org.opengis.parameter.ParameterDescriptor<Double> createLongitude(ParameterBuilder builder)
      Creates a descriptor for a longitude parameter in degrees with a default value of 0°.
    • createScale

      static org.opengis.parameter.ParameterDescriptor<Double> createScale(ParameterBuilder builder)
      Creates a descriptor for a scale parameter with a default value of 1.
    • createShift

      static org.opengis.parameter.ParameterDescriptor<Double> createShift(ParameterBuilder builder)
      Creates a false easting, false northing or height parameter in metre with a default value of 0.
    • resolveAmbiguity

      public String resolveAmbiguity(DefaultMathTransformFactory.Context context)
      If an operation method is ambiguous according Apache SIS, returns the name of the method that SIS should use. Otherwise returns null. The ambiguities that need to be resolved are:
      Parameters:
      context - the potentially ambiguous context.
      Returns:
      name of the provider to use, or null if there is nothing to change.
      Since:
      0.8
    • getOperationType

      public final Class<? extends org.opengis.referencing.operation.SingleOperation> getOperationType()
      Returns the interface implemented by the coordinate operation. This method returns the type specified at construction time.
      Overrides:
      getOperationType in class DefaultOperationMethod
      Returns:
      interface implemented by all coordinate operations that use this method.
      See Also:
    • inverse

      public AbstractProvider inverse()
      Returns the operation method which is the inverse of this method.
      • If null, no inverse method is easily available. This is the default.
      • If this, the inverse of this operation method is the same operation method with some parameter values changed (typically with sign inverted).
      • If another method, it should take the same parameter values.

      This is a SIS-specific information which may be changed in any future SIS version. Current implementation provides this information in a "all or nothing" way: either all parameter values can have their sign reversed, or either the operation is considered not revertible at all. This is different than the EPSG dataset in two way:

      • EPSG provides an equivalent information in the PARAM_SIGN_REVERSAL column of the [Coordinate_Operation Parameter Usage] table, but on a parameter-by-parameter basis instead of for the whole operation (which is probably better).
      • EPSG provides another information in the REVERSE_OP column of the [Coordinate_Operation Method] table, but this is not equivalent to this method because it does not differentiate the map projection methods from inverse map projection methods.
      Returns:
      the inverse of this operation method (possibly this), or null if none.
      See Also:
    • recoverableException

      static void recoverableException(Class<? extends AbstractProvider> caller, Exception e)
      Convenience method for reporting a non-fatal error at transform construction time. This method assumes that the error occurred (indirectly) during execution of MathTransformProvider.createMathTransform(MathTransformFactory, ParameterValueGroup).
      Parameters:
      caller - the provider class in which the error occurred.
      e - the error that occurred.