Hi,<br><br>I have seen I&#39;m not using last version of Openlayers.<br>I will try to see how version 2.8 works, and if it does the same thing, I will report it.<br><br>I&#39;m sorry, but the link you gave me doesn&#39;t work.<br>
<br><div class="gmail_quote">2009/7/1 Andreas Hocevar <span dir="ltr">&lt;<a href="mailto:ahocevar@opengeo.org">ahocevar@opengeo.org</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<div class="im"><br>
On Wed, Jul 1, 2009 at 6:42 PM, Esteban olm&lt;<a href="mailto:esteban.olm@gmail.com">esteban.olm@gmail.com</a>&gt; wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; I have something like:<br>
&gt;<br>
&gt; ---------------------------<br>
&gt;         var MLayerTemp =(...) //New vertor layer<br>
&gt;<br>
&gt;         MLayerTemp.events.register(&quot;beforefeatureadded&quot;, MLayerTemp,<br>
&gt;             function(MElemento){<br>
&gt;                 MElemento.object.removeFeatures([MElemento.feature]);<br>
&gt;                 MElemento.object.destroyFeatures();<br>
&gt;                 return true;<br>
&gt;             }<br>
&gt;         );<br>
&gt;<br>
&gt; //And then  I add the OpenLayers.Control.DrawFeature to the map<br>
&gt; ---------------------------<br>
&gt;<br>
&gt; The problem is that whe the event function is called, the feature is not in<br>
&gt; the screen map, but it is in the features array of the layer.<br>
<br>
</div>You are right, this is a bit odd. You can register for the<br>
&quot;beforefeaturesadded&quot; event instead, this gets triggered before<br>
features are added to the features array.<br>
<div class="im"><br>
&gt; So the problem is:<br>
&gt;<br>
&gt;  If I need to delete all features before inserting the new one, I can not do<br>
&gt; something like:<br>
&gt;<br>
&gt; ---------------------------<br>
&gt;             function(MElemento){<br>
&gt;                 MElemento.object.destroyFeatures();<br>
&gt;                 return true;<br>
&gt;                 }<br>
&gt; ---------------------------<br>
&gt; Becouse this erases also the new feature I try to insert!!<br>
&gt;<br>
&gt; Is it normal that the new feature to insert is already in the feature<br>
&gt; layers&#39; Array?<br>
&gt; I think it shoul not to be in the array, so we have not decided yet if it<br>
&gt; can be inserted or not.<br>
&gt;<br>
&gt; Anyway, another problem: If I return false... The feature is inserted!!!<br>
&gt; The documentatio says it should not be inserted.<br>
<br>
</div>Right. Also odd. It is inserted, but not drawn on the map. Maybe you<br>
want to create a ticket and report this issue?<br>
(<a href="http://trac.openlayers.org/wiki/HowToFileTickets" target="_blank">http://trac.openlayers.org/wiki/HowToFileTickets</a>)<br>
<br>
Regards,<br>
Andreas.<br>
<div class="im"><br>
&gt;<br>
&gt; Any help will be appreciated,<br>
&gt; Thanks<br>
&gt;<br>
&gt;    Esteban Olm<br>
&gt;<br>
&gt;<br>
&gt;<br>
</div>&gt; _______________________________________________<br>
&gt; Dev mailing list<br>
&gt; <a href="mailto:Dev@openlayers.org">Dev@openlayers.org</a><br>
&gt; <a href="http://openlayers.org/mailman/listinfo/dev" target="_blank">http://openlayers.org/mailman/listinfo/dev</a><br>
&gt;<br>
&gt;<br>
<font color="#888888"><br>
<br>
<br>
--<br>
Andreas Hocevar<br>
OpenGeo - <a href="http://opengeo.org/" target="_blank">http://opengeo.org/</a><br>
Expert service straight from the developers.<br>
</font></blockquote></div><br>