Package org.apache.sis.filter
Class DistanceFilter<R,G>
java.lang.Object
org.apache.sis.internal.filter.Node
org.apache.sis.filter.FilterNode<R>
org.apache.sis.filter.BinaryGeometryFilter<R,G>
org.apache.sis.filter.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>
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 Summary
FieldsModifier and TypeFieldDescriptionprivate final javax.measure.Quantity
<javax.measure.quantity.Length> The buffer distance around the geometry of the second expression.private final DistanceOperatorName
Nature of the operation applied by thisDistanceOperator
.private static final long
For cross-version compatibility.Fields inherited from class org.apache.sis.filter.BinaryGeometryFilter
context, expression1, expression2
-
Constructor Summary
ConstructorsConstructorDescriptionDistanceFilter
(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. -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection
<?> Returns the two expressions together with the distance parameter.javax.measure.Quantity
<javax.measure.quantity.Length> Returns the buffer distance around the geometry that will be used when comparing features geometries.List
<Expression<? super R, ?>> Returns the two expressions used as parameters by this filter.org.opengis.geometry.Geometry
Returns the literal geometry from which distances are measured.Identification of this operation.protected boolean
Returns the value to return when a test cannot be applied.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.boolean
Given an object, determines if the test(s) represented by this filter are passed.Methods inherited from class org.apache.sis.filter.BinaryGeometryFilter
optimize, original
Methods inherited from class org.apache.sis.filter.FilterNode
and, negate, or
Methods inherited from class org.apache.sis.internal.filter.Node
createName, createType, equals, getGeometryLibrary, hashCode, symbol, toGeometryWrapper, toString, unwrap, warning
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.sis.filter.Optimization.OnFilter
and, negate, or, recreate
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
operatorType
Nature of the operation applied by thisDistanceOperator
. -
distance
private final javax.measure.Quantity<javax.measure.quantity.Length> distanceThe 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 thisDistanceOperator
.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 classBinaryGeometryFilter<R,
G>
-
getOperatorType
Identification of this operation.- Returns:
- the nature of this operator.
-
getExpressions
Returns the two expressions used as parameters by this filter.- Specified by:
getExpressions
in interfaceFilter<R>
- Overrides:
getExpressions
in classBinaryGeometryFilter<R,
G> - Returns:
- the expressions used as inputs, or an empty list if none.
-
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 classNode
- 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
Given an object, determines if the test(s) represented by this filter are passed.- Parameters:
object
- the object (often aFeature
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 classBinaryGeometryFilter<R,
G>
-