Generalize Tool Control


This sample implements the ICommand and IToolControl interfaces and is intended to be used within the ArcMap application. This control provides a slider bar that can be used to Generalize the geometries of the selected features. These edits are made within edit operations, hence editing must have commenced on the data for the tool to work. Changes made to features can be un-done like other edit operations. The slider controls the offset argument to the Generalize algorithm.

How to use:
  1. Start MS Visual Basic 6 and open the project file LineGeneralizeControl.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 Line Generalize command from the Commands list and drag it onto a toolbar.
  7. Close the Customize dialog.
  8. The Sample line Generalizing tool control is now ready ready for testing. Interact with the command and note the various behavior and properties of the tool.


Difficulty: Intermediate

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

Key CoClasses: Dataset, Editor, Polygon, Polyline
Key Interfaces: IPolyCurve