Hi guys,<div><br></div><div>I&#39;ve got a vector layer that I initialize with the following code:<br clear="all"><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">var vector_style =  new OpenLayers.StyleMap(OpenLayers.Util.applyDefaults({</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-tab-span" style="white-space:pre">        </span>strokeColor:&#39;yellow&#39;,</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-tab-span" style="white-space:pre">        </span>fillOpacity:0.0,</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-tab-span" style="white-space:pre">        </span>strokeOpacity:1,</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-tab-span" style="white-space:pre">        </span>strokeWidth: 2,</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-tab-span" style="white-space:pre">        </span>fillOpacity:0.1</font><span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace; "><span class="Apple-tab-span" style="white-space:pre">        </span></span><span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace; ">},</span></div>

</div><span class="Apple-tab-span" style="white-space:pre">        </span>       <span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace; ">OpenLayers.Feature.Vector.style[&quot;default&quot;]));</span><br>

<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div><span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace; "><span class="Apple-tab-span" style="white-space:pre">        </span></span></div>

</div></blockquote><div><div><span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace; ">vectorLayer.styleMap = </span><span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace; ">vector_style</span><span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace; ">;</span></div>

<div><span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace; "><br></span></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">This renders fine, I get yellow vector features that turn blue when I hover over them (per default)</font></div>

<div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">The problem is that later on I have an event that styles each feature depending on a certain condition, the event is something like the following:</font></div>

<div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></div><div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">var feats =map.layers[22].features;</font></div><div>

<font class="Apple-style-span" face="&#39;courier new&#39;, monospace">var lengd = feats.length;</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">cursize = 2;</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">for(var i=lengd-1 ;i&gt;=0 ;i--)</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">{</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    if(feats[i+1]!==undefined)</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-tab-span" style="white-space:pre">        </span>{</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        if(feats[i].geometry.intersects(feats[i+1].geometry))</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-tab-span" style="white-space:pre">                        </span>cursize++;</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        else</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">            cursize = 2;</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-tab-span" style="white-space:pre">        </span>}</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-tab-span" style="white-space:pre">        </span>feats[i].style = OpenLayers.Util.applyDefaults(</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        {</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-tab-span" style="white-space:pre">                </span>graphicZIndex : (lengd-i)+1000,</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-tab-span" style="white-space:pre">                </span>strokeColor : &quot;#&quot;+genHex(),</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-tab-span" style="white-space:pre">                </span>fillOpacity : 0.03,</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-tab-span" style="white-space:pre">                </span>pointRadius : 7*(cursize)</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-tab-span" style="white-space:pre">        </span>},</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">        OpenLayers.Feature.Vector.style[&quot;select&quot;]);</font></div>

<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">}</font></div></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">The code above loops through the features array </font><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif; ">(these are all Points)</span><font class="Apple-style-span" face="arial, helvetica, sans-serif">, and if it finds </font><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif; ">features</span><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif; "> </span><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif; ">adjacent to each other in the array which also intersect/share the same location  - it draws them in bigger and bigger increments.</span></div>

<div><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif; "><br></span></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">The code works fine, except for the fact that I lose the select </font><font class="Apple-style-span" face="arial, helvetica, sans-serif">behavior from before (the points don&#39;t turn blue when I hover over them). </font></div>

<div></div><div><br></div>Firebug reveals that the style object that I assign to the features contain hoverStrokeColor, hoverFillColor etc, but these don&#39;t seem to do anything.</div><div><br></div><div>Does anybody have ideas?</div>

<div><br></div><div>Kind regards from Iceland,</div><div>Gissur</div><div><br></div><div>-- <br>Gissur Þórhallsson<br><br>Loftmyndir ehf.<br>Laugavegur 13<br>IS 101 Reykjavík - Iceland<br>sími (tel): (+354) 540 2500<br>tölvupóstur (email): <a href="mailto:gissur@loftmyndir.is">gissur@loftmyndir.is</a><br>


</div>