Package org.opengis.filter.expression

Examples of org.opengis.filter.expression.Expression


                FontData fd = fontData[0];
                String name = fd.getName();
                String style = String.valueOf(fd.getStyle());
                String height = String.valueOf(fd.getHeight());
                Color color = fontEditor.getAWTColor();
                Expression colorExpr = ff.literal(color);
                String fontColor = colorExpr.evaluate(null, String.class);

                notifyListeners(new String[]{name, style, height, fontColor}, false, STYLEEVENTTYPE.LABELFONT);
            }
        } else if (source.equals(fontColorButton)) {
            Color color = fontColorEditor.getColor();
            Expression colorExpr = ff.literal(color);
            String fontColor = colorExpr.evaluate(null, String.class);

            notifyListeners(fontColor, false, STYLEEVENTTYPE.LABELCOLOR);
        } else if (source.equals(haloColorButton)) {
            Color color = haloColorEditor.getColor();
            Expression colorExpr = ff.literal(color);
            String haloColor = colorExpr.evaluate(null, String.class);

            notifyListeners(haloColor, false, STYLEEVENTTYPE.LABELHALOCOLOR);
        } else if (source.equals(haloRadiusSpinner)) {
            int radius = haloRadiusSpinner.getSelection();
View Full Code Here


        super(symbolizer, parent);
        this.geomType = geomType;

        textSymbolizer = (TextSymbolizer) symbolizer;

        Expression labelExpression = textSymbolizer.getLabel();
        if (labelExpression != null) {
            labelName = expressionToString(labelExpression);
        }

        font = textSymbolizer.getFont();
        if (font != null) {
            List<Expression> family = font.getFamily();
            fontFamily = family.get(0).evaluate(null, String.class);

            Expression styleExpression = font.getStyle();
            fontStyle = styleExpression.evaluate(null, String.class);

            Expression styleWeight = font.getWeight();
            fontWeight = styleWeight.evaluate(null, String.class);

            Expression styleSize = font.getSize();
            fontSize = styleSize.evaluate(null, String.class);
        }

        fill = textSymbolizer.getFill();
        if (fill != null) {
            Expression colorExpression = fill.getColor();
            color = colorExpression.evaluate(null, String.class);
            Expression opacityExpression = fill.getOpacity();
            if (opacityExpression != null) {
                opacity = expressionToString(opacityExpression);
            }
        }

        halo = textSymbolizer.getHalo();
        if (halo != null) {
            haloFill = halo.getFill();
            Expression haloColorExpression = haloFill.getColor();
            haloColor = haloColorExpression.evaluate(null, String.class);

            Expression haloRadiusExpression = halo.getRadius();
            haloRadius = haloRadiusExpression.evaluate(null, String.class);
        }

        LabelPlacement labelPlacement = textSymbolizer.getLabelPlacement();
        if (geomType != null) {
            switch( geomType ) {
            case POINT:
            case POLYGON:
                if (labelPlacement instanceof PointPlacement) {
                    pointPlacement = (PointPlacement) labelPlacement;
                    if (pointPlacement != null) {
                        anchorPoint = pointPlacement.getAnchorPoint();
                        if (anchorPoint != null) {
                            Expression anchorPointXExpression = anchorPoint.getAnchorPointX();
                            anchorX = anchorPointXExpression.evaluate(null, String.class);
                            Expression anchorPointYExpression = anchorPoint.getAnchorPointY();
                            anchorY = anchorPointYExpression.evaluate(null, String.class);
                        }

                        displacement = pointPlacement.getDisplacement();
                        if (displacement != null) {
                            Expression displacementXExpression = displacement.getDisplacementX();
                            displacementX = displacementXExpression.evaluate(null, String.class);
                            Expression displacementYExpression = displacement.getDisplacementY();
                            displacementY = displacementYExpression.evaluate(null, String.class);
                        } else {
                            displacementX = "0.0"; //$NON-NLS-1$
                            displacementY = "0.0"; //$NON-NLS-1$
                        }

                        Expression rotationExpression = pointPlacement.getRotation();
                        rotation = expressionToString(rotationExpression);
                    }
                }
                break;
            case LINE:
                if (labelPlacement instanceof LinePlacement) {
                    linePlacement = (LinePlacement) labelPlacement;
                    if (linePlacement != null) {
                        Expression initialGapExpression = linePlacement.getInitialGap();
                        if (initialGapExpression != null)
                            initialGap = initialGapExpression.evaluate(null, String.class);

                        Expression perpendicularOffsetExpression = linePlacement.getPerpendicularOffset();
                        if (perpendicularOffset != null)
                            perpendicularOffset = perpendicularOffsetExpression.evaluate(null, String.class);
                    }
                }
                break;
            default:
                break;
View Full Code Here

     * @param symbolizer the symbolizer.
     * @return the offset.
     */
    @SuppressWarnings("rawtypes")
    public static Point2D getOffset( Symbolizer symbolizer ) {
        Expression geometry = symbolizer.getGeometry();
        if (geometry != null) {
            if (geometry instanceof FilterFunction_offset) {
                FilterFunction_offset offsetFunction = (FilterFunction_offset) geometry;
                List parameters = offsetFunction.getParameters();
                Expression xOffsetExpr = (Expression) parameters.get(1);
                Expression yOffsetExpr = (Expression) parameters.get(2);
                Double xOffsetDouble = xOffsetExpr.evaluate(null, Double.class);
                Double yOffsetDouble = yOffsetExpr.evaluate(null, Double.class);
                if (xOffsetDouble != null && yOffsetDouble != null) {
                    Point2D.Double point = new Point2D.Double(xOffsetDouble, yOffsetDouble);
                    return point;
                }
            }
View Full Code Here

            return;
        }
        double xOffset = Double.parseDouble(split[0]);
        double yOffset = Double.parseDouble(split[1]);

        Expression geometry = symbolizer.getGeometry();
        if (geometry != null) {
            if (geometry instanceof FilterFunction_offset) {
                FilterFunction_offset offsetFunction = (FilterFunction_offset) geometry;
                List parameters = offsetFunction.getParameters();
                parameters.set(1, ff.literal(xOffset));
View Full Code Here

            }
        });
        viewer.setLabelProvider( new LabelProvider(){
            public String getText( Object element ) {
                if( element instanceof Expression){
                    Expression expression = (Expression) element;
                    return CQL.toCQL( expression );
                }
                return super.getText(element); // ie use toString()
            }
        });
View Full Code Here

        }

        Graphic gr = sf.createDefaultGraphic();
        gr.graphicalSymbols().clear();
        gr.graphicalSymbols().add(exGraphic);
        Expression size = ff.literal(20);
        gr.setSize(size);

        Rule rule = sf.createRule();
        PointSymbolizer pointSymbolizer = sf.createPointSymbolizer(gr, null);
        rule.symbolizers().add(pointSymbolizer);
View Full Code Here

                FontData fd = fontData[0];
                String name = fd.getName();
                String style = String.valueOf(fd.getStyle());
                String height = String.valueOf(fd.getHeight());
                Color color = fontEditor.getAWTColor();
                Expression colorExpr = ff.literal(color);
                String fontColor = colorExpr.evaluate(null, String.class);

                notifyListeners(new String[]{name, style, height, fontColor}, false, STYLEEVENTTYPE.LABELFONT);
            }
        } else if (source.equals(fontColorButton)) {
            Color color = fontColorEditor.getColor();
            Expression colorExpr = ff.literal(color);
            String fontColor = colorExpr.evaluate(null, String.class);

            notifyListeners(fontColor, false, STYLEEVENTTYPE.LABELCOLOR);
        } else if (source.equals(haloColorButton)) {
            Color color = haloColorEditor.getColor();
            Expression colorExpr = ff.literal(color);
            String haloColor = colorExpr.evaluate(null, String.class);

            notifyListeners(haloColor, false, STYLEEVENTTYPE.LABELHALOCOLOR);
        } else if (source.equals(haloRadiusSpinner)) {
            int radius = haloRadiusSpinner.getSelection();
View Full Code Here

        PointSymbolizer pointSymbolizer = (PointSymbolizer) symbolizer;
        graphic = pointSymbolizer.getGraphic();
        List<ExternalGraphic> externalGraphicsList = externalGraphicsFromGraphic(graphic);

        // size
        Expression sizeExpr = graphic.getSize();
        String tmp = expressionToString(sizeExpr);
        if (tmp != null) {
            size = tmp;
        } else {
            size = DEFAULT_WIDTH;
        }
        // rotation
        Expression rotationExpr = graphic.getRotation();
        tmp = expressionToString(rotationExpr);
        if (tmp != null) {
            rotation = tmp;
        } else {
            rotation = DEFAULT_ROTATION;
        }
        // offset
        Point2D offset = Utilities.getOffset(pointSymbolizer);
        if (offset != null) {
            xOffset = String.valueOf(offset.getX());
            yOffset = String.valueOf(offset.getY());
        } else {
            xOffset = DEFAULT_OFFSET;
            yOffset = DEFAULT_OFFSET;
        }

        if (externalGraphicsList.size() == 0) {
            mark = SLDs.mark(pointSymbolizer);
            if (mark == null) {
                return;
            }
            markName = mark.getWellKnownName().evaluate(null, String.class);
            if (markName == null|| markName.equals("")) { //$NON-NLS-1$
                markName = "circle"; //$NON-NLS-1$
                mark.setWellKnownName(ff.literal(markName));
            }

            fill = mark.getFill();
            if (fill != null) {
                fillColor = fill.getColor().evaluate(null, String.class);
                Expression opacityExpr = fill.getOpacity();
                fillOpacity = expressionToString(opacityExpr);
                hasFill = true;
            } else {
                hasFill = false;
            }

            stroke = mark.getStroke();
            if (stroke != null) {
                Expression color = stroke.getColor();
                tmp = color.evaluate(null, String.class);
                if (tmp != null) {
                    strokeColor = tmp;
                } else {
                    strokeColor = DEFAULT_COLOR;
                }

                Expression opacity = stroke.getOpacity();
                tmp = expressionToString(opacity);
                if (tmp != null) {
                    strokeOpacity = tmp;
                } else {
                    strokeOpacity = DEFAULT_OPACITY;
                }

                Expression width = stroke.getWidth();
                tmp = expressionToString(width);
                if (tmp != null) {
                    strokeWidth = tmp;
                } else {
                    strokeWidth = DEFAULT_WIDTH;
View Full Code Here

            notifyListeners(String.valueOf(selected), false, STYLEEVENTTYPE.FILLENABLE);
        } else if (source.equals(fillColorButton) || source.equals(fillColorAttributecombo)) {
            boolean comboIsNone = comboIsNone(fillColorAttributecombo);
            if (comboIsNone) {
                Color color = fillColorEditor.getColor();
                Expression colorExpr = ff.literal(color);
                String fillColor = colorExpr.evaluate(null, String.class);
                notifyListeners(fillColor, false, STYLEEVENTTYPE.FILLCOLOR);
            } else {
                int index = fillColorAttributecombo.getSelectionIndex();
                String field = fillColorAttributecombo.getItem(index);
                if (field.length() == 0) {
View Full Code Here

        digits = wkmSizeSpinner.getDigits();
        value = selection / Math.pow(10, digits);
        String strokeSize = String.valueOf(value);

        Color color = wkmColorEditor.getColor();
        Expression colorExpr = ff.literal(color);
        String strokeColor = colorExpr.evaluate(null, String.class);

        notifyListeners(new String[]{name, strokeWidth, strokeColor, strokeSize}, false, STYLEEVENTTYPE.WKMGRAPHICSFILL);
    }
View Full Code Here

TOP

Related Classes of org.opengis.filter.expression.Expression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.