com.esri.arcgis.editor
Interface IFeatureSnapAgent

All Superinterfaces:
ISnapAgent, Serializable
All Known Subinterfaces:
IFeatureSnapAgent2
All Known Implementing Classes:
FeatureSnap

public interface IFeatureSnapAgent
extends ISnapAgent, Serializable

Provides access to members that control a feature snap agent's properties.

Superseded By

IFeatureSnapAgent2

Remarks

Use this interface to set the behavior of new feature snap agents. Feature snap agents control which features the editor attempts to snap to. For example, you may want the editor to automatically snap to the vertex of all buildings. To implement this you would create a new FeatureSnapAgent and specify the FeatureClass to be 'Buildings' and the HitType to be esriGeometryPartVertex. New feature snap agents have to be added to the editor's snap environment with ISnapEnvironment::AddSnapAgent before they can be used unless you want to call Snap yourself.

The last member, FeatureCache, is very rarely used. Use it when applying a snapping constraint on top of an existing placement constraint. For example, you may want to create a constraint that places a point exactly 100 feet away but additionally honors the snap environment that states, snap the point to a feature if it is within the search tolerance. Thus the point has to be 100 feet away no matter what and if this location is within snap tolerance of a feature, place the point exactly on the feature. The basic idea is create the distance constraint inside a sketch tool and then reuse the FeatureCache associated with the particular FeatureSnapAgent so you don't have to manage a new one.

When To Use

The IFeatureSnapAgent interface is used to set the properties of a feature snap agent. IFeatureSnapAgent inherits from ISnapAgent so all of the members on ISnapAgent are directly available.

Product Availability

Available with ArcGIS Desktop.

See Also:
ISnapEnvironment, ISnapAgent

Method Summary
 IFeatureCache getFeatureCache()
          The FeatureCache associated with the feature snap agent.
 IFeatureClass getFeatureClass()
          The featureclass the feature snap agent snaps to.
 int getHitType()
          The part of a geometry the feature snap agent snaps to.
 void setFeatureClassByRef(IFeatureClass featClass)
          The featureclass the feature snap agent snaps to.
 void setHitType(int hitType)
          The part of a geometry the feature snap agent snaps to.
 
Methods inherited from interface com.esri.arcgis.editor.ISnapAgent
getName, snap
 

Method Detail

setFeatureClassByRef

void setFeatureClassByRef(IFeatureClass featClass)
                          throws IOException,
                                 AutomationException
The featureclass the feature snap agent snaps to.

Remarks

Specifies the feature class the snap agent will attempt to snap to.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Parameters:
featClass - A reference to a com.esri.arcgis.geodatabase.IFeatureClass (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getFeatureClass

IFeatureClass getFeatureClass()
                              throws IOException,
                                     AutomationException
The featureclass the feature snap agent snaps to.

Remarks

Specifies the feature class the snap agent will attempt to snap to.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Returns:
A reference to a com.esri.arcgis.geodatabase.IFeatureClass
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setHitType

void setHitType(int hitType)
                throws IOException,
                       AutomationException
The part of a geometry the feature snap agent snaps to.

Remarks

Use this property to specify the part of a geometry the FeatureSnapAgent should snap to. HitType must be set to one of the members of the esriGeometryHitPartType enumeration . Valid types are:

esriGeometryPartBoundary
esriGeometryPartCenter
esriGeometryPartExterior
esriGeometryPartInterior
esriGeometryPartMidpoint
esriGeometryPartNone
esriGeometryPartVertex

For example:

 Dim pFeatSnap as IFeatureSnapAgent


Set pFeatSnap = New FeatureSnap
pFeatSnap.HitType = esriGeometryPartVertex

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Parameters:
hitType - A com.esri.arcgis.geometry.esriGeometryHitPartType constant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getHitType

int getHitType()
               throws IOException,
                      AutomationException
The part of a geometry the feature snap agent snaps to.

Remarks

Use this property to specify the part of a geometry the FeatureSnapAgent should snap to. HitType must be set to one of the members of the esriGeometryHitPartType enumeration. Valid types are:

esriGeometryPartBoundary
esriGeometryPartCentroid
esriGeometryPartEndpoint
esriGeometryPartMidpoint
esriGeometryPartNone
esriGeometryPartVertex

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Returns:
A com.esri.arcgis.geometry.esriGeometryHitPartType constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getFeatureCache

IFeatureCache getFeatureCache()
                              throws IOException,
                                     AutomationException
The FeatureCache associated with the feature snap agent.

Remarks

This property has no significance when creating a new feature snap agent. Instead, it is used, albeit rarely, inside a sketch tool to perform custom operations on features held in the snapping environments feature cache. For example, the editor's SketchTool can issue an angular constraint and still honor the current snapping environment. If this case, a new point would be on the specified angle no matter what but its distance away may change depending on whether or not the point falls within the snap tolerance of a feature. To implement this, the Sketch Tool issues the angular constraint and then reuses the snapping environments feature caches to check if the new point is within snap tolerance of a feature belonging to one of the feature snap agents. You could create your own caches to do this, one for each feature snap agent, but since they already exist, it is much easier to use them.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Returns:
A reference to a com.esri.arcgis.carto.IFeatureCache
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.