Search in sources :

Example 1 with PropertyIsBetween

use of org.opengis.filter.PropertyIsBetween 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 PropertyIsBetween

use of org.opengis.filter.PropertyIsBetween 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 PropertyIsBetween

use of org.opengis.filter.PropertyIsBetween in project ddf by codice.

the class FilterBuilderTest method propertyIsBetween.

@Test
public void propertyIsBetween() {
    FilterVisitor visitor = spy(new DefaultFilterVisitor() {
    });
    FilterBuilder builder = new GeotoolsFilterBuilder();
    Filter filter = builder.attribute(FOO_ATTRIBUTE).between().numbers(new Long(5), new Long(7));
    filter.accept(visitor, null);
    filter = builder.attribute(FOO_ATTRIBUTE).is().between().numbers(new Long(5), new Long(7));
    filter.accept(visitor, null);
    filter = builder.attribute(FOO_ATTRIBUTE).between().numbers((short) 5, (short) 7);
    filter.accept(visitor, null);
    filter = builder.attribute(FOO_ATTRIBUTE).between().numbers(new Integer(5), new Integer(7));
    filter.accept(visitor, null);
    filter = builder.attribute(FOO_ATTRIBUTE).between().numbers(new Long(5), new Long(7));
    filter.accept(visitor, null);
    filter = builder.attribute(FOO_ATTRIBUTE).between().numbers(new Float(5), new Float(7));
    filter.accept(visitor, null);
    filter = builder.attribute(FOO_ATTRIBUTE).between().numbers(new Double(5), new Double(7));
    filter.accept(visitor, null);
    filter = builder.attribute(null).is().between().numbers(null, (Integer) null);
    filter.accept(visitor, null);
    InOrder inOrder = inOrder(visitor);
    inOrder.verify(visitor, times(8)).visit(isA(PropertyIsBetween.class), any());
}
Also used : InOrder(org.mockito.InOrder) DefaultFilterVisitor(org.geotools.filter.visitor.DefaultFilterVisitor) DefaultFilterVisitor(org.geotools.filter.visitor.DefaultFilterVisitor) FilterVisitor(org.opengis.filter.FilterVisitor) Filter(org.opengis.filter.Filter) FilterBuilder(ddf.catalog.filter.FilterBuilder) GeotoolsFilterBuilder(ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder) GeotoolsFilterBuilder(ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder) PropertyIsBetween(org.opengis.filter.PropertyIsBetween) Test(org.junit.Test)

Example 4 with PropertyIsBetween

use of org.opengis.filter.PropertyIsBetween in project ddf by codice.

the class CswRecordMapperFilterVisitorTest method testVisitPropertyIsBetween.

@Test
public void testVisitPropertyIsBetween() {
    Expression lower = factory.literal(4);
    Expression upper = factory.literal(7);
    PropertyIsBetween filter = factory.between(attrExpr, lower, upper);
    PropertyIsBetween duplicate = (PropertyIsBetween) visitor.visit(filter, null);
    assertThat(duplicate.getExpression(), is(attrExpr));
    assertThat(duplicate.getLowerBoundary(), is(lower));
    assertThat(duplicate.getUpperBoundary(), is(upper));
}
Also used : Expression(org.opengis.filter.expression.Expression) PropertyIsBetween(org.opengis.filter.PropertyIsBetween) CswQueryFactoryTest(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.CswQueryFactoryTest) Test(org.junit.Test)

Example 5 with PropertyIsBetween

use of org.opengis.filter.PropertyIsBetween in project ddf by codice.

the class TestCswRecordMapperFilterVisitor method testVisitPropertyIsBetween.

@Test
public void testVisitPropertyIsBetween() {
    Expression lower = factory.literal(4);
    Expression upper = factory.literal(7);
    PropertyIsBetween filter = factory.between(attrExpr, lower, upper);
    PropertyIsBetween duplicate = (PropertyIsBetween) visitor.visit(filter, null);
    assertThat(duplicate.getExpression(), is(attrExpr));
    assertThat(duplicate.getLowerBoundary(), is(lower));
    assertThat(duplicate.getUpperBoundary(), is(upper));
}
Also used : Expression(org.opengis.filter.expression.Expression) PropertyIsBetween(org.opengis.filter.PropertyIsBetween) CswQueryFactoryTest(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.CswQueryFactoryTest) Test(org.junit.Test)

Aggregations

PropertyIsBetween (org.opengis.filter.PropertyIsBetween)7 Filter (org.opengis.filter.Filter)5 LogicFilterImpl (org.geotools.filter.LogicFilterImpl)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 Test (org.junit.Test)3 Not (org.opengis.filter.Not)3 FilterConfigInterface (com.sldeditor.filter.v2.function.FilterConfigInterface)2 List (java.util.List)2 CswQueryFactoryTest (org.codice.ddf.spatial.ogc.csw.catalog.endpoint.CswQueryFactoryTest)2 FidFilterImpl (org.geotools.filter.FidFilterImpl)2 PropertyIsGreaterThan (org.opengis.filter.PropertyIsGreaterThan)2 FilterName (com.sldeditor.filter.v2.function.FilterName)1 LineString (com.vividsolutions.jts.geom.LineString)1 FilterBuilder (ddf.catalog.filter.FilterBuilder)1