Re: [svg-developers] Re: Big svg
- Peruzzi Alessandro wrote:
> My problem isn't to generate svg dom but in my applet the ploblem isThe thing is that the way you are creating the document
> to popolate a swing canvas (org.apache.batik.swing.JSVGCanvas)
> including svg creation. Therefore the problem is to conversion
> SVGDocument into swing component.
(lots and lots of rects) is causing your problem when you
try to display it. Can you provide some description of
how these 100's of thousands of rects are laid out?
If they are in a regular grid I would look at combining
rects that have the same fill. Also if the rects are
stroked you are much better off having grid lines that run the
full height/width of the table rather than stroking each rect
separately (much less geometry and you aren't double
stroking everything). Also you may find that path elements
are better than rects (and they are easier to use to combine
> Code to do it is:Can you generate the rects 'as needed'? So if the document
> // generate SVGDocument with org.apache.batik
> // and then the conversion in a swing component
> JSVGCanvas canvas = new JSVGCanvas();
> Up to 100000-150000 elements is ok but over this number of elements
> the conversion is more slow. (I need 300000-500000 elements)
> How do I do it?
> There is another best methods for do it?
is generally larger than the display (you can even force this)
then you only generate the rects for the currently visible portion.
Performance might also be slightly better if you introduce
grouping (for example put all the rects for a row in a group)
rather than having one parent with 500K children.
Hope these ideas help. You might also want to check out
the Batik-users mail-list (although most of my comments above
apply to any SVG renderer).