#include "ltdoc2.h"
L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2GetZoneNodes(hDoc, nPageIndex, nZoneIndex, ppPoints, pnNodesCount)
L_HDOC2 hDoc; |
handle to the OCR document |
L_INT nPageIndex; |
page index |
L_INT nZoneIndex; |
zone index |
PPOINT * ppPoints; |
point to POINT array to be updated |
L_INT * pnNodesCount; |
address of variable to be updated |
Gets the polygon of the user zone.
Parameter |
Description |
hDoc |
Handle to the OCR document. This handle is obtained by calling the L_Doc2StartUp function. |
nPageIndex |
Index of the page. This is a zero-based index. |
nZoneIndex |
Index of the zone. This is a zero-based index. |
ppPoints |
Address of an array of POINT structures to be updated with polygon points |
pnNodesCount |
Address of a variable to be updated with the number of polygon points. |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
This function retrieves a polygon, which consists of the vertices of a user zone. This can be useful for an application with a GUI when drawing irregular zones.
This function will not work for OMR zones, because OMR zones should have a regular shape.
First call this function, passing NULL to ppPoints to get the number of polygon points. Use that number to allocate an array of POINT structures. Then call this function a second time, passing the address of the allocated array to the ppPoints parameter to obtain the polygon points.
To add a user zone, call the L_Doc2AddZone function. To add rectangle(s) to a user zone to make its shape irregular, call the L_Doc2AddZoneRect function.
To get zone rectangles, call the L_Doc2GetZoneLayout function. To set zone rectangles call the L_Doc2SetZoneLayout function.
Required DLLs and Libraries
LTDOC2 For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
L_INT Doc2ZoneNodesExample(L_HDOC2 hDoc, L_INT nPageIndex, L_INT nZoneIndex)
{
L_INT nRet;
L_INT nNodesCount;
POINT * pNodes = NULL;
nRet = L_Doc2GetZoneNodes(hDoc, nPageIndex, nZoneIndex, NULL, &nNodesCount);
if (nRet != SUCCESS)
return nRet;
pNodes = (POINT *)GlobalAllocPtr(GHND, sizeof(POINT) * nNodesCount);
nRet = L_Doc2GetZoneNodes(hDoc, nPageIndex, nZoneIndex, &pNodes, &nNodesCount);
if (nRet != SUCCESS)
{
GlobalFreePtr(pNodes);
return nRet;
}
L_TCHAR szBuffer[100];
for(int i=0; i<nNodesCount; i++)
{
memset(szBuffer, 0, sizeof(szBuffer));
wsprintf(szBuffer, TEXT("Zone Nodes # %d\nx = %d\ny = %d\n"),
i,
pNodes[i].x,
pNodes[i].y);
MessageBox(NULL, szBuffer, TEXT("Notice"), MB_OK);
}
GlobalFreePtr(pNodes);
return SUCCESS;
}