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);
}
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);
}
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());
}
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));
}
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));
}
Aggregations