Search in sources :

Example 16 with PropertyNameType

use of org.geotoolkit.ogc.xml.v100.PropertyNameType 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 17 with PropertyNameType

use of org.geotoolkit.ogc.xml.v100.PropertyNameType 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 18 with PropertyNameType

use of org.geotoolkit.ogc.xml.v100.PropertyNameType in project geotoolkit by Geomatys.

the class FilterFactoryImpl method tcontains.

@Override
public TemporalOperator<Object> tcontains(final Expression<Object, ?> expr1, final Expression<Object, ?> expr2) {
    Object temporal = null;
    PropertyNameType propName = null;
    if (expr1 instanceof PropertyNameType) {
        propName = (PropertyNameType) expr1;
        temporal = expr2;
    } else if (expr2 instanceof PropertyNameType) {
        propName = (PropertyNameType) expr2;
        temporal = expr1;
    }
    return new TimeContainsType(propName.getXPath(), temporal);
}
Also used : TimeContainsType(org.geotoolkit.ogc.xml.v110.TimeContainsType) PropertyNameType(org.geotoolkit.ogc.xml.v110.PropertyNameType)

Example 19 with PropertyNameType

use of org.geotoolkit.ogc.xml.v100.PropertyNameType 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 20 with PropertyNameType

use of org.geotoolkit.ogc.xml.v100.PropertyNameType 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

PropertyNameType (org.geotoolkit.ogc.xml.v110.PropertyNameType)62 JAXBElement (javax.xml.bind.JAXBElement)46 LiteralType (org.geotoolkit.ogc.xml.v110.LiteralType)38 Test (org.junit.Test)38 Unmarshaller (javax.xml.bind.Unmarshaller)37 Marshaller (javax.xml.bind.Marshaller)36 ValueReference (org.opengis.filter.ValueReference)36 Literal (org.opengis.filter.Literal)30 Filter (org.opengis.filter.Filter)26 PropertyNameType (org.geotoolkit.ogc.xml.v100.PropertyNameType)20 BinaryComparisonOperator (org.opengis.filter.BinaryComparisonOperator)20 LiteralType (org.geotoolkit.ogc.xml.v100.LiteralType)16 FilterType (org.geotoolkit.ogc.xml.v110.FilterType)16 PropertyNameType (net.opengis.filter.v_1_1_0.PropertyNameType)13 FilterType (org.geotoolkit.ogc.xml.v100.FilterType)12 Expression (org.opengis.filter.Expression)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