L_AnnHitTest

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnHitTest(hObject, pPoint, puResult, phObjectHit, pHitTestInfo, uStructSize)

HANNOBJECT hObject;

handle to the container object

LPPOINT pPoint;

pointer to a structure

L_UINT *puResult;

position on the object at the point

pHANNOBJECT phObjectHit;

address of the variable to be updated

pANNHITTESTINFO pHitTestInfo;

pointer to a ANNHITTESTINFO structure that provides hit test information

L_UINT uStructSize;

size of the ANNHITTESTINFO structure

This function gets the handle to the annotation object that is located at a specified point. (If objects overlap, it gets the front object.) and additional information about the annotation object handle if the handle is a default or user-defined handle.

Parameter

Description

hObject

Handle to the container object that sets the scope of the search.

pPoint

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

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.

phObjectHit

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

pHitTestInfo

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

uStructSize

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

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

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

LTANN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

L_AnnDefine, L_AnnAddUserHandle, L_AnnAdjustPoint, L_AnnChangeUserHandle, L_AnnConvert, L_AnnDefine2, L_AnnDeleteUserHandle, L_AnnEnumerateHandles, L_AnnGetRestrictToContainer, L_AnnGetRotateAngle, L_AnnGetUserHandle, L_AnnGetUserHandles, L_AnnSetRestrictToContainer

Topics:

Annotation Functions: Creating and Deleting Annotations

 

Annotation Functions: Using Window Coordinates to Select Objects

 

Annotation Functions: Object Information

 

Implementing Custom Annotations

 

Implementing Annotations

 

Implementing an Automated Annotation Program

 

Implementing a Non-automated Annotation Program

Example

This example uses the caller’s mouse coordinates to get the handle to the annotation object at the specified coordinates. The part of the clicked annotation is displayed in the Output window. If the result of the hit test is a user handle, additional information about the handle is displayed.

L_INT AnnHitTestExample(HANNOBJECT    hContainer, 
POINT         ptPointToTest) 
{ 
   L_TCHAR        szMsg[200]; 
   L_TCHAR        szHitTestInfo[200]; 
   ANNHITTESTINFO HitTestInfo; 
   L_TCHAR*       pszResult = TEXT(""); 
   L_INT          nRet; 
   // This function determines which annotation object you have clicked. 
   HANNOBJECT     hObject;  // Local variable for the annotation object 
   L_UINT         uResult; // Result of the test 
   // Get the object at the specified point 
   memset(&HitTestInfo, 0, sizeof(ANNHITTESTINFO)); 
   HitTestInfo.uStructSize = sizeof(ANNHITTESTINFO); 
   nRet = L_AnnHitTest(hContainer, &ptPointToTest, &uResult, &hObject, &HitTestInfo, sizeof(ANNHITTESTINFO)); 
   if (nRet != SUCCESS) 
      return nRet; 
   switch(uResult) 
   { 
      case ANNHIT_NONE: 
      pszResult = TEXT("ANNHIT_NONE"); 
      break; 
      case ANNHIT_BODY: 
      pszResult = TEXT("ANNHIT_BODY"); 
      break; 
      case ANNHIT_NAME: 
      pszResult = TEXT("ANNHIT_NAME"); 
      break; 
      case ANNHIT_HANDLE: 
      wsprintf(szHitTestInfo, TEXT("ANNHIT_HANDLE nHandleIndex[%d], nHandleID[%d]"), 
      HitTestInfo.nHandleIndex, HitTestInfo.nHandleID); 
      pszResult = szHitTestInfo; 
      break; 
      case ANNHIT_USER_HANDLE: 
      wsprintf(szHitTestInfo, TEXT("ANNHIT_USER_HANDLE nHandleIndex[%d], nHandleID[%d]"), 
      HitTestInfo.nHandleIndex, HitTestInfo.nHandleID); 
      pszResult = szHitTestInfo; 
      break; 
   } 
   wsprintf(szMsg, TEXT("[%x] %s\n"), hObject, pszResult); 
   OutputDebugString(szMsg); 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help