[OpenLayers-Trac] Re: [OpenLayers] #3425: Control.Permalink should update its link when layers are added or removed

OpenLayers trac-20090302 at openlayers.org
Mon Jul 25 12:29:22 EDT 2011


#3425: Control.Permalink should update its link when layers are added or removed
-------------------------------+--------------------------------------------
 Reporter:  marcjansen         |       Owner:  crschmidt      
     Type:  bug                |      Status:  new            
 Priority:  minor              |   Milestone:  2.12 Release   
Component:  Control.Permalink  |     Version:  SVN            
 Keywords:                     |       State:  Needs More Work
-------------------------------+--------------------------------------------
Changes (by marcjansen):

  * state:  Review => Needs More Work


Comment:

 Hi Bart,

 a totally valid comment (the scenario isn't to unlikely).

 The additional event listeners might better be suited inside the
 application code, where one knows (or has additional information) about
 what layers are to be added / removed etc. when the applications starts up
 again (which of course is the case in my current application).

 Thinking further, even the current code can quite easily lead to wrong
 links: You simply need to zoom in (or out ...) after a layer has been
 added and the link'll be broken, right? That's because createParams uses
 map.layers if it isn't provided with a set of layers as third parameter.
 This can be seen e.g. in this example:
 http://openlayers.org/dev/examples/controls.html

 If the following sequence of code happens, ebven the current
 implementation is broken.
 {{{
 var dmSolutionLayer = map.layers[2];
 dmSolutionLayer.setVisibility(true);

 var l = new OpenLayers.Layer.Vector('foo', {visibility: false});
 map.addLayer(l);

 map.raiseLayer(dmSolutionLayer, 1);

 // trigger the update
 map.zoomIn();
 }}}

 The addition proposed here would only make the erroneous behaviour show
 earlier. I know that this is a very weak argument, though ;-)

-- 
Ticket URL: <http://trac.openlayers.org/ticket/3425#comment:3>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list