[Mapbender-users] implement "layer conflicts" -
mod_treefolder2.php
Melchior Moos
nimix at gmx.net
Tue Apr 8 11:17:39 EDT 2008
karsten vennemann schrieb:
> Greetings everyone,
>
> I am working on implementing a function that I need for my mapping
> application. The map has a lot of polygon layers and for its users it is
> very confusing once multiple layers are switched on that are covering each
> other. The users have a hard time easily and clearly know which one is drawn
> on top on the map.
> Thus I want to set layers to "conflict with each other". Turning on a Layer
> that has other layers set to be conflicting with it will trigger all
> conflicting layers to automatically be switched off.
> For example a layer 1) "Percentage of Poor people age 65 and over in 2000"
> will conflict with a layer 2) "Percentage of Poor people age 65 and over in
> 2007". Thus if layer 1) is turned on layer 2) automatically will be switched
> off and so on.
> I am working to extended/amend the function "handleSelectedLayer" in
> mod_treefolder2.php.
> For now I just was testing and learning what the function does thus I did
> just set some hard coded conflicts using a new variable like and switched
> the layer off if a certain (also hard coded layer) is switched on:
>
> if(layername == "People_in_Institutions_02" && status == 1){
> mylayerconflicts[0] = "Percentage_of_People_in_Poverty_per_County_2005";
> parent.handleSelectedLayer_array(mapObj, mywms, mylayerconflicts, type, 0);
> }
>
> This does what I wanted to accomplish (the layer is switched off and not
> shown on the map any more, however the checkbox in the tree is still
> "checked".
>
> What would be the best way/ a way to uncheck the checkbox as using java
> script in the tree ?
>
There is a function
checkNode(path, ctrlNr, bChk) in jsTree.js
path should be something like
arrNodes[0][0]+"|"+parent.mb_mapObj[map].wms[wms].wms_id
ctrlNr is the number of the input control (0 for gui_layer_visible and 1
for gui_layer_quaryable)
bChk is either true or false
This function also fires the onclick event of the control
> Any other Ideas on how to generally best implement this?
>
> I was thinking to implement reading an array/list from a new column in a
> database table where each layer could have a list of conflicting layers/
> groups of layers stored. The array could then be used in a loop to switch
> off all conflicting layers on the client side. Later I also could add an
> admin web interface to enter the values for conflicts for each layer.
> Cheers
>
> Karsten Vennemann
>
>
regards, Melchior
More information about the Mapbender_users
mailing list