Hi,
I've been usin Batik to draw very simple map symbols (like spheres,
rectangles and arrows), in a java Graphics2D.
I've been using java2D and I didn't want to abandon this solution, so I am
creating map symbols using a RootGraphicsNode, and calling the method paint.
private RootGraphicsNode node;
private SVGDocument svgDoc = null;
private UserAgent userAgent;
private DocumentLoader loader;
private BridgeContext ctx;
private GVTBuilder builder;
userAgent = new UserAgentAdapter();
loader = new DocumentLoader(userAgent);
ctx = new BridgeContext(userAgent, loader);
ctx.setDynamicState(BridgeContext.DYNAMIC);
builder = new GVTBuilder();
try {
java.net.URL url = file.toURL();
svgDoc = (SVGDocument) loader.loadDocument(url.toString());
}
catch (IOException e) {
e.printStackTrace();
System.exit(-1);
}
node = builder.build(ctx, svgDoc).getRoot();
This parse is done once, and I use a pool of objects to the symbols. When I
need to plot a symbol, I apply a transform
node.setTransform(transform);
and call the method paint();
node.paint(g2d);
It works, but when showing lots of symbols, map operation (like pan and
zoom) are slow. I used to paint it using GeneralPath in Java2D, and didn't
have this performance problem.
I've tried to alter the style attribute,
<svg ... style="shape-rendering:optimizeSpeed;">
but It looks slower than using geometricPrecision.
Profiling the application, I noticed that the bottleneck is the call of
node.paint(g2d);
Should I change to a BufferedImage?
Anyone can help?
Thanks,
Felipe Alcure
--
View this message in context:
http://www.nabble.com/Method-paint%28%29-in-RootGraphicsNode-with-low-performance---tuning-application-tf4631308.html#a13224816
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]