On 04. 06. 11 00:19, JK Chen wrote:
Hi,
I have a requirement to draw lines of different colors, such as the
one show below (implemented in gmap). Can anyone tell me how to do
this in OpenLayers? I have a vector style map, but can I have more
than one, and switch them at run time at drawing? And how?
Or, any other methods able to do same results?
Something like that:
var styleContext = {
getColor: function(feature) {
//whatever function computing your color
return "green"
},
getOpacity: function(feature) { return 1}
};
var styleTemplate = {
strokeColor: "${getColor}",
strokeOpacity: "${getOpacity}"
};
var myStyle = new OpenLayers.Style(styleTemplate, {context:
styleContext});
Yves
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users