#include "ltdoc2.h"
L_LTDOC2_API L_INT L_Doc2GetZoneNodesExt(hDoc, nDocId, nPageIndex, nZoneIndex, ppPoints, pnNodesCount)
Gets the polygon of the user zone.
Handle to the OCR document. This handle is obtained by calling the L_Doc2StartUp function.
Document ID created by calling L_Doc2CreateDocument.
Zero-based index of the page.
Zero-based index of the zone.
Address of an array of POINT structures to be updated with polygon points
Address of a variable to be updated with the number of polygon points.
| Value | Meaning |
|---|---|
| SUCCESS | The function was successful. |
| < 1 | An error occurred. Refer to Return Codes. |
✎ NOTE
This function does not work on OMR zones, because OMR zones need a regular shape.
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.
To use the function properly:
To add a user zone, call L_Doc2AddZone / L_Doc2AddZoneExt. To add rectangle(s) to a user zone to make its shape irregular, call L_Doc2AddZoneRect / L_Doc2AddZoneRectExt.
To get zone rectangles, call the L_Doc2GetZoneLayout / L_Doc2GetZoneLayoutExt function. To set zone rectangles call the L_Doc2SetZoneLayout / L_Doc2SetZoneLayoutExt function.
Required DLLs and Libraries
L_INT Doc2ZoneNodesExample(L_HDOC2 hDoc, L_INT nDocId, L_INT nPageIndex, L_INT nZoneIndex){L_INT nRet;L_INT nNodesCount;POINT * pNodes = NULL;nRet = L_Doc2GetZoneNodesExt(hDoc, nDocId, nPageIndex, nZoneIndex, NULL, &nNodesCount);if (nRet != SUCCESS)return nRet;pNodes = (POINT *)GlobalAllocPtr(GHND, sizeof(POINT) * nNodesCount);nRet = L_Doc2GetZoneNodesExt(hDoc, nDocId, 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;}