Search in sources :

Example 81 with ValueReference

use of org.opengis.filter.ValueReference in project geotoolkit by Geomatys.

the class ExpressionReadingTest method testPropertyName3.

@Test
public void testPropertyName3() throws CQLException {
    final String cql = "ùth{e_$uglY^_pr@perté";
    final Expression obj = CQL.parseExpression(cql);
    assertTrue(obj instanceof ValueReference);
    final ValueReference expression = (ValueReference) obj;
    assertEquals("ùth{e_$uglY^_pr@perté", expression.getXPath());
}
Also used : Expression(org.opengis.filter.Expression) MultiLineString(org.locationtech.jts.geom.MultiLineString) LineString(org.locationtech.jts.geom.LineString) ValueReference(org.opengis.filter.ValueReference) Test(org.junit.Test)

Example 82 with ValueReference

use of org.opengis.filter.ValueReference in project geotoolkit by Geomatys.

the class JavaScriptFunction method apply.

@Override
public Object apply(final Object feature) {
    final Bindings bindings = getEngine().createBindings();
    for (int i = 1, n = parameters.size(); i < n; i++) {
        final ValueReference property = (ValueReference) parameters.get(i);
        final Object value = property.apply(feature);
        bindings.put(VAR_CHARACTER + property.getXPath(), value);
    }
    try {
        return getCompiled().eval(bindings);
    } catch (ScriptException ex) {
        Logger.getLogger("org.geotoolkit.filter.function.javascript").log(Level.WARNING, null, ex);
    }
    return "";
}
Also used : ScriptException(javax.script.ScriptException) Bindings(javax.script.Bindings) ValueReference(org.opengis.filter.ValueReference)

Aggregations

ValueReference (org.opengis.filter.ValueReference)82 Literal (org.opengis.filter.Literal)53 Test (org.junit.Test)52 JAXBElement (javax.xml.bind.JAXBElement)39 Filter (org.opengis.filter.Filter)39 Marshaller (javax.xml.bind.Marshaller)36 Unmarshaller (javax.xml.bind.Unmarshaller)36 Expression (org.opengis.filter.Expression)27 BinaryComparisonOperator (org.opengis.filter.BinaryComparisonOperator)25 PropertyNameType (org.geotoolkit.ogc.xml.v100.PropertyNameType)18 PropertyNameType (org.geotoolkit.ogc.xml.v110.PropertyNameType)18 LiteralType (org.geotoolkit.ogc.xml.v100.LiteralType)16 LiteralType (org.geotoolkit.ogc.xml.v110.LiteralType)16 FilterType (org.geotoolkit.ogc.xml.v110.FilterType)14 FilterType (org.geotoolkit.ogc.xml.v100.FilterType)12 LogicalOperator (org.opengis.filter.LogicalOperator)12 ComparisonOpsType (org.geotoolkit.ogc.xml.v100.ComparisonOpsType)10 BinaryComparisonOpType (org.geotoolkit.ogc.xml.v100.BinaryComparisonOpType)9 BinaryComparisonOpType (org.geotoolkit.ogc.xml.v110.BinaryComparisonOpType)9 ComparisonOpsType (org.geotoolkit.ogc.xml.v110.ComparisonOpsType)9