Post on 12-Apr-2020
transcript
ArcGIS Pro SDK for .NET:
Beginning Pro Customization and ExtensibilityUma Harano
Wolf Kaiser
Session Overview
• The Pro SDK supports Two Main Extensibility patterns
- ArcGIS Pro Module Add-ins
- ArcGIS Pro Managed Configurations
• Declarative Markup for Pro UI Elements: DAML
- How to change the ArcGIS Pro UI with your Add-in
• New (in 2.4) Pro SDK Extensibility patterns
- ArcGIS Pro CoreHost Application
- ArcGIS Pro Plugin (Datasource)
What is the ArcGIS Pro SDK for .NET?
• ArcGIS Pro SDK for .NET extends ArcGIS Pro using .NET
• Extensibility patterns provided by Pro SDK:
- ArcGIS Pro Module Add-ins
- ArcGIS Pro Managed Configurations
- ArcGIS Pro Plug-in Datasource (new in Pro 2.3)
- ArcGIS Pro CoreHost Application
• Includes Visual Studio item templates for most UI elements
• Installation is integrated with Visual Studio Marketplace
• ArcGIS Pro API comes with ArcGIS Pro out-of-box
- File based references (No Global Assembly Cache)
What is the ArcGIS Pro SDK for .NET?
• Noteworthy ArcGIS Pro SDK features and patterns
• 64-bit platform
• UI based on WPF (Windows Presentation Foundation) / .NET
4.6.1 +
• MVVM pattern (Model-View-ViewModel)
• Asynchronous Patterns: Multiple threads
What is an ArcGIS Pro add-in ?
• Extends ArcGIS Pro through:
- Buttons
- Tools
- Dockpanes
- Embeddable control
- ..
• Packaged within a single, compressed
file with an .esriaddinX file extension
- c:%Homepath%\Documents\ArcGIS\AddIns\ArcGISPro
What are the ArcGIS Pro Add-in core components?
• Declarative-based framework to define the UI elements
- Declarative framework is defined in a config.daml file
- XML formatted, contains ArcGIS Pro framework elements (buttons,
dockpane, galleries) and Add-in UI elements
• The Module class
- Hub and central access point for each add-in
- Similar to the Extension object used in the ArcObjects 10.x framework
- Singletons instantiated automatically by the Framework
Demo: Add-in
<ArcGIS defaultAssembly="WorkingWithDAML.dll" defaultNamespace="WorkingWithDAML"xmlns="http://schemas.esri.com/DADF/Registry"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://schemas.esri.com/DADF/Registryfile:///C:/Program%20Files/ArcGIS/Pro/bin/ArcGIS.Desktop.Framework.xsd">
<AddInInfo id="{c6226a24-d69b-46c6-b5e7-9eee4ddad45d}" version="1.0" desktopVersion="1.1.2850">…</AddInInfo><modules>
<insertModule id="WorkingWithDAML" className="Module1" autoLoad="false" caption="Module1"><tabGroups>
<!--The new Tab Group is created here--><tabGroup caption="Example State Solution" id="working_with_DAML_ExampleStateTabGroup">
<color A="255" R="238" G="170" B="90" /><borderColor A="0" R="251" G="226" B="195" />
</tabGroup></tabGroups>
Declarative Markup for Pro UI Elements: DAML
• Add-Ins use “Declarative Markup” (DAML) language for UI Elements
- Buttons, Dockpane, Galleries, Property Sheets, Tools, …
• DAML uses XML Syntax - stored in a Config.daml file
• Using DAML, you can add, modify, delete any User Interface element
• Pro also uses DAML: <Install Location>\bin\Extensions folder
Declarative Markup for Pro UI Elements: DAML
• DAML is transactional and is processed in the order the Pro Extension or Add-in is loaded
- 3 distinct actions: Insert, Update, and Delete
- The type of action is determined by the element name: updateModule, updateGroup, deleteButton
<updateModule refID="esri_mapping"><groups>
<updateGroup refID="esri_mapping_navigateGroup"><deleteButton refID="esri_mapping_bookmarksNavigateGallery“ /><insertButton refID="working_with_DAML_ToggleStateButton" />
</updateGroup></groups>
</updateModule>
In the DAML transactional
model the ‘last’
transaction
wins !
How to use DAML to change the UI of other Add-ins or existing Pro UI
• Ensuring the proper DAML processing order
• If your Add-in changes another Add-in or a Pro Extension
- Use the Dependencies tag in your DAML
- Add-in Example that changes the Mapping Extension has ‘dependency’ on ADMapping.daml
- Add-in Example that changes another Add-in (using the “other” Add-in’s AddInInfo tag’s id
attribute as identifier)
<dependencies><dependency name="ADMapping.daml" />
</dependencies>
<dependencies><dependency name="{c1a60c8f-2f6f-4198-a5d6-ea964ebf678c}" />
</dependencies>
How to use existing Pro UI elements in Your Add-in
• Use any existing ArcGIS Pro framework elements on your Add-in tab
including Buttons, Tools, Galleries
• Find the Unique Element Id of any existing ArcGIS Pro Control and use the Id
in your config.daml markup to add, delete, modify that Element
• Example: Add Pro’s Navigate Bookmarks button to my Add-in toolbar
- button tag references existing Element ID:
esri_mapping_bookmarksNavigateGallery
<group id="HookingCommands_Group1" caption="Hooking Commands" keytip="G1"><button refID="esri_mapping_bookmarksNavigateGallery" />
</group>
How to find Exiting ArcGIS Pro Element Ids
• SDK Help: ArcGIS Pro DAML ID Reference
https://github.com/Esri/arcgis-pro-sdk/wiki/ArcGIS-Pro-DAML-ID-Reference
• Pro Generate DAML Ids tool in Visual Studio
- Allows Intellisense to find Ids:
i.e. DAML.Button.esri_mapping_addDataButton
• ArcGIS Pro ‘Customize the
Ribbon’: Show IDs option
WorkingWithDAML project
Demo: Add-in
using ArcGIS Pro
Buttons, States &
Conditions
What is an ArcGIS Pro Managed Configuration?
• Includes all functionality of an add-in plus- Change the application title and icon
- Change the application splash, start page, and about page
- Optionally customize and streamline the UI (the Pro Ribbon) for a specific workflow
• Packaged within a single, compressed file with a .ProConfigX file extension
- c:%Homepath%\Documents\ArcGIS\AddIns\ArcGISPro\Configurations
Default start page Custom start page
What is an ArcGIS Pro Managed Configuration?(Continued)
• Running an ArcGIS Pro Managed Configuration
- Use the ArcGIS Pro “/config” command-line option
- Only one configuration can run per instance of Pro
• ConfigurationManager class
- Defined in DAML (generated automatically by the template)
- Provides a set of methods by which a developer can override “that” aspect of Pro
public abstract class ConfigurationManager {protected internal virtual Window OnShowSplashScreen();protected internal virtual FrameworkElement OnShowStartPage();protected internal virtual FrameworkElement OnShowAboutPage();...
C:\ArcGIS\bin\ArcGISPro.exe /config:Acme
•
Demo:
Configurations
What is an ArcGIS Pro CoreHost Application?
• Stand-alone application with a subset of Pro Assemblies
- ArcGIS.CoreHost assembly – API to manage CoreHost functions
- ArcGIS.Core assembly – Includes Geodatabase and Geometry classes
• CoreHost Applications have 64-bit access to
- Geodatabase and
- Geometry classes used by ArcGIS Pro
• CoreHost Applications can be
- Windows Console application
- WPF application
How to create an ArcGIS Pro CoreHost Application
• CoreHost Project Template for Console 64 bit application
(optional WPF standalone application)
• Use COM threading model single-threaded apartment (STA)
• ArcGIS Pro has to be installed & licensed
• Call Host.Initialize ()
• C:\Data\Admin\AdminData.gdb
Demo: CoreHost
Sample App
What is an ArcGIS Pro Plugin DataSource?
• The Plugin Datasource framework allows developers to make
custom datasources available for use in Pro
- Access in Pro is read-only
- Access is in form of tables or feature classes
- Access is file based (my data source is a file)
• ArcGIS Pro supports data from a large variety of data sources and
formats from shape files to Oracle databases, but many are not
supported
• Plugin DataSources allow acces to other data sources like relational
databases such as MySQL, non-relational databases such as MongoDB,
and a myriad of other proprietary or obscure file-based data stores
Examples of Custom data source we will access in upcoming demos
• ArcGIS Personal Geodatabase (ArcMap / ArcCatalog)
- A personal geodatabase is a Microsoft Access database that can
store, query, and manage both spatial and nonspatial data
• Jpg photos with GPS metadata
- Smart phone and digital cameras have the option to capture GPS
information when a photo is taken
• Gpx File data
- GPX (the GPS eXchange Format) is a data format for exchanging GPS
data between programs and implemented by many GPS tracking
devices
Providing a plugin datasource for your custom data
• First a look at how basic high-level data access objects work
in ArcGIS Pro:
- Connector defines a connection to a data source
- Used to create a datastore
- Datastore is a specific instance of a data source
- Used to open one or more tables or feature classes
- Tables or Feature classes contain data rows
- Can be queried and return a cursor
- Cursors can be used to iterate through data rows
Implementing plugin datasource for your custom data
• The Plugin Project Template will stub out all code for you
• Create three concrete classes that inherit from these API classes
- PluginDatasourceTemplate
- Used to manage one or more tables or feature classes
- PluginTableTemplate
- Can be queried and return a cursor
- PluginCursorTemplate
- Data Rows are returned by iterating using a cursor
• Update config.daml to register your Plugin Datasource with ArcGIS Pro
<ArcGISPro><PluginDatasources><PluginDatasource id="ProMdbPluginDatasource" class="ProMdbPluginDatasourceTemplate" />
</PluginDatasources></ArcGISPro>
Using a custom plugin datasource in ArcGIS Pro
• Define a connection to a data source instance
- Use PluginDatasourceConnectionPath with the PluginDataSource name and the
path to the data source file
• Use the connection to create a datastore to your data source instance
• Use the datastore to access tables and feature classes
var conMdb = new PluginDatasourceConnectionPath("ProMdbPluginDatasource", filePathUri);QueuedTask.Run(() =>{
using (var pluginMdb = new PluginDatastore(conMdb)){
foreach (var tableName in pluginMdb.GetTableNames()){
using (var fc = pluginMdb.OpenTable(tableName) as FeatureClass){
//Add as a layer to the active map or sceneLayerFactory.Instance.CreateFeatureLayer(fc, MapView.Active.Map);
}}
}});
Demo: Plugin
DataSource SampleC:\Data\PluginData\TestPerson
alGdb\TestPGdb.mdb
Better integration of custom plugin datasource in ArcGIS Pro
• A better user experience is:
- Custom content is integrated both into the Pro
catalog and its browse experience
• Use the ‘Custom Project Item’ item template in
your Add-in
- Pairing a custom item with a plugin datasource
allows your custom content to be integrated into
the Pro catalog
Demo: Plugin
DataSource Sample
ArcGIS Pro SDK for .NET Sessions
Date Time Session Location
Tue, July 0910:00 am – 11:00 am Demonstrating Pro Extensibility with Add-Ins SDCC - Room 17 B
1:00 pm - 2:00 pm An Introduction SDCC - Room 02
Wed, July 1010:00 am - 10:45 am Getting Started Expo Demo Theater 08
1:15 pm - 2:00 pm Solution Configurations Expo Demo Theater 08
Thu, July 11 8:30 am - 9:30 am Demonstrating Pro Extensibility with Add-Ins SDCC - Room 31 A
ArcGIS Pro – Road Ahead Sessions
Date Time Session Location
Tue, July 09 4:00 pm – 5:00 pm ArcGIS Pro: The Road Ahead SDCC - Ballroom 06 B
Thu, July 11 1:00 pm - 2:00 pm ArcGIS Pro: The Road Ahead SDCC - Ballroom 06 D
Fri, July 12 9:00 am - 10:00 am ArcGIS Pro: The Road Ahead SDCC - Ballroom 06 F
Show this after your presentation has ended.