[OpenLayers-Dev] is beforefeatureadded working properly?
Andreas Hocevar
ahocevar at opengeo.org
Thu Jul 2 12:30:26 EDT 2009
Hi,
sorry for the wrong link. It should be
http://trac.openlayers.org/wiki/FilingTickets
2.8 will show the same behaviour.
Regards,
Andreas.
On Thu, Jul 2, 2009 at 1:20 AM, Esteban olm<esteban.olm at gmail.com> wrote:
> Hi,
>
> I have seen I'm not using last version of Openlayers.
> I will try to see how version 2.8 works, and if it does the same thing, I
> will report it.
>
> I'm sorry, but the link you gave me doesn't work.
>
> 2009/7/1 Andreas Hocevar <ahocevar at opengeo.org>
>>
>> Hi,
>>
>> On Wed, Jul 1, 2009 at 6:42 PM, Esteban olm<esteban.olm at 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 at openlayers.org
>> > http://openlayers.org/mailman/listinfo/dev
>> >
>> >
>>
>>
>>
>> --
>> Andreas Hocevar
>> OpenGeo - http://opengeo.org/
>> Expert service straight from the developers.
>
>
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
>
>
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Dev
mailing list