LAnnCrossProduct::GetDistance

Summary

Gets the distance of the annotation object in the object's unit of measurement, set by LAnnRuler::SetUnit.

Syntax

#include "ltwrappr.h"

virtual L_INT LAnnCrossProduct::GetDistance(pdDistance, pdDistance2)

Parameters

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

L_DOUBLE *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

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

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 Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.