<div>Hello,</div>
<div> </div>
<div>I have a GML layer and I want to asign differents colours to its polygons (default style). I want to assign a style when the polygons are selected too (the same style to all the polygons in the layer).</div>
<div> </div>
<div>I try to assign a different stylemap to each layer&#39;s polygon (not depends on the features attributes) like in <a href="http://trac.openlayers.org/wiki/Styles">http://trac.openlayers.org/wiki/Styles</a>, but it seems that OpenLayers.Feature.Vector doesn´t support to asign a mapstyle (in order than a basic style):</div>

<div> </div>
<div><font color="#0000ff"><font color="#0000ff">
<p>if</p></font></font> (...)style = {fillColor: <font color="#a31515"><font color="#a31515">&quot;#FCED97&quot;</font></font>, strokeColor: <font color="#a31515"><font color="#a31515">&quot;#FCE144&quot;</font></font>, fillOpacity: 0.5, strokeWidth: 2};
<p><font color="#0000ff"><font color="#0000ff">else</font></font> <font color="#0000ff"><font color="#0000ff">if</font></font> (...)style = {fillColor: <font color="#a31515"><font color="#a31515">&quot;#000000&quot;</font></font>, fillOpacity: 0.1, strokeColor: <font color="#a31515"><font color="#a31515">&quot;#000000&quot;</font></font>, strokeWidth: 1}; </p>

<p><font color="#0000ff"><font color="#0000ff">var</font></font> styleSel = {fillColor: <font color="#a31515"><font color="#a31515">&quot;#FC1797&quot;</font></font>, strokeColor: <font color="#a31515"><font color="#a31515">&quot;#FC1797&quot;</font></font>, fillOpacity: 0.5, strokeWidth: 2}; 
<p></p><font color="#0000ff"><font color="#0000ff">var</font></font> myStyleMap = <font color="#0000ff"><font color="#0000ff">new</font></font> OpenLayers.StyleMap({<font color="#a31515"><font color="#a31515">&quot;default&quot;</font></font>: style,<font color="#a31515"><font color="#a31515">&quot;select&quot;</font></font>: styleSel}); 
<p></p>
<p></p>
<p><font color="#0000ff"><font color="#0000ff">var</font></font> vector = <font color="#0000ff"><font color="#0000ff">new</font></font> OpenLayers.Feature.Vector(geometry, record, myStyleMap);</p>
<p>layer.addFeatures(vector);</p></p></div>
<div> </div>
<div> </div>
<div>I try to assign a default style to each polygon and assign the selected style to the OpenLayers.Layer.GML (it&#39;s always the same style), but in this case the selected style is not shown:</div>
<div> </div>
<div><font color="#0000ff"></font>
<p><font color="#0000ff"></font></p>
<p>var<font size="2"> styleSel = </font><font size="2">{fillColor: </font><font color="#a31515" size="2"><font color="#a31515" size="2">&quot;#FF7474&quot;</font></font><font size="2">, strokeColor: </font><font color="#a31515" size="2"><font color="#a31515" size="2">&quot;#FF0000&quot;</font></font><font size="2">, fillOpacity: 0.5, strokeWidth: 2};</font></p>

<p><font size="2"></font><font color="#0000ff" size="2"><font color="#0000ff" size="2">var</font></font><font size="2"> myStyleMap = </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">new</font></font><font size="2"> OpenLayers.StyleMap({</font><font size="2"></font><font color="#a31515" size="2"><font color="#a31515" size="2">&quot;select&quot;</font></font><font size="2">: styleSel});</font></p>

<p>layerEditable = <font color="#0000ff" size="2"><font color="#0000ff" size="2">new</font></font><font size="2"> OpenLayers.Layer.GML(</font><font color="#a31515" size="2"><font color="#a31515" size="2">&quot;Polygons&quot;</font></font><font size="2">, urlGML,{styleMap: myStyleMap});</font></p>

<p>.........................................................................................................................................</p>
<p>if (...)style = {fillColor: <font color="#a31515"><font color="#a31515">&quot;#FCED97&quot;</font></font>, strokeColor: <font color="#a31515"><font color="#a31515">&quot;#FCE144&quot;</font></font>, fillOpacity: 0.5, strokeWidth: 2};</p>

<p><font color="#0000ff"><font color="#0000ff">else</font></font> <font color="#0000ff"><font color="#0000ff">if</font></font> (...)style = {fillColor: <font color="#a31515"><font color="#a31515">&quot;#000000&quot;</font></font>, fillOpacity: 0.1, strokeColor: <font color="#a31515"><font color="#a31515">&quot;#000000&quot;</font></font>, strokeWidth: 1}; </p>

<p></p>
<p></p>
<p><font color="#0000ff"><font color="#0000ff">var</font></font> vector = <font color="#0000ff"><font color="#0000ff">new</font></font> OpenLayers.Feature.Vector(geometry, record, style);</p>
<p>layer.addFeatures(vector);<font size="2"></font></p>
<p></p>
<p><font size="2"> </font></p>
<p>Is there a way to assign differents styles in each polygon of a layer and a selected style to the complete layer?</p></div>
<div> </div>