Class WraparoundAdjustment

Object
WraparoundAdjustment

public class WraparoundAdjustment extends Object
An envelope or position converter making them more compatible with a given domain of validity. For each axes having Range­Meaning​.WRAPAROUND, this class can add or subtract an integer amount of periods (typically 360° of longitude) in attempt to move positions or envelopes inside a domain of validity specified at construction time.

Wraparound­Adjustment instances are not thread-safe.

Since:
1.2
  • Constructor Details

    • WraparoundAdjustment

      public WraparoundAdjustment(Envelope domain, CoordinateReferenceSystem target)
      Creates a new instance for adjusting Area Of Interest (AOI) or Point Of Interest (POI) to the given domain. The results of shift(…) methods will be transformed (if needed) to the specified CRS.
      Parameters:
      domain - the region where a given area or point of interest should be located.
      target - the coordinate reference system of objects returned by shift(…) methods, or null for the same CRS than the domain CRS..
    • WraparoundAdjustment

      public WraparoundAdjustment(Envelope domain, MathTransform domainToInput, MathTransform inputToResult)
      Creates a new instance with specified transforms from domain to the CRS of inputs, then to the CRS of outputs. This constructor can be used when those transforms are known in advance; it avoids the cost of inferring them. With this constructor, Wraparound­Adjustment does not verify if a coordinate operation is needed for a pair of CRS; it is caller's responsibility to ensure that input objects use the expected CRS.

      Example

      In the context of Grid­Geometry, the domain argument may be the geospatial envelope of the grid and the input­To­Result argument may be the "CRS to grid" transform. This configuration allows to compute grid coordinates having more chances to be inside the grid.
      Parameters:
      domain - the region where a given area (AOI) or point of interest (POI) should be located.
      domain­To­Input - if the AOI or POI will use a different CRS than domain, the transform from domain to the input CRS. Otherwise null for same CRS as the domain.
      input­To­Result - a transform from the domain CRS to any user space at caller choice. If null, the results will be expressed in same CRS than the inputs.
  • Method Details

    • shift

      public GeneralEnvelope shift(Envelope areaOfInterest) throws TransformException
      Computes an envelope with coordinates equivalent to the given area­Of­Interest, but potentially shifted for intersecting the domain of validity specified at construction time. The dimensions that may be shifted are the ones having an axis with wraparound meaning. In order to perform this operation, the envelope may be temporarily converted to a geographic CRS and converted back to its original CRS.

      The coordinate reference system should be specified in the area­Of­Interest. If not, then the CRS is assumed same as the CRS of the domain specified at construction time.

      This method does not intersect the area of interest with the domain of validity. It is up to the caller to compute that intersection after this method call, if desired.

      Parameters:
      area­Of­Interest - the envelope to potentially shift toward domain of validity. If a shift is needed, then given envelope will be replaced by a new envelope; the given envelope will not be modified.
      Returns:
      envelope potentially expanded or shifted toward the domain of validity.
      Throws:
      Transform­Exception - if a coordinate conversion failed.
      See Also:
    • shift

      public DirectPosition shift(DirectPosition pointOfInterest) throws TransformException
      Computes a position with coordinates equivalent to the given point­Of­Interest, but potentially shifted to interior of the domain of validity specified at construction time. The dimensions that may be shifted are the ones having an axis with wraparound meaning. In order to perform this operation, the position may be temporarily converted to a geographic CRS and converted back to its original CRS.

      The coordinate reference system should be specified in the point­Of­Interest. If not, then the CRS is assumed same as the CRS of the domain specified at construction time.

      Parameters:
      point­Of­Interest - the position to potentially shift to domain of validity interior. If a shift is needed, then the given position will be replaced by a new position; the given position will not be modified.
      Returns:
      position potentially shifted to the domain of validity interior.
      Throws:
      Transform­Exception - if a coordinate conversion failed.