<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri" size="2"><span style="font-size:11pt;">
<div>Hi all</div>
<div> </div>
<div>I have a question manipulating a layer tree.</div>
<div>I do the following:</div>
<div> </div>
<div>1) I create a group Layer</div>
<div>2) then i create a TreeNode for the layer</div>
<div>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.</div>
<div> </div>
<div>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.</div>
<div>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?</div>
<div> </div>
<div>Any help would be appreciated</div>
<div>Regards</div>
<div>Peter</div>
<div> </div>
<div>Here is the code I use</div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div>1)</div>
<div> var groupLayer = new OpenLayers.Layer.WMS(this.gs_tree[i].display_name,</div>
<div> '<a href="http://xxxx.xx.xx/wms">http://xxxx.xx.xx/wms</a>',</div>
<div> { layers: mylayers, // array of sublayers</div>
<div> transparent: true,</div>
<div> format: "image/png"</div>
<div> },</div>
<div> { singleTile : true, </div>
<div> ratio : 1, </div>
<div> buffer : 0,</div>
<div> visibility : false,</div>
<div> isBaseLayer : false</div>
<div> }</div>
<div> );</div>
<div> </div>
<div>2) </div>
<div> </div>
<div> var groupLayerNode = new GeoExt.tree.LayerNode({</div>
<div> layer: groupLayer,</div>
<div> text : display_name,</div>
<div> leaf: false,</div>
<div> expanded: false,</div>
<div> iconCls: 'x-tree-node-icon',</div>
<div> checked: false, </div>
<div> isLeaf: false,</div>
<div> loader: {</div>
<div> param: "LAYERS"</div>
<div> }</div>
<div> });</div>
<div> </div>
<div>3)</div>
<div> var rootNode=layerTree.getRootNode();</div>
<div> rootNode.eachChild(function (myNode) {</div>
<div> myNode.collapse(); </div>
<div> myNode.on('checkchange', function(anode, e){</div>
<div> if (e) { </div>
<div> myNode.expand();</div>
<div> myNode.eachChild(function (n) { </div>
<div> </div>
<div> if (!map.isDefaultOn(n.parentNode.text, n.item)) { </div>
<div> n.getUI().toggleCheck(false); </div>
<div> }</div>
<div> n.enable(); </div>
<div> });</div>
<div> } </div>
<div> else {</div>
<div> myNode.collapse(); </div>
<div> myNode.eachChild(function (n) { </div>
<div> n.disable(); </div>
<div> });</div>
<div> </div>
<div> }</div>
<div> });</div>
<div> </div>
<div> myNode.eachChild(function (n) { </div>
<div> layerText = geoshop.getLayerText(n.text); n.setText(layerText); </div>
<div> n.disable();</div>
<div> });</div>
<div>});</div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
</span></font>
</body>
</html>