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


IHitTest.HitTest Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IH > IHitTest Interface > IHitTest.HitTest Method
ArcGIS Developer Help

IHitTest.HitTest Method

Locates a part of a geometry closest to a query point. Any located part must be within searchRadius units from the query point.

[Visual Basic .NET]
Public Function HitTest ( _
    ByVal QueryPoint As IPoint, _
    ByVal searchRadius As Double, _
    ByVal geometryPart As esriGeometryHitPartType, _
    ByVal hitPoint As IPoint, _
    ByRef hitDistance As Double, _
    ByRef hitPartIndex As Integer, _
    ByRef hitSegmentIndex As Integer, _
    ByRef bRightSide As Boolean _
) As Boolean
[C#]
public bool HitTest (
    IPoint QueryPoint,
    double searchRadius,
    esriGeometryHitPartType geometryPart,
    IPoint hitPoint,
    ref double hitDistance,
    ref int hitPartIndex,
    ref int hitSegmentIndex,
    ref bool bRightSide
);
[C++]
HRESULT HitTest(
  IPoint* QueryPoint,
  double searchRadius,
  esriGeometryHitPartType geometryPart,
  IPoint* hitPoint,
  System.Double* hitDistance,
  System.Int32* hitPartIndex,
  System.Int32* hitSegmentIndex,
  Boolean* bRightSide
);
[C++]
Parameters
QueryPoint 

QueryPoint is a parameter of type IPoint* searchRadius
searchRadius is a parameter of type double geometryPart
geometryPart is a parameter of type esriGeometryHitPartType hitPoint
hitPoint is a parameter of type IPoint* hitDistance [in, out]
hitDistance is a parameter of type double* hitPartIndex [in, out]
hitPartIndex is a parameter of type long* hitSegmentIndex [in, out]
hitSegmentIndex is a parameter of type long* bRightSide [in, out]
bRightSide is a parameter of type bool*

Product Availability

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

Remarks

The segment index returned has different meanings depending on the esriGeometryHitPartType used (Please see the example for more details).


EsriGeometryPartVertex: returns a vertex index


EsriGeometryPartBoundary, esriGeometryPartMidpoint and esriGeometryPartEndpoint: return a segment index


EsriGeometryPartCentroid: Always returns 0 for the part index and the segment index.

 

brightside: Indicates if the input point is on the right side of the input geometry

 

Note: The distance units use in this method are the units of the input geometry. No conversion is performed. esriGeometryHitPartType parameter cannot be a combination of several esriGeometryHitPartTypes.

See Also

IHitTest Interface