I am successfully applying the following StyleMap to a vector layer:

var vectorStyles = new OpenLayers.StyleMap({
        'default' : new OpenLayers.Style({
             fillColor: "#FF0000"
            ,fillOpacity: 0.1
            ,pointRadius: 4
            ,strokeColor: "#FF0000"
            ,strokeWidth: 2
        })
        ,'select': new OpenLayers.Style({
             fillColor: "#0000FF"
            ,fillOpacity: 0.4
            ,strokeColor: "#0000FF"
        })
        ,'temporary': new OpenLayers.Style({
            fillColor: "#FF0000"
            ,fillOpacity: 0.1
            ,strokeColor: "#FF0000"
            ,strokeWidth: 2
            ,strokeDashstyle: 'dot'
            ,pointRadius: 4
            ,cursor: 'crosshair'
        })
});

However, I wish to change the "default" fillColor and strokeColor based on a
feature attribute, called Colour, as follows:
       'default' : new OpenLayers.Style({
             fillColor: "${Colour}"
            ,fillOpacity: 0.1
            ,pointRadius: 4
            ,strokeColor: "${Colour}"
            ,strokeWidth: 2
        })

However, when using attribute replacement, the fill and stroke style
properties of the polygon handles are set to "undefined" in modify mode. I
have attempted to set the extendDefault to false in the StyleMap, and
explicitly set the colours in the "select" intent, but to no avail.

-- 
View this message in context: 
http://n2.nabble.com/StyleMap-issue-when-modifying-feature-tp3308570p3308570.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to