Hi All,
I'm working on an application where one of the new features allows
the user to see the physical representation of the chunk of hardware
they have sitting in their datacenter rack. We have several
different SVG files we are using to represent the various pieces of
the hardware (one for the chassis, one for a "blade" that goes into
the chassis in various slots, etc etc).
This is my initial foray into the world of SVG and Batik, but my
initial approach to building up the combined image was:
1. Load the initial SVG document (the chassis)
2. Load in the rest of the pieces
3. Get the root element of each component piece
4. Import, position, and append that piece into the initial document
So, the code I'm using for that looks something like:
Document chassisDoc = ...
Document subDoc = ...
Element subElement = subDoc.getDocumentElement();
subElement = (Element) chassisDoc.importNode(subElement, true);
// Not shown: Position the sub-element at the right spot in the
chassisDoc
Element chassisElement = chassisDoc.getDocumentElement();
chassisElement.appendChild(subElement)
This works, but I'm a little worried about performance. The
documents themselves are on the large side: the chassis is ~2MB, the
sub-documents are between 200KB and 1MB. It's possible that a
chassis may have up to 20 - 30 components on the high side. Also, a
more recent test of this technique was throwing BridgeException's at
seemingly random times on one of the many the 'appendChild' calls.
Is there a better way to accomplish this? I've looked into using
Overlay's, but am struggling with how I would draw an SVG from the
Overlay's 'paint(...)' method. I've also thought of rasterizing the
SVG of each component, and drawing that way from within an Overlay,
but would I then lose the ability to zoom in & out? Any code
snippets I could look at that do similar things?
Many thanks for your time,
Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]