/** * Retrieve the opacity from the provided fill; or return the default. * * @param fill * @return opacity from the above fill; or return the Fill.DEFAULT value */ public static double opacity(Fill fill) { if (fill == null) { fill = Fill.DEFAULT; } Expression opacityExp = fill.getOpacity(); if (opacityExp == null) { opacityExp = Fill.DEFAULT.getOpacity(); } return Filters.asDouble(opacityExp); }
public void visit(Fill fill) { checkOpacity(fill.getOpacity()); }
/** * Computes the Composite equivalent to the opacity in the SLD Fill * * @param fill * @param feature */ protected Composite getComposite(Fill fill, Object feature) { if (fill == null) { return null; } // get the opacity and prepare the composite float opacity = evalOpacity(fill.getOpacity(), feature); Composite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity); return composite; }
/** 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; } return AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity); } }
/** Reset to produce the default Fill. */ public FillBuilder reset() { unset = false; color = Fill.DEFAULT.getColor(); opacity = Fill.DEFAULT.getOpacity(); graphic.unset(); return this; }
/** * Retrieves the halo opacity from the first TextSymbolizer. * * @param symbolizer Text symbolizer information. * @return double of the halo's opacity, or NaN if unavailable. */ public static double textHaloOpacity(TextSymbolizer symbolizer) { if (symbolizer == null) { return Double.NaN; } Halo halo = symbolizer.getHalo(); if (halo == null) { return Double.NaN; } Fill fill = halo.getFill(); if (fill == null) { return Double.NaN; } Expression expr = fill.getOpacity(); if (expr == null) { return Double.NaN; } return Filters.asDouble(expr); }
public void visit(Fill fill) { Fill copy = sf.getDefaultFill(); copy.setBackgroundColor(copy(fill.getBackgroundColor())); copy.setColor(copy(fill.getColor())); copy.setGraphicFill(copy(fill.getGraphicFill())); copy.setOpacity(copy(fill.getOpacity())); if (STRICT && !copy.equals(fill)) { throw new IllegalStateException("Was unable to duplicate provided Fill:" + fill); } pages.push(copy); }
/** @see org.geotools.styling.StyleVisitor#visit(org.geotools.styling.Fill) */ public void visit(Fill fill) { if (fill.getBackgroundColor() != null) { fill.getBackgroundColor().accept(this, null); } if (fill.getColor() != null) { fill.getColor().accept(this, null); } if (fill.getGraphicFill() != null) { fill.getGraphicFill().accept(this); } if (fill.getOpacity() != null) { fill.getOpacity().accept(this, null); } }
/** * Retrieves the point opacity from a PointSymbolizer. * * <p>If you are using something fun like rules you will need to do your own thing. * * @param symbolizer Point symbolizer information. * @return double of the point's opacity, or NaN if unavailable. */ public static double pointOpacity(PointSymbolizer symbolizer) { if (symbolizer == null) { return Double.NaN; } Graphic graphic = symbolizer.getGraphic(); if (graphic == null) { return Double.NaN; } for (GraphicalSymbol gs : graphic.graphicalSymbols()) { if (gs != null && gs instanceof Mark) { Mark mark = (Mark) gs; Fill fill = mark.getFill(); if (fill != null) { Expression expr = fill.getOpacity(); if (expr != null) { return SLD.opacity(expr); } } } } return Double.NaN; }
public Fill createFill( Expression color, Expression backgroundColor, Expression opacity, Graphic graphicFill) { Fill fill = new FillImpl(filterFactory); if (color == null) { color = Fill.DEFAULT.getColor(); } fill.setColor(color); if (backgroundColor == null) { backgroundColor = Fill.DEFAULT.getBackgroundColor(); } fill.setBackgroundColor(backgroundColor); if (opacity == null) { opacity = Fill.DEFAULT.getOpacity(); } // would be nice to check if this was within bounds but we have to wait until use since it // may depend on an attribute fill.setOpacity(opacity); fill.setGraphicFill(graphicFill); return fill; }
@Override protected void encode(Fill fill) { putColor("fill-color", fill.getColor()); put("fill-opacity", nullIf(fill.getOpacity(), 1d)); if (fill.getGraphicFill() != null) { push("fill-graphic").inline(new GraphicEncoder(fill.getGraphicFill())); } } }
public void visit(Fill fill) { start("Fill"); if (fill.getGraphicFill() != null) { start("GraphicFill"); fill.getGraphicFill().accept(this); end("GraphicFill"); } encodeCssParam("fill", fill.getColor(), "#808080"); encodeCssParam("fill-opacity", fill.getOpacity(), 1.0); end("Fill"); }
public static double opacity(Fill fill) { if (fill == null) { return Double.NaN; } Expression opacityExp = fill.getOpacity(); double opacity = Double.parseDouble(opacityExp.toString()); return opacity; }
private boolean isStaticTransparentFill(Fill fill) { if (fill.getOpacity() instanceof Literal) { // weird case of people setting opacity to 0. In case the opacity is really attribute // driven, // we'll leave it be Double staticOpacity = fill.getOpacity().evaluate(null, Double.class); if (staticOpacity == null || staticOpacity == 0) { return true; } } return false; }
opacity = evalOpacity(symbolizer.getFill().getOpacity(), feature);
@Override public void visit(Fill fill) { if (fill.getColor() != null) { //fill.getColor().accept(visitor, extraData) } if (fill.getGraphicFill() != null) { fill.getGraphicFill().accept(this); } if (fill.getOpacity() != null) { //fill.getOpacity().accept(visitor, extraData) } }
public void visit(Fill fill) { Fill copy = sf.getDefaultFill(); copy.setBackgroundColor( copy( fill.getBackgroundColor()) ); copy.setColor(copy( fill.getColor())); copy.setGraphicFill( copy(fill.getGraphicFill())); copy.setOpacity( copy(fill.getOpacity())); if( STRICT && !copy.equals( fill )){ throw new IllegalStateException("Was unable to duplicate provided Fill:"+fill ); } pages.push(copy); }
/** @see org.geotools.styling.StyleVisitor#visit(org.geotools.styling.Fill) */ public void visit(Fill fill) { handleColor(fill.getBackgroundColor()); handleColor(fill.getColor()); if (fill.getGraphicFill() != null) fill.getGraphicFill().accept(this); handleOpacity(fill.getOpacity()); }
public void visit(Fill fill) { start("Fill"); if (fill.getGraphicFill() != null) { start("GraphicFill"); fill.getGraphicFill().accept(this); end("GraphicFill"); } encodeCssParam("fill", fill.getColor(), "#808080"); encodeCssParam("fill-opacity", fill.getOpacity(), 1.0); end("Fill"); }
public void visit(Fill fill) { start("Fill"); if (fill.getGraphicFill() != null) { start("GraphicFill"); fill.getGraphicFill().accept(this); end("GraphicFill"); } encodeCssParam("fill", fill.getColor()); encodeCssParam("fill-opacity", fill.getOpacity()); end("Fill"); }