Buffer snap agent


Purpose
This sample demonstrates how to create a snapping agent based on a buffer around the points of the current editable point feature class. In this sample, a snapped vertex of a feature will be located no closer than 1000 map units from the point that is closest to the cursor. For electrical datasets, it is common to snap primary lines to the boundary of the symbol representing a pole. Use this snapping agent with an appropriate buffer distance (based on the radius of the pole symbol).

How to use

See How to use ArcGIS samples for help on 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.

  1. Start the sample application. The golf.shp shapefile in the sample data is loaded into the Map control.
  2. Zoom in to a golf course feature on the map.
  3. Use the Editor menu on the toolbar to start an edit session. The editing controls on the toolbar are enabled.
  4. Enable the Buffer Snap Agent command, and activate the Sketch tool.
  5. Hover over an existing feature. The editing circle snaps to a buffer around the feature.


Download the files for Java
editing/EditingApplication.java Entry point for the sample. It initializes the interop, sets up the user interface, and ensures licensing is valid.
editing/BufferSnapAgent.java Contains the code to implement a custom snap agent that snaps to a buffered distance around a feature.
editing/EnableSnappingCommand.java Contains the code to implement a command that enables and disables the custom snap agent.




Development licensing Deployment licensing
Engine Developer Kit Engine Runtime
ArcEditor
ArcInfo