[OpenLayers-Dev] SelectStyle

Francesca Facchetti francesca.facchetti at gmail.com
Tue Oct 6 16:50:05 EDT 2009


Hi,
 I'm trying to apply a style do my SelectFeature control, but it doesn't work.

this is the style I want for unselected features:
var anotherStyleMap = new OpenLayers.StyleMap({fillColor: 'orange',
fillOpacity: 0.3, strokeWidth: 1.0, strokeColor:  'orange',
pointRadius: 10 });

this is my layer:
punti = new OpenLayers.Layer.WFS("Postgis, punti",
"featureserver.cgi/punti?format=WFS",

		{maxfeatures: maxf_level},

		{extractAttributes: true, displayInLayerSwitcher: false, styleMap :
anotherStyleMap}

		);


this is the style for selected features:
var stileSelezione = new OpenLayers.Style({fillColor: 'blue',
fillOpacity: 0.3, strokeWidth: 1.0, strokeColor:  'blue', pointRadius:
10});

and this is the SelectFeature control:
modify_POI_info: new OpenLayers.Control.SelectFeature(punti,  {
clickout: true, toggle: false, multiple: false, hover: false,
 box: false, selectStyle: stileSelezione
 })

the first style is applied, but the selectStyle isn't. What do I do wrong?



More information about the Dev mailing list