Skip To Content ArcGIS for Developers Sign In Dashboard

ImageTiledLayer Class

(Esri::ArcGISRuntime::ImageTiledLayer)

A base class for layers that display tiled map services and cached image services. More...

Header: #include <ImageTiledLayer>
Since: Esri::ArcGISRuntime 100.0
Inherits: ImageAdjustmentLayer
Inherited By:

Esri::ArcGISRuntime::ArcGISTiledLayer, Esri::ArcGISRuntime::ServiceImageTiledLayer, and Esri::ArcGISRuntime::WmtsLayer

Public Functions

ImageTiledLayer(const TileInfo &tileInfo, const Envelope &fullExtent, QObject *parent = nullptr)
~ImageTiledLayer()
NoDataTileBehavior noDataTileBehavior() const
virtual void setAttribution(const QString &attribution)
void setNoDataTileBehavior(NoDataTileBehavior noDataTileBehavior)
TileInfo tileInfo() const

Signals

void cancelTileRequest(const TileKey &tileKey)
void tileRequest(const TileKey &tileKey)

Protected Functions

void setNoDataTile(const TileKey &tileKey)
void setTileData(const TileKey &tileKey, const QByteArray &data)
void setTileError(const TileKey &tileKey, const QString &error)
  • 9 protected functions inherited from QObject

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 1 public variable inherited from QObject
  • 10 static public members inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

A base class for layers that display tiled map services and cached image services.

This is an abstract class that can be derived to implement your own local tile data scheme.

Creating a custom image tiled layer

To implement your own custom ImageTiledLayer, for example to load your own local tile data, you should derive from this type and supply the data for each tile as it is requested.

This allows you to asynchronously generate a byte array (for example from an image file on the device) for each tile.

To do this, connect to the tileRequest signal and call one of the the following protected methods for each TileKey which is requested:

FunctionDescription
setTileDataSets the byte array corresponding to a tile request.
setTileErrorSets the error corresponding to a tile request.
setNoDataTileIf there is no data corresponding to a tile request.

The tileInfo parameter defines the format of images (image format, DPI, width and height), and the limits of extent and scale factor for requests.

CustomTiledLayer::CustomTiledLayer(const TileInfo& tileInfo, const Envelope& fullExtent, QObject* parent) :
  ImageTiledLayer(tileInfo, fullExtent, parent)
{
  connect(this, &CustomTiledLayer::tileRequest, this, [this](const TileKey& tileKey)
  {
    QString localUrl = tilesDataRoot() + QString("/tiledata/%1-%2-%3.jpg").arg(
          QString::number(tileKey.level()),
          QString::number(tileKey.row()),
          QString::number(tileKey.column()));

    QFile f(localUrl);
    if (!f.exists())
    {
      sendMessage(QString("Cannot find: %1").arg(localUrl));
      setNoDataTile(tileKey);
    }
    else if (!f.open(QIODevice::OpenModeFlag::ReadOnly))
    {
      sendMessage(QString("Cannot open: %1").arg(localUrl));
      setTileError(tileKey, QString("Cannot open: %1").arg(localUrl));
    }
    else
      setTileData(tileKey, f.readAll());
  });
}

You can also connect to the cancelTileRequest signal in order to terminate tile requests which are no longer required.

See also TileInfo.

Member Function Documentation

ImageTiledLayer::ImageTiledLayer(const TileInfo &tileInfo, const Envelope &fullExtent, QObject *parent = nullptr)

Constructor that accepts a tile info (tileInfo), an extent (fullExtent), and an optional parent.

This function was introduced in Esri::ArcGISRuntime 100.2.

ImageTiledLayer::~ImageTiledLayer()

Destructor.

[signal] void ImageTiledLayer::cancelTileRequest(const TileKey &tileKey)

Signal emitted when a tile request is cancelled.

  • tileKey - The key used to identify the specific tile.

Note: : React to this signal when implementing your own custom image tiled layer type.

This function was introduced in Esri::ArcGISRuntime 100.2.

NoDataTileBehavior ImageTiledLayer::noDataTileBehavior() const

Gets the NoDataTileBehavior for the layer.

This determines how NoData tiles are handled and displayed.

Below are the default values for a loaded layer.

Layer SituationDefault Value
Unbound (not added to the map/scene)NoDataTileBehavior::UpSample
Basemap reference layerNoDataTileBehavior::Blank
Basemap base layerNoDataTileBehavior::UpSample
Map operational layerNoDataTileBehavior::UpSample

See also setNoDataTileBehavior().

[virtual] void ImageTiledLayer::setAttribution(const QString &attribution)

Sets the attribution text to attribution.

This function was introduced in Esri::ArcGISRuntime 100.1.

[protected] void ImageTiledLayer::setNoDataTile(const TileKey &tileKey)

Specifies that there is no data corresponding to a tileKey.

Note: : This function should only be called when implementing your own custom image tiled layer type.

This function was introduced in Esri::ArcGISRuntime 100.2.

void ImageTiledLayer::setNoDataTileBehavior(NoDataTileBehavior noDataTileBehavior)

Sets the NoDataTileBehavior for the layer to noDataTileBehavior.

This determines how NoData tiles are handled and displayed.

See also noDataTileBehavior().

[protected] void ImageTiledLayer::setTileData(const TileKey &tileKey, const QByteArray &data)

Sets data corresponding to a tileKey.

Note: : This function should only be called when implementing your own custom image tiled layer type.

This function was introduced in Esri::ArcGISRuntime 100.2.

[protected] void ImageTiledLayer::setTileError(const TileKey &tileKey, const QString &error)

Sets an error corresponding to a tileKey.

Note: : This function should only be called when implementing your own custom image tiled layer type.

This function was introduced in Esri::ArcGISRuntime 100.2.

TileInfo ImageTiledLayer::tileInfo() const

Returns the TileInfo.

[signal] void ImageTiledLayer::tileRequest(const TileKey &tileKey)

Signal emitted when a tile is requested.

  • tileKey - The key used to identify the specific tile.

Note: : React to this signal when implementing your own custom image tiled layer type.

This function was introduced in Esri::ArcGISRuntime 100.2.


Feedback on this topic?