[Users] WMSlegend with separate Class/Rule nodes in a layertree
Bray Frédéric
Frederic.Bray at irstea.fr
Fri Apr 4 15:22:43 CEST 2014
Hello,
I'm working on a web app with PostGis/mapserver/GeoExt1.1/Openlayers/ExtJS.
In a layertree, I add WMSlegends from WMS layers generated on the fly by phpmapscript.
I get one image per layer with every class and class names (one legend for a layer = one image), cf. code at the bottom of my message :
X Layer 1
---> 1 image for 2 class
Now, I would like to achieve this in a different way and get each legend boxes + title separately (one class = one image + class name) to interact with each layer class with mapscript
X Layer 1
---> class 1: image1 name1
---> class 2: image2 name2
I saw that i can use RULE parameter in the getLegendGraphic request, but how identify my RULES/Classes from a WMS layer?
Any idea is welcome !
Thanks,
Frédéric Bray
Irstea Grenoble
Here is the (classic) part of code I use for now to create nodes for each layer in my layercontainer:
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",
style: 'padding-left:45px',
baseParams: {
FORMAT: 'image/png',
LEGEND_OPTIONS: 'forceLabels:on'
}
} ;
attr.listeners =
{
click :
function (){
// Action on legend click
}//End fonction
} //End listener
return GeoExt.tree.LayerParamLoader.prototype.createNode.call(this, attr);
}
Frédéric Bray
Pôle Système d'information UR DTM
Irstea - Grenoble
2, rue de la Papeterie
38402 Saint Martin d'Hères
+33 (0)4 76 76 27 74
www.irstea.fr <http://www.irstea.fr/>
Pour mieux affirmer ses missions,
le Cemagref devient Irstea
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20140404/a26b607d/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 2737 bytes
Desc: image001.gif
Url : http://www.geoext.org/pipermail/users/attachments/20140404/a26b607d/attachment.gif
More information about the Users
mailing list