com.esri.arcgis.controls
Interface IEngineSnapAgent

All Superinterfaces:
Serializable
All Known Subinterfaces:
IEngineFeatureSnapAgent
All Known Implementing Classes:
EngineFeatureSnap

public interface IEngineSnapAgent
extends Serializable

Provides access to members that snap point locations using a tolerance.

Description

The IEngineSnapAgent interface is typically used when creating new custom snap agents and when accessing properties of an existing snap agent. Implement this interface when creating a custom snap agent.

Tools that work with snapping typically call the IEngineSnapEnvironment::SnapPoint method every time the mouse moves. SnapPoint in turn calls each snap agents Snap method in succession until one of them returns true. True means a new point has been found that meets the qualifications set within a particular snap agents Snap method. For example, is the passed in point representing the sketch tools current location, within 10 meters of a parcel vertex. The first snap agent to return true, modifies the passed in points x,y location to reflect that of the new snap point location and no other snap agents are called.

Product Availability

Available with ArcGIS Engine.


Method Summary
 String getName()
          The name of the engine snap agent.
 boolean snap(IGeometry geom, IPoint point, double tolerance)
          Fired by the Engine Editor to perform the actual snapping logic.
 

Method Detail

getName

String getName()
               throws IOException,
                      AutomationException
The name of the engine snap agent.

Description

To find a particular snap agent to cycle through all of the loaded snap agents using the Name property.
For Feature Snap Agents, the name is that of their feature class. When creating a custom snap agent, make sure to give it a unique name.

Product Availability

Available with ArcGIS Engine.

Returns:
The name
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

snap

boolean snap(IGeometry geom,
             IPoint point,
             double tolerance)
             throws IOException,
                    AutomationException
Fired by the Engine Editor to perform the actual snapping logic.

Description

Each snap agent uniquely implements the Snap method. Although each snap agent's Snap method can be called directly, typically the IEngineSnapEnvironment::SnapPoint method is used to call this function for each loaded snap agent until one of them reports it has modified the passed in point's properties. To facilitate this behavior, each snap agent's Snap method must return a boolean variable indicating whether or not it has modified the passed in points coordinates.

Snapping the passed in point means changing its x,y location properties. Because an IPoint interface pointer is passed into this function ByValue, direct edits of the point's parameters are possible. Resetting the IPoint interface to a different Point object will have no effect after leaving the scope of the function.

Product Availability

Available with ArcGIS Engine.

Parameters:
geom - A reference to a com.esri.arcgis.geometry.IGeometry (in)
point - A reference to a com.esri.arcgis.geometry.IPoint (in)
tolerance - The tolerance (in)
Returns:
The snapped
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.