#include "l_bitmap.h"
L_LTANN_API L_INT L_AnnEnumerate(hObject, pfnCallback, pUserData, uFlags, pUserList)
Lets you process all of the annotation objects in a container.
Handle of the container object.
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.
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.
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. |
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
.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
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
Win32, x64.
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_INT* pUserData)
{
L_UINT ObjectType; /* The type of annotation object */
L_INT ObjectCount; /* The number of objects */
/* Initialize the object count */
ObjectCount = (L_INT) *pUserData;
/* Get the current object type */
L_AnnGetType (hObject, &ObjectType);
/* Update the counter if the object is a rectangle, ellipse, or polygon */
if ((ObjectType == ANNOBJECT_RECT) ||
(ObjectType == ANNOBJECT_ELLIPSE) ||
(ObjectType == ANNOBJECT_POLYGON))
{
++ObjectCount;
}
/* Update the caller's variable */
*pUserData = ObjectCount;
return SUCCESS;
}
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("%d rectangles, ellipses, and polygons"), ObjectCount);
MessageBox (NULL, szMessage, TEXT("Notice"), MB_OK);
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document