[OpenLayers-Users] Way to detect if layer is done loading?
Paul Spencer
pagameba at gmail.com
Tue Oct 16 20:11:38 EDT 2007
Brad,
you should be able to do something like this:
/* for each layer in onload: */
layer.events.register('loadstart', loadStart);
layer.events.register('loadend', loadEnd);
/* global functions/vars */
var layersLoading = 0;
function loadStart() {
if (layersLoading == 0) {
showLoadingImage();
}
layersLoading++;
}
function loadEnd() {
layersLoading--;
if (layersLoading == 0) {
hideLoadingImage();
}
}
this is rudimentary, untested ...
Cheers
Paul
On 16-Oct-07, at 7:27 PM, bradleyspencer wrote:
> I am trying to implement a Loading Image as well. I have managed to
> use
> LayerLoadMonitoring example to build my own Loading thingy.
>
> See http://demo.cubewerx.com.au/layerload.html
>
> This works fine for single layers as activate the Loading Image as
> start of
> load and I kill it off once that layer has loaded.
>
> However, if there are multiple layers active and there is a time
> difference
> between loading layers, the loading image has gone after the first
> layer has
> completed loading.
>
> I'm not sure how I can modify this to kill off the Loading Image
> only after
> all layers are loaded.
>
> Can anyone help me here?
>
> Cheers,
>
>
> Brad Spencer
> http://www.cubewerx.com.au
>
> -----Original Message-----
> From: users-bounces at openlayers.org [mailto:users-
> bounces at openlayers.org]On
> Behalf Of Christopher Schmidt
> Sent: Tuesday, 16 October 2007 7:15 AM
> To: Edward Fialkowski
> Cc: users at openlayers.org
> Subject: Re: [OpenLayers-Users] Way to detect if layer is done
> loading?
>
> On Mon, Oct 15, 2007 at 03:16:14PM -0500, Edward Fialkowski wrote:
>> Hi List, I would really like to add a loading image to my app to
>> show when
> a
>> layer is still being downloaded, but I'm having difficulty getting
>> the
> right
>> javascript code.
>>
>> One option is if it's possible to know in openlayers when a WMS
>> image is
>> finished downloading and added to the map.
>>
>> Has anyone ever tried anything like this?
>
> http://openlayers.org/dev/examples/layerLoadMonitoring.html
>
> Regards,
> --
> Christopher Schmidt
> MetaCarta
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
+-----------------------------------------------------------------+
|Paul Spencer pspencer at dmsolutions.ca |
+-----------------------------------------------------------------+
|Chief Technology Officer |
|DM Solutions Group Inc http://www.dmsolutions.ca/ |
+-----------------------------------------------------------------+
More information about the Users
mailing list