source: TODO_QT5_GUI.TXT

Last change on this file was fcc3a96, checked in by Martin Kolman <martin.kolman@…>, 8 weeks ago

Improved tile display in Qt 5 GUI

The PinchMap? element is was originally based on code from
the Advanced Geocaching Tool for Linux (AGTL) which (miss)used
the QTQuick image case in an ingenious way to display the tiled map.
The viewport was covered by a grid of tiles that was moved when the map
was panned.

If the pan did not uncover any not yet visible tile row or
column the grid was just nudged a bit. If a new row/column became
visible the visible rows/columns just switched image source url (with
one row/column address "falling of" and being replaced by the newly visible
row/column) and nudged the grid back a bit. Like this a constant number of tiles could
effectively simulate a slippy map.

Unfortunately this has drawbacks, some evident and some even
more horrendous that have only been discovered later:

  • the QtQuick? image cache sometimes gets flushed (application don't really have any direct control of it) which manifests as the map flashing due to visible tiles reloading from the tile image provider
  • according to a discussion with woot on IRC (Thanks! :) ) the clever trick with image source url switching not only causes the above mentioned flickering but is also horrendously inefficient as every image source url switch, even if the image is cached, requires new texture upload to the GPU (!!!!!), which is a very bad idea, especially for maps that can have tens of image, possibly in multiple layers

So to fix these issues, the "clever" url swapping trick has been
scrapped. The new solution works like this:

  • there is a ListModel? that track all tiles that should be visible at the moment
  • a central repeater creates tile delegates based on this model
  • each tile delegate is also a repeater with data model based on enabled map layers
  • unlike the previous url swapping technique tiles are now dynamically added and removed from the visible tiles model as the map is panned, zoomed, recentered, etc.
  • also as we now no longer need to care about image cache coherency we can also scrap the old horrendous "tile size notification" system that used tile size as a notification of tile availability and replace it with a more sane system based on callbacks and direct tile-downloaded notifications based on a tile-tracking map

The new way should have these benefits:

  • better performance as tile textures don't need to be reuploaded to CPU all the time
  • no loaded tile flickering
  • more sane asynchronous tile loading
  • Property mode set to 100644
File size: 1.3 KB
1new tile display logic
2- fix offset
3- fix position marker & route here marker
4- check POI markers & routing overlay
5-> routing overlay seems OK
6- load tiles during drag if cornerX/cornerY changes changes
8- tile instance recycling ? - DONE
9-> eq, reset rather than destroy ? ;-)
10 1) generate list of what should be on screen before and now, new_list & old_list
11 2) generate a list of new_items that contains only items that are in
12    new_list but not in old_list
13 3) iterate over tilesModel:
14    -> if tile is in new_list, do nothing
15    -> if tile not in new_list:
16     -> pop an item from new_items and set x & y accordingly
17     -> if new_items is empty then remove the tile from the tilesModel
18 4) iterate over new_tiles (if any) and add new tiles to the tilesModel
19    accordingly
21- areTilesAvailable() should send a batch notifications for all tiles once it finishes iterating
22  over tile_ids; true for tiles that are available, false for the others - DONE
24- idea: seamless zoom - use scaling of previous zoom level to "mask" zooming
25 0) only trigger real zooming once user stops attempting to zoom in/out
26 1) keep the tiles that will still be visible after being scaled appropriately
27    visible and add tiles corresponding to the new zoom level
28 2) remove the tiles from the previous zoom level once the new tiles cover the tile
29    or possibly after a timeout
Note: See TracBrowser for help on using the repository browser.