ImageTiledLayer Class

  • ImageTiledLayer
  • class Esri::ArcGISRuntime::ImageTiledLayer

    A base class for layers that display cached maps. More...

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

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

    This class was introduced in Esri::ArcGISRuntime 100.0.

    Public Functions

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

    Signals

    void cancelTileRequest(const Esri::ArcGISRuntime::TileKey &tileKey)
    void tileRequest(const Esri::ArcGISRuntime::TileKey &tileKey)

    Protected Functions

    void setNoDataTile(const Esri::ArcGISRuntime::TileKey &tileKey)
    void setTileData(const Esri::ArcGISRuntime::TileKey &tileKey, const QByteArray &data)
    void setTileError(const Esri::ArcGISRuntime::TileKey &tileKey, const QString &error)

    Detailed Description

    ImageTiledLayer defines a base class for layers that display tiled map services and cached image services. This is an abstract class that can be derived in a custom class to implement a local tile data scheme. To implement a 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. You would typically work with one or more sub-classes of this class.

    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 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 Esri::ArcGISRuntime::TileInfo &tileInfo, const Esri::ArcGISRuntime::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.

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

    Signal emitted when a tile request is canceled.

    • 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.

    [signal] void ImageTiledLayer::tileRequest(const Esri::ArcGISRuntime::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.

    [override virtual] ImageTiledLayer::~ImageTiledLayer()

    Destructor.

    Esri::ArcGISRuntime::NoDataTileBehavior ImageTiledLayer::noDataTileBehavior() const

    Return determines how a tile request that returns 'NoData' is resampled. Zooming in can result in tile requests with no tiles at the requested level of detail. In this case, there are options that control what to display where the tile should be:

    - NoDataTileBehavior::UpSample - Resample the pixels from a lower level of detail tile. This can result in pixelation or blurriness. This is the default behavior for operational layers.

    - NoDataTileBehavior::Blank - The 'NoData' pixels will show the raster picture as being blank (or disappearing). This is the default behavior for basemap reference layers.

    - NoDataTileBehavior::Show - This will show the raster picture with the text 'No Data' stamped over it once you pass the lowest level-of-detail scale.

    Sometimes, to see the effect on the map when setting the noDataTileBehavior property, the Layer::maxScale value must also be explicitly set. The Layer::maxScale property may need to be smaller than the level-of-detail setting that was used to create the tiled images in ArcGIS Pro or ArcGIS Desktop. For example, consider an operational image tile layer showing forest cover that was created with the level-of-detail assumption that it was to be viewed above a scale of 5000 (meaning you will not see 'NoData' until you zoom closer to the Earth than a 5000 scale). However, you want to be able to zoom in closer to the Earth surface, say down to 3000 or 300. By setting the Layer::maxScale property to a number smaller than 5000, you will be able to zoom in closer to the Earth and see the effects of changing the noDataTileBehavior enumerations.

    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 Esri::ArcGISRuntime::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.

    See also ImageTiledLayer::setTileData.

    void ImageTiledLayer::setNoDataTileBehavior(Esri::ArcGISRuntime::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 Esri::ArcGISRuntime::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 Esri::ArcGISRuntime::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.

    Esri::ArcGISRuntime::TileInfo ImageTiledLayer::tileInfo() const

    Returns the TileInfo.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.