@Override public void visit(Graphic gr) { if (gr.getAnchorPoint() != null) { gr.getAnchorPoint().accept(this); } if (gr.getDisplacement() != null) { gr.getDisplacement().accept(this); } for (ExternalGraphic eg : gr.getExternalGraphics()) { eg.accept(this); } for (Mark m : gr.getMarks()) { m.accept(this); } }
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"); }
/** @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); }
if (gr.getAnchorPoint() != null) { gr.getAnchorPoint().accept(this); anchorCopy = (AnchorPoint) pages.pop();
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); }
AnchorPoint anchorPoint = sldGraphic.getAnchorPoint(); if (anchorPoint != null) { anchorPointX = evalToFloat(anchorPoint.getAnchorPointX(), feature, 0.5f);
@SuppressWarnings("unchecked") @Test public void testPointAnchor() throws Exception { String yaml = "point: \n" + " anchor: " + tuple(0.75, 0.25) + "\n" + " symbols: \n" + " - mark: \n" + " fill-color: '#FF0000'\n"; StyledLayerDescriptor sld = Ysld.parse(yaml); PointSymbolizer p = SLD.pointSymbolizer(SLD.defaultStyle(sld)); assertThat( p.getGraphic().getAnchorPoint(), allOf( hasProperty("anchorPointX", literal(0.75)), hasProperty("anchorPointY", literal(0.25)))); // SLD/SE 1.1 feature that may not be supported by renderer }
@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)); } }
assertEquals(4.0, rm.getStroke().getWidth().evaluate(null, Double.class), 0d); AnchorPoint actualAnchorPoint = rps.getStroke().getGraphicStroke().getAnchorPoint(); assertNotNull(actualAnchorPoint); assertEquals(
Expression rotationCopy = copy(gr.getRotation()); Expression sizeCopy = copy(gr.getSize()); AnchorPoint anchorCopy = copy(gr.getAnchorPoint());
@Override public void visit(Graphic gr) { if (gr.getAnchorPoint() != null) { gr.getAnchorPoint().accept(this); } if (gr.getDisplacement() != null) { gr.getDisplacement().accept(this); } for (ExternalGraphic eg : gr.getExternalGraphics()) { eg.accept(this); } if (gr.getGap() != null) { //gr.getGap().accept(visitor, extraData) } if (gr.getInitialGap() != null) { //gr.getInitialGap().accept(visitor, extraData) } for (Mark m : gr.getMarks()) { m.accept(this); } if (gr.getOpacity() != null) { //gr.getOpacity().accept(visitor, extraData) } if (gr.getRotation() != null) { //gr.getRotation().accept(visitor, extraData) } if (gr.getSize() != null) { //gr.getSize().accept(visitor, extraData) } }
@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)); } }
AnchorPoint anchorPoint = graphic.getAnchorPoint();
AnchorPoint anchorPoint = graphic.getAnchorPoint();
AnchorPoint anchorPoint = graphicStroke.getAnchorPoint(); if (anchorPoint != null) { expAnchorPointX = anchorPoint.getAnchorPointX();