Package org.geotools.styling

Examples of org.geotools.styling.Stroke


        return styles[0];
    }

    protected PointSymbolizer createPointSymbolizer( Color colour, int size ) {
        Fill fill = styleBuilder.createFill(Color.YELLOW, 0.0);
        Stroke stroke = builder.createStroke(colour, 2);
        Mark mark = styleBuilder.createMark("square", fill, stroke); //$NON-NLS-1$

        Graphic graph2 = styleBuilder.createGraphic(null, mark, null, 1, size, 0);
        PointSymbolizer symb = styleBuilder.createPointSymbolizer(graph2);
View Full Code Here


    }
    protected LineSymbolizer createLineSymbolizer( Color colour, boolean dashed, int thickness,
            double opacity ) {
        LineSymbolizer symbolizer = styleBuilder.createLineSymbolizer();

        Stroke stroke = builder.createStroke(colour, thickness, opacity);
        // if( dashed ){
        // stroke.setDashArray(new float[]{5, 3});
        // }
        symbolizer.setStroke(stroke);
View Full Code Here

                graphic.accept(this);
            }
        }

        public void visit( LineSymbolizer line ) {
            Stroke stroke = line.getStroke();
            if (stroke != null) {
                stroke.accept(this);
            }
        }
View Full Code Here

                stroke.accept(this);
            }
        }

        public void visit( PolygonSymbolizer poly ) {
            Stroke stroke = poly.getStroke();
            if (stroke != null) {
                stroke.accept(this);
            }
            Fill fill = poly.getFill();
            if (fill != null) {
                fill.accept(this);
            }
View Full Code Here

    }

    private void applyBorder( PolygonSymbolizer polygonSymbolizer, StyleBuilder styleBuilder ) {
        if (borderEnabled.getSelection()) {
            RGB c = borderColour.getColorValue();
            Stroke stroke = polygonSymbolizer.getStroke();
            if (stroke == null) {
                stroke = styleBuilder.createStroke();
                polygonSymbolizer.setStroke(stroke);
            }

            stroke.setColor(styleBuilder.colorExpression(new Color(c.red, c.green, c.blue)));
            stroke.setWidth(styleBuilder.literalExpression(borderWidth.getSelection()));
            stroke.setOpacity(styleBuilder.literalExpression(borderOpacity.getSelection()
                    / opacityMaxValueFloat));
        } else {
            polygonSymbolizer.setStroke(null);
        }
    }
View Full Code Here

                            oldColorExpr = marks[0].getFill().getColor();
                            marks[0].getFill().setColor(newColorExpr);
                        }
                    }else if (symb[0] instanceof LineSymbolizer) {
                        LineSymbolizer ps = (LineSymbolizer) symb[0];
                        Stroke stroke = ps.getStroke();
                        oldColorExpr = stroke.getColor();
                        stroke.setColor(newColorExpr);
                    }
                   
                    if (newColorExpr.equals(oldColorExpr)) {
                        return; //don't bother, same colour
                    }
View Full Code Here

        return true;
    }
   
    /** Grab to Stroke from the lineSymbolizer creating if needed */
    Stroke toStroke( LineSymbolizer lineSymbolizer ){       
        Stroke stroke = SLDs.stroke( lineSymbolizer );
        if( stroke == null ){
            stroke = sb.createStroke();
            lineSymbolizer.setStroke( stroke );
        }
        return stroke;
View Full Code Here

                size.setInput( Expression.NIL );
                color.getControl().setEnabled(false);
                color.setInput( Expression.NIL );
                return;
            }
            Stroke stroke = lineSymbolizer.getStroke();           
            if( stroke == null ){
                // no stroke? kind of like width == 0
                size.setInput( Expression.NIL );
                color.setInput( Expression.NIL );
            }
            size.setInput( stroke.getWidth() );
            size.getControl().setEnabled(true);
            color.setInput( stroke.getColor() );
            color.getControl().setEnabled(true);
        }
        finally {
            listen( true );
        }
View Full Code Here

                                Mark mark = sb.createMark(oldMark.getWellKnownName().evaluate(null, String.class));
                                Fill newFill = sb.createFill(fill);
                                newFill.setOpacity(ff.literal(opac));
                                mark.setFill(newFill);

                                Stroke newStroke = oldMark.getStroke();
                                if (newStroke != null) {
                                    if (borderColor!=null) {
                                        newStroke.setColor(ff.literal(borderColor));
                                        mark.setStroke(newStroke);
                                    }else{
                                        mark.setStroke(null);
                                    }
                                }

                                Graphic newGraphic = SLDs.graphic(newPointSymbolizer);
                                newGraphic.setSize(oldGraphic.getSize());
                                newGraphic.setRotation( oldGraphic.getRotation());
                                newGraphic.graphicalSymbols().clear();
                                newGraphic.graphicalSymbols().add(mark);
                                break;
                            }
                        }
                    }
                }
            } else if (symbolizer instanceof PolygonSymbolizer) {
                List<Rule> rules = newFTS.rules();
                for( Rule rule : rules ) {
                    List<Symbolizer> newSymbolizers = rule.symbolizers();
                    for( Symbolizer newSymbolizer : newSymbolizers ) {
                        if (newSymbolizer instanceof PolygonSymbolizer) {
                            PolygonSymbolizer polygonSymbolizer = (PolygonSymbolizer ) newSymbolizer;
                           
                            Fill previousFill = SLDs.fill(polygonSymbolizer);
                            previousFill.setOpacity(ff.literal(opac));
                           
                            Stroke stroke = SLDs.stroke(polygonSymbolizer);
                            if (stroke != null) {
                                if(borderColor!=null){
                                    stroke.setColor(ff.literal(borderColor));
                                }else{
                                    polygonSymbolizer.setStroke(null);
                                }
                            }
                           
View Full Code Here

        }
        return style;
    }

    private Symbolizer createMapOverviewStyle(@Nonnull final StyleBuilder builder) {
        Stroke stroke = builder.createStroke(Color.blue, 2);
        final Fill fill = builder.createFill(Color.blue, 0.2);
        return builder.createPolygonSymbolizer(stroke, fill);
    }
View Full Code Here

TOP

Related Classes of org.geotools.styling.Stroke

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.