文件最后提交记录最后更新时间
6 年前
6 年前
10 年前
6 年前
6 年前
9 年前
README

Editing using a custom form

This sample demonstrates how to hide the complexity of editing in an ArcGIS Engine application by presenting a simple editing interface to users. It also shows how to impose business rules on the editing process by listening to ArcGIS Engine edit events.

Language:              C#, VB
Subject:               Controls
Organization:          Esri, http://www.esri.com
Date:                  10/17/2019
ArcObjects SDK:        10.8
Visual Studio:         2017, 2019
.NET Target Framework: 4.5

Resources

Usage

  1. Compile and run the sample.
  2. Click the launch editor form command (blue square, white E).
  3. Click Edit on the EditorForm to start editing the Highways layer.
  4. On the EditorForm, try the Create, Modify, and Reshape tools.
  5. Perform an action to intersect a lake, for example, digitize a new road through a lake (the application should not allow you to do this).
  6. Try the undo and redo functionality.
  7. Click Finish to stop editing (save or discard edits). See the following screen shot:

Screen shot of the EditorForm used to edit the Highways layer.
Screen shot of the EditorForm used to edit the Highways layer.

Additional information

Applications that allow users to edit data often attempt to simplify the editing process and maintain data integrity through business rules. The following shows how this sample achieves this in an ArcGIS Engine application:
 
Presenting a simple UI for editing
The MainForm form provides viewing capabilities for the application and the EditorForm (shown in the previous screen shot) presents a simple UI dedicated to editing the Highways layer.  
 
To start an edit session, click the E command (EditCmd) on the MainForm, then click Edit in the EditorForm. The target layer is set to Highways using the IEngineEditLayers.SetTargetLayer method. Clicking one of the editing buttons (Create, Modify, and Reshape) adds an appropriate ToolbarControl to the flowLayoutPanel1 and sets the edit task using the IEngineEditor.CurrentTask property. Each ToolbarControl contains out-of-the-box editing commands or sample commands. 
 
Buddying controls hosted on separate forms
Buddying the ToolbarControls hosted on the EditorForm with the axMapControl1 on the MainForm has been achieved through the use of the EditHelper class.
 
Imposing business rules on the editing process
The EditorForm listens to the IEngineEditEvents.OnSketchModified event to check whether an  edit is valid or invalid. A spatial query is performed in the IsHighWaysEditValid function to determine whether the highway feature being edited intersects the Lakes layer. If the function returns false, the edit is rolled back by calling the IOperationStack.Undo method—an Invalid Edit warning appears on the EditorForm.

See Also

Sample: Custom reshape polyline edit task
Sample: Custom vertex editing commands


Licensing

Development licensing Deployment licensing
Engine Developer Kit Engine
ArcGIS Desktop Basic
ArcGIS Desktop Standard
ArcGIS Desktop Advanced