Class DistanceFilter<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>

final class DistanceFilter<R,G> extends BinaryGeometryFilter<R,G>
Spatial operations between two geometries and using a distance. The nature of the operation depends on the subclass.
Note: this class has 3 parameters, but the third one is not an expression. It still a "binary" operator if we count only the expressions.
Since:
1.1
Version:
1.1
  • Field Details

    • serialVersionUID

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

      private final DistanceOperatorName operatorType
      Nature of the operation applied by this DistanceOperator.
    • distance

      private final javax.measure.Quantity<javax.measure.quantity.Length> distance
      The buffer distance around the geometry of the second expression.
  • Constructor Details

    • DistanceFilter

      DistanceFilter(DistanceOperatorName operatorType, Geometries<G> library, Expression<? super R,?> geometry1, Expression<? super R,?> geometry2, javax.measure.Quantity<javax.measure.quantity.Length> distance)
      Creates a new spatial function.
      Parameters:
      operatorType - nature of the operation applied by this DistanceOperator.
      library - the geometry library to use.
      geometry1 - expression fetching the first geometry of the binary operator.
      geometry2 - expression fetching the second geometry of the binary operator.
      distance - the buffer distance around the geometry of the second expression.
  • Method Details

    • recreate

      protected 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.
      Specified by:
      recreate in class BinaryGeometryFilter<R,G>
    • getOperatorType

      public DistanceOperatorName getOperatorType()
      Identification of this operation.
      Returns:
      the nature of this operator.
    • getExpressions

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

      protected Collection<?> getChildren()
      Returns the two expressions together with the distance parameter. This is used for information purpose only, for example in order to build a string representation.
      Specified by:
      getChildren in class Node
      Returns:
      the children of this node, or an empty collection if none.
    • getDistance

      public javax.measure.Quantity<javax.measure.quantity.Length> getDistance()
      Returns the buffer distance around the geometry that will be used when comparing features geometries.
    • getGeometry

      public org.opengis.geometry.Geometry getGeometry()
      Returns the literal geometry from which distances are measured.
      Throws:
      IllegalStateException - if the geometry is not a literal.
    • test

      public boolean test(R object)
      Given an object, determines if the test(s) represented by this filter are passed.
      Parameters:
      object - the object (often a Feature instance) to evaluate.
      Returns:
      true if the test(s) are passed for the provided object.
    • negativeResult

      protected boolean negativeResult()
      Returns the value to return when a test cannot be applied.
      Specified by:
      negativeResult in class BinaryGeometryFilter<R,G>