Package org.geotools.styling

Examples of org.geotools.styling.LineSymbolizer


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


                g2d.setStroke(bStroke);
                g2d.draw(shape);
            }
        }
        if (symb instanceof LineSymbolizer) {
            LineSymbolizer lineSymbolizer = (LineSymbolizer) symb;
            Color c = SLDs.color(lineSymbolizer);
            int w = SLDs.width(lineSymbolizer);
            Stroke stroke = SLDs.stroke(lineSymbolizer);
            if (c != null && w > 0) {
                Graphics2D g2d = g.getGraphics(Graphics2D.class);
View Full Code Here

    }

    public LineSymbolizerWrapper( Symbolizer symbolizer, RuleWrapper parent ) {
        super(symbolizer, parent);

        LineSymbolizer lineSymbolizer = (LineSymbolizer) symbolizer;

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

        stroke = lineSymbolizer.getStroke();
        if (stroke != null) {
            Expression color = stroke.getColor();
            strokeColor = expressionToString(color);
            Expression width = stroke.getWidth();
            strokeWidth = expressionToString(width);
View Full Code Here

    }
        Stroke stroke = styleBuilder.createStroke();
        stroke.setColor(styleBuilder.colorExpression(colour));
        stroke.setWidth(styleBuilder.literalExpression(1));

        LineSymbolizer symbolizer = styleBuilder.createLineSymbolizer(stroke);

        return symbolizer;
    }
View Full Code Here

                g2d.setStroke(new BasicStroke(width));
                g2d.draw(shape);
            }
        }
        if (symb instanceof LineSymbolizer) {
            LineSymbolizer lineSymbolizer = (LineSymbolizer) symb;
            Color c = SLDs.color(lineSymbolizer);
            int w = SLDs.width(lineSymbolizer);
            if (c != null && w > 0) {
                g2d.setColor(c);
                g2d.setStroke(new BasicStroke(w));
View Full Code Here

                g.setStroke(ViewportGraphics.LINE_SOLID, width);
                g.draw( shape );
            }
        }       
        if( symb instanceof LineSymbolizer){
            LineSymbolizer lineSymbolizer = (LineSymbolizer) symb;
            Color c = SLDs.color( lineSymbolizer );
            int w = SLDs.width( lineSymbolizer );
            if( c != null && w > 0 ){
                g.setColor( c );
                g.setStroke(ViewportGraphics.LINE_SOLID, w);
View Full Code Here

     */
    public static Style createLineStyle( String typeName, Color color ) {
        StyleBuilder sb = new StyleBuilder();
        Style linestyle = sb.createStyle();

        LineSymbolizer line = sb.createLineSymbolizer(color);
        linestyle.addFeatureTypeStyle(sb.createFeatureTypeStyle(line));

        FeatureTypeStyle fts = linestyle.getFeatureTypeStyles()[0];
        fts.setName(Messages.Styling_name); //tag as simple
        fts.setFeatureTypeName(SLDs.GENERIC_FEATURE_TYPENAME);
View Full Code Here

                        if(marks!=null && marks.length>0){
                            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)) {
View Full Code Here

     * Style with any modification done by the user.
     * @param event That caused the change; null to sync all controls
     */
    void sync( EventObject event ){
        SLDContentManager content = new SLDContentManager( sb, getContainer().getStyle() );       
        LineSymbolizer lineSymbolizer = content.getSymbolizer( LineSymbolizer.class );
       
        Object source = event != null ? event.getSource() : null;       
        if( source == null || source == size ){
            toStroke( lineSymbolizer ).setWidth( size.getInput() );
        }
View Full Code Here

    public void refresh() {       
        IStyleEditorPageContainer container = getContainer();
        // StyleLayer layer = container.getSelectedLayer();
        // SimpleFeatureType schema = layer.getSchema();
        Style style = container.getStyle();
        LineSymbolizer lineSymbolizer = SLDs.lineSymbolizer(style);
       
        try {
            listen( false ); // do not issue events while controls being updated by hand
            if( lineSymbolizer == null ){
                // nothing to do here - kind of like a geometry of "(none)"
                //
                size.getControl().setEnabled(false);
                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 );
            }
View Full Code Here

TOP

Related Classes of org.geotools.styling.LineSymbolizer

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.