Gets the distance of the rulers in the object's unit of measurement, set by LAnnProtractor::SetProtractorOptions.
#include "ltwrappr.h"
virtual L_INT LAnnProtractor::GetDistance(pdDistance, pdDistance2)
Address of the variable to be updated with the distance of the primary ruler. Since protractors have two rulers, this variable will be updated with the length of the primary ruler.
Address of the variable to be updated with the distance of the secondary ruler. Since protractors have two rulers, this variable will be updated with the length of the secondary ruler.
Either pdDistance or pdDistance2 can be NULL, but not both. If either of these pointers is NULL, the distance for that ruler will not be retrieved.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Win32, x64.
L_INT LAnnProtractor_GetDistanceExample(HWND hWnd)
{
LBitmap MyBitmap;
RECT rect;
LAnnProtractor MyAnnProtractor;
ANNPOINT MyPts[3] = { 40,40,
140,40,
140,140
};
pANNPOINT pMyPts = MyPts;
MyAnnProtractor.SetPoints(pMyPts, 3);
//Change protractor options
L_BOOL bAcute;
MyAnnProtractor.GetProtractorOptions(&bAcute);
MyAnnProtractor.SetProtractorOptions(bAcute, //keep unchanged
ANNANGLE_DEGREES,
TEXT("units"),
4, //precision
60, //arc radius
0);
L_DOUBLE dAngle;
L_TCHAR szTemp[100];
MyAnnProtractor.GetAngle(&dAngle);
wsprintf(szTemp, TEXT("Angle %d"), (int)dAngle);
AfxMessageBox(szTemp);
L_UINT uShowFlags;
MyAnnProtractor.GetShowFlags(&uShowFlags);
MyAnnProtractor.SetShowFlags(ANNSHOW_LENGTH,0);
//Get Distances
L_DOUBLE dDist1=0, dDist2=0;
dDist1 = 0; dDist2=0; MyAnnProtractor.GetDistance(&dDist1, &dDist2);
//Set Protractor properties
MyAnnProtractor.SetVisible(TRUE);
MyAnnProtractor.GetBoundingRect(&rect);
HDC hDC = ::GetDC(hWnd);
MyAnnProtractor.Draw(hDC,&rect);
::ReleaseDC(hWnd, hDC);
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