[OpenLayers-Dev] is beforefeatureadded working properly?

Esteban olm esteban.olm at gmail.com
Wed Jul 1 12:42:29 EDT 2009


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.
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.

Any help will be appreciated,
Thanks

   Esteban Olm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20090701/856dd5b2/attachment.html


More information about the Dev mailing list