figure out if every tile is loaded

المشرف العام

Administrator
طاقم الإدارة
Is there a way to figure out if every tile of an ol.source.TileWMS is loaded? My attempt so far is the following: var tileColl = new ol.Collection() tileColl.on('change:length, function(e){ if(e.target.getLength === 0){ console.log('ready!'); } }); tileWms.on('tileloadstart, function(e){ tileColl.push(e.tile); } tileWms.on('tileloadend, function(e){ tileColl.remove(e.tile); }

Unfortunately, this fails because sometimes all tiles in the list are loaded before all tileloadstart-Events are fired -eventually the collection becomes empty. (Probably because the number of request send by the browser is limited)

I removed all interactions, so the user cannot move the view. I know I can solve the problem by using (for example) ol.source.ImageWMS but I prefer using ol.source.TileWMS because it has some visible progress when the tiles are loading.

Some ideas i had but could not make them work: Calculate the number of tile that are to load, Figuring out the last tile which is to load.

Is there way to archieve this?

Thanks in advance



أكثر...
 
أعلى