
public abstract class MapTool : ArcGIS.Desktop.Framework.Contracts.Tool, System.ComponentModel.INotifyPropertyChanged
Public MustInherit Class MapTool Inherits ArcGIS.Desktop.Framework.Contracts.Tool Implements System.ComponentModel.INotifyPropertyChanged
This base class can be used to create tools to interactively identify and select features in the view or to create custom construction and editing tools. It provides virtual methods that can be overridden to perform actions when keyboard and mouse events occur in the map view, such as OnToolMouseDown and OnToolKeyDown. When overriding mouse and keyboard virtual methods if you need to execute any asynchronous code first set the handled property on the event arguments to true, override the corresponding "Handle...Async" method, and add your asynchronous code.
By setting the IsSketchTool property to true, the tool will create a sketch in the map view with a left mouse click. Use the SketchType property to set the geometry type of the sketch and use the SketchOutputMode property to specify whether the sketch geometry is in screen or map coordinates. Override OnSketchCompleteAsync to add behavior to the tool when the sketch is finished.
internal class ConstructionTool1 : MapTool { public ConstructionTool1() { IsSketchTool = true; UseSnapping = true; // Select the type of construction tool you wish to implement. // Make sure that the tool is correctly registered with the correct component category type in the daml SketchType = SketchGeometryType.Line; //Gets or sets whether the sketch is for creating a feature and should use the CurrentTemplate. UsesCurrentTemplate = true; // set FireSketchEvents property to true FireSketchEvents = true; } // ... }
System.Object
ArcGIS.Desktop.Framework.Contracts.PropertyChangedBase
ArcGIS.Desktop.Framework.Contracts.PlugIn
ArcGIS.Desktop.Framework.Contracts.Button
ArcGIS.Desktop.Framework.Contracts.Tool
ArcGIS.Desktop.Mapping.MapTool
Target Platforms: Windows 11, Windows 10