I want to be able to specify the style of a vector individually. So what I did is this:
vectorLayer.features[1].style = {fillColor: "#8e0303", pointRadius: Math.random() * 50};
vectorLayer.redraw();
I got this from here: http://jsfiddle.net/DR/Udd4e/31/
However, I want to specify a StyleMap
instead of a Style
Something like this
var my_style = new OpenLayers.StyleMap({
"default" : new OpenLayers.Style({
...
}),
"select":new OpenLayers.Style({
...
}),
)};
And assign that as the style (stylemap) of the vector. Is that possible?
Thanks in advance.
Jenia.
I'm not sure if this can be assigned for individual map objects, but try to think from the other direction: You can specify a mapstyle with more 'intelligence' that picks the style depending on the current map feature and it's attributes. See http://docs.openlayers.org/library/feature_styling.html and have a look e.g. to this webmap conditional styling for example: http://www.opennet-initiative.de/map/