Search in sources :

Example 6 with FunctionExpressionImpl

use of org.geotools.filter.FunctionExpressionImpl in project sldeditor by robward-scisys.

the class FilterPanelv2 method addExpression.

/**
 * Adds the expression.
 *
 * @param node the node
 * @return the expression
 */
private Expression addExpression(ExpressionNode node) {
    Expression expression = node.getExpression();
    if (expression instanceof LiteralExpressionImpl) {
        return expression;
    } else if (expression instanceof AttributeExpressionImpl) {
        return expression;
    } else if (expression instanceof FunctionExpressionImpl) {
        FunctionExpressionImpl functionExpression = (FunctionExpressionImpl) expression;
        List<Expression> parameterlist = new ArrayList<Expression>();
        for (int childIndex = 0; childIndex < node.getChildCount(); childIndex++) {
            ExpressionNode childNode = (ExpressionNode) node.getChildAt(childIndex);
            parameterlist.add(addExpression(childNode));
        }
        functionExpression.setParameters(parameterlist);
        return functionExpression;
    } else if (expression instanceof MathExpressionImpl) {
        MathExpressionImpl mathExpression = (MathExpressionImpl) expression;
        ExpressionNode leftChildNode = (ExpressionNode) node.getChildAt(0);
        mathExpression.setExpression1(addExpression(leftChildNode));
        ExpressionNode rightChildNode = (ExpressionNode) node.getChildAt(1);
        mathExpression.setExpression2(addExpression(rightChildNode));
        return mathExpression;
    }
    return null;
}
Also used : MathExpressionImpl(org.geotools.filter.MathExpressionImpl) Expression(org.opengis.filter.expression.Expression) AttributeExpressionImpl(org.geotools.filter.AttributeExpressionImpl) LiteralExpressionImpl(org.geotools.filter.LiteralExpressionImpl) ArrayList(java.util.ArrayList) FunctionExpressionImpl(org.geotools.filter.FunctionExpressionImpl)

Example 7 with FunctionExpressionImpl

use of org.geotools.filter.FunctionExpressionImpl in project sldeditor by robward-scisys.

the class FieldConfigBase method populate.

/**
 * Populate.
 *
 * @param expression the expression
 */
public void populate(Expression expression) {
    if (attributeSelectionPanel != null) {
        attributeSelectionPanel.populateAttributeComboxBox(expression);
    }
    if (expression == null) {
        expressionType = ExpressionTypeEnum.E_VALUE;
        revertToDefaultValue();
        valueUpdated();
    } else {
        if (expression instanceof LiteralExpressionImpl) {
            LiteralExpressionImpl lExpression = (LiteralExpressionImpl) expression;
            Object objValue = lExpression.getValue();
            if (objValue instanceof AttributeExpressionImpl) {
                expressionType = ExpressionTypeEnum.E_ATTRIBUTE;
                if (attributeSelectionPanel != null) {
                    attributeSelectionPanel.setAttribute((AttributeExpressionImpl) objValue);
                }
                setCachedExpression((AttributeExpressionImpl) objValue);
            } else {
                expressionType = ExpressionTypeEnum.E_VALUE;
                populateExpression(objValue);
                valueUpdated();
            }
        } else if (expression instanceof ConstantExpression) {
            ConstantExpression cExpression = (ConstantExpression) expression;
            Object objValue = cExpression.getValue();
            expressionType = ExpressionTypeEnum.E_VALUE;
            populateExpression(objValue);
            valueUpdated();
        } else if (expression instanceof NilExpression) {
            Object objValue = null;
            expressionType = ExpressionTypeEnum.E_VALUE;
            populateExpression(objValue);
            valueUpdated();
        } else if (expression instanceof ProcessFunction) {
            ProcessFunction processExpression = (ProcessFunction) expression;
            Object objValue = processExpression;
            expressionType = ExpressionTypeEnum.E_VALUE;
            populateExpression(objValue);
            valueUpdated();
        } else if (expression instanceof AttributeExpressionImpl) {
            expressionType = ExpressionTypeEnum.E_ATTRIBUTE;
            if (attributeSelectionPanel != null) {
                attributeSelectionPanel.setAttribute(expression);
            } else {
                populateExpression(expression);
            }
            setCachedExpression(expression);
        } else if (expression instanceof FunctionExpressionImpl) {
            expressionType = ExpressionTypeEnum.E_EXPRESSION;
            if (attributeSelectionPanel != null) {
                attributeSelectionPanel.populate(expression);
            }
            setCachedExpression(expression);
        } else if (expression instanceof BinaryExpression) {
            expressionType = ExpressionTypeEnum.E_EXPRESSION;
            if (attributeSelectionPanel != null) {
                attributeSelectionPanel.populate(expression);
            }
            setCachedExpression(expression);
        } else {
            expressionType = ExpressionTypeEnum.E_EXPRESSION;
        }
    }
    setValueFieldState();
}
Also used : ProcessFunction(org.geotools.process.function.ProcessFunction) BinaryExpression(org.opengis.filter.expression.BinaryExpression) AttributeExpressionImpl(org.geotools.filter.AttributeExpressionImpl) LiteralExpressionImpl(org.geotools.filter.LiteralExpressionImpl) ConstantExpression(org.geotools.filter.ConstantExpression) NilExpression(org.opengis.filter.expression.NilExpression) FunctionExpressionImpl(org.geotools.filter.FunctionExpressionImpl)

Example 8 with FunctionExpressionImpl

use of org.geotools.filter.FunctionExpressionImpl in project sldeditor by robward-scisys.

the class CoordinateReferenceSystemValues method setValue.

/*
     * (non-Javadoc)
     * 
     * @see com.sldeditor.rendertransformation.types.RenderTransformValueInterface#setValue(java.lang.Object)
     */
@Override
public void setValue(Object aValue) {
    this.value = null;
    this.expression = null;
    if (aValue instanceof LiteralExpressionImpl) {
        LiteralExpressionImpl literal = (LiteralExpressionImpl) aValue;
        if (literal.getValue() != null) {
            value = literal.toString();
        }
    } else if ((aValue instanceof AttributeExpressionImpl) || (aValue instanceof FunctionExpressionImpl) || (aValue instanceof MathExpressionImpl)) {
        this.expression = (Expression) aValue;
    } else {
        if (aValue instanceof String) {
            value = ((String) aValue);
        }
    }
}
Also used : MathExpressionImpl(org.geotools.filter.MathExpressionImpl) AttributeExpressionImpl(org.geotools.filter.AttributeExpressionImpl) Expression(org.opengis.filter.expression.Expression) LiteralExpressionImpl(org.geotools.filter.LiteralExpressionImpl) FunctionExpressionImpl(org.geotools.filter.FunctionExpressionImpl)

Aggregations

FunctionExpressionImpl (org.geotools.filter.FunctionExpressionImpl)8 AttributeExpressionImpl (org.geotools.filter.AttributeExpressionImpl)7 LiteralExpressionImpl (org.geotools.filter.LiteralExpressionImpl)6 Expression (org.opengis.filter.expression.Expression)6 MathExpressionImpl (org.geotools.filter.MathExpressionImpl)5 ArrayList (java.util.ArrayList)2 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)1 FieldConfigDouble (com.sldeditor.ui.detail.config.FieldConfigDouble)1 UpdateSymbolInterface (com.sldeditor.ui.iface.UpdateSymbolInterface)1 Dimension (java.awt.Dimension)1 InterpolationBicubic (javax.media.jai.InterpolationBicubic)1 InterpolationBicubic2 (javax.media.jai.InterpolationBicubic2)1 InterpolationBilinear (javax.media.jai.InterpolationBilinear)1 InterpolationNearest (javax.media.jai.InterpolationNearest)1 ConstantExpression (org.geotools.filter.ConstantExpression)1 EnvFunction (org.geotools.filter.function.EnvFunction)1 ConcatenateFunction (org.geotools.filter.function.string.ConcatenateFunction)1 ProcessFunction (org.geotools.process.function.ProcessFunction)1 FunctionName (org.opengis.filter.capability.FunctionName)1 BinaryExpression (org.opengis.filter.expression.BinaryExpression)1