Legend widget speed issues

1 message Options
Embed this post
Permalink
Anders Selberg

Legend widget speed issues

Reply Threaded More More options
Print post
Permalink
Hello everybody,

We experience issues with the legend widget and would like to hear from you more experienced Fusion programmers on this:

If the user checks/unchecks several layers after each other, the updating process doesn’t seem to be able to keep up. It appears as if the calls interrupt each other, and then when the map image is loaded the layers shown in the map aren’t the same ones as those checked. I’m not sure whether it is the javascript that gets interrupted or the server calls, if I use Firebug to step through it, the process is slowed down enough to avoid the problem…(The ajax viewer doesn’t appear to have these issues btw, but maybe they aren’t really comparable?)

Still, I managed to solve this by letting stateChanged() push the clicked layers onto a queue. For the first layer in the queue I first do an obj.show(true), then call a custom php that explicitly sets the visibility with $myLayer->SetVisible(true/false). On the callback from this, first I call a slightly modified drawMap2(), that requests the map image after first nulling the show/hidelayers/groups-arrays, and then I continue shifting the queue, repeating the procedure. This makes the legend much more robust, although noticeably slower. The map image requests from drawMap2 get interrupted all the time but that’s all right, since the visibility is already set, and the final layer’s request doesn't.

I’m not sure what implications this might have on the rest of the code, and it’s kind of ugly too I guess. So I wonder if you know a better way to handle this.

(Using Fusion 1.1.1 and MGOS 2.0.2)


Regards,

Anders