arcgis runtime sdk for qt: building apps · 2020. 4. 30. · • flexible: create your ui with qt...
TRANSCRIPT
![Page 1: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/1.jpg)
Lucas Danzinger & Koushik Hajra
ArcGIS Runtime SDK for Qt:Building Apps
![Page 2: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/2.jpg)
• What is Qt• ArcGIS Runtime SDK for Qt capabilities• Getting started• Fundamental development patterns• How Esri uses Qt• Where to go from here
Agenda
![Page 3: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/3.jpg)
What is Qt?
![Page 4: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/4.jpg)
What is the Qt Framework?
• Write once, run anywhere• Builds as native C++Portable
• Cross-platform libraries• High-level abstractions
Approach-able
• Pre-built some platforms• Source code availableOpen
![Page 5: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/5.jpg)
- Cross platform libraries for native app development- Business logic in C++. - UI in QML (JavaScript-based)- Write once, deploy everywhere
- Linux, Windows, Mac, iOS, Android
- Platform nuances are abstracted- Abstraction APIs for common native workflows
- HTTP, local data storage, sensors, Bluetooth, etc
Qt Framework
![Page 6: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/6.jpg)
How does it work?
Android (via JNI & NDK)
iOS(via cocoa)
macOS(via cocoa) Linux Windows
Native platformAPIs (http, file i/o,
sensors etc)
Java Objective C Objective C C++ C++
Qt Abstracted APIQNetworkManager,
QFile, etc
Qt GUI (and other) LibrariesComboBox, Button,Charts, QImage
Your App
Language
C++ Compiler clang/gcc clang clang gcc MSVC
Platform
![Page 7: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/7.jpg)
• Windows – x86, x64• Linux – x64, arm 64 (beta)• macOS – x64• Android – armv7, armv8, x86• iOS – arm64, sim
Which platforms can I build for?
![Page 8: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/8.jpg)
ArcGIS Runtime SDK for Qt capabilities
Offline Maps/Scenes
ArcGIS Runtime SDK for Qt
Offline Routing Offline GeocodingOffline Geometry
Symbols & Renderers(with customizations)
Geoprocessing
Search/Identify/Query/Popups
ArcGIS Platform& IdentityUtility Network
Navigation
Augmented Reality
Data Collectionand editing
![Page 9: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/9.jpg)
Koushik Hajra
ArcGIS Runtime SDK for Qt Capabilities
![Page 10: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/10.jpg)
Getting started
![Page 11: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/11.jpg)
• Setup Qt: - Create account- Commercial license / open-source?- Install kits for target platforms
• Setup ArcGIS Runtime SDK for Qt- Create developer account- https://developers.arcgis.com/qt/latest/
• Install compiler / SDK dependencies- macOS/iOS: Xcode compiler- Windows: Visual Studio compiler, debugging tools- Linux: GCC compiler- Android: Android NDK and SDK
• IDE- Qt Creator
Setup
![Page 12: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/12.jpg)
App development patterns
App Pattern API to useIdeal place to
start for
Runs on Linux, macOS & Windows
Runs on iOS & Android
QML with Qt Quick QML Web Developer Yes Yes
C++ with Qt Quick C++ C++ Developer Yes Yes
C++ with Qt Widgets C++ C++ Developer Yes No
Commonly-used pattern
https://developers.arcgis.com/qt/latest/qml/guide/qt-sdk-best-practices.htm
![Page 13: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/13.jpg)
The QML API
• QML is a declarative language from The Qt Company- Declare components similarly to writing JSON or CSS
• Write procedural code as JavaScript functions • Create UI rapidly with Qt Quick, with animation and prebuilt controls• The QML API extends QML with new types that expose ArcGIS Runtime functionality• Used by AppStudio
![Page 14: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/14.jpg)
The C++ API
• Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)
- Most common design pattern: QML UI, C++ business logic
• Works with Local Server (QML API doesn’t)
Need help choosing between C++ and QML APIs? See https://developers.arcgis.com/qt/latest/qml/guide/qt-sdk-best-practices.htm
![Page 15: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/15.jpg)
Koushik Hajra
Building your first ArcGIS Runtime Qt app
![Page 16: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/16.jpg)
Runtime fundamental patterns + Qt
![Page 17: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/17.jpg)
Asynchronous API
• The Runtime API is a modern, asynchronous API• Tasks
- RouteTask, LocatorTask, OfflineMapTask, GeoprocessingTask, Map.save …- All follow the same pattern- All are Loadable - All have async functions to execute their tasks- TaskWatchers are returned for keep track of concurrent tasks
• Signals & Slots- Signal == “event”- Slot == “event handler”
- *Slots can be defined as standalone methods or inline lambda functions
![Page 18: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/18.jpg)
Asynchronous API – example LocatorTask
![Page 19: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/19.jpg)
Asynchronous API – example LocatorTask
![Page 20: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/20.jpg)
Asynchronous API – example LocatorTask (QML)
![Page 21: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/21.jpg)
Koushik Hajra
Asynchronous coding with Qt
![Page 22: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/22.jpg)
Memory management
• C++ is not a managed language• Memory is not automatically handled for you
- Pros- Close to the metal- Fine tuned performance
- Fast
- Can run on memory constrained devices
- Cons- A little extra work for you
![Page 23: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/23.jpg)
Memory management – Qt Parent/Child
• When you create a new object, you pass in a parent object. • When the parent object is deleted, so are the children• Can be any QObject – often you will see “this”• Any object you create on the heap, it is up to you to manage• Any object we return always has a parent (but you can re-set)
![Page 24: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/24.jpg)
Memory management – Clean up when you are done
• Apps with lots of temporary graphics added and removed- You don’t want memory allocated for the lifetime of the app
• Signals passing through pointers- The parent object is set by our API- No leaks, but memory will grow each time it emits
• Use RAII – Resource Acquisition is Initialization- e.g. C++11 “smart pointers” – std::shared_ptr, std::unique_ptr- Other methods…
![Page 25: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/25.jpg)
Memory management – QML
![Page 26: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/26.jpg)
Koushik Hajra
C++ memory management
![Page 27: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/27.jpg)
ListModels
• Qt’s way of doing MVC/MVVM• Mutable lists exposed as list models in Runtime API
- LayerListModel, GraphicListModel, etc
• List Models can be displayed with- ListViews- TableViews- GridViews
• Model – the data• View – what is displayed• Delegate – access the model’s “roles”
![Page 28: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/28.jpg)
ListModels – Map Layer Documentation
![Page 29: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/29.jpg)
ListModels – Map Layer List Example
![Page 30: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/30.jpg)
Koushik HajraList Models
![Page 31: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/31.jpg)
Wrap up
![Page 32: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/32.jpg)
How is Esri using Qt?
Runtime Core (for testing)
![Page 33: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/33.jpg)
How to get started using the SDK• Create a developer account
- https://developers.arcgis.com/sign-up
• Download Qt Framework and ArcGIS Runtime SDK for Qt- https://developers.arcgis.com/qt/latest/cpp/guide/install-and-set-up-on-windows.htm et al
• Read the guide’s fundamental topics- https://developers.arcgis.com/qt/latest/qml/guide/arcgis-runtime-sdk-for-qt.htm
• Study and modify the samples- https://github.com/Esri/arcgis-runtime-samples-qt
• Use the Forum and join the community discussion- https://geonet.esri.com/community/developers/native-app-developers/arcgis-runtime-sdk-for-qt/
![Page 34: ArcGIS Runtime SDK for Qt: Building Apps · 2020. 4. 30. · • Flexible: Create your UI with Qt Quick (targets any platforms) or Qt Widgets (targets desktop platforms)-Most common](https://reader031.vdocuments.net/reader031/viewer/2022012007/61199a330d2737404639e2a0/html5/thumbnails/34.jpg)