This document is archived and information here might be outdated.  Recommended version.

ISnapAgent.Snap Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Editor > ESRI.ArcGIS.Editor > Interfaces > IS > ISnapAgent Interface > ISnapAgent.Snap Method
ArcGIS Developer Help

ISnapAgent.Snap Method

Called by the editor to perform the actual snapping logic.

[Visual Basic .NET]
Public Function Snap ( _
    ByVal geom As IGeometry, _
    ByVal point As IPoint, _
    ByVal tolerance As Double _
) As Boolean
public bool Snap (
    IGeometry geom,
    IPoint point,
    double tolerance

Product Availability

Available with ArcGIS Desktop.


Each snap agent uniquely implements the Snap method. Although each snap agent's Snap method can be called directly, typically the ISnapEnvironment::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 is possible. Resetting the IPoint interface to a different Point object will have no effect after leaving the scope of the function.

public bool Snap(IGeometry geom, IPoint point, double tolerance)
  double x = 10;
  double y = 10;

point.PutCoords(x, y); return true; }

See Also

ISnapAgent Interface | ISnapEnvironment Interface