|| res.equalsIgnoreCase("stroke-opacity")) { Expression opacity = parseCssParameter(child, false); stroke.setOpacity(opacity); } else if (res.equalsIgnoreCase("linecap") || res.equalsIgnoreCase("stroke-linecap")) {
public Stroke getDefaultStroke() { try { Stroke stroke = createStroke( filterFactory.literal("#000000"), filterFactory.literal(Integer.valueOf(1))); stroke.setDashOffset(filterFactory.literal(Integer.valueOf(0))); stroke.setDashArray(Stroke.DEFAULT.getDashArray()); stroke.setLineCap(filterFactory.literal("butt")); stroke.setLineJoin(filterFactory.literal("miter")); stroke.setOpacity(filterFactory.literal(Integer.valueOf(1))); return stroke; } catch (org.geotools.filter.IllegalFilterException ife) { // we should never be in here throw new RuntimeException("Error creating stroke", ife); } }
public void visit(Stroke stroke) { Stroke copy = sf.getDefaultStroke(); copy.setColor(copy(stroke.getColor())); copy.setDashArray(copyExpressions(stroke.dashArray())); copy.setDashOffset(copy(stroke.getDashOffset())); copy.setGraphicFill(copy(stroke.getGraphicFill())); copy.setGraphicStroke(copy(stroke.getGraphicStroke())); copy.setLineCap(copy(stroke.getLineCap())); copy.setLineJoin(copy(stroke.getLineJoin())); copy.setOpacity(copy(stroke.getOpacity())); copy.setWidth(copy(stroke.getWidth())); if (STRICT && !copy.equals(stroke)) { throw new IllegalStateException("Was unable to duplicate provided Stroke:" + stroke); } pages.push(copy); }
/** * Increase stroke width. * * <p>Based on feedback we may need to change the dash array as well. * * <p> */ public void visit(org.geotools.styling.Stroke stroke) { Stroke copy = sf.getDefaultStroke(); copy.setColor(copy(stroke.getColor())); copy.setDashArray(rescaleDashArray(stroke.dashArray())); copy.setDashOffset(rescale(stroke.getDashOffset())); copy.setGraphicFill(copy(stroke.getGraphicFill())); copy.setGraphicStroke(copy(stroke.getGraphicStroke())); copy.setLineCap(copy(stroke.getLineCap())); copy.setLineJoin(copy(stroke.getLineJoin())); copy.setOpacity(copy(stroke.getOpacity())); copy.setWidth(rescale(stroke.getWidth())); pages.push(copy); }
@Override public void visit(PolygonSymbolizer poly) { super.visit(poly); PolygonSymbolizer polyCopy = (PolygonSymbolizer) pages.peek(); Fill polyFill = polyCopy.getFill(); if (polyFill != null) { polyFill.setOpacity(polyFillExp); } Stroke polyStroke = polyCopy.getStroke(); if (polyStroke != null) { polyStroke.setOpacity(polyStrokeExp); } }
@Override public void visit(PolygonSymbolizer poly) { super.visit(poly); PolygonSymbolizer polyCopy = (PolygonSymbolizer) pages.peek(); Fill polyFill = polyCopy.getFill(); if (polyFill != null) { polyFill.setOpacity(polyFillExp); } Stroke polyStroke = polyCopy.getStroke(); if (polyStroke != null) { polyStroke.setOpacity(polyStrokeExp); } }
opacity = Stroke.DEFAULT.getOpacity(); stroke.setOpacity(opacity);
stroke().setOpacity(Util.expression(map.str("stroke-opacity"), factory));
public Stroke getDefaultStroke() { try { Stroke stroke = createStroke(filterFactory.literal( "#000000"), filterFactory.literal(new Integer(1))); stroke.setDashOffset(filterFactory.literal( new Integer(0))); stroke.setLineCap(filterFactory.literal("butt")); stroke.setLineJoin(filterFactory.literal("miter")); stroke.setOpacity(filterFactory.literal( new Integer(1))); return stroke; } catch (org.geotools.filter.IllegalFilterException ife) { //we should never be in here throw new RuntimeException("Error creating stroke", ife); } }
public Stroke getDefaultStroke() { try { Stroke stroke = createStroke(filterFactory.literal("#000000"), filterFactory.literal(new Integer(1))); stroke.setDashOffset(filterFactory.literal( new Integer(0))); stroke.setDashArray(Stroke.DEFAULT.getDashArray()); stroke.setLineCap(filterFactory.literal("butt")); stroke.setLineJoin(filterFactory.literal("miter")); stroke.setOpacity(filterFactory.literal(new Integer(1))); return stroke; } catch (org.geotools.filter.IllegalFilterException ife) { //we should never be in here throw new RuntimeException("Error creating stroke", ife); } }
public PolygonSymbolizer createPolygonSymbolizer() { Color col = randomColor(); Fill fill = sb.createFill(col, 0.6f); Stroke stroke = sb.createStroke(col, 1); stroke.setOpacity(sb.literalExpression(1f)); return sb.createPolygonSymbolizer(stroke, fill); }
private void applyOpacity(Symbolizer symbol, Expression opa) { if (symbol instanceof PolygonSymbolizer) { PolygonSymbolizer sym = (PolygonSymbolizer) symbol; sym.getFill().setOpacity(opa); sym.getStroke().setOpacity(opa); } else if (symbol instanceof PointSymbolizer) { PointSymbolizer sym = (PointSymbolizer) symbol; sym.getGraphic().setOpacity(opa); Mark[] marks = sym.getGraphic().getMarks(); for (int k = 0; k < marks.length; k++) { marks[k].getFill().setOpacity(opa); marks[k].getStroke().setOpacity(opa); } } else if (symbol instanceof LineSymbolizer) { LineSymbolizer sym = (LineSymbolizer) symbol; sym.getStroke().setOpacity(opa); } else if (symbol instanceof RasterSymbolizer) { RasterSymbolizer sym = (RasterSymbolizer) symbol; sym.setOpacity(opa); } } }
@Override public void visit(Stroke stroke) { super.visit(stroke); Stroke copy = (Stroke) pages.peek(); if (copy.getGraphicFill() != null) { copy.setGraphicFill(null); } if (copy.getGraphicStroke() != null) { copy.setWidth(getSymbolsSize(copy.getGraphicStroke())); copy.setGraphicStroke(null); } copy.setColor(colorFunction); copy.setOpacity(LITERAL_ONE); if (copy.dashArray() != null) { copy.dashArray().clear(); } copy.setDashOffset(null); }
private void initSymbols(){ Color editionStyleColor = Color.RED; Fill fill = STYLE_BUILDER.createFill(editionStyleColor, 1f); Stroke stroke = STYLE_BUILDER.createStroke(editionStyleColor, 1); stroke.setOpacity(STYLE_BUILDER.literalExpression(1f)); Mark mark = STYLE_BUILDER.createMark("cross", fill, stroke); Graphic gra = STYLE_BUILDER.createGraphic(); gra.setOpacity(STYLE_BUILDER.literalExpression(1f)); gra.setMarks(new Mark[]{mark}); gra.setSize(STYLE_BUILDER.literalExpression(14)); pointSymbol = STYLE_BUILDER.createPointSymbolizer(gra); fill = STYLE_BUILDER.createFill(editionStyleColor, 0.4f); stroke = STYLE_BUILDER.createStroke(editionStyleColor, 2); stroke.setOpacity(STYLE_BUILDER.literalExpression(0.6f)); polygonSymbol = STYLE_BUILDER.createPolygonSymbolizer(stroke, fill); lineSymbol = STYLE_BUILDER.createLineSymbolizer(stroke); }
public void apply(){ if(stroke != null){ stroke.setLineCap(GuiStrokeLineCap.getLineCap()); stroke.setLineJoin(GuiStrokeLineJoin.getLineJoin()); stroke.setDashArray(GuiStrokeDashes.getDashes()); stroke.setDashOffset(GuiStrokeDashes.getOffset()); stroke.setOpacity(GuiStrokeAlpha.getExpression()); stroke.setWidth(GuiStrokeWidth.getExpression()); stroke.setColor(GuiStrokeColor.getExpression()); } }
public void visit(Stroke stroke) { Stroke copy = sf.getDefaultStroke(); copy.setColor( copy(stroke.getColor())); copy.setDashArray( copy(stroke.getDashArray())); copy.setDashOffset( copy( stroke.getDashOffset())); copy.setGraphicFill( copy(stroke.getGraphicFill())); copy.setGraphicStroke( copy( stroke.getGraphicStroke())); copy.setLineCap(copy(stroke.getLineCap())); copy.setLineJoin( copy(stroke.getLineJoin())); copy.setOpacity( copy(stroke.getOpacity())); copy.setWidth( copy(stroke.getWidth())); if( STRICT && !copy.equals( stroke)){ throw new IllegalStateException("Was unable to duplicate provided Stroke:"+stroke ); } pages.push(copy); }
/** * Increase stroke width. * <p> * Based on feedback we may need to change the dash array as well. * <p> */ public void visit(org.geotools.styling.Stroke stroke) { Stroke copy = sf.getDefaultStroke(); copy.setColor( copy(stroke.getColor())); copy.setDashArray( rescale(stroke.getDashArray())); copy.setDashOffset( rescale(stroke.getDashOffset())); copy.setGraphicFill( copy(stroke.getGraphicFill())); copy.setGraphicStroke( copy( stroke.getGraphicStroke())); copy.setLineCap(copy(stroke.getLineCap())); copy.setLineJoin( copy(stroke.getLineJoin())); copy.setOpacity( copy(stroke.getOpacity())); copy.setWidth( rescale(stroke.getWidth())); pages.push(copy); }
@Test public void testFill() { PolygonSymbolizer polygonSymbolizer = sb.createPolygonSymbolizer(Color.BLACK, Color.BLACK, 3); polygonSymbolizer.getFill().setOpacity(ff.literal(0.5)); polygonSymbolizer.getStroke().setOpacity(ff.literal(0.5)); Style style = sb.createStyle(polygonSymbolizer); style.accept(visitor); Style copy = (Style) visitor.getCopy(); PolygonSymbolizer ls = (PolygonSymbolizer) copy.featureTypeStyles().get(0).rules().get(0).symbolizers().get(0); Stroke stroke = ls.getStroke(); assertEquals(colorFunction, stroke.getColor()); assertEquals(Integer.valueOf(3), stroke.getWidth().evaluate(null, Integer.class)); assertNull(stroke.dashArray()); assertEquals(Integer.valueOf(1), stroke.getOpacity().evaluate(null, Integer.class)); Fill fill = ls.getFill(); assertEquals(colorFunction, fill.getColor()); assertEquals(Integer.valueOf(1), fill.getOpacity().evaluate(null, Integer.class)); }
@Test public void testGraphicStrokeFill() { Graphic graphic = sb.createGraphic(null, sb.createMark("square"), null); graphic.setSize(ff.literal(8)); Stroke stroke = sb.createStroke(); stroke.setGraphicStroke(graphic); stroke.setOpacity(ff.literal(0.5)); Fill fill = sb.createFill(null, null, 0.5, graphic); PolygonSymbolizer polygonSymbolizer = sb.createPolygonSymbolizer(stroke, fill); Style style = sb.createStyle(polygonSymbolizer); style.accept(visitor); Style copy = (Style) visitor.getCopy(); PolygonSymbolizer ls = (PolygonSymbolizer) copy.featureTypeStyles().get(0).rules().get(0).symbolizers().get(0); Stroke strokeCopy = ls.getStroke(); assertEquals(colorFunction, strokeCopy.getColor()); assertEquals(Integer.valueOf(8), strokeCopy.getWidth().evaluate(null, Integer.class)); assertNull(strokeCopy.dashArray()); assertEquals(Integer.valueOf(1), strokeCopy.getOpacity().evaluate(null, Integer.class)); Fill fillCopy = ls.getFill(); assertEquals(colorFunction, fillCopy.getColor()); assertEquals(Integer.valueOf(1), fillCopy.getOpacity().evaluate(null, Integer.class)); }
stroke().setOpacity(Util.expression(map.str("stroke-opacity"), factory));