Hi, On Wed, Jul 1, 2009 at 6:42 PM, Esteban olm<esteban....@gmail.com> wrote: > Hi, > > I have something like: > > --------------------------- > var MLayerTemp =(...) //New vertor layer > > MLayerTemp.events.register("beforefeatureadded", MLayerTemp, > function(MElemento){ > MElemento.object.removeFeatures([MElemento.feature]); > MElemento.object.destroyFeatures(); > return true; > } > ); > > //And then I add the OpenLayers.Control.DrawFeature to the map > --------------------------- > > The problem is that whe the event function is called, the feature is not in > the screen map, but it is in the features array of the layer.
You are right, this is a bit odd. You can register for the "beforefeaturesadded" event instead, this gets triggered before features are added to the features array. > So the problem is: > > If I need to delete all features before inserting the new one, I can not do > something like: > > --------------------------- > function(MElemento){ > MElemento.object.destroyFeatures(); > return true; > } > --------------------------- > Becouse this erases also the new feature I try to insert!! > > Is it normal that the new feature to insert is already in the feature > layers' Array? > I think it shoul not to be in the array, so we have not decided yet if it > can be inserted or not. > > Anyway, another problem: If I return false... The feature is inserted!!! > The documentatio says it should not be inserted. Right. Also odd. It is inserted, but not drawn on the map. Maybe you want to create a ticket and report this issue? (http://trac.openlayers.org/wiki/HowToFileTickets) Regards, Andreas. > > Any help will be appreciated, > Thanks > > Esteban Olm > > > > _______________________________________________ > Dev mailing list > Dev@openlayers.org > http://openlayers.org/mailman/listinfo/dev > > -- Andreas Hocevar OpenGeo - http://opengeo.org/ Expert service straight from the developers. _______________________________________________ Dev mailing list Dev@openlayers.org http://openlayers.org/mailman/listinfo/dev