Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.24
LEADTOOLS Raster imaging C++ Class library help

LAnnContainer::HitTest

Show in webframe

#include "ltwrappr.h"

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

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

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 */

pHITTESTINFO pHitTestInfo;

/* pointer to a structure that provides hit test information */

L_UINT uStructSize;

/* size in bytes, of the structure pointed to by pHitTestInfo */

Parameter

Description

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 HITTESTINFO 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(HITTESTINFO).

Returns

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

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

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:

Class Members, LAnnotation::GetRotateOptions, LAnnotation::SetRotateOptions

Topics:

Annotation Functions: Using Window Coordinates to Select Objects

 

Annotation Functions: Object Information

Example

This is an example forLAnnContainer::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;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.