[OpenLayers-Dev] Class hierarchy API question

Andreas Hocevar andreas.hocevar at gmail.com
Mon Oct 15 04:54:35 EDT 2007


Hi,

as you know, we have the OpenLayers.Style class in the
ahocevar/sldRenderer sandbox. At the FOSS4G code sprint, we were also
talking about some "magic" on how to detect the correct style for a
layer automatically.

The SLD spec uses "NamedLayer" and "IsDefault", and we could use this
as follows:

- If there is a layer named "NamedLayer", use the according style.
- If there are more styles for "NamedLayer", use the one that is
marked <IsDefault>true</IsDefault>.

For this magic, we would probably need some wrapper around the styles
hash that is now generated by OpenLayers.Format.SLD.read(). And my
question is: where should we put this wrapper class in the API
hierarchy? Or should we create no new class at all and do this magic
in the OpenLayers.Layer.Vector class? In this case, either a single
OpenLayers.Style could be passed to the style property of a vector
layer, or a complete hash of OpenLayers.Style. In the latter case, the
magic would apply.

Please give me some opinion and/or advice on that, so I can start
implementing it.

Regards,
Andreas.



More information about the Dev mailing list