LAnnCrossProduct::GetDistance

#include "ltwrappr.h"

virtual L_INT LAnnCrossProduct::GetDistance(pdDistance, pdDistance2)

L_DOUBLE *pdDistance;

/* address of the variable that will be updated with the distance of a ruler object */

L_DOUBLE *pdDistance2;

/* 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.

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.

Platforms

Win32, x64.

See Also

Functions:

Class Members

Topics:

Annotation Functions: Working with the Toolbar

 

Implementing Annotations

 

Automated User Interface for Annotations

 

Using Rulers in Annotation Objects

Example

L_INT LAnnCrossProduct_GetDistanceExample(HWND hWnd) 
{
   LBitmap MyBitmap;
   RECT rect;
   LSettings::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(hWnd);
   MyAnnCrossProduct.Draw(hDC,&rect);
   ::ReleaseDC(hWnd, hDC);
   return SUCCESS;
}