本文整理汇总了Java中org.newdawn.slick.svg.Diagram.getFigureByID方法的典型用法代码示例。如果您正苦于以下问题:Java Diagram.getFigureByID方法的具体用法?Java Diagram.getFigureByID怎么用?Java Diagram.getFigureByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.newdawn.slick.svg.Diagram
的用法示例。
在下文中一共展示了Diagram.getFigureByID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import org.newdawn.slick.svg.Diagram; //导入方法依赖的package包/类
/**
* @see org.newdawn.slick.svg.inkscape.ElementProcessor#process(org.newdawn.slick.svg.Loader, org.w3c.dom.Element, org.newdawn.slick.svg.Diagram, org.newdawn.slick.geom.Transform)
*/
public void process(Loader loader, Element element, Diagram diagram,
Transform transform) throws ParsingException {
String ref = element.getAttributeNS("http://www.w3.org/1999/xlink", "href");
String href = Util.getAsReference(ref);
Figure referenced = diagram.getFigureByID(href);
if (referenced == null) {
throw new ParsingException(element, "Unable to locate referenced element: "+href);
}
Transform local = Util.getTransform(element);
Transform trans = local.concatenate(referenced.getTransform());
NonGeometricData data = Util.getNonGeometricData(element);
Shape shape = referenced.getShape().transform(trans);
data.addAttribute(NonGeometricData.FILL, referenced.getData().getAttribute(NonGeometricData.FILL));
data.addAttribute(NonGeometricData.STROKE, referenced.getData().getAttribute(NonGeometricData.STROKE));
data.addAttribute(NonGeometricData.OPACITY, referenced.getData().getAttribute(NonGeometricData.OPACITY));
data.addAttribute(NonGeometricData.STROKE_WIDTH, referenced.getData().getAttribute(NonGeometricData.STROKE_WIDTH));
Figure figure = new Figure(referenced.getType(), shape, data, trans);
diagram.addFigure(figure);
}