[OpenLayers-Users] Permalink doesn't update on
addlayer/removelayer
Andreas Hocevar
ahocevar at opengeo.org
Tue Aug 24 09:59:13 EDT 2010
On Aug 24, 2010, at 15:47 , Andreas Hocevar wrote:
> Ok, I do see yours and Marc's point now. You are not talking about using the Permalink control as-is, but with a custom createParams method and a custom ArgParser. In this case it can indeed be useful to listen to addlayer/removelayer.
>
> So yes, the Peramlink control could be improved with a patch containing the snipped posted by Marc.
But then, a more proper fix would probably be to register the Permalink control's map event listeners in activate() rather than draw(). Now if users configure a custom createParams method, they can also register a listener to the control's activate event and add additional map listeners there.
Marc: and yes, this is what we would usually discuss in dev rather than users :-).
Regards,
Andreas.
> On Aug 24, 2010, at 15:30 , Slawomir Messner wrote:
>
>> Hi all,
>> I thought permalink should have the information about visibility(and
>> other stuff) and should refresh when this values change, then for me
>> it's a bug when the initial values are not stored in the link (it's like
>> the first change).
>> The other thing is the need for extra information about layers to load
>> them at the beginning. Thanks for the link Andreas, I will visit it
>> tomorrow. I didn't look for an external solution because Permalink and
>> ArgParams are easy to extend and the informations are not complex. But
>> who knows, maybe there will be more data to store, so I will visit your
>> link, thx.
>> Regards,
>> Slawomir
>>
>> Am 24.08.2010 15:15, schrieb Marc Jansen:
>>> Hi Andreas,
>>>
>>> first of all, sorry for cross-posting in the past. I thought it was
>>> useful in this case.
>>>
>>> I'd disagree about the not handling of the layeradd/layerremove event
>>> for the Permalink-control -- but can easily live without this addition
>>> to OpenLayers :-)
>>>
>>> Your suggestions of alternative ways of handling application "state" are
>>> valid and often better suited, yet I think the addition of two
>>> additional listeners to the control would be very intuitive.
>>>
>>> Best regards,
>>>
>>> Marc
>>>
>>>
>>>
>>> On 24.08.2010 14:49, Andreas Hocevar wrote:
>>>> Hi,
>>>>
>>>> first of all, please don't cross-post dev and users.
>>>>
>>>> I am not sure if a permalink as provided by OpenLayers is what you really want for applications where the user can add or remove layers. The permalink only stores the visible/invisible state of the available layers in their order. It does not know anything about what these layers are. So a permalink will look exactly the same for any map with the same extent with let's say 3 layers that are all visible.
>>>>
>>>> If you want to store information on what layers are actually configured, you should look into Format.WMC, Format.OWS or solutions like the OpenGeo Suite's GeoExplorer (http://suite.opengeo.org/geoexplorer), which stores layer configurations in a database and provides a permalink with a map id.
>>>>
>>>> Regards,
>>>> Andreas.
>>>>
>>>> On Aug 24, 2010, at 14:31 , Marc Jansen wrote:
>>>>
>>>>
>>>>> Hi Slawomir,
>>>>>
>>>>> I'd consider this a bug with a (on first sight) reasonable easy fix:
>>>>>
>>>>> In the Permalinks draw-method:
>>>>>
>>>>> this.map.events.on({
>>>>> 'moveend': this.updateLink,
>>>>> 'changelayer': this.updateLink,
>>>>> 'changebaselayer': this.updateLink,
>>>>> 'addlayer': this.updateLink,
>>>>> 'removelayer': this.updateLink,
>>>>> scope: this
>>>>> });
>>>>>
>>>>> Or one could think of triggering a changelayer event when a layer has
>>>>> been added/removed in Map.js.
>>>>>
>>>>> I am unsure which design is better, so I'd suggest opening up a ticket
>>>>> (I cc'ed the developer list so the core developers notice this discussion).
>>>>>
>>>>> Regards,
>>>>> Marc
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 24.08.2010 13:53, Slawomir Messner wrote:
>>>>>
>>>>>> Hello,
>>>>>> Does anyone know why Permalink doesn't listen to addlayer/removelayer?
>>>>>> Every time I add a new layer I have to change a property(i.e.
>>>>>> visibility) to refresh the link. It's a bug or a feature?
>>>>>> Regards,
>>>>>> Slawomir
>>>>>>
>>>>>>
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> Dev at openlayers.org
>>>>> http://openlayers.org/mailman/listinfo/dev
>>>>>
>>>>
>>>
>>
>>
>> --
>> -----------------------------------------------
>> Slawomir Messner
>> Forschungszentrum "Deutscher Sprachatlas"
>> 06421-28-24981
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list