[Users] Layer group with legend
Alexandre Dube
adube at mapgears.com
Tue Oct 19 15:56:23 CEST 2010
Andreas,
Thanks again for your support.
On 10-10-19 09:41 AM, Andreas Hocevar wrote:
> You are calling the wrong superclass. You need
> GeoExt.tree.LayerParamLoader.prototype.createNode.call(this, attr);
>
Got it. Now it's working but with one remaining issue : the WMSLegend
is the same for all nodes. If I have the 4 paramNodes checked, I get 4
icons under each one instead of the specific one per layer (and it
figures, because that's what it's configured to do). You can see for
yourself by replacing the mapPanel and tree in the tree-legend example
with these [1].
So, I need to configure the WMSLegend to use a single param layer value
(haven't checked, but I don't know if that's possible).
>> Secondly, I about my other "group" node level thing, I'm not sure if
>> that's currently possible with the current elements unless I create the
>> nodes manually, am I right ?
>>
> You could use a LayerLoader with a filter for each of your groups. At least that's what I hear other people do.
>
Do you have any example to share ?
Thanks,
Alexandre
[1] ====================
var mapPanel = new GeoExt.MapPanel({
region: "center",
center: [146.1569825, -41.6109735],
zoom: 6,
layers: [
new OpenLayers.Layer.WMS("Tasmania",
"http://demo.opengeo.org/geoserver/wms", {
layers:
"topp:tasmania_state_boundaries,topp:tasmania_water_bodies,topp:tasmania_roads,topp:tasmania_cities"
}, {
buffer: 0,
isBaseLayer: false
})
]
});
var tree = new Ext.tree.TreePanel({
region: "east",
title: "Layers",
width: 250,
autoScroll: true,
enableDD: true,
// apply the tree node component plugin to layer nodes
plugins: [{
ptype: "gx_treenodecomponent"
}],
loader: {
applyLoader: false,
uiProviders: {
"custom_ui": LayerNodeUI
}
},
root: {
nodeType: "gx_layer",
layer: "Tasmania",
isLeaf: false,
loader: {
param: "LAYERS",
baseAttrs: {
uiProvider: "custom_ui"
},
uiProviders: {
"custom_ui": LayerNodeUI
},
createNode: function(attr) {
// add a WMS legend to each node created
attr.component = {
xtype: "gx_wmslegend",
layerRecord:
mapPanel.layers.getByLayer(attr.layer),
showTitle: false,
// custom class for css positioning
// see tree-legend.html
cls: "legend"
}
return
GeoExt.tree.LayerParamLoader.prototype.createNode.call(this, attr);
}
}
},
rootVisible: true,
lines: false
});
--
Alexandre Dubé
Mapgears
www.mapgears.com
More information about the Users
mailing list