A local cache of rendered map tiles that can be used to create a layer. More...
Header: | #include <TileCache.h> |
Since: | Esri::ArcGISRuntime 100.0 |
Inherits: | Esri::ArcGISRuntime::Object and Esri::ArcGISRuntime::Loadable |
Public Functions
TileCache(const QString &path, QObject *parent = nullptr) | |
virtual | ~TileCache() override |
Esri::ArcGISRuntime::CacheStorageFormat | cacheStorageFormat() const |
Esri::ArcGISRuntime::TileCache * | clone(QObject *parent = nullptr) const |
Esri::ArcGISRuntime::Envelope | fullExtent() const |
bool | isAntialiasing() const |
QString | path() const |
QImage | thumbnail() const |
QByteArray | tileData(const Esri::ArcGISRuntime::TileKey &tileKey) const |
Esri::ArcGISRuntime::TileInfo | tileInfo() const |
bool | operator!=(const Esri::ArcGISRuntime::TileCache &other) const |
bool | operator==(const Esri::ArcGISRuntime::TileCache &other) const |
Reimplemented Public Functions
virtual void | cancelLoad() override |
virtual void | load() override |
virtual Esri::ArcGISRuntime::Error | loadError() const override |
virtual Esri::ArcGISRuntime::LoadStatus | loadStatus() const override |
virtual void | retryLoad() override |
Signals
void | doneLoading(const Esri::ArcGISRuntime::Error &loadError) |
void | loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus) |
Detailed Description
A tile cache stores a collection of images at various scales. A client can request the tiles needed to display a particular map extent. You can use ExportTileCacheTask to generate and download tiles from a service, creating a tile package (.tpk/.tpkx). Alternatively, you can use ArcGIS Pro to create a map tile package and provision it to the device.
Functional characteristics
ArcGIS tiled layers do not support reprojection, query, select, identify, or editing.
Performance characteristics
Tiles are generated when the cache is created. Requests for tiles are made on multiple threads and handled asynchronously. The size of each returned tile increases as the resolution or complexity of the image in the tile increases. For example, high-resolution imagery tiles can be larger files than topographic mapping for the same area and map extent.
Local tile caches are ideal for providing basemaps, or for infrequent changes to contextual layers when network access is limited or non-existent. Use ExportTileCacheJob to create and download a local tile cache to a device. Alternatively, the cache can be provisioned directly to local storage. The supported types of cache file formats are:
- Tile package (.tpk, .tpkx) - a tile cache of data, packaged into one convenient, portable file, ideal for offline sharing of complete tiled layers in a disconnected environment or via a portal.
- Compact Cache - a directory structure where groups of tiles are combined into larger .bundle files, preserving performance and reducing copy times and the size on disk of the cache.
- Exploded Cache - a directory structure where map tiles are stored as individual files.
A tile cache is often used as a basemap, but can also be used to create an ArcGISTiledLayer that is added to a map as an operational layer. An offline ArcGISTiledElevationSource can also be created from an appropriate tile cache and added to the Scene::baseSurface of a Scene.
Relevant samples:
- ArcGIS tiled layer (tile cache): Load an offline copy of a tiled map service as a basemap.
- Export tiles: Download tiles to a local tile cache file stored on the device.
- Offline routing: This sample demonstrates how to solve a route on-the-fly using offline data.
See also ArcGISTiledLayer.
Member Function Documentation
[explicit]
TileCache::TileCache (const QString &path, QObject *parent = nullptr)
Create a tile cache from the specified tile cache path.
- path - The path to the tile cache.
- parent - The optional parent QObject.
Creates a tile cache from the given local path to a tile package (.tpk or .tpkx file), or directory containing a compact or exploded cache.
See also ArcGISTiledLayer.
[override virtual]
TileCache::~TileCache ()
Destructor.
[since Esri::ArcGISRuntime 100.2]
Esri::ArcGISRuntime::CacheStorageFormat TileCache::cacheStorageFormat () const
Returns the cache storage format of this tile cache.
CacheStorageFormat::Unknown if an error occurs.
This function was introduced in Esri::ArcGISRuntime 100.2.
[override virtual]
void TileCache::cancelLoad ()
Reimplements: Loadable::cancelLoad().
Cancels loading metadata for the object.
Cancels loading the metadata if the object is loading.
See Loadable.
[since Esri::ArcGISRuntime 200.1]
Esri::ArcGISRuntime::TileCache *TileCache::clone(QObject *parent = nullptr) const
Clones the TileCache to a new instance with an optional parent.
Returns a new instance of the current TileCache.
This function was introduced in Esri::ArcGISRuntime 200.1.
[signal]
void TileCache::doneLoading (const Esri::ArcGISRuntime::Error &loadError )
Signal emitted when this object is done loading.
- loadError - Details about any error that may have occurred.
Note: If there is a load error it will also be emitted on the errorOccurred
signal.
Esri::ArcGISRuntime::Envelope TileCache::fullExtent () const
Returns the full extent of the tile cache.
Expressed in coordinates of the spatial reference of the source map document.
bool TileCache::isAntialiasing () const
Returns the antialiasing flag of this tile cache.
false
if an error occurs.
[override virtual]
void TileCache::load()
Reimplements: Loadable::load().
Loads the metadata for the object asynchronously.
Loads the metadata if the object is not loaded.
See Loadable.
[override virtual]
Esri::ArcGISRuntime::Error TileCache::loadError () const
Reimplements: Loadable::loadError() const.
Returns the load error.
See Loadable.
See also Error.
[override virtual]
Esri::ArcGISRuntime::LoadStatus TileCache::loadStatus () const
Reimplements: Loadable::loadStatus() const.
Returns the load status.
See Loadable.
See also LoadStatus.
[signal]
void TileCache::loadStatusChanged (Esri::ArcGISRuntime::LoadStatus loadStatus )
loadStatus See Loadable.
QString TileCache::path() const
Returns the path of the tile cache.
For caches based on tile packages (.tpk or .tpkx files) this is the full path of the .tpk or .tpkx file; for caches based on compact or exploded caches this is the path of the directory containing the cache.
This path can be empty when the tile cache is contained within a MobileMapPackage or MobileScenePackage.
{TileCache(const QString&, QObject*)}
See also Esri::ArcGISRuntime::TileCache::TileCache(const QString&, QObject*).
[override virtual]
void TileCache::retryLoad ()
Reimplements: Loadable::retryLoad().
Loads or retries loading metadata for the object asynchronously.
Will retry loading the metadata if the object is failed to load. Will load the object if it is not loaded. Will not retry to load the object if the object is loaded. Will always call the done loading if this is called.
See Loadable.
QImage TileCache::thumbnail() const
Returns the thumbnail image of this tile cache.
[since Esri::ArcGISRuntime 100.14]
QByteArray TileCache::tileData (const Esri::ArcGISRuntime::TileKey &tileKey ) const
Returns the tile data for the specified tile key.
- tileKey - The tile key.
This function was introduced in Esri::ArcGISRuntime 100.14.
Esri::ArcGISRuntime::TileInfo TileCache::tileInfo () const
Returns the information about the tiling scheme used by this tile cache.
For example, the tiling scheme indicates the origin of the cached tiles, the levels of detail available, and the size of each tile.
[since Esri::ArcGISRuntime 200.2]
bool TileCache::operator!=(const Esri::ArcGISRuntime::TileCache &other) const
Inequality operator. Returns true
if this object and other are not equal.
This function was introduced in Esri::ArcGISRuntime 200.2.
See also TileCache::operator==.
[since Esri::ArcGISRuntime 200.1]
bool TileCache::operator==(const Esri::ArcGISRuntime::TileCache &other) const
Returns a bool that tests if this object is equal to a second TileCache object.
- other - The other tile cache.
This function was introduced in Esri::ArcGISRuntime 200.1.