Class TLcdOGCFilterFactory
define
an OGC Filter.- Since:
- 2012.1
-
Method Summary
Modifier and TypeMethodDescriptionstatic TLcdOGCBinaryOperator
add
(ILcdOGCExpression aFirstExpression, ILcdOGCExpression aSecondExpression) Creates an operator that corresponds to an arithmetic add operation betweenaFirstExpression
andaSecondExpression
.static TLcdOGCBinaryLogicOperator
and
(ILcdOGCCondition... aConditions) Creates a new 'and' condition that evaluates to true if all of the conditions inaConditions
are true.static TLcdOGCBBoxOperator
bbox
(ILcdBounds aBounds) Creates a new bounding box operator which can be used to perform a spatial query on anILcdModel
.static TLcdOGCBBoxOperator
bbox
(ILcdBounds aBounds, ILcdGeoReference aBoundsReference) Creates a new bounding box operator which can be used to perform a spatial query on anILcdModel
.static TLcdOGCIsBetweenOperator
between
(ILcdOGCExpression aExpression, ILcdOGCExpression aLowerBounds, ILcdOGCExpression aUpperBounds) Creates an operator that evaluates to true whenaExpression
is contained in the[aLowerBounds, aUpperBounds]
interval.static TLcdOGCBinaryOperator
div
(ILcdOGCExpression aFirstExpression, ILcdOGCExpression aSecondExpression) Creates an operator that corresponds to an arithmetic divide operation betweenaFirstExpression
andaSecondExpression
.eq
(ILcdOGCExpression aFirstExpression, ILcdOGCExpression aSecondExpression) Creates a condition that evaluates to true whenaFirstExpression
is equal toaSecondExpression
.eq
(ILcdOGCExpression aExpression, Object aLiteralContent) Creates a condition that evaluates to true whenaExpression
is equal toaLiteralContent
, which is a static value.static TLcdOGCFunction
function
(String aName, ILcdOGCExpression... aArguments) Creates a custom OGC function with the given name and arguments.gt
(ILcdOGCExpression aFirstExpression, ILcdOGCExpression aSecondExpression) Creates a condition that evaluates to true whenaFirstExpression
is greater thenaSecondExpression
gte
(ILcdOGCExpression aFirstExpression, ILcdOGCExpression aSecondExpression) Creates a condition that evaluates to true whenaFirstExpression
is greater then or equal toaSecondExpression
static TLcdOGCIsNullOperator
isNull
(TLcdOGCPropertyName aPropertyName) Creates an operator that evaluates to true when the given property is null.static TLcdOGCIsLikeOperator
like
(TLcdOGCPropertyName aPropertyName, Object aLiteralPatternContent) Creates an operator that evaluates to true when the value ofaPropertyName
matches the pattern specified inaLiteralPatternContent
.static TLcdOGCLiteral
Creates a literal foraLiteralValue
.lt
(ILcdOGCExpression aFirstExpression, ILcdOGCExpression aSecondExpression) Creates a condition that evaluates to true whenaFirstExpression
is less thenaSecondExpression
lte
(ILcdOGCExpression aFirstExpression, ILcdOGCExpression aSecondExpression) Creates a condition that evaluates to true whenaFirstExpression
is less then or equal toaSecondExpression
static ILcdOGCCondition
minBoundsSize
(double aMinSizeX, double aMinSizeY) Creates a condition that passes objects that have a minimum bounds size.static TLcdOGCBinaryOperator
mul
(ILcdOGCExpression aFirstExpression, ILcdOGCExpression aSecondExpression) Creates an operator that corresponds to an arithmetic multiply operation betweenaFirstExpression
andaSecondExpression
.static TLcdOGCNotOperator
not
(ILcdOGCCondition aCondition) Creates a condition that evaluates to true when the given condition is false and vice versa.static TLcdOGCBinaryLogicOperator
or
(ILcdOGCCondition... aConditions) Creates a new 'or' condition that evaluates to true if one of the conditions inaConditions
is true.static TLcdOGCPropertyName
property
(TLcdDataType aDataType, TLcdDataProperty... aProperties) Creates a property name that points to the last property inaProperties
, the xpath will start from an object of typeaDataType
.static TLcdOGCPropertyName
Creates a property name based on an xpath expression that only uses the default name space.static TLcdOGCPropertyName
Creates a property name based on an xpath expression that only uses the default name space.static TLcdOGCPropertyName
Creates a property name based on an xpath expression and aMap
that maps prefixes to namespaces.static TLcdOGCResourceIdsOperator
resourceIds
(TLcdOGCResourceId... aResourceIds) Creates a condition that can be used in anOGC Filter
to match elements based on their ID.static TLcdOGCResourceIdsOperator
resourceIds
(String... aResourceIds) Creates a condition that can be used in anOGC Filter
to match elements based on their ID.static TLcdOGCBinaryOperator
sub
(ILcdOGCExpression aFirstExpression, ILcdOGCExpression aSecondExpression) Creates an operator that corresponds to an arithmetic subtract operation betweenaFirstExpression
andaSecondExpression
.temporal
(TLcdOGCPropertyName aPropertyName, Date aDate, QName aComparison) Creates an operator that evaluates to true whenaPropertyName
matches in the comparison withaDate
.temporalInterval
(TLcdOGCPropertyName aPropertyName, Date aBegin, Date aEnd, QName aComparison) Creates an operator that evaluates to true whenaPropertyName
matches in the comparison with time interval defined byaBegin
andaEnd
.
-
Method Details
-
or
Creates a new 'or' condition that evaluates to true if one of the conditions inaConditions
is true.- Parameters:
aConditions
- One or more conditions.- Returns:
- A valid 'or' operator
-
and
Creates a new 'and' condition that evaluates to true if all of the conditions inaConditions
are true.- Parameters:
aConditions
- One or more conditions.- Returns:
- A valid 'and' operator
-
eq
public static TLcdOGCBinaryComparisonOperator eq(ILcdOGCExpression aFirstExpression, ILcdOGCExpression aSecondExpression) Creates a condition that evaluates to true whenaFirstExpression
is equal toaSecondExpression
.- Parameters:
aFirstExpression
- The first expression.aSecondExpression
- The second expression.- Returns:
- An 'equals' operator.
-
gt
public static TLcdOGCBinaryComparisonOperator gt(ILcdOGCExpression aFirstExpression, ILcdOGCExpression aSecondExpression) Creates a condition that evaluates to true whenaFirstExpression
is greater thenaSecondExpression
- Parameters:
aFirstExpression
- The first expressionaSecondExpression
- The second expression- Returns:
- A 'greater then' operator
-
gte
public static TLcdOGCBinaryComparisonOperator gte(ILcdOGCExpression aFirstExpression, ILcdOGCExpression aSecondExpression) Creates a condition that evaluates to true whenaFirstExpression
is greater then or equal toaSecondExpression
- Parameters:
aFirstExpression
- The first expressionaSecondExpression
- The second expression- Returns:
- A 'greater then or equal' operator
-
lt
public static TLcdOGCBinaryComparisonOperator lt(ILcdOGCExpression aFirstExpression, ILcdOGCExpression aSecondExpression) Creates a condition that evaluates to true whenaFirstExpression
is less thenaSecondExpression
- Parameters:
aFirstExpression
- The first expressionaSecondExpression
- The second expression- Returns:
- A 'less then' operator
-
lte
public static TLcdOGCBinaryComparisonOperator lte(ILcdOGCExpression aFirstExpression, ILcdOGCExpression aSecondExpression) Creates a condition that evaluates to true whenaFirstExpression
is less then or equal toaSecondExpression
- Parameters:
aFirstExpression
- The first expressionaSecondExpression
- The second expression- Returns:
- A 'less then or equal' operator
-
not
Creates a condition that evaluates to true when the given condition is false and vice versa.- Parameters:
aCondition
- The condition to invert- Returns:
- the condition that is the inverse of the given condition
-
isNull
Creates an operator that evaluates to true when the given property is null.- Parameters:
aPropertyName
- The name of the property to check- Returns:
- the operator that will check if the given property is null
-
eq
public static TLcdOGCBinaryComparisonOperator eq(ILcdOGCExpression aExpression, Object aLiteralContent) Creates a condition that evaluates to true whenaExpression
is equal toaLiteralContent
, which is a static value.- Parameters:
aExpression
- The first expression.aLiteralContent
- An object which can be compared to the result of aFirstExpression- Returns:
- An 'equals' operator.
-
like
public static TLcdOGCIsLikeOperator like(TLcdOGCPropertyName aPropertyName, Object aLiteralPatternContent) Creates an operator that evaluates to true when the value of
aPropertyName
matches the pattern specified inaLiteralPatternContent
. It uses the OGC default values for a wildcard ('*'), a single char ('?') and the escape character ('\').- Parameters:
aPropertyName
- The name of the property to checkaLiteralPatternContent
- An object which can be compared to the given property- Returns:
- the operator that will check whether the property matches the pattern
-
between
public static TLcdOGCIsBetweenOperator between(ILcdOGCExpression aExpression, ILcdOGCExpression aLowerBounds, ILcdOGCExpression aUpperBounds) Creates an operator that evaluates to true when
aExpression
is contained in the[aLowerBounds, aUpperBounds]
interval.- Parameters:
aExpression
- The expression to checkaLowerBounds
- The lower bounds of the interval (inclusive)aUpperBounds
- The upper bounds of the interval (inclusive)- Returns:
- The operator that will check whether the expression is contained in the specified range.
-
function
Creates a custom OGC function with the given name and arguments. All functions have to be supported by the filter evaluator. For the defaultTLcdOGCFilterEvaluator
, functions can be registered usingTLcdOGCFilterEvaluator.registerFunction(com.luciad.format.xml.TLcdXMLName, com.luciad.ogc.filter.evaluator.ILcdEvaluatorFunction)
. A function that evaluates to a boolean can be used directly as acondition
.
In that case, this:function
(FUNCTION_NAME, ...)eq
(function
(FUNCTION_NAME, ...),literal
(true))- Parameters:
aName
- The name of a custom function, should not be null.aArguments
- The arguments that should be passed to the function.- Returns:
- A function with the given name and arguments.
-
add
public static TLcdOGCBinaryOperator add(ILcdOGCExpression aFirstExpression, ILcdOGCExpression aSecondExpression) Creates an operator that corresponds to an arithmetic add operation between
Note that the OGC Filter 2.0 standard no longer includes the binary operators. You will get anaFirstExpression
andaSecondExpression
.IllegalArgumentException
when you use this operator in OGC Filter 2.0 XML (for example WFS 2.0).- Parameters:
aFirstExpression
- The first expressionaSecondExpression
- The second expression- Returns:
- An 'add' operator
-
sub
public static TLcdOGCBinaryOperator sub(ILcdOGCExpression aFirstExpression, ILcdOGCExpression aSecondExpression) Creates an operator that corresponds to an arithmetic subtract operation between
Note that the OGC Filter 2.0 standard no longer includes the binary operators. You will get anaFirstExpression
andaSecondExpression
.IllegalArgumentException
when you use this operator in OGC Filter 2.0 XML (for example WFS 2.0).- Parameters:
aFirstExpression
- The first expressionaSecondExpression
- The second expression- Returns:
- An 'subtract' operator
-
mul
public static TLcdOGCBinaryOperator mul(ILcdOGCExpression aFirstExpression, ILcdOGCExpression aSecondExpression) Creates an operator that corresponds to an arithmetic multiply operation between
Note that the OGC Filter 2.0 standard no longer includes the binary operators. You will get anaFirstExpression
andaSecondExpression
.IllegalArgumentException
when you use this operator in OGC Filter 2.0 XML (for example WFS 2.0).- Parameters:
aFirstExpression
- The first expressionaSecondExpression
- The second expression- Returns:
- An 'multiply' operator
-
div
public static TLcdOGCBinaryOperator div(ILcdOGCExpression aFirstExpression, ILcdOGCExpression aSecondExpression) Creates an operator that corresponds to an arithmetic divide operation between
Note that the OGC Filter 2.0 standard no longer includes the binary operators. You will get anaFirstExpression
andaSecondExpression
.IllegalArgumentException
when you use this operator in OGC Filter 2.0 XML (for example WFS 2.0).- Parameters:
aFirstExpression
- The first expressionaSecondExpression
- The second expression- Returns:
- An 'divide' operator
-
temporal
public static TLcdOGCBinaryTemporalOperator temporal(TLcdOGCPropertyName aPropertyName, Date aDate, QName aComparison) Creates an operator that evaluates to true when
aPropertyName
matches in the comparison withaDate
. TheaComparison
type determines how the dates are matched.Example:
Date date = new Date(); TLcdOGCBinaryTemporalOperator operator = temporal(property("timeProperty"), date, TLcdOGCBinaryTemporalOperator.BEFORE);
Date date = new Date(); TLcdOGCBinaryTemporalOperator operator = temporal(property("timeProperty"), date, TLcdOGCBinaryTemporalOperator.BEFORE);
- Parameters:
aPropertyName
- the name of the property to checkaDate
- the date to compare withaComparison
- the type of the temporal comparison, seeTLcdOGCBinaryTemporalOperator
- Returns:
- An temporal operator
- Since:
- 2017.0
-
temporalInterval
public static TLcdOGCBinaryTemporalOperator temporalInterval(TLcdOGCPropertyName aPropertyName, Date aBegin, Date aEnd, QName aComparison) Creates an operator that evaluates to true when
aPropertyName
matches in the comparison with time interval defined byaBegin
andaEnd
. TheaComparison
type determines how the dates are matched.- Parameters:
aPropertyName
- the name of the property to checkaBegin
- the begin dateaEnd
- the end dateaComparison
- the type of the temporal comparison, seeTLcdOGCBinaryTemporalOperator
- Returns:
- An temporal operator
- Since:
- 2017.0
-
property
Creates a property name that points to the last property inaProperties
, the xpath will start from an object of typeaDataType
. Each property inaProperties
should be a child property of its preceding property. The first property in the list does not have to be a direct child ofaDataType
. Returns null if a suitable path could not be found. There are some usage considerations:- This operation can be costly for large data models, so in general it is recommended to store the resulting property name once it is created.
- The data property should not be a property of a GML geometry data type, as there is usually no need to reference part of a geometry.
TLcdDataType
and the firstTLcdDataProperty
inaDataProperties
will be determined based on a best-effort approach. This means that a result is not guaranteed, mostly depending on the complexity of the data model. It is only necessary to specify multipleTLcdDataProperty
instances if the xpath generation fails to find a path betweenaDataType
and the first property inaProperties
.- Parameters:
aDataType
- A data type from which to reach the propertyaProperties
- A list of subsequent properties, each property in the list should be a child property of its preceding property.- Returns:
- A property name, or null if no suitable path could be found
-
property
public static TLcdOGCPropertyName property(String aExpression, Map<String, String> aPrefix2Namespace) Creates a property name based on an xpath expression and aMap
that maps prefixes to namespaces. An empty string can be used to define the default namespace. Example, note that the prefix map can be reused for multiple property names:Map<String, String> namespaceMap = new HashMap<String, String>(2); namespaceMap.put("", "DefaultNS"); namespaceMap.put("ogc", "http://www.opengis.net/ogc"); TLcdOGCPropertyName filterProperty = property("MyObject/ogc:Filter", namespaceMap);
- Parameters:
aExpression
- An XPath expressionaPrefix2Namespace
- A map containing prefixes.- Returns:
- A valid property name.
-
property
Creates a property name based on an xpath expression that only uses the default name space. Functionally equivalent toproperty(String, java.util.Map)
with an empty map.- Parameters:
aExpression
- An XPath expression- Returns:
- A valid property name.
-
property
Creates a property name based on an xpath expression that only uses the default name space. The default name space is specified as a parameter.
Functionally equivalent to
property(String, java.util.Map)
with a map containing one entry("", aDefaultNameSpace)
.- Parameters:
aExpression
- An XPath expressionaDefaultNameSpace
- The default name space (which uses an empty prefix)- Returns:
- A valid property name
-
literal
Creates a literal for
aLiteralValue
.Short for
new TLcdOGCLiteral( aLiteralValue )
- Parameters:
aLiteralValue
- The literal value- Returns:
- The
TLcdOGCLiteral
foraLiteralValue
-
minBoundsSize
Creates a condition that passes objects that have a minimum bounds size. You can use this for example to discard objects that are too small to see when zoomed out. SeeTLcdOGCVendorSpecificFunctions.MIN_BOUNDS_SIZE_FUNCTION_NAME
for details. Equivalent to:function
(MIN_BOUNDS_SIZE_FUNCTION_NAME
,literal
(aMinSizeX),literal
(aMinSizeY))eq
(function
(MIN_BOUNDS_SIZE_FUNCTION_NAME
,literal
(aMinSizeX),literal
(aMinSizeY)),literal
(true))- Parameters:
aMinSizeX
- The minimum X extent objects should have, in model units.aMinSizeY
- The minimum Y extent objects should have, in model units.- Returns:
- The condition
- Since:
- 2017.0
-
resourceIds
Creates a condition that can be used in anOGC Filter
to match elements based on their ID. This operator can be used regardless of what OGC Filter version is used for (de)serialization:- When used as an OGC Filter 1.1 (for example WFS 1), this operator will be transformed to/from an OGC Filter with a list of
object IDs
- When used as an OGC Filter 2.0 (for example WFS 2), this operator will be transformed to/from an OGC Filter with a condition with a list of
resource IDs
- Returns:
- The condition
- Since:
- 2017.0
- When used as an OGC Filter 1.1 (for example WFS 1), this operator will be transformed to/from an OGC Filter with a list of
-
resourceIds
Creates a condition that can be used in anOGC Filter
to match elements based on their ID. This operator can be used regardless of what OGC Filter version is used for (de)serialization:- When used as an OGC Filter 1.1 (for example WFS 1), this operator will be transformed to/from an OGC Filter with a list of
object IDs
- When used as an OGC Filter 2.0 (for example WFS 2), this operator will be transformed to/from an OGC Filter with a condition with a list of
resource IDs
- Returns:
- The condition
- Since:
- 2017.0
- When used as an OGC Filter 1.1 (for example WFS 1), this operator will be transformed to/from an OGC Filter with a list of
-
bbox
Creates a new bounding box operator which can be used to perform a spatial query on an
ILcdModel
. This method is equivalent to calling:bbox(aBounds, null)
- Parameters:
aBounds
- The bounds- Returns:
- The condition
- Since:
- 2019.1
-
bbox
Creates a new bounding box operator which can be used to perform a spatial query on an
ILcdModel
.When using the returned
TLcdOGCBBoxOperator
to filter domain objects from a model intersecting with the specified bounds (e.g. using aTLcdOGCFilter
or thequery
method), the operator will compare the geometry of the domain object with those bounds. TheTLcdOGCBBoxOperator
supports:ILcdDataObject
domain objects which expose their geometry through theTLcdHasGeometryAnnotation
.- Domain objects which implement the
ILcdShape
interface.
An example how this method can be used to perform a spatial query on a model using the
query
method://Start by creating the bbox condition TLcdOGCBBoxOperator bbox = bbox(new TLcdLonLatBounds(10, 10, 10, 10), new TLcdGeodeticReference()); //use that bbox condition to query the model for all elements that intersect with those bounds try (TLcdLockUtil.Lock readLock = TLcdLockUtil.readLock(aModel)) { try (Stream<Object> domainObjects = aModel.query(ILcdModel.filter(bbox))) { //do something with the found domain objects long count = domainObjects.count(); System.out.println("Found " + count + " domain objects in those bounds"); } }
- Parameters:
aBounds
- The bounds.aBoundsReference
- The reference of those bounds. When usingnull
:- The bounds are assumed to be in the model reference when using the condition to query the model directly.
- The bounds are assumed to be in the default georeference of the filter context when used to evaluate an OGC filter.
When that reference is also
null
, the bounds are assumed to be defined in the same reference as the shape for which the bounds check is happening.
- Returns:
- The condition
- Since:
- 2019.1
-