GVTBuilder builder = ctx.getGVTBuilder();
GraphicsNode refNode = builder.build(ctx, g);
///////////////////////////////////////////////////////////////////////
CompositeGraphicsNode gn = new CompositeGraphicsNode();
gn.getChildren().add(refNode);
UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, e);
String s;
// 'x' attribute - default is 0
float x = 0;
s = e.getAttributeNS(null, SVG_X_ATTRIBUTE);
if (s.length() != 0) {
x = UnitProcessor.svgHorizontalCoordinateToUserSpace
(s, SVG_X_ATTRIBUTE, uctx);
}
// 'y' attribute - default is 0
float y = 0;
s = e.getAttributeNS(null, SVG_Y_ATTRIBUTE);
if (s.length() != 0) {
y = UnitProcessor.svgVerticalCoordinateToUserSpace
(s, SVG_Y_ATTRIBUTE, uctx);
}
// set an affine transform to take into account the (x, y)
// coordinates of the <use> element
s = e.getAttributeNS(null, SVG_TRANSFORM_ATTRIBUTE);
AffineTransform at = AffineTransform.getTranslateInstance(x, y);
// 'transform'
if (s.length() != 0) {
at.preConcatenate
(SVGUtilities.convertTransform(e, SVG_TRANSFORM_ATTRIBUTE, s));
}
gn.setTransform(at);
// set an affine transform to take into account the (x, y)
// coordinates of the <use> element
// 'visibility'
gn.setVisible(CSSUtilities.convertVisibility(e));
// 'enable-background'
Rectangle2D r
= CSSUtilities.convertEnableBackground(e, uctx);
if (r != null) {
gn.setBackgroundEnable(r);
}
return gn;
}