LAnnContainer::HitTest

#include "ltwrappr.h"

virtual LAnnotation * LAnnContainer::HitTest(pPoint, puResult, pHitTestInfo, uStructSize)

virtual L_INT LAnnContainer::HitTest(pPoint, puResult, phObjectHit, pHitTestInfo, uStructSize)

Parameters

LPPOINT pPoint

Pointer to the POINT structure that specifies the point to test. Coordinates are relative to the associated window's client area.

L_UINT * puResult

The position on the annotation object that was found at the specified point. Possible values are:

ANNHIT_NONE [0]
ANNHIT_BODY [1]
ANNHIT_HANDLE [2]
ANNHIT_NAME [3]
ANNHIT_USER_HANDLE [4]
ANNHIT_ROTATE_HANDLE [5]
ANNHIT_MULTISELECT_HANDLE [6]
ANNHIT_MULTISELECT_ROTATE_HANDLE [7]
ANNHIT_MULTISELECT_BODY [8]

If (*puResult) is updated with ANNHIT_HANDLE or ANNHIT_USER_HANDLE, then pHitTestInfo contains additional information about the annotation object handle. For example, if (*puResult) is ANNHIT_ROTATE_HANDLE, pHitTestInfo->nHandleID will be either ROTATE_HANDLE_CENTER_ID [100] or ROTATE_HANDLE_GRIPPER_ID [101] to identify which rotate handle was hit.

pHANNOBJECT phObjectHit

Address of the variable to be updated with the handle to the annotation object that is found at the specified point.

pANNHITTESTINFO pHitTestInfo

Pointer to a HITTESTINFO structure that provides hit test information whenever (*puResult) is updated with ANNHIT_HANDLE or ANNHIT_USER_HANDLE.

L_UINT uStructSize

Size in bytes, of the structure pointed to by pHitTestInfo, for versioning. Use sizeof(HITTESTINFO).

Returns

LAnnContainer::HitTest(pPoint, puResult, phObjectHit, pHitTestInfo, uStructSize) returns the following:

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

LAnnContainer::HitTest(pPoint, puResult, pHitTestInfo, uStructSize) returns the following:

A pointer to the annotation object that is located at the specified point. The user is responsible for deleting the returned object.

Comments

Before calling this function, you must declare a variable of data type HANNOBJECT. You can then pass the address of the variable in the phObjectHit parameter, which this function will update with the handle of the object located at the specified point.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

This is an example for LAnnContainer::HitTest(pPoint,
puResult, phObjectHit):

L_INT LAnnContainer_HitTestExample(LAnnContainer& LeadAContainer,pHANNOBJECT phAnnObject,L_INT xFromWindow, L_INT yFromWindow) 
{ 
   L_INT nRet; 
   HANNOBJECT ThisObject; // Local variable for the annotation object  
   POINT PointToTest;// The point in the window's client area to test 
   L_UINT TestResult; // Result of the test  
   ANNHITTESTINFO HitTestInfo; 
 
   memset(&HitTestInfo, 0, sizeof(ANNHITTESTINFO)); 
   HitTestInfo.uStructSize = sizeof(ANNHITTESTINFO); 
 
   // Use incoming coordinates to specify the point to test 
   PointToTest.x = xFromWindow; 
   PointToTest.y = yFromWindow; 
 
 
 
   // Get the object at the specified point  
 
   nRet = LeadAContainer.HitTest( &PointToTest, &TestResult, &ThisObject, &HitTestInfo, sizeof(ANNHITTESTINFO)); 
   if(nRet != SUCCESS) 
      return nRet; 
 
    
 
   // Update the caller's object variable 
 
   if (TestResult == ANNHIT_NONE) 
      *phAnnObject = 0; 
   else 
      *phAnnObject = ThisObject;      
 
 
   return SUCCESS; 
} 

Help Version 22.0.2021.9.12
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help