Building a better toolkit

736
0
08-28-2020 12:28 PM
Labels (1)
NeilMacDonald
Esri Contributor
2 0 736

The timeslider tool provided with the toolkit

The Qt toolkit for the ArcGIS Runtime SDK is a collection of open source controls and utilities that was released in August of 2014. In those 6 years the toolkit has seen a fair amount of use. We utilize it ourselves in our Dynamic Situational Awareness application and we see a healthy level of engagement from both SDK developers and App Studio customers.

Why make a new toolkit?

Both the QML ecosystem and technology has progressed quite a bit since 2014. Back when the Toolkit first came out we targeted Qt version 5.6. In those days there were no QML enums, no Control type (and the idea of inherited styles), and we needed to craft our own DPI scaling code for mobile devices before Qt Quick Controls 2 was introduced in Qt 5.7. (That custom DPI code is long gone now, thank goodness!)

While we have done our best to keep our toolkit up to date with the evolving QML landscape there has been some legacy carryover. For example all of our controls expose special properties for styling that differs from modern, native QML components. Further, the scope of the toolkit has increased well beyond what was first envisioned. In 2014 the toolkit started off as a one-stop shop for map-related UI, but has now grown to include more general utilities and our AR toolkit.

Compounding all of this is a steady stream of customer requests for more tools, widget support and an easier integration pattern. It has become clear that we need a hard look at what we want out of the toolkit for the future.

Overview

To address this we are proposing this redesigned toolkit which we hope to release in tandem with SDK version 100.10. It is currently in beta.

There are changes in both the toolkit integration story and tool configuration which means that this toolkit does differ from the current toolkit in some significant areas. For a high level breakdown we have:

  • Widget support. We are still in the process of porting all the toolkit controls to Widgets, but the structure now exists to support widgets as a first-class workflow.

  • Easier integration. We have expunged the different workflows for desktop and mobile platforms in favour of one unified process. All you need is a one-line include in your *.pro file that embeds the toolkit's sources into your project.

  • Palette/font inheritance. Tools now inherit from QML Control, so achieving a look and feel consistent with the rest of your application should be easier than before.

  • MVC everywhere All tools are backed by a combined model/controller instance which does most of the heavy-lifting interfacing with runtime. The intent is to allow for finer grained management of a tool from both C++ and QML. This should help the developer write their own custom views for our tools.

Examples

For detailed integration instructions look here.

Depending on your use case, import one of these three *.pri files into your project:

  • toolkitqml.pri (for use with QML only apps.)
  • toolkitcpp.pri (for use with C++ apps which use a QtQuick UI.)
  • toolkitwidgets.pri (for use with C++ apps which use a QWidgets UI.)

For these examples we will look at the toolkitqml.pri case.

NorthArrow

The NorthArrow tool is a UI component that always points North with reference to the orientation of your SceneView/MapView.

import QtQuick 2.12
import QtQuick.Controls 2.12
import Esri.ArcGISRuntime 100.9
import Esri.ArcGISRuntime.Toolkit 100.9

ApplicationWindow {
width: 800
height: 600
SceneView {
id: sceneView
anchors.fill: parent

Scene {
BasemapTopographic {}
}

NorthArrow {
anchors {
right: parent.right
bottom: sceneView.attributionTop
}
geoView: sceneView
width: 64
height: 64
}
}
}

Northarrow tool

AuthenticationView

AuthenticationView provides a dialog for the user to input credentials whenever an authentication challenges is produced by ArcGISRuntime. This dialog is context sensitive and will change based on the type of challenge that is produced by ArcGIS runtime .

import QtQuick 2.12
import QtQuick.Controls 2.12
import Esri.ArcGISRuntime 100.9
import Esri.ArcGISRuntime.Toolkit 100.9

ApplicationWindow {
id: appWindow
width: 800
height: 600

AuthenticationView {
anchors.centerIn: parent
}

MapView {
anchors.fill: parent

Map {
BasemapTopographic {}
ArcGISMapImageLayer {
}
}
}
}

AuthenticationView example

The roadmap ahead

In version 100.8 of the Runtime SDK we stopped shipping prebuilt C++ toolkit binaries; in version 100.10 we will be completing that removal process and will no longer be shipping the QML part of the toolkit. Going forward, you will need to clone and build toolkit directly from our toolkit repo.

In the meantime, for this 100.9 release we are declaring the current toolkit deprecated and we encourage developers to give feedback on the beta branch during this time. Come version 100.10 of the Runtime SDK we plan to merge the redesign into master and make this new workflow official. For those unwilling or unable to upgrade to the new toolkit we will still make the current toolkit available as a legacy branch.