Hi Martin,

it would probably also be much more efficient to create the text elements on the fly as needed, and not pre-generate them all. You could store all the map attributes with the SVG pathes in a separate namespace.

If you want, I can create you an example with a map with several thousand communities which still works sufficiently fast. Or you could send me your data as a GIS data set (prefereably ESRI shape) and I can convert you the data in a more efficient way. I think I have some experience in that area.

Also, I recommend experimenting with the newest Batik release (SVN repository or nightly builds). Batik is getting better all the time and there are many improvements since version 1.6.

All the best,
Andreas

Gold, Martin (LVG) wrote:

Hi Thomas, dvholten

Thank you for the detailed answer.

> Just to know what version of Batik are you using?
I'm using Batik 1.6.

> > Mouse over the area is fast.
Yes. I mean that if I don't have the text changes the fill updates quickly !

I have solved the problem with the <descr> attribut.

But I will also optimize my SVG file and try to solve the problem with the evt.target or/and
wrapping each of the 'text' elements in a 'g'.

Best regards,
Martin



Hi Martin,

"Gold, Martin \(LVG\)" <[EMAIL PROTECTED]> wrote on 02/23/2006
05:00:52 AM:

> I have a SVG-File with some thousand communities. The SVG file is 5
megabyte.

   That's a pretty big SVG file...
   Just to know what version of Batik are you using?

> I do that with ECMA-Script in the SVG-File with onmouseover and
onmouseout events.
> My problem is that showing the name of the community with mouse over
(command:
> styleText.setProperty... ) is very slow.

   I suspect that you have tripped on some 'bad behavior' with the CSS
engine,
but I am unsure.  You could try wrapping each of the 'text' elements in a
'g'.
This will limit the possible scope of CSS selectors to just the one text
element
(otherwise a selector could modify and sibling after the modified
element), so
the CSS style is recomputed - which could cause the text to need to be
relaid
out, which could easily take several seconds for a large amount of text.

> On a Dell 3.2 Ghz it takes some seconds for every area until the text is
shown.
> Mouse over the area is fast.

   I am not sure I understand this point.  Do you just mean that the mouse
moves over the canvas quickly?  Or do you mean that if you don't have the
text changes the fill updates quickly?

> Some ideas how I can accelerate showing the community name with mouse
over in Batik ?

   There is some chance that the real problem is just figuring out what
element
the mouse is over.  If there is any complex geometry that doesn't need to
be
sensitive to mouse over you might try setting pointer-events to 'none' on
those
elements.

   Also In this particular case where you have _lots_ of text and only
one will be shown at a time I would strongly lean towards changing display
rather
than visibility (although this will have the side effect of making it so
mouse
over of the hidden text will not pop it up).

   You have a _lot_ of onmouseXXX event handlers.  Just from a cleanness
perspective
I would be tempted to modify the structure of the code so there is one
event
handler (perhaps two one for text one for shapes) which used 'evt.target'
to identify
the state/text element the mouse is over (just check the 'id').  To know
what
color to 'reset' fill to (assuming it changes) I would add a custom
attribute
to the shapes (MG:fill="black").

   Finally, one last possible suggestion which should really only be tried
out
of desperation as I think visibility should be at least as good, would be
to
use fill-opacity to make the text 'hidden' (really don't think this one
will
help).

> thank you

> and here an extract of one area and the name of this area in the
SVG-File:
>  <g visibility="visible" id="Gemeinde">
>         <g style="fill:black;font-size:2000pt;visibility:hidden"
>            id="GemeindeText">
>             <text x="4422270.0" y="5455740.0"
> onmouseover="change_color_over(evt,&apos;Abenberg&apos;)"
>                   transform="translate(0,-1.091098E7)"
>                   onmouseout="change_color_out(evt,
&apos;Abenberg&apos;,
> &apos;black&apos;)"
>                   id="TAbenberg">
>                 Abenberg
>             </text>
>             ...
>
>  <g id="GemeindeGrenzen"
>            style="stroke-opacity:0.5;stroke:black;stroke-width:50;fill-
> opacity:0.1;fill:black"
>            visibility="inherit" transform="matrix(1,0,0,-1,0,0)">
>             <path d="M 4485677.53,5412940.36  L 4485779.29,5412606.16  L

> 4485348.34,5412546.30  L 4485427.64,5412283.72  L 4484946.24,5411864.18
L
> 4485024.22,5411428.54  L 4485437.41,5411252.49  L 4485144.46,5411009.62
L
> 4485728.59,5410647.54  L 4485790.97,5410196.63  L 4486453.84,5410206.84
L
> 4486536.38,5409885.12  L 4486173.48,5409843.40  L 4486238.64,5409236.50
L
> 4486101.18,5408976.65  L 4485818.01,5409034.52  L 4485871.35,5408666.44
L
> 4486349.14,5408467.59  L 4486220.59,5407957.26  L 4487204.95,5407589.25
L
> 4486771.77,5407341.24  L 4487581.89,5407113.22  L 4487522.87,5406800.89
L
> 4488538.24,5407183.97  L 4489222.36,5407163.89  L 4489754.72,5407552.04
L
> 4490042.26,5407103.35  L 4490446.33,5407174.15  L 4490339.58,5405824.34
L
> 4490963.13,5405596.83  L 4490888.14,5405238.01  L 4491247.14,5404928.31
L
> 4491310.63,5404306.98  L 4491632.49,5404198.35  L 4492114.75,5404095.85
L
> 4492581.77,5404388.21  L 4492614.56,5404948.30  L 4493023.28,5405103.02
L
> 4492900.35,5406422.58  L 4493285.04,5406362.96  L 4493937.26,5406341.59
L
> 4494061.85,5407012.86  L 4494414.23,5407133.10  L 4494407.85,5407354.95
L
> 4494071.38,5407273.17  L 4494126.90,5407897.99  L 4493937.02,5408647.76
L
> 4493766.04,5408625.38  L 4493843.58,5409371.88  L 4493549.02,5410422.90
L
> 4493066.01,5410553.64  L 4493082.34,5411030.73  L 4492174.62,5411544.21
L
> 4492031.08,5412566.28  L 4491668.52,5412546.08  L 4491006.12,5413071.44
L
> 4490857.10,5413815.61  L 4490138.41,5414664.10  L 4490409.09,5415357.33
L
> 4490153.54,5415497.16  L 4489933.35,5415211.15  L 4489661.14,5415416.43
L
> 4489713.49,5415798.44  L 4489093.44,5415754.26  L 4489187.25,5416044.29
L
> 4488676.46,5416843.15  L 4488720.91,5417418.18  L 4488510.08,5417096.28
L
> 4488833.21,5416576.08  L 4488326.42,5416628.46  L 4488826.16,5416548.65
L
> 4488393.41,5416298.90  L 4488765.61,5416225.77  L 4488545.20,5416213.69
L
> 4488664.01,5415852.64  L 4488061.82,5415775.83  L 4487309.63,5416193.69
L
> 4487173.16,5415320.39  L 4487458.04,5414276.71  L 4487258.70,5414282.48
L
> 4487099.37,5413844.18  L 4486068.23,5413522.39  L 4485677.53,5412940.36
Z"
>                   id="Abensberg"
>                   onmouseout="change_color_out(evt,
&apos;Abensberg&apos;,
> &apos;black&apos;)"
> onmouseover="change_color_over(evt,&apos;Abensberg&apos;)"/>
>             ...



--
----------------------------------------------
Andreas Neumann
Institute of Cartography
ETH Zurich
Wolfgang-Paulistrasse 15
CH-8093  Zurich, Switzerland

Phone: ++41-44-633 3031, Fax: ++41-44-633 1153
e-mail: [EMAIL PROTECTED]
www: http://www.carto.net/neumann/
SVG.Open: http://www.svgopen.org/
Carto.net: http://www.carto.net/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to