LAnnCrossProduct::GetDistance
#include "ltwrappr.h"
virtual L_INT LAnnCrossProduct::GetDistance(pdDistance, pdDistance2)
/* address of the variable that will be updated with the distance of a ruler object */ | |
/* address of the variable that will be updated with the distance of a ruler object */ |
Gets the distance of the annotation object in the object's unit of measurement, set by LAnnRuler::SetUnit. This function is available in the Document/Medical Toolkits.
Parameter |
Description |
pdDistance |
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. |
pdDistance2 |
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. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Required DLLs and Libraries
LTANN For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
See Also
Functions: |
|
Topics: |
|
|
|
|
|
|
Example
void CVCAnnotation11Dlg::OnButtonCrossproduct()
{
LBitmap MyBitmap;
RECT rect;
L_UNLOCKSUPPORT(L_SUPPORT_DOCUMENT, L_KEY_DOCUMENT);
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(m_hWnd);
MyAnnCrossProduct.Draw(hDC,&rect);
::ReleaseDC(m_hWnd, hDC);
}