com.esri.arcgis.controls
Class EngineFeatureSnap

java.lang.Object
  extended by com.esri.arcgis.controls.EngineFeatureSnap
All Implemented Interfaces:
IEngineFeatureSnapAgent, IEngineSnapAgent, com.esri.arcgis.interop.RemoteObjRef, Serializable

public class EngineFeatureSnap
extends Object
implements com.esri.arcgis.interop.RemoteObjRef, IEngineFeatureSnapAgent

An engine snap agent that snaps to features in a specific feature class.

Product Availability

Available with ArcGIS Engine.

See Also:
Serialized Form

Constructor Summary
EngineFeatureSnap()
          Constructs a EngineFeatureSnap using ArcGIS Engine.
EngineFeatureSnap(Object obj)
          Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
EngineFeatureSnap theEngineFeatureSnap = (EngineFeatureSnap) obj;
 
Method Summary
 boolean equals(Object o)
          Compare this object with another
static String getClsid()
          getClsid.
 IFeatureCache getFeatureCache()
          The FeatureCache associated with the engine feature snap agent.
 IFeatureClass getFeatureClass()
          The featureclass the feature snap agent snaps to.
 int getHitType()
          The part of a geometry the engine feature snap agent snaps to.
 String getName()
          The name of the engine snap agent.
 int hashCode()
          the hashcode for this object
 void setFeatureClassByRef(IFeatureClass featClass)
          The featureclass the feature snap agent snaps to.
 void setHitType(int hitType)
          The part of a geometry the engine feature snap agent snaps to.
 boolean snap(IGeometry geom, IPoint point, double tolerance)
          Fired by the Engine Editor to perform the actual snapping logic.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.esri.arcgis.interop.RemoteObjRef
getJintegraDispatch, release
 

Constructor Detail

EngineFeatureSnap

public EngineFeatureSnap()
                  throws IOException,
                         UnknownHostException
Constructs a EngineFeatureSnap using ArcGIS Engine.

Throws:
IOException - if there are interop problems
UnknownHostException - if there are interop problems

EngineFeatureSnap

public EngineFeatureSnap(Object obj)
                  throws IOException
Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
EngineFeatureSnap theEngineFeatureSnap = (EngineFeatureSnap) obj;

Construct a EngineFeatureSnap using a reference to such an object returned from ArcGIS Engine or Server. This is semantically equivalent to casting obj to EngineFeatureSnap.

Parameters:
obj - an object returned from ArcGIS Engine or Server
Throws:
IOException - if there are interop problems
Method Detail

getClsid

public static String getClsid()
getClsid.


equals

public boolean equals(Object o)
Compare this object with another

Overrides:
equals in class Object

hashCode

public int hashCode()
the hashcode for this object

Overrides:
hashCode in class Object

setFeatureClassByRef

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

Product Availability

Available with ArcGIS Engine.

Specified by:
setFeatureClassByRef in interface IEngineFeatureSnapAgent
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

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

Product Availability

Available with ArcGIS Engine.

Specified by:
getFeatureClass in interface IEngineFeatureSnapAgent
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

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

Product Availability

Available with ArcGIS Engine.

Specified by:
setHitType in interface IEngineFeatureSnapAgent
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

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

Product Availability

Available with ArcGIS Engine.

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

getFeatureCache

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

Remarks

This property has no significance when creating a new engine 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 engine 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 Engine.

Specified by:
getFeatureCache in interface IEngineFeatureSnapAgent
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.

getName

public 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.

Specified by:
getName in interface IEngineSnapAgent
Returns:
The name
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

snap

public 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.

Specified by:
snap in interface IEngineSnapAgent
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.