[Users] adding legendURL, legend tree

Bart van den Eijnden bartvde at opengeo.org
Tue May 22 19:27:49 CEST 2012


Hi Karsten,

WMSLegend does not listen to LegendURL, only UrlLegend does.

Feel free to open up a github ticket, and patches welcome as always (should be an easy patch). Something like (not tested):

    getLegendUrl: function(layerName, layerNames) {
        var rec = this.layerRecord;
        if (rec.get("legendURL")  != null) {
            return rec.get("legendURL");
        } else {
            … continue as we do now

Best regards,
Bart

-- 
Bart van den Eijnden
OpenGeo - http://opengeo.org
Expert service straight from the developers.



On May 12, 2012, at 2:22 AM, karsten wrote:

> In a Ext.tree.TreePanel I am grouping layers as below. When the layer is a tiled (tile cache layer) I would like to use an alternate image for the legend to still show up
> so I wanted to use legendURL for the legend image
>  
> // add legend images for tiled layers        
> var regierungsbezirke_rec  = mapPanel.layers.getByLayer(regierungsbezirke_tile);
> regierungsbezirke_rec.set("legendURL", "http://vfsviewer.vfs-muenchen.de/legend/regierungsbezirke.gif");
>  
> However i could not get it show up in geoext 1.1 in the tree yet -  any hints what I am doing wrong ?
> Karsten
>  
> // in layer tree
> ...
> {nodeType: "gx_layercontainer",
>     text: 'Kartendaten',
>     layerStore: mapPanel.layers,
>     expanded: false,
>     loader: {
>         filter: function(record) {  
>            return record.get("layer").group == "Kartendaten";// this.group; 
>         },
>         baseAttrs: {
>             uiProvider: "custom_ui"
>         },
>         createNode: function(attr) {
>             // add a WMS legend to each node created
>             if (GeoExt.WMSLegend.supports(mapPanel.layers.getByLayer(attr.layer))){
>                attr.component = {
>                    xtype: "gx_wmslegend",
>                    layerRecord: mapPanel.layers.getByLayer(attr.layer),
>                    showTitle: false,
>                    cls: "legend"
>                };
>             }   
>             return GeoExt.tree.LayerLoader.prototype.createNode.call(this, attr);
>         }
>     }    
> }
> ...
> 
> 
> 
> 
> 
> =======
> Email scanned by PC Tools - No viruses or spyware found.
> (Email Guard: 9.0.0.888, Virus/Spyware Database: 6.19640)
> http://www.pctools.com
> =======
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20120522/aedf6831/attachment.htm 


More information about the Users mailing list