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 

 

<<image001.gif>>

_______________________________________________
Users mailing list
Users@geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to