Gets the distance of the annotation object in the object's unit of measurement, set by LAnnRuler::SetUnit.
#include "ltwrappr.h"
virtual L_INT LAnnCrossProduct::GetDistance(pdDistance, pdDistance2)
Address of the variable to be updated with the distance of the ruler object. For objects having only one ruler, this variable will be updated with the length. For cross products, which 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 ruler object. For cross products and protractors, which have two rulers, this variable will be updated with the length of the secondary ruler.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Win32, x64.
L_INT LAnnCrossProduct_GetDistanceExample(HWND hWnd)
{
LBitmap MyBitmap;
RECT rect;
LAnnCrossProduct MyAnnCrossProduct;
ANNPOINT MyPts[5] = { 50,50,
150,150,
100,100,
150,50,
50,150
};
pANNPOINT pMyPts = MyPts;
MyAnnCrossProduct.SetPoints(pMyPts, 5);
//Verify points of crossproduct
L_UINT uPointCount = MyAnnCrossProduct.GetPointCount();
HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, sizeof(ANNPOINT) * uPointCount);
pANNPOINT pAnnPoint = (pANNPOINT)GlobalLock(hGlobal);
MyAnnCrossProduct.GetPoints(pAnnPoint);
for (unsigned int i=0; i<uPointCount; i++)
{
L_TCHAR szTemp[100];
wsprintf(szTemp, TEXT("[%d]Point(%d, %d)"), i, (int)pAnnPoint[i].x, (int)pAnnPoint[i].y);
AfxMessageBox(szTemp);
}
GlobalFree(hGlobal);
L_UINT uShowFlags;
MyAnnCrossProduct.GetShowFlags(&uShowFlags);
MyAnnCrossProduct.SetShowFlags(ANNSHOW_GAUGE,0);
L_UINT uLineStyle = MyAnnCrossProduct.GetLineStyle();
L_DOUBLE dLineWidth = MyAnnCrossProduct.GetLineWidth();
L_TCHAR szTemp[100];
wsprintf(szTemp, TEXT("Old Line Style[%d]\nOld Line Width[%d]"), uLineStyle, (int)dLineWidth);
AfxMessageBox(szTemp);
MyAnnCrossProduct.SetLineStyle(ANNLINE_SOLID);
MyAnnCrossProduct.SetLineWidth(5.0);
//Get Distances
L_DOUBLE dDist1=0, dDist2=0;
dDist1 = 0; dDist2=0; MyAnnCrossProduct.GetDistance(&dDist1, &dDist2);
//Set CrossProduct properties
MyAnnCrossProduct.SetVisible(TRUE);
MyAnnCrossProduct.GetBoundingRect(&rect) ;
//Draw the annotation
HDC hDC = ::GetDC(hWnd);
MyAnnCrossProduct.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