How to use
See How to use ArcGIS samples for help on compiling, setting up the debugger, and running the sample. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.
- Build and run the sample.
- Start editing.
- Zoom in polygon features to cut.
- Click the Cut Polygons Without Selection task.
- Click the Sketch tool.
- Cut a polygon (or polygons) in two or more places with the Sketch tool.
- Finish the sketch to perform the cut.
- Stop editing. See the following illustration:
Additional information
The edit task is created by implementing the IEngineEditTask interface. Compiling this sample registers the edit task in the ESRI Engine Edit Tasks component category which is used to populate the ControlsEditingTaskToolControl at runtime.
The position of the task in the ControlsEditingTaskToolControl list is controlled using the IEngineEditTask.GroupName property and the display name using the IEngineEditTask.Name property.
The IEngineEditTask.Activate method is called when the end user selects the edit task in the ControlsEditingTaskToolControl. The Activate method is used to set up listeners to the following IEngineEditEvents:
- OnTargetLayerChanged fires when the target layer changes.
- OnCurrentTaskChanged fires when selected task changes.
These event listeners set the IEngineEditSketch.GeometryType to null if the target layer does not have a polygon geometry type, thereby disabling the Sketch tool.
The IEngineEditTask.OnFinishSketch method is used to cut the intersected features using the IFeatureEdit.Split method, passing in the geometry from the digitized sketch as an argument. Edits to features are made in a single edit operation and added to the operation stack.
CutPolygonsWithoutSelection\CutPolygonsWithoutSelectionEditTask.cs | Implementation of the edit task. |
Application\EditingForm.cs | The main form for the application. |
CutPolygonsWithoutSelection\CutPolygonsWithoutSelectionEditTask.vb | Implementation of the edit task. |
Application\EditingForm.vb | The main form for the application. |
Download the files for all languages
Development licensing | Deployment licensing |
---|---|
Engine Developer Kit | ArcGIS for Desktop Basic |
ArcGIS for Desktop Standard | |
ArcGIS for Desktop Advanced | |
Engine |