L_AnnEnumerate

Summary

Lets you process all of the annotation objects in a container.

Syntax

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnEnumerate(hObject, pfnCallback, pUserData, uFlags, pUserList)

Parameters

HANNOBJECT hObject

Handle of the container object.

ANNENUMCALLBACK pfnCallback

Callback function for processing each enumerated object. Use the function pointer as the value of this parameter.

L_AnnEnumerate calls this callback function as it gets the handle of each annotation object. The callback function must adhere to the function prototype described in ANNENUMCALLBACK Function.

L_VOID *pUserData

Void pointer that you can use to pass one or more additional parameters that the callback function needs.

To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure. If the additional parameters are not needed, you can pass NULL in this parameter.

L_UINT uFlags

Flags that determine which objects to process. Most of the flags apply only to container objects. You can combine values when appropriate by using a bitwise OR ( | ). The following are valid values:

Value Meaning
0 Process only the specified object.
ANNFLAG_SELECTED [0x0001] Process only objects that have the selected property set to TRUE. For getting and setting the selected property, use the L_AnnGetSelected and L_AnnSetSelected functions.
ANNFLAG_NOTTHIS [0x0004] Process only one level of objects within the specified container, not the container itself.
ANNFLAG_RECURSE [0x0008] Process objects within a container, and within any subcontainers, down to any level.
ANNFLAG_NOTCONTAINER [0x0002] (Used with ANNFLAG_RECURSE) Process objects within containers, not the containers themselves.
ANNFLAG_USER [0x0040] Process only those objects that have a user included in pUserList. If pUserList is NULL, process only those objects that do not have an associated user.

L_TCHAR *pUserList

Character string that contains the list of users associated with the specified object. pUserList has the form "User1,User2,,UserN". This must be a NULL terminated string with user names separated by a comma. This parameter is valid only if ANNFLAG_USER is set in uFlags.

Returns

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

Comments

You pass the handle of the container object in the hObject parameter, and you specify your callback function that is to process each object in the container. The L_AnnEnumerate function calls your callback function as it gets the handle of each annotation object.

You should not call this function during processing of WM_LTANNEVENT if wParam equals LTANNEVENT_REMOVE or LTANNEVENT_INSERT, or during the ANNENUMCALLBACK callback function

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

This ANNENUMCALLBACK function updates a count of the number of rectangles, ellipses, and polygons, as it processes each annotation object.
This example uses a callback function to count the number of rectangles, ellipses, and polygons.

L_INT EXT_CALLBACK TestAnnCallback(HANNOBJECT hObject, L_VOID* pUserData) 
{ 
   L_UINT   ObjectType;    /* The type of annotation object */ 
   L_INT*   pObjectCount;   /* The number of objects */ 
   L_INT    nRet; 
 
   /* Initialize the object count */ 
   pObjectCount = (L_INT*)pUserData; 
 
   /* Get the current object type */ 
   nRet = L_AnnGetType(hObject, &ObjectType); 
   if (nRet != SUCCESS) 
      return nRet; 
 
   /* Update the counter if the object is a rectangle, ellipse, or polygon */ 
   if (ObjectType == ANNOBJECT_RECT || 
      ObjectType == ANNOBJECT_ELLIPSE || 
      ObjectType == ANNOBJECT_POLYGON) 
      ++pObjectCount; 
 
   /* Update the caller's variable */ 
   pUserData = pObjectCount; 
 
   return SUCCESS; 
} 
 
extern "C" L_INT AnnEnumerateExample(HANNOBJECT hContainer /* Container annotation object */) 
{ 
   L_INT    nRet; 
   L_TCHAR  szMessage[80]; 
   L_INT    ObjectCount;            /* Counter for annotation objects */ 
   L_INT*   pCount = &ObjectCount;  /* Pointer to the object counter */ 
 
   /* Initialize the object count */ 
   ObjectCount = 0; 
 
   /* Set the callback function */ 
   /* Process every object in the root container */ 
   /* Refer to the callback function below to see how the count is updated */ 
   nRet = L_AnnEnumerate(hContainer, TestAnnCallback, pCount, ANNFLAG_RECURSE, NULL); 
   if (nRet != SUCCESS) 
      return nRet; 
 
   /* Display a message box with the result */ 
   wsprintf(szMessage, TEXT("Notice: %d rectangles, ellipses, and polygons"), ObjectCount); 
   _tprintf(_T("%s"), szMessage); 
 
   return SUCCESS; 
} 

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

LEADTOOLS Raster Imaging C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.