Joined: 07 Sep 2011
Location: Maasland, The Netherlands
|Posted: Thu Apr 05, 2012 2:46 pm Post subject: Tiling and Geomap
|I want to use a webbases tiling source like OpenStreetmap. This means a standardized way of cutting up a map in tiles of 256x256 where the lines by which the tiles are cut is determined by an open standard. Google maps for example also uses this.
The tiles are sorted on a folder tree like this:
dataroot/zoomlevel/column/row.png or .jpg
The source can either be downloaded and locally stored tiles or online tiles. I use downloaded tiles.
Loading tiles from disk can be time consuming and thus I prefer to first load some tiles, show them in Geomap, continu loading the rest and then show the whole image in Geomap. (I use threads to achieve this in background.)
For this I use some code like Geomap.MapBitmap:=MyBitmap;
Where MyBitmap is made up of x*y tiles that were drawn on the Canvas of MyBitmap.
MyBitmap is already sized to the max of all tiles to be downloaded.
This code calls SetMapBitmap and in here MyBitmap is assigned to the internal Bitmap of Geomap. Assigning means making a copy and not pointing with a pointer.
So when I then draw the remaining tiles on MyBitmap, they will not show on the Geomap internal memory bitmap (GrafBMP). For this I have to call Geomap.MapBitmap:=MyBitmap again and thus Assign the whole bitmap again.
Is there a better way to do this? For example when MyBitmap and GrafBMP point to the same bitmap source in memory and thus changes made to the bitmap will show after the next call to Paint in Geomap.
I love to hear.
Jaap van Goor