public Object parse(ElementInstance instance, Node node, Object value) throws Exception { Graphic g = (Graphic) super.parse(instance, node, value); // <xsd:element minOccurs="0" ref="se:InitialGap"/> if (node.hasChild("InitialGap")) { g.setInitialGap((Expression) node.getChildValue("InitialGap")); } // <xsd:element minOccurs="0" ref="se:Gap"/> if (node.hasChild("Gap")) { g.setGap((Expression) node.getChildValue("Gap")); } return 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 handle(YamlObject<?> obj, YamlParseContext context) { graphic(g); YamlMap map = obj.map(); if (map.has("anchor")) { g.setAnchorPoint(Util.anchor(map.get("anchor"), factory)); } if (map.has("opacity")) { g.setOpacity(Util.expression(map.str("opacity"), factory)); } if (map.has("size")) { g.setSize(Util.expression(map.str("size"), factory)); } if (map.has("displacement")) { g.setDisplacement(Util.displacement(map.get("displacement"), factory)); } if (map.has("rotation")) { g.setRotation(Util.expression(map.str("rotation"), factory)); } if (map.has("gap")) { g.setGap(Util.expression(map.str("gap"), factory)); } if (map.has("initial-gap")) { g.setInitialGap(Util.expression(map.str("initial-gap"), factory)); } context.push("symbols", new SymbolsParser()); }
public Object parse(ElementInstance instance, Node node, Object value) throws Exception { Graphic g = (Graphic) super.parse(instance, node, value); //<xsd:element minOccurs="0" ref="se:InitialGap"/> if (node.hasChild("InitialGap")) { g.setInitialGap((Expression)node.getChildValue("InitialGap")); } //<xsd:element minOccurs="0" ref="se:Gap"/> if (node.hasChild("Gap")) { g.setGap((Expression)node.getChildValue("Gap")); } return 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); } } } } }
@Override public void handle(YamlObject<?> obj, YamlParseContext context) { graphic(g); YamlMap map = obj.map(); if (map.has("anchor")) { g.setAnchorPoint(Util.anchor(map.get("anchor"), factory)); } if (map.has("opacity")) { g.setOpacity(Util.expression(map.str("opacity"), factory)); } if (map.has("size")) { g.setSize(Util.expression(map.str("size"), factory)); } if (map.has("displacement")) { g.setDisplacement(Util.displacement(map.get("displacement"), factory)); } if (map.has("rotation")) { g.setRotation(Util.expression(map.str("rotation"), factory)); } if (map.has("gap")) { g.setGap(Util.expression(map.str("gap"), factory)); } if (map.has("initial-gap")) { g.setInitialGap(Util.expression(map.str("initial-gap"), factory)); } context.push("symbols", new SymbolsParser()); }
graphic.setGap(gap);