[Users] Displaying single legend items when the layer is a group layer comprised of several layers
Andreas Hocevar
ahocevar at opengeo.org
Thu Nov 18 22:25:59 CET 2010
Hi,
you may want to have a look at http://geoext.org/lib/GeoExt/widgets/tree/LayerParamLoader.html.
For your layer_Base layer, the tree node configuration could look like this:
layerList_Base = new GeoExt.tree.LayerNode({
"layer": layer_Base,
"isLeaf": false,
"loader": {
"param": "LAYERS"
}
});
Regards,
Andreas.
On Nov 18, 2010, at 22:09 , Andrew Stewart wrote:
> Is this possible to display each individual item so I can still check/uncheck them using my below code, or can I use a different GeoExt/Ext container to accomplish this? I need to keep the layers grouped because of performance but I still need to be able to display each individual layer so that I can turn them on/off. Is this possible? Any example/help immensely appreciated.
>
>
> My layer group is declared as the following -
>
> // Base Group Layers
> var layer_Base = new OpenLayers.Layer.WMS("Base Layers", "http://localhost/WebService/Request.aspx",
> {
> layers: ['Bridge,Rural_Highway,Highway,Arterial,Street_Segment, Street_Secondary_Segment, City_Boundary, Hydrology,Neighbourhood_Area__clear_,Neighbourhood_Boundary,Major_Parks,Neighbourhood_Parks,Recreation_Sites,School_Sites,Linear_Parks,Section_Lines,Rural_Block_Line,Rural_Lot_Line'],
> VERSION: "1.1.1",
> transparent: true
> },
> { isBaseLayer: false,
> singleTile: true,
> buffer: 4
> }
> );
>
>
> Then I define my Treenode root and treepanel, and create a GeoExt LayerContainer to load the layer into the root node. Can the layers above be displayed as individual items with separate checkboxes somehow?
>
> var layerRoot_Legend = new Ext.tree.TreeNode({
> enableDD: true,
> text: "All Legend Items",
> loaded: true,
> expanded: true
> });
>
> var layerTree_Legend = new Ext.tree.TreePanel({
> title: '',
> root: layerRoot_Legend,
> enableDD: true,
> applyLoader: true,
> rootVisible: false
> });
>
>
> //Base layerList
> layerList_Base = new GeoExt.tree.LayerContainer({
> text: 'Base',
> layerStore: mapPanel.layers,
> leaf: false,
> enableDD: true,
> cls: 'rootnode',
> singleClickExpand: true,
> expanded: false,
> checked: false,
> listeners: {
> 'checkchange' : function(node, checked)
> {
> // If a parent node is unchecked, uncheck all the children
> if (node.getUI().isChecked()) {
> node.expand();
> node.eachChild(function(child){
> child.ui.toggleCheck(true);
> });
> }
> if (!node.getUI().isChecked())
> {
> node.expand();
> node.eachChild(function(child) {
> child.ui.toggleCheck(false);
> });
> }
> }
> },
> loader:
> {
> filter: function(record)
> {
> if (record.data.title == 'Base Layers')
> return true;
> }
> }
> });
>
>
> layerRoot_Legend.appendChild(layerList_Base);
>
>
>
>
>
>
>
> This e-mail is intended for the original recipient(s) only. If you have received it in error, please advise the sender and delete this message.
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list