[ka-Map-users] legend tree

marco barra marco.barra at gmail.com
Tue Feb 3 06:58:38 EST 2009


Hi all, i've modified kalegend.js, implementing a tree legend, to group
layers in subgroups.
I'm not a javascript guru, but it works fine for my  purposes.
You can see a simple example, based on spearfish dataset, at
http://140.164.26.222/ka-map_1108/htdocs/index_1_0.html
You can define the subgroups in the mapfile, using  "subgroup"
"aaaa|bbbb|cccc", in metadata section of the layer object.
Using  "subgroup" "aaaa|bbbb|cccc", the legend looks like

aaaa
    bbbb
        cccc
            layer

You can also specfy if a group has to be closed when the application is
initialized, using ":c" ;
so if you use "subgroup" "aaaa|bbbb:c|cccc"
the legend looks like simply
 aaaa
     bbbb

If more layers belongs to the same subgroup and you want the subgroup
closed at startup, there is no need to specify :c for each layers, simply
specify :c only for one of them.

I've also modified  the mechanism to manage layer's minscale/maxscale.
Normally if a layer is not visible at current scale, this layer disappear
from the legend. But in my opinion, this behaviour can create a  mismatch
for an end user. So in my kalegend, when a layer is not visible, it becomes
red in legend (as slope and aspect in the demo), and when mouse is over it
in the legend a message appears.
In my kalegend.js I've tagged all my changes to make it clear.
If someone is interested he can get the code at
http://140.164.26.222/legend_tree.tar.gz
In the package you will find kalegend.js, kamap.js and init.php (i've
modified this last two files only to manage "subgroup" option in layer's
metadata).
For the future i'll develope a system to manage layers drawing order,
separated from the main legend, something like a second panel where manage
various options, because currently using subgroup you can move only layers
inside the subgroup.
I'm developing/modifying others tools for Ka-map, as you can see at
http://140.164.26.222/demo/htdocs/index_app.html, but they are still in
alpha status. There are more problems connected with the use of this tools,
the first and most important is related with the managment of them (I've
planned to develope a tools manager to solve various problem).
I'll share them as soon as possible :-).

Any suggestions, help or problem reporting will be appreciated.

Cheers Marco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/ka-map-users/attachments/20090203/e216373a/attachment.htm 


More information about the ka-Map-users mailing list