[Users] Dynamic layer groups

Mehmet Sirin m.sirin07 at googlemail.com
Sat Aug 7 02:12:46 CEST 2010


Helloooo!

I'm still trying to make progress with my project of creating a
dynamically created layer-tree out of a xml file. At this moment I'm
grouping the layers manually by creating a LayerContainer for every
group with 3 layers that are children of the group-folder and then add
this LayerContainer-Array to the TreePanel. But that's hardcore and a
very ugly code. And updating the tree afterwards with a new
LayerContainer or a additional layer to a group is hard enough.  Is
there a good concept or idea how to realize for what I like to do?

Something like:

    root: {
          text: 'All groups',
    	    nodeType:'async',
    	    children: {
                     for(every groupname in xml file){
                           if(group not yet there)
                              makeGroup(groupName){
                                add the layers which belong to that group
                             }
                            else{ find group and append layer}
   //for layers that are added after loading the xml file
                    }
             },
    	    expanded: true,
    	    baseAttrs: {radioGroup: "root"}
    },
Then when adding a layer for example via button to the map the
treepanel knows where to put in this layer..

All That means in short: I want to add to the OpenLayers.Map a ~layer~
with a specific group (as attribute) and what geoext then
(automatically) should do is to create such a group with this ~layer~
as his child. when this group is already existing then it should just
add the layer as second layer to that group.

Anyone can help me ? I know there is an easy way that I just don't see yet....


good night or good morning!
regards


More information about the Users mailing list