[OpenLayers-Users] How to access style properties of features?
Andreas Hocevar
ahocevar at opengeo.org
Mon Dec 21 06:28:30 EST 2009
Hi,
Peter.Sykora at ooe.gv.at wrote:
> The following code creates a Vector layer using a styleMap where I set
> the style properties within some functions:
>
>
> style = new OpenLayers.Style(template, {context: context});
> styleMap = new OpenLayers.StyleMap({'default': style, 'select':
> {fillOpacity: 0.7}});
>
> ...
> ergebnisL = new OpenLayers.Layer.Vector('Suchergebnis', {
> styleMap: styleMap
> });
>
> I´d like to calculate the graphicXOffset manually within the function
> getXOffset. Therefore I would need to access some style properties
> like graphicWidth of my current feature. I thought that it should work
> using something like gW=feature.Vector.style.graphicWidth but
> feature.Vector is empty ...
Try feature.style.graphicWidth instead of feature.Vector.style.graphicWidth.
Regards,
Andreas.
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list