[OpenLayers-Dev] What if I extend the OpenLayers.Style class??

Milan Antonovic milan.antonovic at gmail.com
Wed Jan 21 03:01:08 EST 2009


Hi all,
In my OL app, I needed to create some OpenLayers.Style class to group
complex layer styling.
I create some classes like OpenLayers.Style.Rain,
OpenLayers.Style.Temperature to represent some
weather icons depending on some feature's attribute values.

But, I had an other problem, in the OpenLayers.StyleMap class passed to my
weather layer.
I found this code in the initialize function:

*if(style instanceof OpenLayers.Style)*

This code block my Rain or Temperature classes to go further.

So I changed the code in something like:

*if(style instanceof OpenLayers.Style ||
               (style.CLASS_NAME &&
style.CLASS_NAME.indexOf("OpenLayers.Style")!=-1))*

Does it make sense to you?

Thanks

  Milan Antonovic


Milan Antonovic
Institute of Earth Sciences
University of Applied Sciences of the South Switzerland - SUPSI
Trevano, C.P. 72, CH-6952 Canobbio, SWITZERLAND
Tel: +41(0)58 666 62 13
E-mail: milan.antonovic at supsi.ch
Web: http://www.ist.supsi.ch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20090121/568836cf/attachment.html


More information about the Dev mailing list