BasemapListModel QML Type

  • Esri.ArcGISRuntime
  • BasemapListModel
  • The result of fetching the basemaps available for a portal. More...

    Import Statement: import Esri.ArcGISRuntime
    Since: Esri.ArcGISRuntime 100.0

    Properties

    Signals

    Methods

    Detailed Description

    The request is made by calling fetchBasemaps and if the operation is succesful, this type is returned by the portal's basemaps method.

    The basemaps contained in the model are initially unloaded.

    The model returns data for the following roles:

    RoleTypeDescription
    namestringThe basemap's name.
    urlurlThe basemap's URL.
    accessInformationstringThe item's access information.
    createddateThe date this item was created.
    descriptionstringThe item's description.
    itemIdstringThe item's ID.
    typeEnums.ItemTypeThe item's type.
    modifieddateThe date this item was last modified.
    snippetstringThe item's snippet.
    tagslist<string>The item's tags.
    titlestringThe item's title.
    thumbnailUrlurlThe local file URL of the thumbnail image for this item.

    Example: Accessing roles from a BasemapListModel from within a QML delegate:

    Image {
        id: basemapImg
        anchors {
            bottom: basemapLabel.top;
            horizontalCenter: parent.horizontalCenter
        }
        height: parent.height - ( basemapLabel.height * 2 );
        width: height
        source: thumbnailUrl
        fillMode: Image.PreserveAspectCrop
    }
    
    Text {
        id: basemapLabel
        anchors {
            bottom: parent.bottom;
            left: parent.left;
            right: parent.right
        }
        height: 16
        z: 100
        horizontalAlignment: Text.AlignHCenter
        text: title
        wrapMode: Text.Wrap
        elide: Text.ElideRight
        font.pointSize: 8
        font.bold: index === basemapsGrid.currentIndex
    }

    See also Portal, Basemap, and Loadable.

    Property Documentation

    [read-only] count : int

    Returns the number of objects in the model (read-only).


    [read-only] error : Error

    Returns the Error object (read-only).


    Signal Documentation

    countChanged()

    Emitted when the count property of the model changes.

    Note: The corresponding handler is onCountChanged.


    errorChanged()

    Signal emitted when the error property changes, which can indicate that an error occurred.

    Note: The corresponding handler is onErrorChanged.


    [since Esri.ArcGISRuntime 100.15] itemAdded(int index)

    Signal emitted when an item is added to the list model.

    index is the index of the added item.

    Note: The corresponding handler is onItemAdded.

    This signal was introduced in Esri.ArcGISRuntime 100.15.


    [since Esri.ArcGISRuntime 100.15] itemRemoved(int index)

    Signal emitted when an item is removed from the list model.

    index is the index of the removed item.

    Note: The corresponding handler is onItemRemoved.

    This signal was introduced in Esri.ArcGISRuntime 100.15.


    Method Documentation

    void append(Basemap basemap)

    Appends a Basemap basemap to the list model.


    void clear()

    Removes all basemaps from the list model.


    bool contains(Basemap basemap)

    Returns true if the list model contains the specified basemap.


    error forEach(callback)

    Receives a callback function to execute for each Basemap in the model.

    The callback function can take 0 to 3 optional arguments, in order:

    Returns undefined if no error occurred, and an error message otherwise.

    const error = BasemapListModel.forEach(function(element, index, array) {
        ...
    });
    if (error) {
        console.error(error.message);
    }

    Basemap get(int index)

    Returns the Basemap at the specified index.


    [since Esri::ArcGISRuntime 100.5.] int indexOf(Basemap basemap)

    Returns the index of the basemap specified.

    This method was introduced in Esri::ArcGISRuntime 100.5..


    void insert(int index, Basemap basemap)

    Inserts a Basemap basemap at the specified index in the list.


    void move(int from, int to)

    Moves one Basemap from an index in the list model to a different index.


    void remove(int index, int count = 1)

    Removes one or more objects starting at the specified index.

    • index Index of first object to remove.
    • count Number of objects to remove. This parameter defaults to 1.

    [since Esri::ArcGISRuntime 100.5.] void removeOne(Basemap basemap)

    Removes the specified basemap (basemap) from the list model.

    This method was introduced in Esri::ArcGISRuntime 100.5..


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