[OpenLayers-Users] How to access style properties of features?

Peter.Sykora at ooe.gv.at Peter.Sykora at ooe.gv.at
Mon Dec 21 05:46:06 EST 2009


The following code creates a Vector layer using a styleMap where I set the style properties within some functions:
 
...
    var template = {
     fillOpacity: "${getOpacity}",
     externalGraphic: "${getChartURL}",
     graphicWidth: "${getSizeW}",
     graphicHeight: "${getSizeH}",
     strokeWidth: 0,
     graphicXOffset: "${getXOffset}",
     graphicYOffset: "${getYOffset}"
    };
   
    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 ...
 
Thanks for any help
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091221/68e67b81/attachment.html


More information about the Users mailing list