use of org.opengis.filter.spatial.BinarySpatialOperator 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.spatial.BinarySpatialOperator 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.spatial.BinarySpatialOperator 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) {
List<Filter> childFilterList = ((LogicFilterImpl) filter).getChildren();
if (childFilterList.isEmpty()) {
// No child filter so add a minimum 1 to work with.
setFilterParameter(null, filterName.getParameter(0));
} else {
setFilterParameter(childFilterList.get(0), filterName.getParameter(0));
}
} else if (filter instanceof LogicFilterImpl) {
List<Filter> childFilterList = ((LogicFilterImpl) filter).getChildren();
if (childFilterList.isEmpty()) {
// No child filter so add a minimum 2 to work with.
setFilterParameter(null, filterName.getParameter(0));
setFilterParameter(null, filterName.getParameter(0));
} else {
for (Filter childFilter : childFilterList) {
setFilterParameter(childFilter, filterName.getParameter(0));
}
}
} 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));
setExpressionParameter(ff.literal(((PropertyIsLike) filter).getWildCard()), filterName.getParameter(2));
setExpressionParameter(ff.literal(((PropertyIsLike) filter).getSingleChar()), filterName.getParameter(3));
setExpressionParameter(ff.literal(((PropertyIsLike) filter).getEscape()), filterName.getParameter(4));
setExpressionParameter(ff.literal(((PropertyIsLike) filter).isMatchingCase()), filterName.getParameter(5));
} else if (filter instanceof BinarySpatialOperator) {
setExpressionParameter(((BinaryComparisonAbstract) filter).getExpression1(), filterName.getParameter(0));
setExpressionParameter(((BinaryComparisonAbstract) filter).getExpression2(), filterName.getParameter(1));
} else if (filter instanceof BinaryComparisonAbstract) {
setExpressionParameter(((BinaryComparisonAbstract) filter).getExpression1(), filterName.getParameter(0));
setExpressionParameter(((BinaryComparisonAbstract) filter).getExpression2(), filterName.getParameter(1));
// which has no matchCase parameter
if (filterName.getParameterList().size() > 2) {
setExpressionParameter(ff.literal(((BinaryComparisonAbstract) filter).isMatchingCase()), filterName.getParameter(2));
}
}
}
}
use of org.opengis.filter.spatial.BinarySpatialOperator in project sldeditor by robward-scisys.
the class ExtractAttributes method copy.
/**
* (non-Javadoc)
*
* @see org.geotools.styling.visitor.DuplicatingStyleVisitor#copy(org.opengis.filter.Filter)
*/
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<String>();
Class<?> returnType1 = extractAttribute(String.class, multiCompareFilter.getExpression1(), foundList1);
List<String> foundList2 = new ArrayList<String>();
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<String>();
Class<?> returnType1 = extractAttribute(String.class, binaryTemporalOperator.getExpression1(), foundList1);
List<String> foundList2 = new ArrayList<String>();
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<String>();
Class<?> returnType1 = extractAttribute(String.class, binarySpatialOperator.getExpression1(), foundList1);
List<String> foundList2 = new ArrayList<String>();
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<String>();
Class<?> returnType1 = extractAttribute(String.class, isBetween.getLowerBoundary(), foundList1);
List<String> foundList2 = new ArrayList<String>();
Class<?> returnType2 = extractAttribute(String.class, isBetween.getExpression(), foundList2);
List<String> foundList3 = new ArrayList<String>();
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<String>();
extractAttribute(String.class, isNull.getExpression(), foundList1);
} else if (filter instanceof PropertyIsLike) {
PropertyIsLike isLike = (PropertyIsLike) filter;
List<String> foundList1 = new ArrayList<String>();
extractAttribute(String.class, isLike.getExpression(), foundList1);
}
return super.copy(filter);
}
Aggregations