opacity = Graphic.DEFAULT.getOpacity();
/** @see org.geotools.styling.StyleVisitor#visit(org.geotools.styling.Graphic) */ public void visit(Graphic gr) { if (gr.getSymbols() != null) { Symbol[] symbols = gr.getSymbols(); for (int i = 0; i < symbols.length; i++) { Symbol symbol = symbols[i]; symbol.accept(this); } } if (gr.getOpacity() != null) { gr.getOpacity().accept(this, null); } if (gr.getRotation() != null) { gr.getRotation().accept(this, null); } if (gr.getSize() != null) { gr.getSize().accept(this, null); } if (gr.getDisplacement() != null) gr.getDisplacement().accept(this); if (gr.getAnchorPoint() != null) gr.getAnchorPoint().accept(this); }
public void visit(Graphic gr) { Graphic copy = null; Displacement displacementCopy = copy(gr.getDisplacement()); ExternalGraphic[] externalGraphicsCopy = copy(gr.getExternalGraphics()); Mark[] marksCopy = copy(gr.getMarks()); Expression opacityCopy = copy(gr.getOpacity()); Expression rotationCopy = copy(gr.getRotation()); Expression sizeCopy = copy(gr.getSize()); AnchorPoint anchorCopy = copy(gr.getAnchorPoint()); // Looks like Symbols are a "view" of marks and external graphics? // Symbol[] symbolCopys = copy( gr.getSymbols() ); copy = sf.createDefaultGraphic(); copy.setDisplacement(displacementCopy); copy.setAnchorPoint(anchorCopy); copy.setExternalGraphics(externalGraphicsCopy); copy.setMarks(marksCopy); copy.setOpacity(opacityCopy); copy.setRotation(rotationCopy); copy.setSize(sizeCopy); // copy.setSymbols(symbolCopys); if (STRICT) { if (!copy.equals(gr)) { throw new IllegalStateException("Was unable to duplicate provided Graphic:" + gr); } } pages.push(copy); }
float opacity = evalOpacity(sldGraphic.getOpacity(), feature);
Expression opacityCopy = copy(gr.getOpacity()); Expression rotationCopy = copy(gr.getRotation()); Expression sizeCopy = rescaleGraphicSize(gr);
public void visit(Graphic gr) { start("Graphic"); // encodeGeometryProperty(gr.getGeometryPropertyName()); Symbol[] symbols = gr.getSymbols(); for (int i = 0; i < symbols.length; i++) { symbols[i].accept(this); } element("Opacity", gr.getOpacity(), 1.0); element("Size", gr.getSize()); element("Rotation", gr.getRotation(), 0.0); if (gr.getAnchorPoint() != null) { visit(gr.getAnchorPoint()); } if (gr.getDisplacement() != null) { visit(gr.getDisplacement()); } end("Graphic"); }
@Override protected void encode(Graphic g) { if (!flatten) push("graphic"); inline(new AnchorPointEncoder(g.getAnchorPoint())); inline(new DisplacementEncoder(g.getDisplacement())); put("gap", nullIf(g.getGap(), 0d), nullIf(g.getInitialGap(), 0d)); put("opacity", nullIf(g.getOpacity(), 1)); put("size", g.getSize()); put("rotation", nullIf(g.getRotation(), 0d)); put("symbols", new SymbolsEncoder(g)); } }
/** @see org.geotools.styling.StyleVisitor#visit(org.geotools.styling.Graphic) */ public void visit(Graphic gr) { if (gr.getSymbols() != null) { Symbol[] symbols = gr.getSymbols(); for (int i = 0; i < symbols.length; i++) { Symbol symbol = symbols[i]; symbol.accept(this); } } handleOpacity(gr.getOpacity()); }
/** * @see org.geotools.styling.StyleVisitor#visit(org.geotools.styling.Graphic) */ public void visit(Graphic gr) { if (gr.getSymbols() != null) { Symbol[] symbols = gr.getSymbols(); for (int i = 0; i < symbols.length; i++) { Symbol symbol = symbols[i]; symbol.accept(this); } } handleOpacity(gr.getOpacity()); }
public void addGraphicProperties(String prefix, Graphic g, Map<String,String> props) { if (g.getOpacity() != null && !isStatic(g.getOpacity())) { props.put(prefix + OPACITY, g.getOpacity().evaluate(feature, String.class)); } if (g.getRotation() != null && !isStatic(g.getRotation())) { props.put(prefix + ROTATION, g.getRotation().evaluate(feature, String.class)); } if (g.getSize() != null && !isStatic(g.getSize())) { props.put(prefix + SIZE, g.getSize().evaluate(feature, String.class)); } if (!g.graphicalSymbols().isEmpty()) { if (g.graphicalSymbols().get(0) instanceof Mark) { Mark mark = (Mark) g.graphicalSymbols().get(0); addMarkProperties(prefix, mark, props); } else if (g.graphicalSymbols().get(0) instanceof ExternalGraphic) { ExternalGraphic exGraphic = (ExternalGraphic) g.graphicalSymbols().get(0); addExternalGraphicProperties(prefix, exGraphic, props); } } }
opacity = Graphic.DEFAULT.getOpacity();
/** * @see org.geotools.styling.StyleVisitor#visit(org.geotools.styling.Graphic) */ public void visit(Graphic gr) { if (gr.getSymbols() != null) { Symbol[] symbols = gr.getSymbols(); for (int i = 0; i < symbols.length; i++) { Symbol symbol = symbols[i]; symbol.accept(this); } } if (gr.getOpacity() != null) { gr.getOpacity().accept(this,null); } if (gr.getRotation() != null) { gr.getRotation().accept(this,null); } if (gr.getSize() != null) { gr.getSize().accept(this,null); } if (gr.getDisplacement() != null) gr.getDisplacement().accept(this); }
/** * @see org.geotools.styling.StyleVisitor#visit(org.geotools.styling.Graphic) */ public void visit(Graphic gr) { if (gr.getSymbols() != null) { Symbol[] symbols = gr.getSymbols(); for (int i = 0; i < symbols.length; i++) { Symbol symbol = symbols[i]; symbol.accept(this); } } if (gr.getOpacity() != null) { gr.getOpacity().accept(this,null); } if (gr.getRotation() != null) { gr.getRotation().accept(this,null); } if (gr.getSize() != null) { gr.getSize().accept(this,null); } if (gr.getDisplacement() != null) gr.getDisplacement().accept(this); }
public void visit(Graphic gr) { Graphic copy = null; Displacement displacementCopy = copy( gr.getDisplacement() ); ExternalGraphic[] externalGraphicsCopy = copy( gr.getExternalGraphics() ); Mark[] marksCopy = copy( gr.getMarks() ); Expression opacityCopy = copy( gr.getOpacity() ); Expression rotationCopy = copy( gr.getRotation() ); Expression sizeCopy = copy( gr.getSize() ); // Looks like Symbols are a "view" of marks and external graphics? // Symbol[] symbolCopys = copy( gr.getSymbols() ); copy = sf.createDefaultGraphic(); copy.setDisplacement(displacementCopy); copy.setExternalGraphics(externalGraphicsCopy); copy.setMarks(marksCopy); copy.setOpacity((Expression) opacityCopy); copy.setRotation((Expression) rotationCopy); copy.setSize((Expression) sizeCopy); // copy.setSymbols(symbolCopys); if( STRICT ){ if( !copy.equals( gr )){ throw new IllegalStateException("Was unable to duplicate provided Graphic:"+gr ); } } pages.push(copy); }
public void visit(Graphic gr) { start("Graphic"); encodeGeometryProperty(gr.getGeometryPropertyName()); Symbol[] symbols = gr.getSymbols(); for (int i = 0; i < symbols.length; i++) { symbols[i].accept(this); } element("Opacity", gr.getOpacity()); element("Size", gr.getSize()); element("Rotation", gr.getRotation()); end("Graphic"); }
public void visit(Graphic gr) { start("Graphic"); //encodeGeometryProperty(gr.getGeometryPropertyName()); Symbol[] symbols = gr.getSymbols(); for (int i = 0; i < symbols.length; i++) { symbols[i].accept(this); } element("Opacity", gr.getOpacity(), 1.0); element("Size", gr.getSize()); element("Rotation", gr.getRotation(), 0.0); visit(gr.getDisplacement()); end("Graphic"); }
"Graphic of TextSymbolizer2 has not been correctly duplicated", gr.getOpacity(), copy.getGraphic().getOpacity()); assertEquals( "Graphic of TextSymbolizer2 has not been correctly duplicated",
public void setEdited(Graphic graphic) { if (graphic != null) { guiDisplacement.setEdited(graphic.getDisplacement()); guiGeom.setGeom(graphic.getGeometryPropertyName()); guiOpacity.setExpression(graphic.getOpacity()); guiRotation.setExpression(graphic.getRotation()); guiSize.setExpression(graphic.getSize()); // marks and external graphics are symbols so no need to handle this method //graphic.getSymbols(); guiMark.setEdited(graphic.getMarks()); guiExternal.setEdited(graphic.getExternalGraphics()); } this.graphic = graphic; }
@Override protected void encode(Graphic g) { if (!flatten) push("graphic"); inline(new AnchorPointEncoder(g.getAnchorPoint())); inline(new DisplacementEncoder(g.getDisplacement())); put("gap", nullIf(g.getGap(), 0d), nullIf(g.getInitialGap(), 0d)); put("opacity", nullIf(g.getOpacity(), 1)); put("size", g.getSize()); put("rotation", nullIf(g.getRotation(), 0d)); put("symbols", new SymbolsEncoder(g)); } }
@Test public void testGraphicFallbacks() { FilterFactory ff = CommonFactoryFinder.getFilterFactory(); Style style = SLD.createPointStyle("circle", Color.RED, Color.yellow, 0.5f, 10f); Graphic g = SLD.graphic(SLD.pointSymbolizer(style)); g.setRotation(ff.literal(45)); g.setOpacity(ff.literal(0.5)); Map<String, String> props = new HashMap<String, String>(); props.put("0.0.0", ""); style = IconPropertyInjector.injectProperties(style, props); g = SLD.graphic(SLD.pointSymbolizer(style)); assertEquals(10.0, g.getSize().evaluate(null, Double.class), 0.1); assertEquals(45.0, g.getRotation().evaluate(null, Double.class), 0.1); assertEquals(0.5, g.getOpacity().evaluate(null, Double.class), 0.1); } }