L_AnnSaveMulti (original) (raw)
Summary
Saves an array of annotation containers to the specified file.
Syntax
#include "l_bitmap.h"
L_LTANN_API L_INT L_AnnSaveMulti(pFile, phObjects, nCount, uFormat, fSelected, pSaveOptions)
Parameters
L_TCHAR * pFile
Character string that contains the name of the file to save.
HANNOBJECT *phObjects
Pointer to an array of handles to annotation container objects. Each annotation container object can include multiple annotation objects.
L_INT nCount
The number of objects in the phObjects
array.
L_UINT uFormat
Format for saving annotation data. Possible values are:
Value | Meaning |
---|---|
ANNFMT_XML | [0x0005] Save as an XML text format. This is the only format supported for this call. All other values return ERROR_FEATURE_NOT_SUPPORTED. |
L_BOOL fSelected
Flag that indicates which objects to saved. Possible values are:
Value | Meaning |
---|---|
TRUE | Save all objects that have the selected property set to TRUE. For getting and setting the selected property, use the L_AnnGetSelected and L_AnnSetSelected functions. |
FALSE | Save only the specified object. |
pSAVEFILEOPTION pSaveOptions
Pointer to a SAVEFILEOPTION structure that contains optional extended save options. Pass NULL because this parameter is currently ignored.
Returns
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Comments
This function saves an entire array of annotation container objects with each page of the multipage annotation file corresponding to one of the annotation containers. If pFile
already exists, it will be overwritten. If phObjects
contains many annotation containers, then this function will create the multipage annotation file much faster than repeated calls to L_AnnSave. Note that this function only supports the ANNFMT_XML format. Passing any other format for uFormat
will return an ERROR_FEATURE_NOT_SUPPORTED error.
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_AnnDeletePage
- L_AnnDeletePageMemory
- L_AnnDeletePageOffset
- L_AnnFileInfo
- L_AnnFileInfoMemory
- L_AnnSaveMemory
- L_AnnSaveOffset
- L_AnnSaveTag
- L_AnnSetOptions
- L_AnnGetOptions
- L_AnnSave
Topics
- Annotation Files
- Annotation Functions: Input and Output
- Implementing Annotations
- Implementing an Automated Annotation Program
- Implementing a Non-automated Annotation Program
- Annotation Features
- Annotation Functions: Saving Annotation Files
Example
This example creates an annotation container with two objects, saves ten copies of the container in a multipage annotation file, and then reloads the ten containers from the file.
#ifndef MAX_ANN_CONTAINERS
#define MAX_ANN_CONTAINERS (10)
#endif
extern "C" L_VOID AnnSaveMultiExample(L_HWND hwnd, L_TCHAR *pszFileMultiOut)
{
HANNOBJECT hContainer = NULL;
HANNOBJECT hRect = NULL;
HANNOBJECT hEllipse = NULL;
ANNRECT rc = {0,0, 600,600};
L_AnnCreateContainer(hwnd, &rc, L_TRUE, &hContainer);
// Create a rectangle object
ANNRECT rcRect = {20,20,120,120};
L_AnnCreate(ANNOBJECT_RECT, &hRect);
L_AnnSetForeColor(hRect, RGB(255,0,0), 0);
L_AnnSetRect(hRect, &rcRect);
L_AnnSetVisible(hRect, L_TRUE, 0, NULL);
L_AnnInsert(hContainer, hRect, L_FALSE);
// Create an ellipse object
ANNRECT rcEllipse = {120,120,220,220};
L_AnnCreate(ANNOBJECT_ELLIPSE, &hEllipse);
L_AnnSetForeColor(hEllipse, RGB(0,0,255), 0);
L_AnnSetRect(hEllipse, &rcEllipse);
L_AnnSetVisible(hEllipse, L_TRUE, 0, NULL);
L_AnnInsert(hContainer, hEllipse, L_FALSE);
HANNOBJECT hObjects[MAX_ANN_CONTAINERS] = {0};
for (int i=0; i<MAX_ANN_CONTAINERS; i++)
hObjects[i] = hContainer;
// This saves a multipage annotation file -- there will be MAX_ANNCONTAINERS pages
L_AnnSaveMulti(pszFileMultiOut, hObjects, MAX_ANN_CONTAINERS, ANNFMT_XML, L_FALSE, NULL);
// Now load the multipage annotation file. Assume we do not know the number of pages in the file.
// Call the function twice -- the first time to get the number of pages in the multi-page annotation file
L_INT nItemsRead = 0;
L_AnnLoadMulti(pszFileMultiOut, NULL, 0, &nItemsRead, NULL);
if (nItemsRead != 0)
{
HANNOBJECT *phObjects = new HANNOBJECT[nItemsRead];
L_AnnLoadMulti(pszFileMultiOut, phObjects, nItemsRead, &nItemsRead, NULL);
delete phObjects;
}
// Cleanup
L_AnnDestroy(hContainer, ANNFLAG_RECURSE);
MessageBox(hwnd, TEXT("Finished"), TEXT(""), MB_OK);
}