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

ITopologyGraph.HitTest Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geodatabase > ESRI.ArcGIS.GeoDatabase > Interfaces > IT > ITopologyGraph Interface > ITopologyGraph.HitTest Method
ArcGIS Developer Help

ITopologyGraph.HitTest Method

Locates an element of the graph nearest to the query point that is also within searchRadius units of it; whichElements is a bitwise combination of esriTopologyElement values.

[Visual Basic .NET]
Public Function HitTest ( _
    ByVal whichElements As Integer, _
    ByVal QueryPoint As IPoint, _
    ByVal searchRadius As Double, _
    ByVal hitPoint As IPoint, _
    ByRef hitDistance As Double, _
    ByRef hitElement As ITopologyElement _
) As Boolean
public bool HitTest (
    int whichElements,
    IPoint QueryPoint,
    double searchRadius,
    IPoint hitPoint,
    ref double hitDistance,
    ref ITopologyElement hitElement
  long whichElements,
  IPoint* QueryPoint,
  double searchRadius,
  IPoint* hitPoint,
  System.Double* hitDistance,
  ITopologyElement** hitElement
whichElements [in]

whichElements is a parameter of type long QueryPoint [in]
QueryPoint is a parameter of type IPoint* searchRadius [in]
searchRadius is a parameter of type double hitPoint [in]
hitPoint is a parameter of type IPoint* hitDistance [out]
hitDistance is a parameter of type double* hitElement [out]
hitElement is a parameter of type ITopologyElement**

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.


The ITopologyGraph::HitTest method allows to retrieve the nearest TopologyElement (TopologyNode or TopologyEdge) located within a distance from an input point. This could be used to get a TopologyElement based on a user mouse click. The return value represents success (whether or not a point in the graph was hit), while the final two parameters return the distance from the hit point to the output point and a reference to the topology element that was hit.

If a reference to the hit point is needed, an instantiated IPoint reference should be passed to the hitPoint parameter. This will modify the coordinates of the existing point to those of the hit point. If the hit point is not required, a null value can be passed into this parameter.

The search radius distance must use the same distance units as the Topology or MapTopology units no conversion is performed if they are not the same.


Note: whichElements is a bitwise combination of esriTopologyElementType values

See Also

ITopologyGraph Interface