[Users] Legend tree custom image URL

Christian Mayer Christian.Mayer at isb-ag.de
Wed Oct 29 13:06:54 CET 2014


Hi Hugo,

isn’t it the UrlLegend class [1] what you need?

Cheers,
Chris


[1] http://geoext.github.io/geoext2/docs/#!/api/GeoExt.container.UrlLegend

Von: users-bounces at geoext.org [mailto:users-bounces at geoext.org] Im Auftrag von Hugo
Gesendet: Mittwoch, 29. Oktober 2014 11:49
An: users at geoext.org
Betreff: Re: [Users] Legend tree custom image URL

Hi guys,

I've made a small change to the WmsLegend class and now it works perfectly.
I've just added the following code inside the getLegendUrl method (at line 145):

if (rec.get('legendURL') != ''){
     url = rec.get('legendURL');
}

Obviously this assumes that if legendURL is different than an empty strig, it will override the url returned by the styles definition.

Cheers,


2014-10-28 19:13 GMT+00:00 Hugo <hfpmartins at gmail.com<mailto:hfpmartins at gmail.com>>:
Hi all,

I'm building a tree panel similar to the example LegendTree. So far so good, I'm able to use gx_wmslegend ctype to show the legend below each node in the tree.
However there is a case where i need to override the legendURL and point it to a specific image instead of using the default GetLegendGraphic.

I have sucessfully implemented this override in a GeoExt.panel.Legend by "manually" seting the layer record legendurl field [eg: layerRec.set("legendURL", rec.data.legURL);]

When trying the same approach on th gx_wmslegend it doesn't work. I was reading through the docs of this xtype and it states that the image can be read from the styles field of a layer record

When looking at the layerModel i cannot see this field defined. So my question would be, where should i set this styles field? GeoExt layer record? Openlayers layer record? How would it look like?

Thanks in advance.
Cheers,


--
Hugo Martins



--
Hugo Martins
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20141029/0b9da137/attachment.htm 


More information about the Users mailing list