arcgis pro sdk for .net: advanced editing with focus on ......advanced editing with focus on ui...

of 34 /34
Sean Jones Narelle Chedzey ArcGIS Pro SDK for .NET Advanced Editing with Focus on UI Customization

Author: others

Post on 29-Mar-2021

7 views

Category:

Documents


0 download

Embed Size (px)

TRANSCRIPT

  • Sean JonesNarelle Chedzey

    ArcGIS Pro SDK for .NETAdvanced Editing with Focus on UI Customization

  • Session Overview

    • Create construction tool• Create construction tool with tool options• Create an editing tool

    - Using the sketch- Placing in the modify features pane- Providing a UI for the tool

  • • Construction tools create features- Appear under each feature template in the Create Features Pane

    - Use the sketch to create a geometry- Examples: Line, Polygon, Trace, Circle

    • Editing tools- Appear on the ribbon or the Modify Features Pane

    - Use the sketch to provide geometry for an EditOperation- Examples: Split, Reshape

    Editing customizations

  • Construction Tool – Implementation• Implement using the Pro SDK “Construction Tool” Item Template:

  • • Change construction tool type by modifying the DAML categoryRefID (geometry type of destination feature class).

    • Supported categories are- esri_editing_construction_point- esri_editing_construction_polyline- esri_editing_construction_polygon- esri_editing_construction_multipoint- esri_editing_construction_annotation- esri_editing_construction_dimension

    Construction Tool – config.daml

    Default construction tool.

  • Construction Tool – tool file

    internal class SimpleConstructionTool : MapTool{

    public SimpleConstructionTool (){

    IsSketchTool = true;UseSnapping = true;SketchType = SketchGeometryType.Point;

    }

    /// Called when the sketch finishes. This is where we will create the sketch operation and then execute it.protected override Task OnSketchCompleteAsync(Geometry geometry){

    if (CurrentTemplate == null || geometry == null)return Task.FromResult(false);

    // Create an edit operationvar createOperation = new EditOperation();createOperation.Name = string.Format("Create {0}", CurrentTemplate.Layer.Name);createOperation.SelectNewFeatures = true;

    createOperation.Create(CurrentTemplate, geometry);return createOperation.ExecuteAsync();

    }}

  • • In the Config.daml, tool is registered in the relevant construction tool category via categoryRefID

    - Adds your tool to the correct Create Pane construction tool palettes- Category should match your destination feature class.

    • Supported categories are- esri_editing_construction_point, esri_editing_construction_polyline- esri_editing_construction_polygon, esri_editing_construction_multipoint- esri_editing_construction_annotation, esri_editing_construction_dimension

    Construction Tool – Palette Placement

  • • In the Config.daml, tool is registered in the relevant construction tool category via categoryRefID

    - Adds your tool to the correct Create Pane construction tool palettes- Category should match your destination feature class.

    • Supported categories are- esri_editing_construction_point, esri_editing_construction_polyline- esri_editing_construction_polygon, esri_editing_construction_multipoint- esri_editing_construction_annotation, esri_editing_construction_dimension

    Construction Tool – Palette Placement

  • • In the Config.daml, tool is registered in the relevant construction tool category via categoryRefID

    - Adds your tool to the correct Create Pane construction tool palettes- Category should match your destination feature class.

    • Supported categories are- esri_editing_construction_point, esri_editing_construction_polyline- esri_editing_construction_polygon, esri_editing_construction_multipoint- esri_editing_construction_annotation, esri_editing_construction_dimension

    Construction Tool – Palette Placement

  • • Control placement on the palette with a child element in the Config.daml

    - Add a placeWith=daml_id, insert=before | after attribute- Default placement is “after” if no insert attribute is specified.

    Construction Tool – Palette Placement

  • • Control placement on the palette with a child element in the Config.daml

    - Add a placeWith=daml_id, insert=before | after attribute- Default placement is “after” if no insert attribute is specified.

    Construction Tool – Palette Placement

  • • Control placement on the palette with a child element in the Config.daml

    - Add a placeWith=daml_id, insert=before | after attribute- Default placement is “after” if no insert attribute is specified.

    Construction Tool – Palette Placement

  • Construction Tool

    Demo

  • • Custom UI for providing configurable “settings” for use with your construction tool edits

    - Eg default buffer distance, proximity distance, use of overrides, etc.- Hosted on the Active Template pane when its related construction tool(s) is/are

    activated*

    - Implement using an Embeddable Control (Pro SDK item template)

    - *And/or on Template Properties Dialog to persist custom settings in the template

    Construction Tool – Tool Option UI

  • • Procedure- Add an Embeddable Control (run the Pro SDK item template)- Register Embeddable control in the esri_editing_tool_options category in the Config.daml- Implement the UI (standard WPF)- Implement IEditingCreateToolControl (on the embeddable control)

    Construction Tool – Tool Option UI

  • • Add an EmbeddableControl. • Update daml

    - embeddable control is registered with "esri_editing_tool_options"- Add toolOptionsID attribute to content tag for tool

    Construction Tool with Options

    Create a polygon with a fixed buffer.

  • • ViewModel file- Implement IEditingCreateToolControl

    - InitializeForActiveTemplate, InitializeForTemplateProperties methods provide a ToolOptionsvariable – collection of key-value pairs for option values

    Construction Tool with Options

    private ToolOptions ToolOptions { get; set; }

    /// /// Called just before ArcGIS.Desktop.Framework.Controls.EmbeddableControl.OpenAsync/// when this IEditingCreateToolControl is being used within the ActiveTemplate pane./// /// true if the control is to be displayed in the ActiveTemplate pane.. False otherwisebool IEditingCreateToolControl.InitializeForActiveTemplate(ToolOptions options) {// assign the current optionsToolOptions = options;// initialize the viewInitializeOptions();return true; // true do show me in ActiveTemplate; false don't show me

    }

  • • ViewModel file- View elements bind to properties in the ViewModel which add or update values to

    ToolOptions

    Construction Tool with Options

    // binds in xamlprivate double _buffer;public double Buffer {get { return _buffer; }set {

    if (SetProperty(ref _buffer, value)) {_isDirty = true;// add/update the buffer value to the tool optionsif (!ToolOptions.ContainsKey(BufferOptionName))

    ToolOptions.Add(BufferOptionName, value);else

    ToolOptions[BufferOptionName] = value;// ensure options are notifiedNotifyPropertyChanged(BufferOptionName);

    }}

    }

  • • Tool file- Get options from the CurrentTemplate and use within the OnSketchCompleteAsync

    Construction Tool with Options

    private ReadOnlyToolOptions ToolOptions => CurrentTemplate?.GetToolOptions(ID);

    private double defaultBuffer = 20;private double BufferDistance => (ToolOptions == null) ? defaultBuffer :

    ToolOptions.GetProperty("BufferDistance", defaultBuffer);

    protected override Task OnSketchCompleteAsync(Geometry geometry) {// Create an edit operation...

    // create the buffered geometryGeometry bufferedGeometry = GeometryEngine.Instance.Buffer(geometry, BufferDistance);// Queue feature creationcreateOperation.Create(CurrentTemplate, bufferedGeometry);

    // Execute the operationreturn createOperation.ExecuteAsync();

    }

  • Construction Tool – Tool Options

    Demo

  • Editing Tools – Using the Sketch• Map Tool (aka “Sketch Tool”) used for editing features

    - By convention, hosted on the ribbon- Uses the sketch geometry to edit features

    - Integrate in Edit Operation, Inspector- Can host on the Modify Features Dockpane via Config.daml

  • • Use Visual Studio Map Tool template• To add the editing tool to the Modify Features pane

    - Set CategoryRefID attribute to “esri_editing_CommandList”- Set group attribute in content element

    Editing Tool

  • • To add the editing tool to the Edit Tools gallery favorites- Set values for gallery2d and gallery3d attributes in content element

    Editing Tool

  • • MapTool class has properties for specifying WPF User controls- ControlID – sets the DAML-ID for an Embedded control- EmbeddableControl – retrieves the ViewModel

    Editing Tool – Embedding UI into Modify Features pane

  • • Add an ArcGIS Pro Embeddable Control template in your add-in.- Updates the “esri_embeddableControls” category in Config.daml- DAML follows Pro MVVM pattern

    • Set the ControlID property to the id.

    Editing Tool – Embedding UI into Modify Features pane

    public UseInspectorTool() : base(){

    IsSketchTool = true;SketchType = SketchGeometryType.Rectangle;SketchOutputMode = SketchOutputMode.Map;ControlID = "InspectorTool_AttributeControl";

    }

  • • Access the ViewModel and set or retrieve properties.

    Editing Tool – Embedding UI into Modify Features pane

    private void UpdateEmbeddableControl(string someText) {if (_vm == null) {

    _vm = this.EmbeddableControl as SketchToolControlViewModel;}

    vm.TheText = someText;}

  • Edit Operations – Relationships

    • New at 2.5• Use EditOperation.Create(RelationshipDescription) to create a relationship between

    an origin and destination row.- Previously would use Core.Data API RelationShipClass.CreateRelationship()

  • Editing tool

    Demo

  • • Create construction tool• Create construction tool with tool options• Create an editing tool

    - Using the sketch- Placing in the modify features pane- Providing a UI for the tool

    Session Summary

  • ArcGIS Pro SDK for .NETBeginning Editing with Focus on EditOperation

    • Questions?

    - https://github.com/esri/arcgis-pro-sdk/wiki/tech-sessions#2020-palm-springs

    https://github.com/esri/arcgis-pro-sdk/wiki/tech-sessions#2020-palm-springs

  • Presenter Names

    Presentation Title

  • Section SubheadSection Header

  • Presenter(s)Demo Title

    ���ArcGIS Pro SDK for .NET�Advanced Editing with Focus on UI CustomizationSession OverviewEditing customizationsConstruction Tool – ImplementationConstruction Tool – config.damlConstruction Tool – tool fileConstruction Tool – Palette PlacementConstruction Tool – Palette PlacementConstruction Tool – Palette PlacementConstruction Tool – Palette PlacementConstruction Tool – Palette PlacementConstruction Tool – Palette PlacementConstruction ToolConstruction Tool – Tool Option UIConstruction Tool – Tool Option UIConstruction Tool with OptionsConstruction Tool with OptionsConstruction Tool with OptionsConstruction Tool with OptionsConstruction Tool – Tool OptionsEditing Tools – Using the SketchEditing ToolEditing ToolEditing Tool – Embedding UI into Modify Features paneEditing Tool – Embedding UI into Modify Features paneEditing Tool – Embedding UI into Modify Features paneEdit Operations – RelationshipsEditing toolSession SummaryArcGIS Pro SDK for .NET�Beginning Editing with Focus on EditOperationPresentation TitleSlide Number 40Section HeaderDemo Title