Package org.geotools.styling

Examples of org.geotools.styling.PolygonSymbolizer


        if (arg0 instanceof PointSymbolizer) {
            PointSymbolizer ps = (PointSymbolizer) arg0;
            ps.accept(this);
        }
        if (arg0 instanceof PolygonSymbolizer) {
            PolygonSymbolizer ps = (PolygonSymbolizer) arg0;
            ps.accept(this);
        }
        if (arg0 instanceof LineSymbolizer) {
            LineSymbolizer ps = (LineSymbolizer) arg0;
            ps.accept(this);
        }
        if (arg0 instanceof TextSymbolizer) {
            TextSymbolizer ps = (TextSymbolizer) arg0;
            ps.accept(this);
        }
        if (arg0 instanceof RasterSymbolizer) {
            RasterSymbolizer ps = (RasterSymbolizer) arg0;
            ps.accept(this);
        }
    }
View Full Code Here


        Set<String> colorSet = new HashSet<String>();

        Color color = null;
        for( Symbolizer sym : rule.symbolizers() ) {
            if (sym instanceof PolygonSymbolizer) {
                PolygonSymbolizer symb = (PolygonSymbolizer) sym;
                color = polyFill(symb);

            } else if (sym instanceof LineSymbolizer) {
                LineSymbolizer symb = (LineSymbolizer) sym;
                color = color(symb);
View Full Code Here

            placement = SLDs.getPlacement(SLDs.ALIGN_LEFT, SLDs.ALIGN_MIDDLE, 0);

            name = sym == null ? null : sym.getGeometryPropertyName();
        } else if (mode == Mode.POLYGON) {
            polyMode.setSelection(true);
            PolygonSymbolizer sym = SLDs.polySymbolizer(fts);
            stroke = SLDs.stroke(sym);
            fill = SLDs.fill(sym);
            placement = SLDs.getPlacement(SLDs.ALIGN_CENTER, SLDs.ALIGN_MIDDLE, 0);

            name = sym == null ? null : sym.getGeometryPropertyName();
        } else if (mode == Mode.POINT || mode == Mode.ALL) { // default to handling as Point
            pointMode.setSelection(true);

            PointSymbolizer sym = SLDs.pointSymbolizer(fts);
            stroke = SLDs.stroke(sym);
            fill = SLDs.fill(sym);
            graphic = SLDs.graphic(sym);
            placement = SLDs.getPlacement(SLDs.ALIGN_LEFT, SLDs.ALIGN_MIDDLE, 0);

            name = sym == null ? null : sym.getGeometryPropertyName();
        }
       
        text = SLDs.textSymbolizer(fts);
        if (text != null && placement != null) {
            text.setLabelPlacement(placement);
View Full Code Here

            }
        }
            break;

        case POLYGON: {
            PolygonSymbolizer polygonSymbolizer = this.build.createPolygonSymbolizer(this.line
                    .getStroke(this.build), this.fill.getFill(this.build));
            polygonSymbolizer.setGeometryPropertyName(geometryPropertyName);
            acquire.add(polygonSymbolizer);
            if (textSym != null) {
                acquire.add(textSym);
            }
        }
            break;

        case POINT: {
            PointSymbolizer pointSymbolizer = this.build.createPointSymbolizer(this.point
                    .getGraphic(this.fill.getFill(this.build), this.line.getStroke(this.build),
                            this.build));
            pointSymbolizer.setGeometryPropertyName(geometryPropertyName);
            acquire.add(pointSymbolizer);
            if (textSym != null) {
                acquire.add(textSym);
            }
        }
            break;
        case ALL: {
            LineSymbolizer lineSymbolizer = this.build.createLineSymbolizer(this.line
                    .getStroke(this.build));
            acquire.add(lineSymbolizer);
            acquire.add(lineSymbolizer);
            PolygonSymbolizer polygonSymbolizer = this.build.createPolygonSymbolizer(this.line
                    .getStroke(this.build), this.fill.getFill(this.build));
            polygonSymbolizer.setGeometryPropertyName(geometryPropertyName);
            acquire.add(polygonSymbolizer);
            PointSymbolizer pointSymbolizer = this.build.createPointSymbolizer(this.point
                    .getGraphic(this.fill.getFill(this.build), this.line.getStroke(this.build),
                            this.build));
            pointSymbolizer.setGeometryPropertyName(geometryPropertyName);
View Full Code Here

        Stroke stroke = null;
        Symbolizer[] symbolizers = newRule.getSymbolizers();
        if (symbolizers.length > 0) {
            Symbolizer symbolizer = symbolizers[0];
            if (symbolizer instanceof PolygonSymbolizer) {
                PolygonSymbolizer polygonSymbolizer = (PolygonSymbolizer) symbolizer;
                stroke = SLDs.stroke(polygonSymbolizer);
            }
        }
        int strokeSize = 0;
        if (stroke != null) {
View Full Code Here

                } else if (symbolizer instanceof LineSymbolizer) {
                    LineSymbolizer lineSymbolizer = (LineSymbolizer) symbolizer;
                    Stroke stroke = lineSymbolizer.getStroke();
                    graphics[0] = stroke.getGraphicStroke();
                } else if (symbolizer instanceof PolygonSymbolizer) {
                    PolygonSymbolizer polygonSymbolizer = (PolygonSymbolizer) symbolizer;
                    Stroke stroke = polygonSymbolizer.getStroke();
                    if (stroke != null)
                        graphics[0] = stroke.getGraphicStroke();
                    Fill fill = polygonSymbolizer.getFill();
                    if (fill != null)
                        graphics[1] = fill.getGraphicFill();
                }
                for( int i = 0; i < graphics.length; i++ ) {
                    if (graphics[i] != null) {
View Full Code Here

     * Creates a default {@link Rule} for a polygon.
     *
     * @return the default rule.
     */
    public static Rule createDefaultPolygonRule() {
        PolygonSymbolizer polygonSymbolizer = sf.createPolygonSymbolizer();
        polygonSymbolizer.setFill(sf.createFill(ff.literal(Color.red)));
        polygonSymbolizer.setStroke(sf.createStroke(ff.literal(Color.BLACK), ff.literal(DEFAULT_WIDTH)));

        Rule rule = sf.createRule();
        rule.setName("New rule");
        rule.symbolizers().add(polygonSymbolizer);

View Full Code Here

     * @param rule the rule to check for symbolizers.
     * @return the first symbolizer found.
     */
    public static PolygonSymbolizer polygonSymbolizerFromRule( Rule rule ) {
        List<Symbolizer> symbolizers = rule.symbolizers();
        PolygonSymbolizer polygonSymbolizer = null;
        for( Symbolizer symbolizer : symbolizers ) {
            if (symbolizer instanceof PolygonSymbolizer) {
                polygonSymbolizer = (PolygonSymbolizer) symbolizer;
                break;
            }
View Full Code Here

    private Mark mark;

    public PolygonSymbolizerWrapper( Symbolizer tmpSymbolizer, RuleWrapper parent ) {
        super((PolygonSymbolizer) tmpSymbolizer, parent);

        PolygonSymbolizer polygonSymbolizer = (PolygonSymbolizer) tmpSymbolizer;

        // offset
        Point2D offset = getOffset(polygonSymbolizer);
        if (offset != null) {
            xOffset = String.valueOf(offset.getX());
            yOffset = String.valueOf(offset.getY());
        } else {
            xOffset = DEFAULT_OFFSET;
            yOffset = DEFAULT_OFFSET;
        }

        stroke = polygonSymbolizer.getStroke();
        if (stroke != null) {
            Expression color = stroke.getColor();
            strokeColor = expressionToString(color);
            Expression width = stroke.getWidth();
            strokeWidth = expressionToString(width);
            Expression opacity = stroke.getOpacity();
            strokeOpacity = expressionToString(opacity);

            if (strokeColor == null) {
                strokeColor = DEFAULT_COLOR;
                stroke.setColor(ff.literal(DEFAULT_COLOR));
            }
            if (strokeOpacity == null) {
                strokeOpacity = DEFAULT_OPACITY;
                stroke.setOpacity(ff.literal(DEFAULT_OPACITY));
            }
            if (strokeWidth == null) {
                strokeWidth = DEFAULT_WIDTH;
                stroke.setWidth(ff.literal(DEFAULT_WIDTH));
            }

            strokeGraphicStroke = stroke.getGraphicStroke();
            if (strokeGraphicStroke != null) {
                List<GraphicalSymbol> graphicalSymbolsList = strokeGraphicStroke.graphicalSymbols();
                if (graphicalSymbolsList.size() > 0) {
                    GraphicalSymbol graphicalSymbol = graphicalSymbolsList.get(0);
                    if (graphicalSymbol instanceof ExternalGraphic) {
                        strokeExternalGraphicStroke = (ExternalGraphic) graphicalSymbol;
                    }
                }
            }

            // dash
            float[] dashArray = stroke.getDashArray();
            if (dashArray != null) {
                dash = Utilities.getDashString(dashArray);
            } else {
                dash = ""; //$NON-NLS-1$
            }
            // dashoffset
            dashOffset = stroke.getDashOffset().evaluate(null, String.class);
            // line cap
            lineCap = stroke.getLineCap().evaluate(null, String.class);
            // line join
            lineJoin = stroke.getLineJoin().evaluate(null, String.class);

            hasStroke = true;
        } else {
            hasStroke = false;
        }

        fill = polygonSymbolizer.getFill();
        if (fill != null) {
            Expression color = fill.getColor();
            if (color != null) {
                fillColor = expressionToString(color);
            }
View Full Code Here

        if (fill == null) {
            if (fillColor == null) {
                fillColor = DEFAULT_COLOR;
            }
            fill = sf.createFill(ff.literal(fillColor));
            PolygonSymbolizer polygonSymbolizer = (PolygonSymbolizer) getSymbolizer();
            polygonSymbolizer.setFill(fill);
            fillGraphicFill = fill.getGraphicFill();
        }
    }
View Full Code Here

TOP

Related Classes of org.geotools.styling.PolygonSymbolizer

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.