Object
DomainDefinition

public class DomainDefinition extends Object
Specification about how to estimate a domain of validity for transforms. Contrarily to CRS domain of validity, this class estimates a domain based on mathematical behavior only, not on "real world" considerations. For example, the Mercator projection tends to infinity when approaching poles, so it is recommended to not use it above some latitude threshold, typically 80° or 84°. The exact limit is arbitrary. This is different than the domain of validity of CRS, which is often limited to a particular country. In general, the CRS domain of validity is much smaller than the domain computed by this class.

Current implementation does not yet provide ways to describe how a domain is decided. A future version may, for example, allows to specify a maximal deformation tolerated for map projections. In current implementation, the estimation can be customized by overriding the estimate(Math­Transform) or intersect(Envelope) methods.

Each Domain­Definition instance should be used only once for an Abstract­Math­Transform instance, unless that transform is a chain of concatenated transforms (this case is handled automatically by Apache SIS). Usage example:

AbstractMathTransform transform = …;
transform.getDomain(new DomainDefinition()).ifPresent((domain) -> {
    // Do something here with the transform domain.
});
The Math­Transforms​.get­Domain(Math­Transform) convenience method can be used when the default implementation is sufficient.
Since:
1.3
See Also:
  • Constructor Details

    • DomainDefinition

      public DomainDefinition()
      Creates a new instance using default configuration.
  • Method Details

    • estimate

      public void estimate(MathTransform evaluated) throws TransformException
      Estimates the domain of the given math transform and intersects it with previously computed domains. The result can be obtained by a call to result().

      The default implementation invokes Abstract­Math­Transform​.get­Domain(Domain­Definition) if possible, or does nothing otherwise. The domain provided by the transform is given to intersect(Envelope). Subclasses can override for modifying this behavior.

      Parameters:
      evaluated - the transform for which to estimate the domain.
      Throws:
      Transform­Exception - if the domain cannot be estimated.
    • intersect

      public void intersect(Envelope domain)
      Sets the domain to the intersection of current domain with the specified envelope. The envelope coordinates shall be in units of the inputs of the first Math­Transform given to estimate(Math­Transform). If that method is invoked recursively in a chain of transforms, callers are responsible for converting the envelope.
      Parameters:
      domain - the domain to intersect with.
    • result

      public Optional<Envelope> result()
      Returns the domain computed so far by this instance. The envelope is in units of the inputs of the transform given in the first call to estimate(Math­Transform).
      Returns:
      the domain of the transform being evaluated.
    • toString

      public String toString()
      Returns a string representation for debugging purposes.
      Overrides:
      to­String in class Object
      Returns:
      string representation of current domain.