Buffer Tool Control

Description:

This sample implements the ICommand and IToolControl interface and is intended to be used within the ArcMap application. This control provides a slider bar that is used to buffer the selected features. The individual buffers are unioned together and the resultant polygon is displayed on the screen for visual feedback. The result polygon is drawn with an XOR pen. Using an XOR pen means that drawn once the polygon appears on screen, but drawn a second time it disappears. This means that by successively drawn the polygon the polygon is visually updated rapidly without the need for a complete screen redraw.

How to use:
  1. Start MS Visual Basic 6 and open the project file BufferToolControl.vbp. Ignore any warnings about not being able to set version compatibly. This is due to the DLL not being present when the project is loaded.
  2. The project must be compiled to a DLL. From the File Menu Select Make. This will create the DLL in the same directory as the project.
  3. Now that the DLL is made the version compatibility must be set. On the Project menu select the Properties menu item and then on the Component tab set the Version Compatibility to be Binary and select the newly created DLL file.
  4. Start ArcMap and load some data into the map. Display the Customize dialog and select the Commands tab. Select the appropriate document to save the customizations in and then press the Add from file... button. Using the file selection dialog, select the newly compiled DLL and press OK. Press OK on the information dialog telling you what class has been added.
  5. In the list of categories scroll down to the Category Samples and select this category.
  6. Select the newly added Buffer command from the Commands list and drag it onto a toolbar.
  7. Close the Customize dialog.
  8. The Sample buffer tool control is now ready ready for testing. Interact with the command and note the various behavior and properties of the tool.

Application:
ArcMap

Difficulty: Advanced


Visual Basic
File Description
clsBufferToolControl.cls Class file that implements the COM Server.
frmSlider.frm B Form file holding resources used within project.
BufferToolControl.vbp VB Project File for sample.


Key CoClasses: Dataset, Polygon, Polyline
Key Interfaces: IDisplayTransformation, IEnumFeature, IDisplayTransformation, IEnumFeature, IRGBColor, ITopologicalOperator