@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)); } }
private void rescale(Graphic graphic, Unit<Length> unit) { if (graphic != null) { graphic.setSize(rescale(graphic.getSize(), unit)); graphic.setGap(rescale(graphic.getGap(), unit)); Displacement disp = graphic.getDisplacement(); if (disp != null) { disp.setDisplacementX(rescale(disp.getDisplacementX(), unit)); disp.setDisplacementY(rescale(disp.getDisplacementY(), unit)); graphic.setDisplacement(disp); } if (graphic.graphicalSymbols() != null) { for (GraphicalSymbol gs : graphic.graphicalSymbols()) { if (gs instanceof Mark) { Mark mark = (Mark) gs; rescaleStroke(mark.getStroke(), unit); rescaleFill(mark.getFill(), unit); } } } } }
@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)); } }
private void rescale(Graphic graphic, double mapScale, Unit<Length> unit) { if(graphic != null) { graphic.setSize(rescale(graphic.getSize(), mapScale, unit)); graphic.setGap(rescale(graphic.getGap(), mapScale, unit)); Displacement disp = graphic.getDisplacement(); if (disp != null) { disp.setDisplacementX(rescale(disp.getDisplacementX(), mapScale, unit)); disp.setDisplacementY(rescale(disp.getDisplacementY(), mapScale, unit)); graphic.setDisplacement(disp); } if (graphic.graphicalSymbols() != null) { for (GraphicalSymbol gs : graphic.graphicalSymbols()) { if(gs instanceof Mark) { Mark mark = (Mark) gs; rescaleStroke(mark.getStroke(), mapScale, unit); rescaleFill(mark.getFill(), mapScale, unit); } } } } }
expGap = graphic.getGap(); expInitialGap = graphic.getInitialGap();
expGap = graphic.getGap(); expInitialGap = graphic.getInitialGap();
expGap = graphicStroke.getGap(); expInitialGap = graphicStroke.getInitialGap();