[OpenLayers-Users] StyleMap issue when modifying feature

Schmettermann sm at skyvention.com
Fri Jan 15 11:29:07 EST 2010


Hi Phil!

I have the same problem, but still no solution in sight...
Except the fact that you did not get any replys here as yet, did you find a
solution to your problem?

You can find me question here:
http://n2.nabble.com/attributes-of-an-Vector-object-never-reach-the-StyleMap-tp4396806p4396806.html

Regards from Berlin
SM



PhilM wrote:
> 
> 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-tp3308570p4399667.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list