AnnGetDistance2 example for C++ Builder
void TForm1:: ExampleAnnGetDistance2 (HANNOBJECT hObject )
{
L_INT nObjectType ;
long lCount ;
double dTotalDis ;
long lTotalRulerUnit;
long lTotalSmartUnit;
double dDistance;
double dDistance2;
long lRulerUnit;
long lSmartUnit;
AnsiString asResult;
int i;
nObjectType = LEADAnn1->AnnGetType(hObject);
if (nObjectType != ANNOBJECT_RULER)
ShowMessage("This Object is not an RULER Object");
LEADAnn1->AnnGetDistance2(hObject);
lCount = LEADAnn1->AnnDistanceCount;
dTotalDis = LEADAnn1->AnnTotalDistance;
lTotalRulerUnit = LEADAnn1->AnnTotalRulerUnit;
lTotalSmartUnit = LEADAnn1->AnnTotalSmartUnit;
ShowMessage ( "Total Distance = " + FloatToStr(dTotalDis) + "\n\t" +
"Total Ruler Unit = " + IntToStr(lTotalRulerUnit) + "\n\t" +
"Total Smart Unit = " + IntToStr(lTotalSmartUnit));
for(i = 0; i<lCount ;i++)
{
dDistance = LEADAnn1->AnnDistance[i];
lRulerUnit = LEADAnn1->AnnRulerUnit[i];
lSmartUnit = LEADAnn1->AnnSmartUnit[i];
ShowMessage( "Distance Index = " + IntToStr(i) + "\n\t" +
"Distance = " + FloatToStr(dDistance) + "\n\t" +
"Ruler Unit = " + IntToStr(lRulerUnit) + "\n\t" +
"Smart Unit = " + IntToStr(lSmartUnit));
}
}