Search in sources :

Example 1 with Not

use of com.sldeditor.filter.v2.function.logic.Not in project sldeditor by robward-scisys.

the class ExpressionPanelv2 method addFilter.

/**
 * Adds the filter.
 *
 * @param node the node
 * @return the filter
 */
private Filter addFilter(FilterNode node) {
    Filter filter = node.getFilter();
    FilterConfigInterface filterConfig = node.getFilterConfig();
    if (filter instanceof LogicFilterImpl) {
        List<Filter> filterList = new ArrayList<Filter>();
        createFilterList(node, filterList);
        return filterConfig.createLogicFilter(filterList);
    }
    List<Expression> parameterFilter = new ArrayList<Expression>();
    if (filter instanceof FidFilterImpl) {
        createExpressionParameterList(node, 1, parameterFilter);
    } else if (filter instanceof BinaryTemporalOperator) {
        createExpressionParameterList(node, 2, parameterFilter);
    } else if (filter instanceof PropertyIsBetween) {
        createExpressionParameterList(node, 3, parameterFilter);
    } else if (filter instanceof PropertyIsNull) {
        createExpressionParameterList(node, 1, parameterFilter);
    } else if (filter instanceof PropertyIsLike) {
        createExpressionParameterList(node, 6, parameterFilter);
    } else if (filter instanceof BinarySpatialOperator) {
        createExpressionParameterList(node, 2, parameterFilter);
    } else if (filter instanceof BinaryComparisonAbstract) {
        if (filter instanceof Not) {
            createExpressionParameterList(node, 1, parameterFilter);
        } else if (filter instanceof PropertyIsGreaterThan) {
            createExpressionParameterList(node, 2, parameterFilter);
        } else {
            createExpressionParameterList(node, 3, parameterFilter);
        }
    } else {
        return filter;
    }
    return filterConfig.createFilter(parameterFilter);
}
Also used : PropertyIsLike(org.opengis.filter.PropertyIsLike) ArrayList(java.util.ArrayList) FilterConfigInterface(com.sldeditor.filter.v2.function.FilterConfigInterface) BinaryTemporalOperator(org.opengis.filter.temporal.BinaryTemporalOperator) Not(org.opengis.filter.Not) PropertyIsNull(org.opengis.filter.PropertyIsNull) Filter(org.opengis.filter.Filter) Expression(org.opengis.filter.expression.Expression) LogicFilterImpl(org.geotools.filter.LogicFilterImpl) FidFilterImpl(org.geotools.filter.FidFilterImpl) PropertyIsBetween(org.opengis.filter.PropertyIsBetween) BinaryComparisonAbstract(org.geotools.filter.BinaryComparisonAbstract) BinarySpatialOperator(org.opengis.filter.spatial.BinarySpatialOperator) PropertyIsGreaterThan(org.opengis.filter.PropertyIsGreaterThan)

Example 2 with Not

use of com.sldeditor.filter.v2.function.logic.Not in project sldeditor by robward-scisys.

the class FilterPanelv2 method addFilter.

/**
 * Adds the filter.
 *
 * @param node the node
 * @return the filter
 */
private Filter addFilter(FilterNode node) {
    Filter filter = node.getFilter();
    FilterConfigInterface filterConfig = node.getFilterConfig();
    if (filter instanceof LogicFilterImpl) {
        List<Filter> filterList = new ArrayList<Filter>();
        createFilterList(node, filterList);
        return filterConfig.createLogicFilter(filterList);
    }
    List<Expression> parameterFilter = new ArrayList<Expression>();
    if (filter instanceof FidFilterImpl) {
        createExpressionParameterList(node, 1, parameterFilter);
    } else if (filter instanceof BinaryTemporalOperator) {
        createExpressionParameterList(node, 2, parameterFilter);
    } else if (filter instanceof PropertyIsBetween) {
        createExpressionParameterList(node, 3, parameterFilter);
    } else if (filter instanceof PropertyIsNull) {
        createExpressionParameterList(node, 1, parameterFilter);
    } else if (filter instanceof PropertyIsLike) {
        createExpressionParameterList(node, 6, parameterFilter);
    } else if (filter instanceof BinarySpatialOperator) {
        createExpressionParameterList(node, 2, parameterFilter);
    } else if (filter instanceof BinaryComparisonAbstract) {
        if (filter instanceof Not) {
            createExpressionParameterList(node, 1, parameterFilter);
        } else if (filter instanceof PropertyIsGreaterThan) {
            createExpressionParameterList(node, 2, parameterFilter);
        } else {
            createExpressionParameterList(node, 3, parameterFilter);
        }
    } else {
        return filter;
    }
    return filterConfig.createFilter(parameterFilter);
}
Also used : PropertyIsLike(org.opengis.filter.PropertyIsLike) ArrayList(java.util.ArrayList) FilterConfigInterface(com.sldeditor.filter.v2.function.FilterConfigInterface) BinaryTemporalOperator(org.opengis.filter.temporal.BinaryTemporalOperator) Not(org.opengis.filter.Not) PropertyIsNull(org.opengis.filter.PropertyIsNull) Filter(org.opengis.filter.Filter) Expression(org.opengis.filter.expression.Expression) LogicFilterImpl(org.geotools.filter.LogicFilterImpl) FidFilterImpl(org.geotools.filter.FidFilterImpl) PropertyIsBetween(org.opengis.filter.PropertyIsBetween) BinaryComparisonAbstract(org.geotools.filter.BinaryComparisonAbstract) BinarySpatialOperator(org.opengis.filter.spatial.BinarySpatialOperator) PropertyIsGreaterThan(org.opengis.filter.PropertyIsGreaterThan)

Example 3 with Not

use of com.sldeditor.filter.v2.function.logic.Not in project sldeditor by robward-scisys.

the class SLDEditorFileHandler method extractEnvironmentVariables.

/**
 * Extract environment variables.
 *
 * @param document the document
 * @param envvarElement the environment variable element
 * @return the list
 */
private List<EnvVar> extractEnvironmentVariables(Document document, String elementName) {
    List<EnvVar> list = new ArrayList<EnvVar>();
    NodeList nodeList = document.getElementsByTagName(elementName);
    for (int index = 0; index < nodeList.getLength(); index++) {
        Element element = (Element) nodeList.item(index);
        Class<?> type = null;
        try {
            type = Class.forName(element.getAttribute(ENVVAR_TYPE_ATTRIBUTE));
        } catch (ClassNotFoundException e) {
            ConsoleManager.getInstance().exception(this, e);
        }
        // Assume not predefined, will get sorted out later
        EnvVar envVar = new EnvVar(element.getAttribute(ENVVAR_NAME_ATTRIBUTE), type, false);
        if (element.hasAttribute(ENVVAR_VALUE_ATTRIBUTE)) {
            envVar.setValue(element.getAttribute(ENVVAR_VALUE_ATTRIBUTE));
        }
        list.add(envVar);
    }
    return list;
}
Also used : NodeList(org.w3c.dom.NodeList) Element(org.w3c.dom.Element) ArrayList(java.util.ArrayList) EnvVar(com.sldeditor.filter.v2.envvar.EnvVar)

Example 4 with Not

use of com.sldeditor.filter.v2.function.logic.Not in project sldeditor by robward-scisys.

the class FilterManager method getFilterConfigList.

/**
 * Gets the filter config list.
 *
 * @return the filter config list
 */
@Override
public List<FilterConfigInterface> getFilterConfigList() {
    List<FilterConfigInterface> filterConfigList = new ArrayList<FilterConfigInterface>();
    // Logic filters
    filterConfigList.add(new And());
    filterConfigList.add(new Or());
    filterConfigList.add(new Not());
    filterConfigList.add(new IsEqualTo());
    filterConfigList.add(new IsNotEqualTo());
    filterConfigList.add(new IsLessThan());
    filterConfigList.add(new IsLessThanEqualTo());
    filterConfigList.add(new IsGreaterThan());
    filterConfigList.add(new IsGreaterThanEqualTo());
    filterConfigList.add(new IsBetween());
    filterConfigList.add(new IsNull());
    filterConfigList.add(new IsLike());
    // Temporal
    filterConfigList.add(new After());
    filterConfigList.add(new Before());
    filterConfigList.add(new During());
    filterConfigList.add(new TEquals());
    filterConfigList.add(new TOverlaps());
    filterConfigList.add(new TContains());
    // Geometry
    filterConfigList.add(new BBox());
    filterConfigList.add(new Beyond());
    filterConfigList.add(new Contains());
    filterConfigList.add(new Crosses());
    filterConfigList.add(new Disjoint());
    filterConfigList.add(new DWithin());
    filterConfigList.add(new Equals());
    filterConfigList.add(new Intersects());
    filterConfigList.add(new Overlaps());
    filterConfigList.add(new Touches());
    filterConfigList.add(new Within());
    return filterConfigList;
}
Also used : Before(com.sldeditor.filter.v2.function.temporal.Before) TOverlaps(com.sldeditor.filter.v2.function.temporal.TOverlaps) Overlaps(com.sldeditor.filter.v2.function.geometry.Overlaps) Or(com.sldeditor.filter.v2.function.logic.Or) ArrayList(java.util.ArrayList) Beyond(com.sldeditor.filter.v2.function.temporal.Beyond) IsLike(com.sldeditor.filter.v2.function.misc.IsLike) TEquals(com.sldeditor.filter.v2.function.temporal.TEquals) During(com.sldeditor.filter.v2.function.temporal.During) IsEqualTo(com.sldeditor.filter.v2.function.property.IsEqualTo) Crosses(com.sldeditor.filter.v2.function.geometry.Crosses) IsLessThan(com.sldeditor.filter.v2.function.property.IsLessThan) DWithin(com.sldeditor.filter.v2.function.geometry.DWithin) Intersects(com.sldeditor.filter.v2.function.geometry.Intersects) Disjoint(com.sldeditor.filter.v2.function.geometry.Disjoint) Touches(com.sldeditor.filter.v2.function.geometry.Touches) IsNotEqualTo(com.sldeditor.filter.v2.function.property.IsNotEqualTo) TOverlaps(com.sldeditor.filter.v2.function.temporal.TOverlaps) IsBetween(com.sldeditor.filter.v2.function.property.IsBetween) IsGreaterThanEqualTo(com.sldeditor.filter.v2.function.property.IsGreaterThanEqualTo) IsGreaterThan(com.sldeditor.filter.v2.function.property.IsGreaterThan) TContains(com.sldeditor.filter.v2.function.temporal.TContains) Not(com.sldeditor.filter.v2.function.logic.Not) TEquals(com.sldeditor.filter.v2.function.temporal.TEquals) Equals(com.sldeditor.filter.v2.function.geometry.Equals) And(com.sldeditor.filter.v2.function.logic.And) BBox(com.sldeditor.filter.v2.function.geometry.BBox) After(com.sldeditor.filter.v2.function.temporal.After) TContains(com.sldeditor.filter.v2.function.temporal.TContains) Contains(com.sldeditor.filter.v2.function.geometry.Contains) Within(com.sldeditor.filter.v2.function.geometry.Within) DWithin(com.sldeditor.filter.v2.function.geometry.DWithin) IsNull(com.sldeditor.filter.v2.function.misc.IsNull) IsLessThanEqualTo(com.sldeditor.filter.v2.function.property.IsLessThanEqualTo)

Example 5 with Not

use of com.sldeditor.filter.v2.function.logic.Not in project sldeditor by robward-scisys.

the class DurationTest method testDurationString.

/**
 * Test method for
 * {@link com.sldeditor.filter.v2.function.temporal.Duration#Duration(java.lang.String)}.
 */
@Test
public void testDurationString() {
    test("P10D", 0, 0, 10, 0, 0, 0, null);
    test("P1Y2M3D", 1, 2, 3, 0, 0, 0, null);
    test("P1Y2M", 1, 2, 0, 0, 0, 0, null);
    test("P1Y2M3D4H5M6S", 1, 2, 3, 4, 5, 6, null);
    test("P1Y6S", 1, 0, 0, 0, 0, 6, null);
    test("P1Y0H6M", 1, 0, 0, 0, 6, 0, null);
    test("P1Y6H", 1, 0, 0, 6, 0, 0, null);
    test("T1H6M", 0, 0, 0, 1, 6, 0, null);
    // This is not valid
    test("P1M6M", 0, 1, 0, 0, 0, 0, "P1M");
    test("T10H", 0, 0, 0, 10, 0, 0, null);
    String dateString = "20-09-2016T17:42:27Z";
    Duration duration = new Duration(dateString);
    assertTrue(duration.isDate());
    String actual = duration.getString();
    assertTrue(dateString, dateString.compareTo(actual) == 0);
}
Also used : Duration(com.sldeditor.filter.v2.function.temporal.Duration) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)4 Filter (org.opengis.filter.Filter)4 BinaryComparisonAbstract (org.geotools.filter.BinaryComparisonAbstract)3 LogicFilterImpl (org.geotools.filter.LogicFilterImpl)3 Not (org.opengis.filter.Not)3 PropertyIsBetween (org.opengis.filter.PropertyIsBetween)3 PropertyIsLike (org.opengis.filter.PropertyIsLike)3 PropertyIsNull (org.opengis.filter.PropertyIsNull)3 BinarySpatialOperator (org.opengis.filter.spatial.BinarySpatialOperator)3 BinaryTemporalOperator (org.opengis.filter.temporal.BinaryTemporalOperator)3 FilterConfigInterface (com.sldeditor.filter.v2.function.FilterConfigInterface)2 FilterName (com.sldeditor.filter.v2.function.FilterName)2 FidFilterImpl (org.geotools.filter.FidFilterImpl)2 PropertyIsGreaterThan (org.opengis.filter.PropertyIsGreaterThan)2 Expression (org.opengis.filter.expression.Expression)2 EnvVar (com.sldeditor.filter.v2.envvar.EnvVar)1 FilterNameParameter (com.sldeditor.filter.v2.function.FilterNameParameter)1 BBox (com.sldeditor.filter.v2.function.geometry.BBox)1 Contains (com.sldeditor.filter.v2.function.geometry.Contains)1 Crosses (com.sldeditor.filter.v2.function.geometry.Crosses)1