Hello Manuel,

I think you'll have to monitor these layers yourself. I remember having problems using the "moveend" event of the map (at least it didn't fit my needs).

But it's quite simple to catch that "all layers are loaded" event. Just declare a global (or semi-global) counter, increase it on each "loadstart" and decrease it on each "loadend". When the counter is back to zero you're done.

Applied to your sample code:

var layerCounter = 0;

function registerEvents(layer) {
    layer.events.register("loadstart", layer, function() {
        layerCounter++;
    });
    layer.events.register("loadend", layer, function() {
        layerCounter--;
        if (layerCounter == 0) {
            // now all layers should be loaded
        }
    });
}


Greeting, Jana.


Am 04.12.2012 22:09, schrieb Manuel Arredondo:
I have multiple WMS layers on an OpenStreetMap base layer. I want to be able to
know when there are no more map requests being done by any layer. I have used
the OL example to monitor layers as shown below.
Do I have to monitor each layer separately and give them a boolean to switch to
true when their ‘loadend’ event is triggered?
or is there an API call I can use which monitors all the events as a whole?
The map event doesn’t have a “loadend” event type.
function registerEvents(layer) {
layer.events.register("loadend", layer, function() {
this.logEvent("Ready");
baseTilesLoaded = true;
});
map.addLayer(layer);
}
Best Regards,
Manuel Arredondo.


_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to