Hi all
I have a question manipulating a layer tree.
I do the following:
1) I create a group Layer
2) then i create a TreeNode for the layer
3) In manipulate the layer tree the way that on everey 'checkchange' of the
grouplayer, it should switch off subayers, that should be unvisible by default.
To to this, I run through the subnodes, check if the sublayer should be visible
or not, an use the getUI().toggleCheck(false) method the switch a sublayer off.
Maybe i did this in a complicated, but it works so far. My problem is, that on
every call of getUI().toggleCheck , the map seems to be updated. At least there
are scores of WMS-Requests on the server.
So my question: is there a better way to achieve the behavior I want? Or is
there a way to stop map updates, until all toogles of a group layer have done?
Any help would be appreciated
Regards
Peter
Here is the code I use
1)
var groupLayer = new OpenLayers.Layer.WMS(this.gs_tree[i].display_name,
'http://xxxx.xx.xx/wms',
{ layers: mylayers, // array of sublayers
transparent: true,
format: "image/png"
},
{ singleTile : true,
ratio : 1,
buffer : 0,
visibility : false,
isBaseLayer : false
}
);
2)
var groupLayerNode = new GeoExt.tree.LayerNode({
layer: groupLayer,
text : display_name,
leaf: false,
expanded: false,
iconCls: 'x-tree-node-icon',
checked: false,
isLeaf: false,
loader: {
param: "LAYERS"
}
});
3)
var rootNode=layerTree.getRootNode();
rootNode.eachChild(function (myNode) {
myNode.collapse();
myNode.on('checkchange', function(anode, e){
if (e) {
myNode.expand();
myNode.eachChild(function (n) {
if (!map.isDefaultOn(n.parentNode.text,
n.item)) {
n.getUI().toggleCheck(false);
}
n.enable();
});
}
else {
myNode.collapse();
myNode.eachChild(function (n) {
n.disable();
});
}
});
myNode.eachChild(function (n) {
layerText = geoshop.getLayerText(n.text);
n.setText(layerText);
n.disable();
});
});
_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users