Layer Class

  • Layer
  • class Esri::ArcGISRuntime::Layer

    A base class for classes that represent layers. More...

    Public Functions

    virtual ~Layer() override
    QString attribution() const
    Esri::ArcGISRuntime::Layer *clone(QObject *parent = nullptr) const
    QString description() const
    Esri::ArcGISRuntime::Envelope fullExtent() const
    bool isIdentifyEnabled() const
    Esri::ArcGISRuntime::Item *item() const
    QString layerId() const
    Esri::ArcGISRuntime::LayerType layerType() const
    double maxScale() const
    double minScale() const
    float opacity() const
    void setDescription(const QString &description)
    void setLayerId(const QString &layerId)
    void setMaxScale(double maxScale)
    void setMinScale(double minScale)
    void setName(const QString &name)
    void setOpacity(float opacity) const
    Esri::ArcGISRuntime::SpatialReference spatialReference() const
    bool operator!=(const Esri::ArcGISRuntime::Layer &other) const
    bool operator==(const Esri::ArcGISRuntime::Layer &other) const

    Reimplemented Public Functions

    virtual bool canChangeVisibility() const override
    virtual void cancelLoad() override
    virtual bool isAutoFetchLegendInfos() const override
    virtual bool isShowInLegend() const override
    virtual bool isVisible() const override
    virtual bool isVisibleAtScale(double scale) const override
    virtual Esri::ArcGISRuntime::LegendInfoListModel *legendInfos() const override
    virtual void load() override
    virtual Esri::ArcGISRuntime::Error loadError() const override
    virtual Esri::ArcGISRuntime::LoadStatus loadStatus() const override
    virtual QString name() const override
    virtual void retryLoad() override
    virtual void setAutoFetchLegendInfos(bool autoFetchLegendInfos) override
    virtual void setShowInLegend(bool showInLegend) override
    virtual void setVisible(bool visible) override
    virtual QList<Esri::ArcGISRuntime::LayerContent *> subLayerContents() const override

    Signals

    void doneLoading(const Esri::ArcGISRuntime::Error &loadError)
    void loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)
    void visibleChanged(bool visible)

    Detailed Description

    A layer, also known as an operational layer, provides access to geographic data that is displayed in a map or scene. Each layer references a file or service data source that contains either vector data (points, lines, polygons and attributes) or raster data (images). The Map or Scene can display these layers inside a MapView or SceneView, respectively. To enhance the displayed information, you can 'stack' the layers into a collection of Map::operationalLayers or Scene::operationalLayers. The first layer in the collection is drawn first (on the bottom) and each subsequent layer is drawn on top of it.

    Layer is the base class for all these layer types:

    Layer type2D/3DTime-awareOnline/offlineSources
    AnnotationLayer2DNoBothArcGIS feature service, portal item, mobile map package (.mmpk)
    ArcGISMapImageLayerBothYesOnlineArcGIS map service
    ArcGISSceneLayer3DNoBothScene service or scene package
    ArcGISTiledLayerBothNoArcGIS tile service, tile package (.tpk/.tpkx)
    ArcGISVectorTiledLayer2DNoBothArcGIS vector tile service, vector tile package (.vtpk)
    BingMapsLayerBothNoOnlineBing maps
    DimensionLayer2DYesOfflineMobile map package (.mmpk)
    DynamicEntityLayerBothNoOnlineArcGIS stream service
    EncLayer2DNoOfflineENC exchange set, ENC cell
    FeatureCollectionLayerBothNoBothPortal item, web map, feature set / query result
    FeatureLayerBothYesBothArcGIS feature service, WFS, shapefile, GeoPackage, geodatabase, OGC API Features
    GroupLayerBothNoBothOther layers and group layers
    KmlLayerBothYesBothKML file (.kml, .kmz)
    IntegratedMeshLayer3DNoBothScene later package (.slpk)
    MobileBasemapLayer2DNoOfflineMobile map package (.mmpk)
    OpenStreetMapLayerBothNoOnlineOpenStreetMap.org
    PointCloudLayer3DNoBothPortal item, scene layer package (.slpk)
    RasterLayerBothYesBothGeoPackage, raster file, ArcGIS Image service
    SubtypeFeatureLayer2DNoBothArcGIS feature service, geodatabase
    WebTiledLayerBothNoOnlineWeb tile service
    WmsLayerBothYesOnlineWMS service
    WmtsLayerBothNoOnlineWMTS service

    Member Function Documentation

    [override virtual] Layer::~Layer()

    Destructor.

    QString Layer::attribution() const

    Returns the attribution text for the layer.

    [override virtual] bool Layer::canChangeVisibility() const

    Reimplements: LayerContent::canChangeVisibility() const.

    Returns a bool indicating whether the layer content's visibility can be changed.

    [override virtual] void Layer::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::Layer *Layer::clone(QObject *parent = nullptr) const

    Clones the Layer to a new instance with an optional parent.

    Returns a new instance of the current Layer.

    This function was introduced in Esri::ArcGISRuntime 200.1.

    QString Layer::description() const

    Returns the description for the layer.

    For service layers, the description is defined by the service when the layer initializes.

    See also setDescription().

    [signal] void Layer::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.

    See also Loadable and Object.

    Esri::ArcGISRuntime::Envelope Layer::fullExtent() const

    Returns the full extent of this layer, which is the extent where all layer data is contained.

    You can use this to zoom to all of the data contained in this layer. For feature layers, the extent is retrieved from its FeatureTable::extent.

    See also FeatureTable::extent.

    [override virtual] bool Layer::isAutoFetchLegendInfos() const

    Reimplements: LayerContent::isAutoFetchLegendInfos() const.

    Returns whether legend infos are automatically fetched by the layer's legend info list model.

    See LayerContent.

    bool Layer::isIdentifyEnabled() const

    Returns true if the layer supports identify, false otherwise.

    The value of this property may not be correct until the layer is in a fully loaded state.

    [override virtual] bool Layer::isShowInLegend() const

    Reimplements: LayerContent::isShowInLegend() const.

    Returns a bool indicating whether the layer content participates in the legend.

    [override virtual] bool Layer::isVisible() const

    Reimplements: LayerContent::isVisible() const.

    Returns the layer content's visibility.

    [override virtual] bool Layer::isVisibleAtScale(double scale) const

    Reimplements: LayerContent::isVisibleAtScale(double scale) const.

    Returns the layer content's effective visibility at the specified scale.

    • scale - The scale the visibility has to be calculated for.

    Returns the effective layer content visibility. This effective visibility takes care of the effective visibility of the parents at the specified scale. Will return false if an error occurs.

    Esri::ArcGISRuntime::Item *Layer::item() const

    Returns the item the layer has been created from.

    See also ArcGISTiledLayer::ArcGISTiledLayer(), ArcGISVectorTiledLayer::ArcGISVectorTiledLayer(), ArcGISMapImageLayer::ArcGISMapImageLayer(), FeatureLayer::FeatureLayer(), ArcGISMapImageLayer::ArcGISMapImageLayer(), and ArcGISTiledLayer::ArcGISTiledLayer().

    QString Layer::layerId() const

    Returns the unique identifying string for the layer, for example specified in a map or scene.

    The id is used by other parts of this API to refer to a specific Layer, such as in a set of FeatureFenceParameters or a FacilityLayerDefinition. If not supplied, all layers will be assigned a unique id when created.

    It is not recommended to change this property when the layer is obtained from a map or scene. If changed, ensure that the string is unique, for example based on a generated GUID.

    See also setLayerId().

    Esri::ArcGISRuntime::LayerType Layer::layerType() const

    Returns the type of the layer.

    [override virtual] Esri::ArcGISRuntime::LegendInfoListModel *Layer::legendInfos() const

    Reimplements: LayerContent::legendInfos() const.

    Returns a list of legend information for the layer and any sublayers.

    See LayerContent.

    [override virtual] void Layer::load()

    Reimplements: Loadable::load().

    Returns loads the metadata for the object asynchronously.

    Loads the metadata if the object is not loaded.

    See Loadable.

    [override virtual] Esri::ArcGISRuntime::Error Layer::loadError() const

    Reimplements: Loadable::loadError() const.

    Returns the load error.

    See Loadable.

    See also Error.

    [override virtual] Esri::ArcGISRuntime::LoadStatus Layer::loadStatus() const

    Reimplements: Loadable::loadStatus() const.

    Returns the load status.

    See Loadable.

    See also LoadStatus.

    [signal] void Layer::loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)

    Signal emitted when the loadStatus changes for this object.

    See also Loadable.

    double Layer::maxScale() const

    Returns the maximum scale for the layer.

    The maximum scale at which this layer is visible. If the map or scene is zoomed in beyond this scale, the layer will not be visible. A value of 0 means there is no maximum scale threshold and the layer will be visible at the smallest scale available for the map or scene. If the value is NaN, there is no maximum scale. All of the connected map and scene views will be updated.

    See also setMaxScale().

    double Layer::minScale() const

    Returns the minimum scale for the layer.

    The minimum scale at which this layer is visible. If the map or scene is zoomed out beyond this scale, the layer will not be visible. A value of 0 means there is no minimum scale threshold and the layer will be visible at the largest scale available for the map or scene. If the value is NaN, there is no minimum scale. All of the connected map and scene views will be updated.

    See also setMinScale().

    [override virtual] QString Layer::name() const

    Reimplements: LayerContent::name() const.

    Returns the layer content's name.

    See also setName().

    float Layer::opacity() const

    Returns the opacity for the layer.

    The opacity of this layer as a value between 0 (fully transparent) and 1 (fully opaque). The default opacity value is 1.

    See also setOpacity().

    [override virtual] void Layer::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.

    [override virtual] void Layer::setAutoFetchLegendInfos(bool autoFetchLegendInfos)

    Reimplements: LayerContent::setAutoFetchLegendInfos(bool autoFetchLegendInfos).

    Sets whether legend infos are automatically fetched by the layer's legend info list model to autoFetchLegendInfos.

    See LayerContent.

    See also isAutoFetchLegendInfos().

    void Layer::setDescription(const QString &description)

    Sets the description to description.

    See also description.

    void Layer::setLayerId(const QString &layerId)

    Sets the id to layerId.

    See also layerId.

    void Layer::setMaxScale(double maxScale)

    Sets the maxScale to maxScale.

    See also maxScale.

    void Layer::setMinScale(double minScale)

    Sets the minScale to minScale.

    See also minScale.

    void Layer::setName(const QString &name)

    Sets the layer's name.

    The name is defined by the service when the layer initializes, so this method is typically used after the service layer initializes.

    name The name.

    See also name().

    void Layer::setOpacity(float opacity) const

    Sets the opacity to opacity.

    See also opacity.

    [override virtual] void Layer::setShowInLegend(bool showInLegend)

    Reimplements: LayerContent::setShowInLegend(bool showInLegend).

    Sets the showInLegend to showInLegend.

    See also isShowInLegend.

    [override virtual] void Layer::setVisible(bool visible)

    Reimplements: LayerContent::setVisible(bool visible).

    Sets the visible to visible.

    See also isVisible.

    Esri::ArcGISRuntime::SpatialReference Layer::spatialReference() const

    Returns the spatial reference of the layer.

    [override virtual] QList<Esri::ArcGISRuntime::LayerContent *> Layer::subLayerContents() const

    Reimplements: LayerContent::subLayerContents() const.

    Returns the sublayer contents of a layer content.

    [signal, since Esri::ArcGISRuntime 100.9] void Layer::visibleChanged(bool visible)

    Signal emitted when the isVisible property changes for this object.

    • visible - The current visibility of the layer.

    This function was introduced in Esri::ArcGISRuntime 100.9.

    [since Esri::ArcGISRuntime 200.2] bool Layer::operator!=(const Esri::ArcGISRuntime::Layer &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 Layer::operator==.

    [since Esri::ArcGISRuntime 200.1] bool Layer::operator==(const Esri::ArcGISRuntime::Layer &other) const

    Returns a bool that tests if this layer is equal to a second Layer object.

    • other - The other layer.

    This function was introduced in Esri::ArcGISRuntime 200.1.

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