Class WraparoundApplicator

java.lang.Object
org.apache.sis.internal.referencing.WraparoundApplicator

public final class WraparoundApplicator extends Object
Appends a WraparoundTransform to an existing MathTransform. Each WraparoundTransform instance should be used only once.
Since:
1.1
Version:
1.3
Author:
Martin Desruisseaux (Geomatys)
  • Constructor Summary

    Constructors
    Constructor
    Description
    WraparoundApplicator(org.opengis.geometry.DirectPosition sourceMedian, org.opengis.geometry.DirectPosition targetMedian, org.opengis.referencing.cs.CoordinateSystem targetCS)
    Creates a new applicator.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.opengis.referencing.operation.MathTransform
    forDomainOfUse(org.opengis.referencing.operation.MathTransform tr)
    Returns the given transform augmented with a "wrap around" behavior if applicable.
    static org.opengis.referencing.operation.MathTransform
    forTargetCRS(org.opengis.referencing.operation.CoordinateOperation op)
    Returns the transform of the given coordinate operation augmented with a "wrap around" behavior if applicable.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • WraparoundApplicator

      public WraparoundApplicator(org.opengis.geometry.DirectPosition sourceMedian, org.opengis.geometry.DirectPosition targetMedian, org.opengis.referencing.cs.CoordinateSystem targetCS)
      Creates a new applicator. The median coordinates are optional and can be null. Coordinates shall be in the source and target CRS of the WraparoundTransform, not in the source CRS of the concatenated transform to be created by this applicator.
      Parameters:
      sourceMedian - the coordinates at the center of source envelope, or null if none.
      targetMedian - the coordinates to put at the center of new range, or null for standard axis center.
      targetCS - the target coordinate system.
  • Method Details

    • forTargetCRS

      public static org.opengis.referencing.operation.MathTransform forTargetCRS(org.opengis.referencing.operation.CoordinateOperation op) throws org.opengis.referencing.operation.TransformException
      Returns the transform of the given coordinate operation augmented with a "wrap around" behavior if applicable. The wraparound is applied on target coordinates and aims to clamp coordinate values inside the range of target coordinate system axes.

      This method tries to avoid unnecessary wraparounds on a best-effort basis. It makes its decision based on an inspection of source and target CRS axes. For a method making decision based on a domain of use, see forDomainOfUse(…) instead.

      Parameters:
      op - the coordinate operation for which to get the math transform.
      Returns:
      the math transform for the given coordinate operation.
      Throws:
      org.opengis.referencing.operation.TransformException - if a coordinate cannot be computed.
    • forDomainOfUse

      public org.opengis.referencing.operation.MathTransform forDomainOfUse(org.opengis.referencing.operation.MathTransform tr) throws org.opengis.referencing.operation.TransformException
      Returns the given transform augmented with a "wrap around" behavior if applicable. The wraparound is applied on target coordinates and aims to clamp coordinate values in a range centered on the target median given at construction time.

      The centered ranges may be different than the range declared by the coordinate system axes. In such case, the wraparound range applied by this method will have a translation compared to the range declared by the axis. This translation is useful when the target domain is known (e.g. when transforming a raster) and we want that output coordinates to be continuous in that domain, independently of axis ranges.

      If a non-null sourceMedian position has been specified at construction time, those coordinates shall be expressed in the target CRS of given transform.

      Parameters:
      tr - the transform to augment with "wrap around" behavior.
      Returns:
      the math transform with wraparound if needed.
      Throws:
      org.opengis.referencing.operation.TransformException - if a coordinate cannot be computed.