In this section:
Commands appear in numerous places in the editor framework, providing a large part of the editors interactive functionality; examples of editor commands include the Buffer, Intersect, and Union commands. As with any commands, an edit command does not require the user to interact with the Map after being clicked.
Commands do not require you to interact with the map; instead, commands often rely on the current state of the map.
The main editor commands reside on the Editor Menu, for example, the Start Editing and Stop Editing commands. The majority of the remaining commands reside on one of the editors context menus; for example, the Delete Vertex and the Finish Sketch commands.
All the items on the Editing menu, the Sketch Tool context menu, and the Edit Sketch context menu are implemented as commands. Most of these commands perform an edit operation, but a few, such as Snapping, open a dialog box.
Like any other ArcGIS command, editing commands must implement the ICommand interface, although many commands also sink the outbound IEditEvents interface (or the IEditEvents2, IEditEvents3 interfaces).
Editor commands are typically registered to the ESRI Mx Commands component category. To facilitate developers, the editing framework also supports several additional component categories for editing commands:
A command registered in one of these categories will automatically appear in its associated context menu. This prevents users from having to set up their customized editing environment manually.
Seen below are the context menus for the Sketch tool, the edit sketch, and the Edit tool.
The editing framework additionally has numerous context menus for fixing topology errors. Each type of topology violation has a context menu and a corresponding component category that maintains the list of commands on the menu. You can automatically add new commands to a particular context menu by registering the command in the appropriate component category. For example, a custom command that resolves a 'Point Inside Area' topology error should be registered in the ESRI Point Inside Area Error Commands component category. There are too many component categories for topology errors to list here but they all have names that start with one of the following: ESRI Area, ESRI Line, or ESRI Point; below you can see a number of the component categories for Area error commands.
You can add commands to many of the editing and topology menus and toolbars by registering your commands to the appropriate component categories.
You can see an example of an editor command, which performs a spatial operation upon two selected features in the Difference Command Example. Other examples of editor commands you may want to create include:
Tools are nearly the same as commands, except they require you to interact with the map canvas after they have been clicked. For example, the Split tool waits for you to select a point on the selected polyline feature, then breaks it into two features.
Other edit tools include the sketch tools, the Edit tool, and the Rotate tool.
To better illustrate the difference between a command and a tool, look at the Move command versus a tool that moves features. Once clicked, the Move command prompts you with a dialog box for a delta x and a delta y; after these values have been entered, the selected features are moved. Aside from entering values in a dialog box, you don't interact with the ArcMap canvas at all. In contrast, to reposition features with a move tool, such as the Edit tool, you must interactively drag selected features across the display.
Edit tools typically reside on the Editor toolbar. General editing tools are registered in the ESRI MxCommands component category, and they must implement both the ICommand and ITool interfaces.
The sketch tools are a specific type of editing tool. Sketch tools are always used to create an edit sketch which, when completed, is passed onto the current task to perform a specific operation such as: creating a new feature, modifying an existing feature, or simply selecting features. You can create a custom sketch tool and have it appear on the sketch tool palette by registering the tool in the ESRI SketchTool Palette Commands component category.
You can see an example of an editor tool that splits an existing feature at a mouse-click location in the Split at Intersection Tool Example.
See Also Extending the Editing Framework, Difference Command Example, and Split At Intersection Tool Example.