Hi,
you are using the context in an incorrect way. Try something like
var context = {
color: function(feature) {
return feature.stylers.color;
}
};
If you have your color in feature.attributes, you don't need a context at all.
Regards,
Andreas.
On May 27, 2010, at 08:49 , [email protected] wrote:
> 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
>
>
>
> _______________________________________________
> Users mailing list
> [email protected]
> http://openlayers.org/mailman/listinfo/users
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users