Class TwoGeometries<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, Function<R,Object>, Expression<R,Object>, Optimization.OnExpression<R,Object>, FeatureExpression<R,Object>
Direct Known Subclasses:
TwoGeometries.WithArgument

class TwoGeometries<R,G> extends SpatialFunction<R>
SQLMM spatial functions taking two geometry operands.
Since:
1.1
Version:
1.3
  • Field Details

  • Constructor Details

    • TwoGeometries

      TwoGeometries(SQLMM operation, Expression<? super R,?>[] parameters, Geometries<G> library)
      Creates a new function for geometries represented by the given parameter.
  • Method Details

    • recreate

      public Expression<R,Object> recreate(Expression<? super R,?>[] effective)
      Creates a new expression of the same type than this expression, but with an optimized geometry. The optimization may be a geometry computed immediately if all operator parameters are literals.
      Parameters:
      effective - the expressions to use as a replacement of this expression parameters.
      Returns:
      the new expression, or this if unsupported.
    • optimize

      public Expression<? super R,?> optimize(Optimization optimization)
      If the CRS of the first argument is known in advance and the second argument is a literal, transforms the second geometry to the CRS of the first argument. The transformed geometry is always the second argument because according SQLMM specification, operations shall be executed in the CRS of the first argument.
      Parameters:
      optimization - the simplifications or optimizations to apply on this expression.
      Returns:
      the simplified or optimized expression, or this if no optimization has been applied.
    • getGeometryLibrary

      final Geometries<?> getGeometryLibrary()
      Returns a handler for the library of geometric objects used by this expression.
      Specified by:
      getGeometryLibrary in class SpatialFunction<R>
      Returns:
      the geometry library (never null).
      See Also:
    • getParameters

      public List<Expression<? super R,?>> getParameters()
      Returns the sub-expressions that will be evaluated to provide the parameters to the function.
      Returns:
      the sub-expressions to be evaluated, or an empty list if none.
    • apply

      public Object apply(R input)
      Evaluates the two first expressions as geometry objects, applies the operation and returns the result.
      Parameters:
      input - the object to be evaluated by the expression. Can be null if this expression allows null values.
      Returns:
      value computed by the expression.