summaryrefslogtreecommitdiff
path: root/src/location/maps/qgeofiletilecache.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Print warning when QGeoFileTileCache::init fails creating the directoryPaolo Angelelli2019-03-101-1/+3
| | | | | Change-Id: I4369e71bbef0c218b35ef3449c5a1615fbf2cb4d Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix tile cache not honoring cost 0Paolo Angelelli2017-09-111-9/+29
| | | | | | | | | This patch fixes the case of disabling the various caches. Currently setting the cache size to 0 results in default initial values instead. Change-Id: I019cd15ac23b6479e4367a3e102dd661895a7fda Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Refactor: move code not depending on "this" into static methodsPaolo Angelelli2017-05-291-57/+67
| | | | | | | | | | | This patch moves the implementation of the default filenameToTileSpec and tileSpecToFileName methods into standalone public static methods so that they can be possibly reused by plugins or other components, since these implementations do not actually depend on any member of QGeoFileTileCache. Change-Id: I6e3f59615ff3a5e0924f946aa13aabebb8157e42 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add a way to skip showing tilesPaolo Angelelli2017-05-081-3/+22
| | | | | | | | | | | | | | | In certain cases servers provide tiles that can be fully transparent, provide no content or are bogus. Tile fetchers can be smart and detect some of these cases. This patch offers an extensible way to allow them to communicate (via a null QImage) tiles that should not be rendered, in addition to an extensible mechanism to identify such tiles on disk. The default way is by assuming that, once such tiles have been detected, the tile fetcher would simply write a file with "NoRetry" as content. Change-Id: I404bb4dcc38fdd33c412f7407601b47947e4ce8d Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Workaround for QGeoFileTileCache losing contentv5.9.0-beta4Paolo Angelelli2017-05-071-2/+4
| | | | | | | | | This patch disables the queue persistence, that causes the cache to fail indexing valid content present in the cache on disk Task-number: QTBUG-60581 Change-Id: Iec3ba6105fe59a6f466bfabf0db4bf4fc00267af Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Proactively convert tile formats to ARGB32_PremultipliedPaolo Angelelli2017-03-271-0/+4
| | | | | | | | | | This patch avoids each bind to do this conversion if the format of the tile isn't RGB or ARGB32_Premultiplied. This is the case of PNG with alpha channel, that usually comes as ARGB32. Change-Id: I8f1297dd82ab20b6c8ecac3e68bf5d82e03f2e70 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Refactor: move CacheAreas to QAbstractGeoTileCachePaolo Angelelli2017-01-161-3/+3
| | | | | | | | | | | | | | | This change moves QGeoTiledMappingManagerEngine::CacheAreas to the more appropriate container that is QAbstractGeoTileCache, which already uses this enum in its interface. Together with making the virtual init() method of QAbstractGeoTileCache public, instead of protected, this patch effectively disentangle QAbstractGeoTileCache/QGeoFileTileCache from the QGeoTiledMappingManagerEngine, and makes it usable potentially also by other (tile) renderers. Change-Id: Ic635b81660f81d86884cc6b00e3a2ab9420daa9f Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Fix for Unitary cache strategy supportPaolo Angelelli2016-11-241-13/+23
| | | | | | | | | This patch fixes the population phase of the cache to support unitary strategy. It also prevents a possible divide-by-zero error. Change-Id: I4ab18041f8e908bd60eb581663fe34fbb01c4991 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Improve support for unitary tile cost in QGeoFileTileCachePaolo Angelelli2016-11-231-13/+39
| | | | | | | | | | | | | | | This patch adds support for separate caching mode for each of the three caches, disk, memory and texture. It also adds separate plugin parameters to the mapbox plugin to control the functioning of each of these cache. By default it only sets the disk cache to unitary, to comply with mapbox TOS, and leaves the other two caches to bytesize behavior (old beavior). Change-Id: I665d40568f4e69a836d7489e1daa2d8dcb8987af Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
* Add support for unitary tile cost in QGeoFileTileCachePaolo Angelelli2016-11-221-10/+33
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for unitary pricing of tiles in the disk, memory and texture caches. This is done through a new enum in QAbstractGeoTileCache, "CostStrategy" having two values, Unitary (new one) and ByteSize (the old way). Using Unitary instead of ByteSize gives, as advantages: - the ability to comply with the TOS of certain providers, who allow to cache a fixed number of tiles, and not of bytes. - even performance with different types of tiles, like lo vs hi res, indexed vs satellite (which usually compresses much less). This patch sets the Unitary mode to be the default for the mapbox plugin since Mapbox is one of the providers whose TOS limit the amount of cacheable tiles. Therefore, the patch also modifies the mapbox plugin ".mapping.cache" parameters to reflect the new behavior. Since these parameters have been introduced with 5.8 (which is unreleased), the change doesn't need to be backward compatible. Change-Id: I76edd43900242885f24eb9f28e8c833538647edc Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Evict obsolete provider data on init()Paolo Angelelli2016-11-081-1/+29
| | | | | | | | | | | | | | | | | | | | | | During initialization, this patch makes sure that the cached tiles belong to the provider currently in use by using the file lastModified() value and comparing it against the (optional) Timestamp in the provider records. If this value is not present in the provider record, or if it is older than the newest modified file, the data is untouched. This operation is performed separately for each map id. This method isn't perfect in all use cases, though. E.g., if we are forced to shut down one of the provider and run on the hardcoded fallback, which has an older TS. These are however rare edge cases that most likely won't happen in practice (in the case above we could put the content of the hardcoded provider in the remote json files too) Change-Id: Ie29cf05c1fbc835ce4e3363fc0caa38a97800214 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Version tile cache with qt version and evict obsolete data on init()Paolo Angelelli2016-08-041-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | This patch changes the base cache directory to a new scheme containing the qt version. At the time of commit, this would be "QtLocation/5.8/tiles/" This versioning does not have to change at every release, but when there are changes in the caching scheme. The reason for this is that, otherwise, it becomes difficult to clean up old cache data. QGeoFileTileCache::init already clean up old tile cache from 5.4 or older, where the cache data wasn't organized under a directory for each plugin. In 5.8 different naming scheme are introduced for mapbox tiles (with @1x,@2x) , here maps (with ppi), and soon for OSM too (with an identifier for the actual provider, not only the mapId). With this patch it will become easier and cleaner to upgrade the cache data without leaving residues. Change-Id: I89aeac0aaf1408d119cde5792fc69a64d5d89c3a Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* OSM Geoservice plugin improvements, including offline data supportPaolo Angelelli2016-07-211-35/+47
| | | | | | | | | | | | | | | | | | | | | | | | This patch contains improvements for the OSM geoservice plugin, in form of property-controllable disk cache, and the support for a directory containing an offline dataset. The offline directory can contain subdirectories also in form of symlinks. If duplicate tiles are present, the newest is used. The population of the offline tiles registry is offloaded to a thread to prevent blocking the startup of the application. No synchronization is used (except on cache destruction), so that, as the tiles are being indexed, they can be used in the application. For the time being, no support is given to populate such directory (mostly due to current API limitations), but tiles can be placed manually, for example copying them from the disk cache directory. Task-number: QTBUG-45284 Change-Id: I518980669a3ee474545025adf05adc69cdd29781 Reviewed-by: Paolo Angelelli <paolo.angelelli@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Fix for caching after mapbox improvement/highdpi-supportPaolo Angelelli2016-07-071-2/+6
| | | | | | | | | | Currently the qgeofiletilecache/qgeofiletilecachemapbox contains a bug in that it makes use of virtual functions in the constructor. This patch fixes it by moving those calls into a virtual init() method that is called by QGeoTiledMappingManagerEngine::setTileCache() Change-Id: Icf7932dfbae7d99eef22c67e034246a834212a03 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Improve Mapbox geoservice pluginPaolo Angelelli2016-06-301-2/+2
| | | | | | | | | | | | | | | This patch adds standard mapbox map modes so that they could be used out of the box without the need for specifying it as parameter, and also adds a QGeoFileTileCache to the plugin, since the Mapbox TOS allow a limited caching even in the free plan. The default cache max disk usage has been set accordingly. The mapbox.map_id parameter is now optional, meaning that things will work like before if present, but will work with the default mapbox styles if not. Change-Id: I4056a3706f47d7f5c46a873c135b743106647fc0 Reviewed-by: Topi Reiniƶ <topi.reinio@theqtcompany.com> Reviewed-by: Michal Klocek <michal.klocek@theqtcompany.com>
* Add clearData() call to map qml apiMichal Klocek2015-12-071-0/+13
| | | | | | | | | | | Add clearData call to clear texture, memory and disk cache. Update mapviewer example and add "prefetchData" and "clearData" to Tools menu. Task-number: QTBUG-47292 Change-Id: Ifc71a3652688d1403f5b011ef231b59381c17ee3 Reviewed-by: Harald Meyer <dev@meh.at> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Avoid extra QPixmap convertion when tile fetchedMichal Klocek2015-11-231-9/+9
| | | | | | | | Initialize QGeoTileTexture with QImage instead of converting from QPixmap Change-Id: I69dddda385ebc9ce63cb0dd68fee3d3fa6eed73f Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Do not cache empty tiles.Harald Meyer2015-11-181-0/+3
| | | | | | | | With this update tiles which failed to load and have zero data are not saved (cached). Change-Id: I580db9096553d403d89c135bcf90ac5fb4c97fe8 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Split QGeoTileCache for easier customization of the tile cache.Harald Meyer2015-10-221-0/+447
The QGeoTileCache is split into two classes: The abstract class QAbstractGeoTileCache offers interfaces for inserting and getting tiles, as well as getting cache status information such as used texture memory. The new class QGeoFileTileCache implements QAbstractGeoTileCache and offers a file based caching implementation (the implementation is the same as before splitting the class). Change-Id: I2eab7491d489ac5b251c1296b67688901f5cc7d7 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>