How to determine when all tiles have been loaded?

I have an application that needs perform an action only after all map tiles have been successfully loaded.

I've read other posts that suggested iterating through the Documents image elements, but I have not found a reliable way of determining whether or not an element has been loaded.

How can I determine when all tiles for a given map have completed loading (after a zoom or pan operation, for example).

Thanks,

Alan Chavis

[467 byte] By [AlanChavis] at [2008-1-6]
# 1
Does anyone have any ideas regarding this?
AlanChavis at 2007-9-28 > top of Msdn Tech,Windows Live Developer Forums,Virtual Earth: Map Control Development...
# 2

It tough as the tiles are <img> tags and it upto the browser to go fetch them and render. Unlike a winforms app the javascript that is the VE API doesn't have much access here, in theory you can put an onload event on img tags, keep track of the outstanding tiles to be loaded and then bubble up some fully loaded event.

But I don't see this being a simple modification and the extra overhead won't suit everyone. Is it such a critical problem for your application? For most applications it is pretty obvious to the user that it is still loading.

on a side note V5 load less tiles, V4 loads an entire ring on tiles that are completly out of view, V5 does not. If your looking for good tile performance V5 is much better.

John.

SoulSolutions at 2007-9-28 > top of Msdn Tech,Windows Live Developer Forums,Virtual Earth: Map Control Development...
# 3

My application is grabbing a still image of the map so it can be used in with an imaging control that provides the user with a rich annotation feature set.

The VE map is not visible to the user. When the map changes (pan, zoom, etc.), I'm having the map element draw itself to a bitmap and then I'm assigning that bitmap to the annotation control.

This works well except occasionally when a tile has not been loaded and the map is not completely drawn.

This is why I would like to be able to know when the map has finished loading so I can initiate a redraw of the imaging control.

I am using V5. I've tried checking the browser controls image collection, but it appears that the images are only added to the collection once they have completed loading so that's no help.

Can anyone give me an example of how I could attach events to the img tags to determine when they've been loaded?

Thanks!

Alan

AlanChavis at 2007-9-28 > top of Msdn Tech,Windows Live Developer Forums,Virtual Earth: Map Control Development...
# 4

I was able to set up an IAdviseSink notification off of the IViewObject interface that is provided by the web browser control's IHTMLDocument2 interface.

IAdviseSink's OnViewChange notifies my application when the browser control's view changes, and appears to be called after all of the tiles have been successfully loaded.

This seems to have resolved the issue I was trying to address.

Hope this helps someone else!

AlanChavis at 2007-9-28 > top of Msdn Tech,Windows Live Developer Forums,Virtual Earth: Map Control Development...
# 5
Do you have a sample code for this?
regards,
Patrick
LugPaj at 2007-9-28 > top of Msdn Tech,Windows Live Developer Forums,Virtual Earth: Map Control Development...

Windows Live Developer Forums

Site Classified