Class BinaryGeometryFilter<R,G>

Type Parameters:
R - the type of resources (e.g. Feature) used as inputs.
G - the implementation type of geometry objects.
All Implemented Interfaces:
Serializable, Predicate<R>, Filter<R>, Optimization.OnFilter<R>
Direct Known Subclasses:
BinarySpatialFilter, DistanceFilter

abstract class BinaryGeometryFilter<R,G> extends FilterNode<R> implements Optimization.OnFilter<R>
Base class for filters having two expressions evaluating to geometries. In addition of 2 geometries, the filter can have additional non-geometric arguments. The nature of the operation depends on the subclass.
Since:
1.1
Version:
1.1
  • Field Details

    • serialVersionUID

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

      protected final Expression<? super R,GeometryWrapper<G>> expression1
      The first of the two expressions to be used by this function.
    • expression2

      protected final Expression<? super R,GeometryWrapper<G>> expression2
      The second of the two expressions to be used by this function.
    • context

      protected final SpatialOperationContext context
      The preferred CRS and other context to use if geometry transformations are needed.
  • Constructor Details

    • BinaryGeometryFilter

      protected BinaryGeometryFilter(Geometries<G> library, Expression<? super R,?> geometry1, Expression<? super R,?> geometry2, javax.measure.Unit<?> systemUnit)
      Creates a new binary function.
      Parameters:
      geometry1 - the first of the two expressions to be used by this function.
      geometry2 - the second of the two expressions to be used by this function.
      systemUnit - if the CRS needs to be in some units of measurement, the Unit.getSystemUnit() value.
  • Method Details

    • recreate

      protected abstract BinaryGeometryFilter<R,G> recreate(Expression<? super R,?> geometry1, Expression<? super R,?> geometry2)
      Recreates a new filter of the same type and with the same parameters, but using the given expressions. This method is invoked when it is possible to simplify or optimize at least one of the expressions that were given in the original call to the constructor.
    • original

      protected static <R, G> Expression<? super R,?> original(Expression<R,GeometryWrapper<G>> expression)
      Returns the original expression specified by the user.
      Type Parameters:
      R - the type of resources (e.g. Feature) used as inputs.
      G - the geometry implementation type.
      Parameters:
      expression - the expression to unwrap.
      Returns:
      the unwrapped expression.
    • getExpressions

      public List<Expression<? super R,?>> getExpressions()
      Returns the two expressions used as parameters by this filter.
      Specified by:
      getExpressions in interface Filter<R>
      Returns:
      the expressions used as inputs, or an empty list if none.
    • optimize

      public final Filter<? super R> optimize(Optimization optimization)
      Tries to optimize this filter. This method checks if any expression is a literal. If both expressions are literal, we can evaluate immediately. If any expression is a literal and returns null, then the result is known in advance too.
      Specified by:
      optimize in interface Optimization.OnFilter<R>
      Parameters:
      optimization - the simplifications or optimizations to apply on this filter.
      Returns:
      the simplified or optimized filter, or this if no optimization has been applied.
    • negativeResult

      protected abstract boolean negativeResult()
      Returns the value to return when a test cannot be applied.