FeatureShapes

Created:6/26/2002
Description:

The FeatureShapes code demonstrates how to use a Sketch Extension to change the behavior of the Sketch tool. The sample employs a dropdown box that allows the user to choose the type of polygon shape they would like to add to their feature class. Options are circle, square, and rectangle. As an example, if the circle shape is chosen, then the behavior of the sketch tool is to allow a circle to be entered with two mouse clicks. The first point being the center of the circle and second marking the outside edge. The circle shape is rubberbanded between the first and second mouse clicks.

How to use:
  1. Double click on the _Install.bat file found in the FeatureShapes directory. Executing this batch file will register the FeatShapesExt.dll and add the FeatShapes (Editor Extensions) and PolygonType (Mx Command) classes to the appropriate component categories.
  2. Start ArcMap and add at least one editable polygon layer to the map.
  3. Open up the customize dialog and drag the Polygon Type combo box from the Developer Samples category to a toolbar.
  4. Select the type of shape you would like to add from the drop down list.
  5. Set the target layer to a polygon feature class, set the task to Create Feature, and activate the Sketch tool.
  6. Use the sketch tool to add the designated type with two button clicks.
  7. If you want to switch back and forth between the User Defined type and one of the other types (Circle, Square, or Rectangle), then you will need to change the target layer to another feature class and then back to the one you want to add to. The Applies routine for the sketch extension is fired when the target layer is changed.

Application:
ArcMap

Requires: Editable polygon data

Difficulty: Advanced


Visual Basic
File Description
DispFeedback.cls Class implementing the IDisplayFeedback interface. This class defines the behavior of the Sketch tool for this extension.
FeatShapes.cls Class implementing the IExtension and IEditSketchExtension interfaces.
PolygonType.cls Class that creates the dropdown list of polygon shape types.
FeatShapesExt.vbp The project file for the FeatureShapes extension.
frmResources.frm Form containing the combo box used for the polygon shape types.


Key CoClasses: Editor, FeatureClass
Key Interfaces: IDisplayFeedback, IEditEvents, IEditLayers, IEditSketchExtension, IFeatureClass
Key Members: IDisplayFeedback::MoveTo, IEditEvents::OnVertexAdded, IEditLayers::CurrentLayer, IEditSketchExtension::Applies, IFeatureClass::FeatureType