[OpenLayers-Dev] Added & Removed (from map) events for layers
Matt Priour
mpriour at kestrelcomputer.com
Wed Jan 19 12:23:37 EST 2011
Reposted from the GeoExt Dev list
Matt Priour
--------------------------------------------------
From: "Matt Priour" <mpriour at kestrelcomputer.com>
Sent: Wednesday, January 19, 2011 10:15 AM
To: "Andreas Hocevar" <ahocevar at opengeo.org>
Cc: "Alexandre Dube" <adube at mapgears.com>; <dev at geoext.org>
Subject: Re: [Dev] Lazy loading of map panel layers
> I have added a patch to OpenLayers trac which adds the " added" &
> "removed" events to the base OpenLayers.Layer and fires them from
> OpenLayers.Map
> The event object for both of these events includes a 'map' property (which
> could be redundant, might also be useful)
> Ticket - http://trac.osgeo.org/openlayers/ticket/2983
> Patch -
> http://trac.osgeo.org/openlayers/attachment/ticket/2983/2983_layer_events.patch
>
> Matt Priour
> Kestrel Computer Consulting
>
> --------------------------------------------------
> From: "Andreas Hocevar" <ahocevar at opengeo.org>
> Sent: Tuesday, January 18, 2011 9:45 AM
> To: "Matt Priour" <mpriour at kestrelcomputer.com>
> Cc: "Alexandre Dube" <adube at mapgears.com>; <dev at geoext.org>
> Subject: Re: [Dev] Lazy loading of map panel layers
>
>>
>> On Jan 12, 2011, at 21:39 , Matt Priour wrote:
>>
>>> Agreed and I was hoping to do that the other day when I ran up against
>>> this
>>> problem, but when I checked the available layer events was reminded
>>> again
>>> that there was no added or removed events on the layer.
>>>
>>> So, yes that is an elegant solution, but in the meantime, wouldn't using
>>> an
>>> optional map configuration property be the most reasonable solution?
>>
>> I think creating a patch for
>> http://trac.osgeo.org/openlayers/tickets/2983 would not be much effort,
>> and I'd be glad to review it once it is available. Let's take advantage
>> of the fact that most of us here also have experience contributing to
>> OpenLayers.
>>
>> Andreas.
>>
>>>
>>> Matt Priour
>>> Kestrel Computer Consulting
>>>
>>> --------------------------------------------------
>>> From: "Andreas Hocevar" <ahocevar at opengeo.org>
>>> Sent: Wednesday, January 12, 2011 1:40 PM
>>> To: "Alexandre Dube" <adube at mapgears.com>
>>> Cc: <dev at geoext.org>
>>> Subject: Re: [Dev] Lazy loading of map panel layers
>>>
>>>> Hi,
>>>>
>>>> a very elegant solution, which depends on
>>>> http://trac.osgeo.org/openlayers/ticket/2983, would be to register for
>>>> the
>>>> layer's "added" event and continue when it is added.
>>>>
>>>> Andreas.
>>>>
>>>> On Jan 12, 2011, at 20:18 , Alexandre Dube wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I just hit the exact same issue here. I was using an old proposed
>>>>> patch on ticket 235 [1] where the layer record, when rendered,
>>>>> registers
>>>>> an event to the record.layer.map, but the layer hasn't been added to
>>>>> the
>>>>> map yet so it's null.
>>>>>
>>>>> I'll try the Mixin pluggin instead, but I can see in it that it's
>>>>> guessing the mappanel and in my app I have two. I'll see what it
>>>>> does...
>>>>>
>>>>> Figured it was useful to tell.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Alexandre
>>>>>
>>>>> [1] http://trac.geoext.org/ticket/235
>>>>>
>>>>>
>>>>> On 11-01-12 11:50 AM, Matt Priour wrote:
>>>>>> Forgot the ticket link:
>>>>>> [1] http://trac.geoext.org/ticket/396
>>>>>>
>>>>>> Matt Priour
>>>>>> Kestrel Computer Consulting
>>>>>>
>>>>>> --------------------------------------------------
>>>>>> From: "Matt Priour"<mpriour at kestrelcomputer.com>
>>>>>> Sent: Wednesday, January 12, 2011 9:10 AM
>>>>>> To: "Eric Lemoine"<eric.lemoine at camptocamp.com>
>>>>>> Cc: "GeoEXT Dev"<dev at geoext.org>
>>>>>> Subject: Re: [Dev] Lazy loading of map panel layers
>>>>>>
>>>>>>> Thanks for that suggestion Eric.
>>>>>>> I have opened a ticket [1] for this issue, and attached a patch with
>>>>>>> an
>>>>>>> example fix for two classes. If this approach seems sound, then I
>>>>>>> would
>>>>>>> be
>>>>>>> happy to fix the remaining 7 components and add tests for this use
>>>>>>> case.
>>>>>>>
>>>>>>> An alternative approach would be to add the GeoExt.MapPanel's map
>>>>>>> property
>>>>>>> to the layers in the GeoExt.MapPanel layers configuration option
>>>>>>> when
>>>>>>> it
>>>>>>> uses an array of OpenLayers.Layer objects. However, that could
>>>>>>> interfere
>>>>>>> with OpenLayers code and various tests it does to determine if a
>>>>>>> layer
>>>>>>> has
>>>>>>> been added to a map or not. So I don't think that is a good
>>>>>>> approach.
>>>>>>>
>>>>>>> --------------------------------------------------
>>>>>>> From: "Eric Lemoine"<eric.lemoine at camptocamp.com>
>>>>>>> Sent: Wednesday, January 12, 2011 12:45 AM
>>>>>>> To: "Matt Priour"<mpriour at kestrelcomputer.com>
>>>>>>> Cc: "GeoEXT Dev"<dev at geoext.org>
>>>>>>> Subject: Re: [Dev] Lazy loading of map panel layers
>>>>>>>
>>>>>>>> On Wednesday, January 12, 2011, Matt
>>>>>>>> Priour<mpriour at kestrelcomputer.com>
>>>>>>>> wrote:
>>>>>>>>> Given the change in the way layers configured in the map panel are
>>>>>>>>> loaded
>>>>>>>>> in
>>>>>>>>> the map:
>>>>>>>>>
>>>>>>>>> (http://trac.geoext.org/wiki/Release/1.0/Notes): "Layers
>>>>>>>>> configured
>>>>>>>>> in
>>>>>>>>> the
>>>>>>>>> MapPanel's layers property won't be added to the map before it is
>>>>>>>>> rendered.
>>>>>>>>> This is a behavioral change that may require changes in code that
>>>>>>>>> relies
>>>>>>>>> on
>>>>>>>>> a layer's map property before the map is rendered."
>>>>>>>>>
>>>>>>>>> Are there plans to change the internal GeoExt code so that
>>>>>>>>> components
>>>>>>>>> which
>>>>>>>>> rely on the layer's map property are initialized after the layer
>>>>>>>>> is
>>>>>>>>> added
>>>>>>>>> to
>>>>>>>>> the map or instead use the GeoExt.MapPanel.guess() and its map
>>>>>>>>> property.
>>>>>>>>>
>>>>>>>>> I recently ran into this problem when attempting to use a
>>>>>>>>> GridPanel
>>>>>>>>> configured with a FeatureStore and a FeatureSelectionModel. I'm
>>>>>>>>> sure
>>>>>>>>> other
>>>>>>>>> components also have this issue. I solved it by manually binding
>>>>>>>>> the
>>>>>>>>> FeatureStore and FeatureSelectionModel in an 'afterrender'
>>>>>>>>> listener
>>>>>>>>> for
>>>>>>>>> the
>>>>>>>>> MapPanel.
>>>>>>>> Would that solve the issue if these components could be optionally
>>>>>>>> be
>>>>>>>> configured with a Map or a MapPanel?
>>>>>>>>
>>>>>>>> --
>>>>>>>> Eric Lemoine
>>>>>>>>
>>>>>>>> Camptocamp France SAS
>>>>>>>> Savoie Technolac, BP 352
>>>>>>>> 73377 Le Bourget du Lac, Cedex
>>>>>>>>
>>>>>>>> Tel : 00 33 4 79 44 44 96
>>>>>>>> Mail : eric.lemoine at camptocamp.com
>>>>>>>> http://www.camptocamp.com
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Dev mailing list
>>>>>>> Dev at geoext.org
>>>>>>> http://www.geoext.org/cgi-bin/mailman/listinfo/dev
>>>>>>>
>>>>>> _______________________________________________
>>>>>> Dev mailing list
>>>>>> Dev at geoext.org
>>>>>> http://www.geoext.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>>
>>>>> --
>>>>> Alexandre Dubé
>>>>> Mapgears
>>>>> www.mapgears.com
>>>>>
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> Dev at geoext.org
>>>>> http://www.geoext.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>>
>>>> --
>>>> Andreas Hocevar
>>>> OpenGeo - http://opengeo.org/
>>>> Expert service straight from the developers.
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> Dev at geoext.org
>>>> http://www.geoext.org/cgi-bin/mailman/listinfo/dev
>>>>
>>> _______________________________________________
>>> Dev mailing list
>>> Dev at geoext.org
>>> http://www.geoext.org/cgi-bin/mailman/listinfo/dev
>>
>> --
>> Andreas Hocevar
>> OpenGeo - http://opengeo.org/
>> Expert service straight from the developers.
>>
>>
More information about the Dev
mailing list