LAnnProtractor::GetDistance

#include "ltwrappr.h"

virtual L_INT LAnnProtractor::GetDistance(pdDistance, pdDistance2)

Gets the distance of the rulers in the object's unit of measurement, set by LAnnProtractor::SetProtractorOptions.

Parameters

L_DOUBLE *pdDistance

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.

L_DOUBLE *pdDistance2

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.

Comments

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.

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

LEADTOOLS Raster Imaging C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.