Azimuth Distance Context Menu Item


The ArcMap Editor makes use of two context menus, the 'Sketch Tool Context Menu' and the 'Sketch Context Menu.' You can add your own custom menu items to either of these menus. This tutorial will create a new item for the Sketch Tool Context Menu called 'Azimuth/Distance'. This will allow you to add Edit Sketch segments in a similar way to the 'Angle/Length' menu item by using the north azimuth survey system. Since the operation does not require direct interaction with features on the map, only ICommand is implemented. This sample also shows how to make use of the ISketchTool interface.

How to use:
  1. Browse and select the AzimDistance.dll using the 'Add From File' button on the Customize dialog.
  2. From the 'Developer Samples' commands category, add the 'Azimuth/Distance...' command to the Sketch tool context menu.
  3. The new context menu item can now be used for entry of survey azimuths. For example, instead of typing in 88.5 degrees in the Cartesian coordinate system, you would use the azimuth equivalent of 1.3000, representing 1 degree, 30 minutes, and zero seconds. (Azimuths are measured positive clockwise, and 0 degrees represents north.)


Requires: An edit session.

Difficulty: Intermediate

Visual Basic
File Description
AzimDist.cls Class file demonstrating how to create a sketch tool context menu item.
AzimDistance.vbp The project file for the sample sketch tool context menu item.
AzimDistance.dll The compiled project.

Key CoClasses: Editor, SketchTool
Key Interfaces: IEditSketch, IEditLayers, IEditor, ISketchTool, IConstructPoint, ILine, ICoordinateDialog
Key Members: IEditSketch::LastPoint, IEditSketch::AddPoint, IEditLayers::IsEditable, IEditLayers::CurrentLayer, ICoordinateDialog::DoModal, ILine::PutCoordinates, ILine::Angle, IConstructPoint::ConstructAngleDistance, ISketchTool::Location