#include "ltivw.h"
L_LTIVW_API L_INT EXT_FUNCTION L_DispContainerAddCobbAngle(hCellWnd, nSubCellIndex, hFirstLine, hSecondLine)
Creates a cobb-angle, which is a text display the angle between two lines, using the specified annotation lines (hFirstLine and hSecondLine).
A handle to the window that represents the cell on which the function's effect will be applied.
A zero-based index into the image list attached to the cell specified in nCellIndex. This sub-cell contains the image that contains the annotation container. Pass -2 to refer to the selected sub-cell.
Handle of the first annotation line that is used to create the cobb-angle.
Handle to the second annotation line that is used to creat the cobb-angle.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
To retrieve the cobb angle value, use the function L_DispContainerGetCobbAngleValue.
To delete a cobb angle, use the functionL_DispContainerRemoveCobbAngle.
Required DLLs and Libraries
This function generate a cobb angle out of the 2 lines drawn in the container.
L_INT nCounter = 0;
L_INT CALLBACK FindLine(HANNOBJECT hObject, L_VOID * pUserData)
{
pHANNOBJECT hLinesObjects = (pHANNOBJECT)pUserData;
L_UINT uType;
L_AnnGetType(hObject, &uType);
if (uType == ANNOBJECT_LINE)
{
hLinesObjects[nCounter] = hObject;
nCounter++;
}
return SUCCESS;
}
L_DOUBLE L_DispContainerAddCobbAngleExample(HWND hCellWnd)
{
L_INT nSubCellIndex;
L_DispContainerGetActiveSubCell(hCellWnd, &nSubCellIndex, 0);
HANNOBJECT hAnnContainer;
L_DispContainerGetAnnotationContainer(hCellWnd, nSubCellIndex, &hAnnContainer, 0);
HANNOBJECT hLinesObjects[256];
memset(hLinesObjects, 0, sizeof(HANNOBJECT) * 256);
nCounter = 0;
L_AnnEnumerate(hAnnContainer, FindLine, hLinesObjects, ANNFLAG_RECURSE, NULL);
if (nCounter < 2)
{
MessageBox(hCellWnd, TEXT("You have to have two lines on the cell to create the cobb angle"), TEXT("Error"), MB_OK);
return 0.0;
}
L_INT nRet = L_DispContainerAddCobbAngle(hCellWnd, nSubCellIndex, hLinesObjects[nCounter - 1], hLinesObjects[nCounter - 2]);
L_DOUBLE dAngle;
nRet = L_DispContainerGetCobbAngleValue(hCellWnd, 0, hLinesObjects[nCounter - 1], &dAngle);
if (nRet != SUCCESS)
{
MessageBox(hCellWnd, TEXT("The line you sent is not attached to any cobb angle"), TEXT("Error"), MB_OK);
}
return dAngle;
}