Examples of Fill


Examples of org.geotools.styling.Fill

                        for( Symbolizer newSymbolizer : newSymbolizers ) {
                            if (newSymbolizer instanceof PointSymbolizer) {
                                PointSymbolizer newPointSymbolizer = (PointSymbolizer) newSymbolizer;

                                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));
View Full Code Here

Examples of org.geotools.styling.Fill

        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

Examples of org.geotools.styling.Fill

            Expression graphicName = parseProperty(styleJson.getString(JSON_GRAPHIC_NAME), new Function<String, Object>() {
                public Object apply(final String input) {
                    return input;
                }
            });
            Fill fill = createFill(styleJson);
            Stroke stroke = createStroke(styleJson, false);

            final Mark mark = this.styleBuilder.createMark(graphicName, fill, stroke);
            graphic.graphicalSymbols().add(mark);
        }

        if (graphic.graphicalSymbols().isEmpty()) {
            Fill fill = createFill(styleJson);
            Stroke stroke = createStroke(styleJson, false);

            final Mark mark = this.styleBuilder.createMark(DEFAULT_POINT_MARK, fill, stroke);
            graphic.graphicalSymbols().add(mark);
        }
View Full Code Here

Examples of org.geotools.styling.Fill

                public Double apply(final String input) {
                    return Double.parseDouble(input);
                }
            });

            final Fill fill;
            if (styleJson.has(JSON_HALO_COLOR) || styleJson.has(JSON_HALO_OPACITY)) {
                fill = addFill(styleJson.optString(JSON_HALO_COLOR, "white"), styleJson.optString(JSON_HALO_OPACITY, "1.0"));
                return this.styleBuilder.createHalo(fill, radius);
            }
        }
View Full Code Here

Examples of org.geotools.styling.Fill

    }

    @Test
    public void fill() throws Exception {
        FillBuilder b = new FillBuilder();
        Fill fill = b.color(Color.BLUE).opacity(0.75).build();
        assertNotNull(fill);
        assertNotNull(b.color);
        assertEquals(Color.BLUE, fill.getColor().evaluate(null, Color.class));
    }
View Full Code Here

Examples of org.geotools.styling.Fill

    /**
     * Computes and returns the fill based on the feature and the symbolizer
     */
    public java.awt.Paint getFill() {
        Fill fill = ps.getFill();

        if (fill == null) {
            return null;
        }

        Paint fillPaint = (Color) fill.getColor().evaluate(feature, Color.class);

        // if a graphic fill is to be used, prepare the paint accordingly....
        org.geotools.styling.Graphic gr = fill.getGraphicFill();

        if (gr != null) {
            SLDStyleFactory fac = new SLDStyleFactory();
            fillPaint = fac.getTexturePaint(gr, feature, ps);
        }
View Full Code Here

Examples of org.geotools.styling.Fill

    /**
     * Computes and returns the fill composite based on the feature and the symbolizer
     */
    public Composite getFillComposite() {
        Fill fill = ps.getFill();

        if (fill == null) {
            return null;
        }

        // get the opacity and prepare the composite
        float opacity = ((Float) fill.getOpacity().evaluate(feature,Float.class)).floatValue();

        if (opacity == 1) {
            return null;
        }

View Full Code Here

Examples of org.geotools.styling.Fill

     */
    public Fill build() {
        if (unset) {
            return null;
        }
        Fill fill = sf.createFill(color, null, opacity, graphic.build());

        if (parent == null) {
            reset();
        }
        return fill;
View Full Code Here

Examples of org.geotools.styling.Fill

            defaultStroke = sb.createStroke(color, 1, opacity);
        }

        if ((geometryAttrType.getType().getBinding() == MultiPolygon.class)
                || (geometryAttrType.getType().getBinding() == Polygon.class)) {
            Fill fill = sb.createFill(color, opacity);
            symb = sb.createPolygonSymbolizer(defaultStroke, fill);
        } else if (geometryAttrType.getType().getBinding() == LineString.class) {
            symb = sb.createLineSymbolizer(color);
        } else if ((geometryAttrType.getType().getBinding() == MultiPoint.class)
                || (geometryAttrType.getType().getBinding() == Point.class)) {
            Fill fill = sb.createFill(color, opacity);
            Mark square = sb.createMark(StyleBuilder.MARK_SQUARE, fill, defaultStroke);
            Graphic graphic = sb.createGraphic(null, square, null); //, 1, 4, 0);
            symb = sb.createPointSymbolizer(graphic);

            //TODO: handle Text and Raster
View Full Code Here

Examples of org.geotools.styling.Fill

  private PolygonSymbolizer polysym(StyleFactory sFac)
      throws IllegalFilterException {
    Stroke myStroke;
    PolygonSymbolizer polysym = sFac.createPolygonSymbolizer();
    Fill myFill = sFac.getDefaultFill();
    myFill.setColor(filterFactory.literal("#ff0000"));
    polysym.setFill(myFill);
    myStroke = sFac.getDefaultStroke();
    myStroke.setColor(filterFactory.literal("#0000ff"));
    myStroke
        .setWidth(filterFactory.literal(new Integer(2)));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.