[OpenLayers-Users] Rules, Styles and context
James.Sewell at lisasoft.com
James.Sewell at lisasoft.com
Thu May 27 02:49:02 EDT 2010
Hello,
I want to dynamically set a strokeColor based on feature.styler.color rather that feature.attribute.color.
I am using this code:
var context = function(feature) {
feature.stylers ? ret = feature.stylers : ret = feature.attributes;
ret ? null : ret = feature;
return ret;
}
var defaultStyle = new OpenLayers.Style(OpenLayers.Util.applyDefaults({ strokeColor: "${color}", strokeWidth: 3 }
, OpenLayers.Feature.Vector.style["default"]), {context: context});
I have also tried this:
var defaultStyle = new OpenLayers.Style(OpenLayers.Util.applyDefaults({ strokeColor: "${color}", strokeWidth: 3 }
, OpenLayers.Feature.Vector.style["default"]), {context: {styler: null}}) ;
But neither seem to work! I am particularly confused as the top example works for OpenLayers.Rule context manipulation.
Any hints?
Cheers,
James Sewell
LISAsoft Developer
+61 (3) 8680 3200 / +61 414 688 892
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100527/669bea8e/attachment.html
More information about the Users
mailing list