How to use
See How to use ArcGIS samples for help on compiling, setting up the debugger, and running the sample.
Data has been provided for your use with this sample. It can be found at
<Your ArcGIS Developer Kit Install directory>/Samples/data/USAMajorHighways/usa_major_highways.
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 on a polyline feature that you want to reshape.
- Select this feature with the Edit tool.
- Select the Reshape Polyline edit task from the Edit Task Tool control.
- Using the Sketch tool, digitize a new line that intersects the selected feature in at least two places.
- Finish the sketch to perform the reshape.
- Stop editing and save edits to persist changes. 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 within 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.
- OnSelectionChanged—Fires when the feature selection changes.
- OnCurrentTaskChanged—Fires when the selected task changes.
These event listeners set the IEngineEditSketch.GeometryType to null if the following conditions are met, thereby, disabling the Sketch tool:
- The target layer does not have a polyline geometry type.
- More than one feature is selected in the target layer.
The IEngineEditLayers.TargetLayer property on the EngineEditor singleton is used to return to the target layer selected in the ControlsEditingTargetToolControl. The IEngineEditTask.OnFinishSketch method is used to reshape the geometry of the selected feature using the IPolyline.Reshape method, passing in a path created from the digitized sketch as an argument. The task calls the IFeature.Store method within an edit operation to commit the changes.
EngineEditTask/ReshapePolylineEditTask.cs | Class file. |
Application/EditingForm.cs | Form file. |
EngineEditTask/ReshapePolylineEditTask.vb | Class file. |
Application/EditingForm.vb | Form file. |
Download the files for all languages
See Also:
EngineEditorClassDevelopment licensing | Deployment licensing |
---|---|
Engine Developer Kit | Engine |
ArcGIS for Desktop Basic | |
ArcGIS for Desktop Standard | |
ArcGIS for Desktop Advanced |