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.
- Add data to map, globe or both. For instance, add wsiearth/wsiearth.tif as the globe backdrop to allow black graphics and callouts to be seen. You could add line features from UsaMajorHighways/usa_major_highways.shp.
- Select some features. Note: on globe, you must select multiple features using Shift+Ctrl; there is no extent selection.
- Right-click the display to zoom, pan, flash or create graphics, labels, or callouts of selected features.
- Note: on globe, graphics cannot be selected.
Additional information
Each custom command uses the HookHelper and GlobeHookHelper object to manage the hook passed to the ICommand.OnCreate event. In the ICommand.OnClick event, the IBasicMap.FeatureSelection method is used to return the feature selection of the IHookHelper.FocusMap or the IGlobeHookHelper.Globe. The geometry of each feature in the feature selection is added to an IArray.
The IHookActions.ActionSupportedOnMultiple property is used to determine whether the specified action (zoom, pan, flash, graphic, label, or callout) is supported with the geometries in the array. If the action is supported, the IHookActions.DoActionOnMultiple or IHookActions.DoActionWithNameOnMultiple method is called to perform the specific action. The DoActionWithNameOnMultiple method is used when performing a label or callout action. In addition to passing an array of geometries, an array of strings for labeling is also passed. In this case, that string array contains the value from the first field of each feature.
The custom commands are added to a ToolbarMenu using the IToolbarMenu.AddItem method and the ToolbarMenu's hook property is set to the ToolbarControl. In the MapControl and GlobeControl OnMouseDown event, the IToolbarMenu.PopupMenu method is used to display the menu when the right mouse button is clicked.
HookActions.cs | Form file. |
hookActionsCallout.cs | Class file. |
hookActionsFlash.cs | Class file. |
hookActionsGraphic.cs | Class file. |
hookActionsLabel.cs | Class file. |
hookActionsPan.cs | Class file. |
hookActionsZoom.cs | Class file. |
HookActions.vb | Form file. |
hookActionsCallout.vb | Class file. |
hookActionsFlash.vb | Class file. |
hookActionsGraphic.vb | Class file. |
hookActionsLabel.vb | Class file. |
hookActionsPan.vb | Class file. |
hookActionsZoom.vb | Class file. |
Download the files for all languages
See Also:
HookHelperGlobeHookHelper
IHookActions
Development licensing | Deployment licensing |
---|---|
Engine Developer Kit | Engine: 3D Analyst |
ArcGIS for Desktop Basic: 3D Analyst | |
ArcGIS for Desktop Standard: 3D Analyst | |
ArcGIS for Desktop Advanced: 3D Analyst |