amal-kronz-orch / osmdroid

Automatically exported from code.google.com/p/osmdroid
0 stars 0 forks source link

Set a TileRequestCompleteHandler when adding a TileProvider to a mapView #251

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add a TileProvider (that loads tiles async.) to a TilesOverlay and the 
TilesOverlay to your mapView 
2. ZoomIn somewhere on the map

What is the expected output? What do you see instead?
Expected: Tiles should be loaded and when retrieved they should display on the 
map.
Instead: Sometime the expected tiles are shown and sometimes they are not.

What version of the product are you using? On what operating system?
3.0.5, Windows 7 and Mac 10.6.8

Please provide any additional information below.
It is a gamble if the expected tiles from the overlay get displayed. The view 
Invalidates while the base layer loads tiles and sends tileRequestComplete 
Messages to the mapView Object (the base layer gets the Handler set when 
creating the mapView Object). Since the download of maptiles takes some time 
this works fine most of the times. But not always. Then some tiles from the 
overlay is just not displayed even thou they get loaded in the background. The 
simple Solution is to call setTileRequestHandler for every TileProvider you add 
to your overlays and as parameter you use mapView.getTileRequestHandler. I 
guess that there will be enough people who do not find out that without this 
call there is a invalitation missing. 
My solution would be to add the Handler to Every Provider at the Moment when a 
new Overlay is added to a mapView.

In summery:
1) OverlayManager need to get the mapView Object it is bound to at 
initialisation.
2) If class is TilesOverlay OverlayManager.add() needs to call a new method in 
TilesOverlay "setTileRequestHandler"
3) TilesOverlay.setTileRequestHandler needs to call setTileRequestHandler on 
mTileProvider

A Link where the problem is described in detail (with example code and log 
files) is on the google group of osmdroid: 
http://groups.google.com/group/osmdroid/browse_thread/thread/9198237b3e5d5ac5

Original issue reported on code.google.com by abzy...@gmail.com on 26 Aug 2011 at 9:03

GoogleCodeExporter commented 9 years ago
Forgot: Tested on latest virtual device and on galaxy S with android 2.3.3 and 
2.2

Original comment by abzy...@gmail.com on 26 Aug 2011 at 9:06