BasemapGalleryController Class

  • BasemapGalleryController
  • class Esri::ArcGISRuntime::Toolkit::BasemapGalleryController

    The controller part of a BasemapGallery. This class handles the management of the BasemapGalleryItem objects, and listening to changes to the current Basemap of an associated GeoModel. More...

    Header: #include <BasemapGalleryController>
    Inherits: QObject

    Properties

    Public Functions

    BasemapGalleryController(QObject *parent = nullptr)
    virtual ~BasemapGalleryController() override
    bool append(Esri::ArcGISRuntime::Basemap *basemap)
    bool append(Esri::ArcGISRuntime::Basemap *basemap, QImage thumbnail, QString tooltip = {})
    Esri::ArcGISRuntime::Basemap *currentBasemap() const
    Esri::ArcGISRuntime::Toolkit::GenericListModel *gallery() const
    Esri::ArcGISRuntime::GeoModel *geoModel() const
    Esri::ArcGISRuntime::Portal *portal() const
    void setCurrentBasemap(Esri::ArcGISRuntime::Basemap *basemap)
    void setGeoModel(Esri::ArcGISRuntime::GeoModel *geoModel)
    void setGeoModelFromGeoView(QObject *view)
    void setPortal(Esri::ArcGISRuntime::Portal *portal)

    Signals

    Detailed Description

    Property Documentation

    currentBasemap : Basemap* const

    This property holds the current basemap of in the current geoModel.

    Access functions:

    Esri::ArcGISRuntime::Basemap *currentBasemap() const

    Notifier signal:

    See also Esri::ArcGISRuntime::Toolkit::BasemapGalleryController::currentBasemap().

    This property holds the gallery of BasemapGalleryItem objects.

    Access functions:

    Esri::ArcGISRuntime::Toolkit::GenericListModel *gallery() const

    See also Esri::ArcGISRuntime::Toolkit::BasemapGalleryController::gallery().

    geoModel : GeoModel*

    This property holds the geoModel the controller is listening for basemap changes.

    Access functions:

    Esri::ArcGISRuntime::GeoModel *geoModel() const
    void setGeoModel(Esri::ArcGISRuntime::GeoModel *geoModel)

    Notifier signal:

    See also Esri::ArcGISRuntime::Toolkit::BasemapGalleryController::geoModel().

    portal : Portal*

    This property holds the optional portal the controller queries for basemaps

    Access functions:

    Esri::ArcGISRuntime::Portal *portal() const
    void setPortal(Esri::ArcGISRuntime::Portal *portal)

    Notifier signal:

    void portalChanged()

    See also Esri::ArcGISRuntime::Toolkit::BasemapGalleryController::portal().

    Member Function Documentation

    BasemapGalleryController::BasemapGalleryController(QObject *parent = nullptr)

    Constructs a new controller object with a given parent.

    The controller will automatically populate itself with the developer basemaps from AGOL.

    The given default basemaps require either an API key or named-user to be signed into the app.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [signal] void BasemapGalleryController::currentBasemapChanged()

    Emitted when the current basemap has changed.

    Note: Notifier signal for property currentBasemap.

    [signal] void BasemapGalleryController::geoModelChanged()

    Emitted when the geoModel has changed.

    Note: Notifier signal for property geoModel.

    [signal] void BasemapGalleryController::portalChanged()

    Emitted when the portal has changed.

    Note: Notifier signal for property portal.

    [override virtual] BasemapGalleryController::~BasemapGalleryController()

    Destructor.

    bool BasemapGalleryController::append(Esri::ArcGISRuntime::Basemap *basemap)

    Convenience function that appends a basemap to the gallery.

    • basemap Basemap to add to the gallery.

    This is equivelent to calling

    controller->gallery()->append(new BasemapGalleryItem(basemap, controller));

    Returns true if successfully added, false otherwise.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    bool BasemapGalleryController::append(Esri::ArcGISRuntime::Basemap *basemap, QImage thumbnail, QString tooltip = {})

    Convenience function that appends a basemap to the gallery with an overloaded thumbnail and tooltip.

    • basemap Basemap to add to the gallery.
    • thumbnail Thumbnail to display in the gallery.
    • tooltip Tooltip to show when mouse hovers over the gallery item.

    This is equivelent to calling

    controller->gallery()->append(new BasemapGalleryItem(basemap, thumbnail, tooltip, controller));

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    Esri::ArcGISRuntime::Basemap *BasemapGalleryController::currentBasemap() const

    Returns the current basemap selected in the BasemapGallery.

    If a GeoModel is set, this is also the basemap applied to that GeoModel.

    It is possible for the current basemap to not be in the gallery.

    Note: Getter function for property currentBasemap.

    See also setCurrentBasemap().

    Returns the known list of available basemaps. Internally, this is a GenericListModel with an elementType of Basemap.

    Note: Getter function for property gallery.

    Esri::ArcGISRuntime::GeoModel *BasemapGalleryController::geoModel() const

    Returns the GeoModel.

    Note: Getter function for property geoModel.

    See also setGeoModel().

    Esri::ArcGISRuntime::Portal *BasemapGalleryController::portal() const

    Returns the current portal if set.

    Note: Getter function for property portal.

    See also setPortal().

    void BasemapGalleryController::setCurrentBasemap(Esri::ArcGISRuntime::Basemap *basemap)

    Sets the current basemap associated with the map/scene of the given GeoModel to basemap.

    It is possible for the current basemap to not be in the gallery.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    See also currentBasemap().

    void BasemapGalleryController::setGeoModel(Esri::ArcGISRuntime::GeoModel *geoModel)

    Set the GeoModel object this Controller uses to geoModel. This function will also extract the basemap from the Geomodel and set it as the current one. Passing a geoModel nullptr, will unset the current geomodel loaded.

    Note: Setter function for property geoModel.

    See also geoModel().

    void BasemapGalleryController::setGeoModelFromGeoView(QObject *view)

    Convenience function for QML/C++ users which allows the map/scene to be extracted from a SceneView or MapView assigned to view in QML code.

    This is only a concern as [Map/Scene]QuickView does not expose a [Map/Scene] property in QML.

    For example, to hook up BasemapGallery with a MapQuickView (which does not expose a map property):

    MapView {
       BasemapGallery {
           id: gallery
           anchors {
               left: view.left
               top: view.top
               margins: 5
       }
       onMapChanged: gallery.setGeoModelFromGeoView(this)
    }

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    void BasemapGalleryController::setPortal(Esri::ArcGISRuntime::Portal *portal)

    Sets the current portal. This resets the gallery.

    When portal is set, the basemaps of the Portal are fetched via Portal::fetchBasemaps.

    This is useful for displaying an organization's basemaps or to display a gallery of the old-style basemaps (which do not require an API key or named user.)

    To display the old-style basemaps do the following:

    controller->setPortal(new Portal(QUrl("https://arcgis.com"), this));

    Note: Setter function for property portal.

    See also portal().

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