ArcGIS Runtime SDK for Qt

Map loaded

Loading

Code

import QtQuick 2.6
import Esri.ArcGISRuntime 100.3
import Esri.ArcGISExtras 1.1

Rectangle {
    width: 800
    height: 600

    property real scaleFactor: System.displayScaleFactor
    property string statusText

    // Create MapView that contains a Map
    MapView {
        anchors {
            left: parent.left
            right: parent.right
            top: parent.top
            bottom: statusBar.top
        }

        Map {
            // Set the initial basemap to Streets
            BasemapStreets {}

            // Set up signal handler to determine load status
            // Load status should be loaded once the basemap successfully loads
            onLoadStatusChanged: {
                switch (loadStatus) {
                case Enums.LoadStatusFailedToLoad:
                    statusText = "Failed to Load";
                    break;
                case Enums.LoadStatusLoaded:
                    statusText = "Loaded";
                    break;
                case Enums.LoadStatusLoading:
                    statusText = "Loading...";
                    break;
                case Enums.LoadStatusNotLoaded:
                    statusText = "Not Loaded";
                    break;
                case Enums.LoadStatusUnknown:
                    statusText = "Unknown";
                    break;
                default:
                    statusText = "Unknown";
                    break;
                }
            }
        }
    }

    Rectangle {
        id: statusBar
        anchors {
            left: parent.left
            right: parent.right
            bottom: parent.bottom
        }
        height: 30 * scaleFactor
        color: "lightgrey"
        border {
            width: 0.5 * scaleFactor
            color: "black"
        }

        Text {
            anchors {
                verticalCenter: parent.verticalCenter
                left: parent.left
                leftMargin: 10 * scaleFactor
            }
            text: "Map Load Status: %1".arg(statusText)
            font.pixelSize: 14 * scaleFactor
        }
    }
}


In this topic
  1. Code