Class SpatialOperationContext

java.lang.Object
org.apache.sis.internal.feature.SpatialOperationContext
All Implemented Interfaces:
Serializable

public final class SpatialOperationContext extends Object implements Serializable
Context (such as desired CRS) in which a spatial operator will be executed.

Instances of this class are immutable and thread-safe.

The serialization form is not a committed API and may change in any future version.

Since:
1.1
Version:
1.3
Author:
Martin Desruisseaux (Geomatys)
See Also:
  • Constructor Details

    • SpatialOperationContext

      public SpatialOperationContext(org.opengis.metadata.extent.GeographicBoundingBox areaOfInterest, GeometryWrapper<?> literal, javax.measure.Unit<?> systemUnit, int skipIndex) throws org.opengis.util.FactoryException, org.opengis.referencing.operation.TransformException, javax.measure.IncommensurableException
      Creates a new context.
      Parameters:
      areaOfInterest - approximate geographic area of geometries, or null if unspecified.
      literal - if a geometry operand is a literal, that literal. Otherwise null.
      systemUnit - if the CRS needs to be in some units of measurement, the Unit.getSystemUnit() value.
      skipIndex - index of the geometry associated to commonCRS, or -1 if none.
      Throws:
      org.opengis.util.FactoryException - if an error occurred while fetching literal CRS.
      org.opengis.referencing.operation.TransformException - if a coordinate conversion was required but failed.
      javax.measure.IncommensurableException - if a coordinate system does not use the expected units.
  • Method Details

    • transform

      public <G> GeometryWrapper<G> transform(GeometryWrapper<G> geometry) throws org.opengis.util.FactoryException, org.opengis.referencing.operation.TransformException
      Transforms the specified geometry to the computation CRS. Geometries with unspecified CRS will be used as-is, without transformation. The common CRS is stored in the commonCRS field.
      Type Parameters:
      G - geometry implementation base class.
      Parameters:
      geometry - the geometry to transform.
      Returns:
      the transformed geometry, or the same instance if no transformation was applied.
      Throws:
      org.opengis.util.FactoryException - if an error occurred while fetching a CRS.
      org.opengis.referencing.operation.TransformException - if a coordinate conversion was required but failed.
    • negativeResult

      public static boolean negativeResult(SpatialOperatorName type)
      The value to return when a test cannot be applied. This method is defined for having a single place to update if more operator types need to be recognized.
      Parameters:
      type - the test that could not be applied.
      Returns:
      the operation result to assume.
    • negativeResult

      public static boolean negativeResult(DistanceOperatorName type)
      The value to return when a test cannot be applied. This method is defined for having a single place to update if more operator types need to be recognized.
      Parameters:
      type - the test that could not be applied.
      Returns:
      the operation result to assume.