Hi,<br><br>I have seen I'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'm sorry, but the link you gave me doesn't work.<br>
<br><div class="gmail_quote">2009/7/1 Andreas Hocevar <span dir="ltr"><<a href="mailto:ahocevar@opengeo.org">ahocevar@opengeo.org</a>></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<<a href="mailto:esteban.olm@gmail.com">esteban.olm@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
> I have something like:<br>
><br>
> ---------------------------<br>
> var MLayerTemp =(...) //New vertor layer<br>
><br>
> MLayerTemp.events.register("beforefeatureadded", MLayerTemp,<br>
> function(MElemento){<br>
> MElemento.object.removeFeatures([MElemento.feature]);<br>
> MElemento.object.destroyFeatures();<br>
> return true;<br>
> }<br>
> );<br>
><br>
> //And then I add the OpenLayers.Control.DrawFeature to the map<br>
> ---------------------------<br>
><br>
> The problem is that whe the event function is called, the feature is not in<br>
> 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>
"beforefeaturesadded" event instead, this gets triggered before<br>
features are added to the features array.<br>
<div class="im"><br>
> So the problem is:<br>
><br>
> If I need to delete all features before inserting the new one, I can not do<br>
> something like:<br>
><br>
> ---------------------------<br>
> function(MElemento){<br>
> MElemento.object.destroyFeatures();<br>
> return true;<br>
> }<br>
> ---------------------------<br>
> Becouse this erases also the new feature I try to insert!!<br>
><br>
> Is it normal that the new feature to insert is already in the feature<br>
> layers' Array?<br>
> I think it shoul not to be in the array, so we have not decided yet if it<br>
> can be inserted or not.<br>
><br>
> Anyway, another problem: If I return false... The feature is inserted!!!<br>
> 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>
><br>
> Any help will be appreciated,<br>
> Thanks<br>
><br>
> Esteban Olm<br>
><br>
><br>
><br>
</div>> _______________________________________________<br>
> Dev mailing list<br>
> <a href="mailto:Dev@openlayers.org">Dev@openlayers.org</a><br>
> <a href="http://openlayers.org/mailman/listinfo/dev" target="_blank">http://openlayers.org/mailman/listinfo/dev</a><br>
><br>
><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>