This document is archived and information here might be outdated. Recommended version. |
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
[C#] public bool Snap ( IGeometry geom, IPoint point, double tolerance );
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;
}