LAnnProtractor::GetDistance

#include "ltwrappr.h"

virtual L_INT LAnnProtractor::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 rulers in the object's unit of measurement, set by LAnnProtractor::SetProtractorOptions.

Parameter

Description

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.

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

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:

Class Members, LAnnAutomation::GetTicMarkLength, LAnnAutomation::SetTicMarkLength

Topics:

Annotation Functions: Working with the Toolbar

 

Implementing Annotations

 

Automated User Interface for Annotations

 

Using Rulers in Annotation Objects

Example

L_INT LAnnProtractor_GetDistanceExample(HWND hWnd)
{
   LBitmap MyBitmap;
   RECT rect;
   LSettings::UnlockSupport(L_SUPPORT_DOCUMENT, L_KEY_DOCUMENT);
   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;
}