advanced topics in developing arcgis apps with qt · 2016. 3. 21. · arcgis apps with qt. with ....

25
Advanced Topics in Developing ArcGIS Apps with Qt with Michael Tims and Lucas Danzinger – Esri March 8–11, 2016 | Palm Springs, CA Esri Developer Summit

Upload: others

Post on 04-Oct-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

Advanced Topics in Developing ArcGIS Apps with Qt

with Michael Tims and Lucas Danzinger – Esri

March 8–11, 2016 | Palm Springs, CA

Esri Developer Summit

Page 2: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

Agenda

• Security and authentication• Task handling• Disconnected mapping• Advanced visualization• Q & A

Page 3: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

Authentication OptionsSecurity and Authentication

• Authentication methods - ArcGIS token authentication- OAuth 2 authentication- PKI security – Quartz

• Identity Manager simplifies authentication management

• More info- Developer's Authentication Page

Page 4: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

ArcGIS Token authenticationSecurity and Authentication

• Works for ArcGIS services

• Every resource request includes a valid token

• Use UserCredentials with username and password to automatically generate token

• After successful authentication, UserCredentials is stored in the Identity Manager for reuse

Page 5: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

OAuth 2 authenticationSecurity and Authentication

• OAuth 2.0 is a standard way to handle authentication

• OAuth modes- User-based authentication – user has a named-user organization account- App-based authentication – app manages authentication

• Register your app with developers.arcgis.com to get Client ID and Client Secret- Client ID is needed for user-based and app-based authentication - Client secret is needed for app-based authentication, not user-based

Page 6: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

OAuth 2 authentication objectsSecurity and Authentication

• UserCredentials- Represents user credentials for accessing secured ArcGIS services and tasks.

• OAuthClientInfo- Contains properties for configuring OAuth info used by UserCredentials

• Qt’s WebView or WebEngineView- Provides a way for your app to display the OAuth login web page

• IdentityManager- Successful authentication is cached here

Page 7: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

Identity Manager Security and Authentication

Supports single sign-on:• Manages authentication challenges• Stores a credential cache• Credentials reused for subsequent requests

Page 8: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

Identity Manager – credential challengeSecurity and Authentication

QML:

Connections:Used for singletons

Connect to the Identity ManagerHandle the

challenge request signal

Page 9: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

Indentity Manager – credential challengeSecurity and Authentication

C++:

Provide credential information when challenged

Qt lambda connection syntax for connecting to the Identity Manager

Page 10: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

DemoAuthentication

Page 11: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

Handling Asynchronous TasksTask Handling

• C++ API uses signals and slots to communicate when events occur

• QML API has signal handlers, based on signals and slots, for QML types that emit signals (events)

• ArcGIS Runtime SDK leverages these to implement task-based framework

Page 12: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

Task-based FrameworkTask handling

1. Construct a task object

2. Provide parameters

3. Connect slots for completion signals

4. Execute task

5. Grab results in slot when task completes

Some Runtime tasks:o Locator (geocoding) o Routing o Geoprocessingo Geodatabase synco Findo Queryo Identify featureso Find closest facilityo Calculate service areao Tile cache generation

Page 13: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

Task handlingQML

Declare task:GeodatabaseSyncTask

QueryTask

LocatorTask

Hook up signal handler

Declare parameters with properties

Kick off the task with supplied parameters

Page 14: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

Task handlingC++

Kick off the task with supplied parameters

Construct task:GeodatabaseSyncTask

QueryTask

LocatorTaskHook up lambda SLOT connection

Create task parameters

Page 15: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

Components of Disconnected MappingDisconnected Mapping

• Basemap- ExportTileCacheTask- Offline data source is a tile cache for a specific extent and level of detail- Tile package consumed by ArcGISLocalTiledLayer

• Feature data- GeodatabaseSyncTask

• Network datasets and geocoding locators- LocalRouteTask- LocalLocator

Page 16: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

GeodatabaseSyncTaskDisconnected Mapping

Declare Geodatabase Sync Task

Provide URL to Feature Service

Hook up signal handler

Declare parameters with properties

Kick off the task with supplied parameters

Page 17: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

Demo

Disconnected mapping

Page 18: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

Aggregated Query ResultsAdvanced Visualization

• Aggregated query results- Aggregate fields in query results using out statistics

• Out Statistics- Definitions for one or more field-based statistics to be

calculated- Types: count, sum, min, max, avg, stddev- Define the field to be calculated

Page 19: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

Out Statistics example codeAdvanced Visualization

Query with an array of out statistics

Type of statistic

Calculate statistic on certain field Resulting

output field name

Page 20: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

ChartsAdvanced Visualization

• Qt Charts - A set of easy to use chart components- May be used in C++ and QML apps- Great for displaying query results, especially aggregated results

• QChart.js- QML bindings for Charts.js

- HTML5 Charts JavaScript library using the canvas

Page 21: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

DemoCharts

Page 22: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

Summary

• Security and authentication• Task handling• Disconnected mapping• Advanced visualization

Page 23: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

Related sessions

• Cross-platform UI for C++ Apps using QML at Quartz- Thursday 10:30 – 11:30 am in Demo Theater 3 (Oasis 1)

• Cross-platform Native App Development with Qt/QML- Thursday 2:30 – 3:30 pm in Demo Theater 3 (Oasis 1)

• Implementing Offline Editing Workflows with the Runtime SDKs

- Thursday 2:30 – 3:30 pm in Primrose B

• The Road Ahead: ArcGIS Runtime- Thursday 5:30 – 6:30 pm in Primrose A

Page 24: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache

Questions?

Page 25: Advanced Topics in Developing ArcGIS Apps with Qt · 2016. 3. 21. · ArcGIS Apps with Qt. with . Michael Tims and Lucas Danzinger – Esri. ... -Offline data source is a tile cache