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


IHitTest.HitTest Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Geometry)  

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,
  double* hitDistance,
  long* hitPartIndex,
  long* hitSegmentIndex,
  VARIANT_BOOL* bRightSide,
  VARIANT_BOOL* bHit
);
[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 VARIANT_BOOL bHit [out, retval] bHit is a parameter of type VARIANT_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

.NET Related Topics

How to modify a specific segment of a polyline | How to modify a specific vertex of a polyline