Search in sources :

Example 11 with LiteralType

use of org.geotoolkit.ogc.xml.v110.LiteralType in project geotoolkit by Geomatys.

the class FilterFactoryImpl method lessOrEqual.

@Override
public BinaryComparisonOperator<Object> lessOrEqual(final Expression<Object, ?> expr1, final Expression<Object, ?> expr2) {
    LiteralType lit = null;
    PropertyNameType propName = null;
    if (expr1 instanceof PropertyNameType) {
        propName = (PropertyNameType) expr1;
    } else if (expr2 instanceof PropertyNameType) {
        propName = (PropertyNameType) expr2;
    }
    if (expr1 instanceof LiteralType) {
        lit = (LiteralType) expr1;
    } else if (expr2 instanceof LiteralType) {
        lit = (LiteralType) expr2;
    }
    return new PropertyIsLessThanOrEqualToType(lit, propName, null);
}
Also used : LiteralType(org.geotoolkit.ogc.xml.v110.LiteralType) PropertyIsLessThanOrEqualToType(org.geotoolkit.ogc.xml.v110.PropertyIsLessThanOrEqualToType) PropertyNameType(org.geotoolkit.ogc.xml.v110.PropertyNameType)

Example 12 with LiteralType

use of org.geotoolkit.ogc.xml.v110.LiteralType in project geotoolkit by Geomatys.

the class FilterFactoryImpl method disjoint.

@Override
public BinarySpatialOperator<Object> disjoint(final Expression<Object, ?> geometry1, final Expression<Object, ?> geometry2) {
    PropertyNameType propertyName = null;
    if (geometry1 instanceof PropertyNameType) {
        propertyName = (PropertyNameType) geometry1;
    } else {
        throw new IllegalArgumentException("unexpected type instead of propertyNameType: " + geometry1.getClass().getSimpleName());
    }
    // we transform the JTS geometry into a GML geometry
    Object geom = null;
    if (geometry2 instanceof LiteralType) {
        geom = ((LiteralType) geometry2).getValue();
        geom = GeometryToGML(geom);
    }
    return new DisjointType(propertyName, geom);
}
Also used : DisjointType(org.geotoolkit.ogc.xml.v110.DisjointType) LiteralType(org.geotoolkit.ogc.xml.v110.LiteralType) PropertyNameType(org.geotoolkit.ogc.xml.v110.PropertyNameType)

Example 13 with LiteralType

use of org.geotoolkit.ogc.xml.v110.LiteralType in project geotoolkit by Geomatys.

the class FilterFactoryImpl method dwithin.

@Override
public DistanceOperator<Object> dwithin(final Expression geometry1, final Expression geometry2, final double distance, String units) {
    String propertyName = "";
    // we get the propertyName
    if (geometry1 instanceof PropertyNameType) {
        propertyName = ((PropertyNameType) geometry1).getXPath();
    } else {
        throw new IllegalArgumentException("unexpected type instead of propertyNameType: " + geometry1.getClass().getSimpleName());
    }
    // we transform the JTS geometry into a GML geometry
    Object geom = null;
    if (geometry2 instanceof LiteralType) {
        geom = ((LiteralType) geometry2).getValue();
        geom = GeometryToGML(geom);
    }
    // we formats the units (CQL parser add a white space at the end)
    if (units.indexOf(' ') == units.length() - 1) {
        units = units.substring(0, units.length() - 1);
    }
    return new DWithinType(propertyName, (AbstractGeometryType) geom, distance, units);
}
Also used : DWithinType(org.geotoolkit.ogc.xml.v110.DWithinType) LiteralType(org.geotoolkit.ogc.xml.v110.LiteralType) LineString(org.locationtech.jts.geom.LineString) PropertyNameType(org.geotoolkit.ogc.xml.v110.PropertyNameType)

Example 14 with LiteralType

use of org.geotoolkit.ogc.xml.v110.LiteralType in project geotoolkit by Geomatys.

the class FilterFactoryImpl method equal.

@Override
public BinaryComparisonOperator<Object> equal(final Expression<Object, ?> expr1, final Expression<Object, ?> expr2, final boolean matchCase, final MatchAction action) {
    LiteralType lit = null;
    PropertyNameType propName = null;
    if (expr1 instanceof PropertyNameType) {
        propName = (PropertyNameType) expr1;
    } else if (expr2 instanceof PropertyNameType) {
        propName = (PropertyNameType) expr2;
    }
    if (expr1 instanceof LiteralType) {
        lit = (LiteralType) expr1;
    } else if (expr2 instanceof LiteralType) {
        lit = (LiteralType) expr2;
    }
    return new PropertyIsEqualToType(lit, propName, matchCase);
}
Also used : PropertyIsEqualToType(org.geotoolkit.ogc.xml.v110.PropertyIsEqualToType) LiteralType(org.geotoolkit.ogc.xml.v110.LiteralType) PropertyNameType(org.geotoolkit.ogc.xml.v110.PropertyNameType)

Example 15 with LiteralType

use of org.geotoolkit.ogc.xml.v110.LiteralType in project geotoolkit by Geomatys.

the class FilterFactoryImpl method lessOrEqual.

@Override
public BinaryComparisonOperator<Object> lessOrEqual(final Expression<Object, ?> expr1, final Expression<Object, ?> expr2, final boolean matchCase, final MatchAction action) {
    LiteralType lit = null;
    PropertyNameType propName = null;
    if (expr1 instanceof PropertyNameType) {
        propName = (PropertyNameType) expr1;
    } else if (expr2 instanceof PropertyNameType) {
        propName = (PropertyNameType) expr2;
    }
    if (expr1 instanceof LiteralType) {
        lit = (LiteralType) expr1;
    } else if (expr2 instanceof LiteralType) {
        lit = (LiteralType) expr2;
    }
    return new PropertyIsLessThanOrEqualToType(lit, propName, matchCase);
}
Also used : LiteralType(org.geotoolkit.ogc.xml.v110.LiteralType) PropertyIsLessThanOrEqualToType(org.geotoolkit.ogc.xml.v110.PropertyIsLessThanOrEqualToType) PropertyNameType(org.geotoolkit.ogc.xml.v110.PropertyNameType)

Aggregations

JAXBElement (javax.xml.bind.JAXBElement)40 LiteralType (org.geotoolkit.ogc.xml.v110.LiteralType)40 PropertyNameType (org.geotoolkit.ogc.xml.v110.PropertyNameType)40 Literal (org.opengis.filter.Literal)35 Marshaller (javax.xml.bind.Marshaller)34 Unmarshaller (javax.xml.bind.Unmarshaller)34 Test (org.junit.Test)34 ValueReference (org.opengis.filter.ValueReference)34 Filter (org.opengis.filter.Filter)26 BinaryComparisonOperator (org.opengis.filter.BinaryComparisonOperator)21 LiteralType (org.geotoolkit.ogc.xml.v100.LiteralType)17 PropertyNameType (org.geotoolkit.ogc.xml.v100.PropertyNameType)16 FilterType (org.geotoolkit.ogc.xml.v110.FilterType)14 FilterType (org.geotoolkit.ogc.xml.v100.FilterType)11 Expression (org.opengis.filter.Expression)11 LiteralType (org.flyte.api.v1.LiteralType)10 BinaryComparisonOpType (org.geotoolkit.ogc.xml.v100.BinaryComparisonOpType)9 ComparisonOpsType (org.geotoolkit.ogc.xml.v100.ComparisonOpsType)9 BinaryComparisonOpType (org.geotoolkit.ogc.xml.v110.BinaryComparisonOpType)9 LogicalOperator (org.opengis.filter.LogicalOperator)9