Search in sources :

Example 6 with PropertyIsBetween

use of org.opengis.filter.PropertyIsBetween in project sldeditor by robward-scisys.

the class ExtractAttributes method copy.

/**
 * (non-Javadoc)
 *
 * @see org.geotools.styling.visitor.DuplicatingStyleVisitor#copy(org.opengis.filter.Filter)
 */
@Override
protected Filter copy(Filter filter) {
    if (filter instanceof NotImpl) {
        copy(((NotImpl) filter).getFilter());
    } else if (filter instanceof LogicFilterImpl) {
        LogicFilterImpl logicFilter = (LogicFilterImpl) filter;
        for (Filter childFilter : logicFilter.getChildren()) {
            copy(childFilter);
        }
    } else if (filter instanceof MultiCompareFilterImpl) {
        MultiCompareFilterImpl multiCompareFilter = (MultiCompareFilterImpl) filter;
        List<String> foundList1 = new ArrayList<>();
        Class<?> returnType1 = extractAttribute(String.class, multiCompareFilter.getExpression1(), foundList1);
        List<String> foundList2 = new ArrayList<>();
        Class<?> returnType2 = extractAttribute(String.class, multiCompareFilter.getExpression2(), foundList2);
        determineTypeFromExpressions(foundList1, returnType1, foundList2, returnType2);
    } else if (filter instanceof BinaryTemporalOperator) {
        BinaryTemporalOperator binaryTemporalOperator = (BinaryTemporalOperator) filter;
        List<String> foundList1 = new ArrayList<>();
        Class<?> returnType1 = extractAttribute(String.class, binaryTemporalOperator.getExpression1(), foundList1);
        List<String> foundList2 = new ArrayList<>();
        Class<?> returnType2 = extractAttribute(String.class, binaryTemporalOperator.getExpression2(), foundList2);
        determineTypeFromExpressions(foundList1, returnType1, foundList2, returnType2);
    } else if (filter instanceof BinarySpatialOperator) {
        BinarySpatialOperator binarySpatialOperator = (BinarySpatialOperator) filter;
        List<String> foundList1 = new ArrayList<>();
        Class<?> returnType1 = extractAttribute(String.class, binarySpatialOperator.getExpression1(), foundList1);
        List<String> foundList2 = new ArrayList<>();
        Class<?> returnType2 = extractAttribute(String.class, binarySpatialOperator.getExpression2(), foundList2);
        determineTypeFromExpressions(foundList1, returnType1, foundList2, returnType2);
    } else if (filter instanceof PropertyIsBetween) {
        PropertyIsBetween isBetween = (PropertyIsBetween) filter;
        List<String> foundList1 = new ArrayList<>();
        Class<?> returnType1 = extractAttribute(String.class, isBetween.getLowerBoundary(), foundList1);
        List<String> foundList2 = new ArrayList<>();
        Class<?> returnType2 = extractAttribute(String.class, isBetween.getExpression(), foundList2);
        List<String> foundList3 = new ArrayList<>();
        Class<?> returnType3 = extractAttribute(String.class, isBetween.getUpperBoundary(), foundList3);
        determineTypeFromExpressions(foundList1, returnType1, foundList2, returnType2, foundList3, returnType3);
    } else if (filter instanceof PropertyIsNull) {
        PropertyIsNull isNull = (PropertyIsNull) filter;
        List<String> foundList1 = new ArrayList<>();
        extractAttribute(String.class, isNull.getExpression(), foundList1);
    } else if (filter instanceof PropertyIsLike) {
        PropertyIsLike isLike = (PropertyIsLike) filter;
        List<String> foundList1 = new ArrayList<>();
        extractAttribute(String.class, isLike.getExpression(), foundList1);
    }
    return super.copy(filter);
}
Also used : PropertyIsLike(org.opengis.filter.PropertyIsLike) NotImpl(org.geotools.filter.NotImpl) ArrayList(java.util.ArrayList) LineString(org.locationtech.jts.geom.LineString) BinaryTemporalOperator(org.opengis.filter.temporal.BinaryTemporalOperator) PropertyIsNull(org.opengis.filter.PropertyIsNull) Filter(org.opengis.filter.Filter) MultiCompareFilterImpl(org.geotools.filter.MultiCompareFilterImpl) LogicFilterImpl(org.geotools.filter.LogicFilterImpl) ArrayList(java.util.ArrayList) List(java.util.List) PropertyIsBetween(org.opengis.filter.PropertyIsBetween) BinarySpatialOperator(org.opengis.filter.spatial.BinarySpatialOperator)

Example 7 with PropertyIsBetween

use of org.opengis.filter.PropertyIsBetween in project sldeditor by robward-scisys.

the class FilterNode method setFilter.

/**
 * Sets the filter.
 *
 * @param filter the new expression
 * @param filterConfig the filter config
 */
public void setFilter(Filter filter, FilterConfigInterface filterConfig) {
    this.filter = filter;
    this.filterConfig = filterConfig;
    setDisplayString();
    this.removeAllChildren();
    TypeManager.getInstance().reset();
    if (filterConfig != null) {
        FilterName filterName = filterConfig.getFilterConfiguration();
        if (filter instanceof Not) {
            setNotFilter(filter, filterName);
        } else if (filter instanceof LogicFilterImpl) {
            setLogicFilter(filter, filterName);
        } else if (filter instanceof BinaryTemporalOperator) {
            setExpressionParameter(((BinaryTemporalOperator) filter).getExpression1(), filterName.getParameter(0));
            setExpressionParameter(((BinaryTemporalOperator) filter).getExpression2(), filterName.getParameter(1));
        } else if (filter instanceof PropertyIsNull) {
            setExpressionParameter(((PropertyIsNull) filter).getExpression(), filterName.getParameter(0));
        } else if (filter instanceof PropertyIsBetween) {
            setExpressionParameter(((PropertyIsBetween) filter).getLowerBoundary(), filterName.getParameter(0));
            setExpressionParameter(((PropertyIsBetween) filter).getExpression(), filterName.getParameter(1));
            setExpressionParameter(((PropertyIsBetween) filter).getUpperBoundary(), filterName.getParameter(2));
        } else if (filter instanceof PropertyIsLike) {
            setExpressionParameter(((PropertyIsLike) filter).getExpression(), filterName.getParameter(0));
            setExpressionParameter(ff.literal(((PropertyIsLike) filter).getLiteral()), filterName.getParameter(1));
            setExpressionStringSizeParameter(ff.literal(((PropertyIsLike) filter).getWildCard()), filterName.getParameter(2), 1, true);
            setExpressionStringSizeParameter(ff.literal(((PropertyIsLike) filter).getSingleChar()), filterName.getParameter(3), 1, true);
            setExpressionStringSizeParameter(ff.literal(((PropertyIsLike) filter).getEscape()), filterName.getParameter(4), 1, true);
            setExpressionParameter(ff.literal(((PropertyIsLike) filter).isMatchingCase()), filterName.getParameter(5));
        } else if (filter instanceof BinarySpatialOperator) {
            setBinarySpatialOperator(filter, filterName);
        } else if (filter instanceof BinaryComparisonAbstract) {
            setBinaryComparisonAbstract(filter, filterName);
        } else if (filter instanceof FidFilterImpl) {
            FidFilterImpl fidFilter = (FidFilterImpl) filter;
            for (Identifier identifier : fidFilter.getIdentifiers()) {
                setExpressionParameter(ff.literal(identifier), filterName.getParameter(0));
            }
        }
    }
}
Also used : Not(org.opengis.filter.Not) BinaryTemporalOperator(org.opengis.filter.temporal.BinaryTemporalOperator) PropertyIsLike(org.opengis.filter.PropertyIsLike) PropertyIsNull(org.opengis.filter.PropertyIsNull) Identifier(org.opengis.filter.identity.Identifier) LogicFilterImpl(org.geotools.filter.LogicFilterImpl) FidFilterImpl(org.geotools.filter.FidFilterImpl) PropertyIsBetween(org.opengis.filter.PropertyIsBetween) FilterName(com.sldeditor.filter.v2.function.FilterName) BinaryComparisonAbstract(org.geotools.filter.BinaryComparisonAbstract) BinarySpatialOperator(org.opengis.filter.spatial.BinarySpatialOperator)

Aggregations

PropertyIsBetween (org.opengis.filter.PropertyIsBetween)7 LogicFilterImpl (org.geotools.filter.LogicFilterImpl)4 Filter (org.opengis.filter.Filter)4 PropertyIsLike (org.opengis.filter.PropertyIsLike)4 PropertyIsNull (org.opengis.filter.PropertyIsNull)4 Expression (org.opengis.filter.expression.Expression)4 BinarySpatialOperator (org.opengis.filter.spatial.BinarySpatialOperator)4 BinaryTemporalOperator (org.opengis.filter.temporal.BinaryTemporalOperator)4 ArrayList (java.util.ArrayList)3 BinaryComparisonAbstract (org.geotools.filter.BinaryComparisonAbstract)3 FidFilterImpl (org.geotools.filter.FidFilterImpl)3 Test (org.junit.Test)3 Not (org.opengis.filter.Not)3 FilterConfigInterface (com.sldeditor.filter.v2.function.FilterConfigInterface)2 CswQueryFactoryTest (org.codice.ddf.spatial.ogc.csw.catalog.endpoint.CswQueryFactoryTest)2 PropertyIsGreaterThan (org.opengis.filter.PropertyIsGreaterThan)2 FilterName (com.sldeditor.filter.v2.function.FilterName)1 FilterBuilder (ddf.catalog.filter.FilterBuilder)1 GeotoolsFilterBuilder (ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder)1 List (java.util.List)1