AnnGetDistance2 example for C++ 5 and later
void CTutorDlg::ExampleAnnGetDistance2(long hObject)
{
AnnObjectType ObjectType ;
long Count ;
double TotalDis ;
long TotalRulerUnit;
long TotalSmartUnit;
double Distance;
long RulerUnit;
long SmartUnit;
CString szResult;
int i;
m_pRasterAnn->AnnGetType(hObject);
ObjectType = m_pRasterAnn->GetAnnType();
if (ObjectType != ANN_OBJECT_RULER)
MessageBox(TEXT("This Object is not an RULER Object"));
m_pRasterAnn->AnnGetDistance2(hObject);
Count = m_pRasterAnn->DistanceCount;
TotalDis = m_pRasterAnn->GetTotalDistance();
TotalRulerUnit = m_pRasterAnn->GetTotalRulerUnit();
TotalSmartUnit = m_pRasterAnn->GetTotalSmartUnit();
szResult.Format(TEXT("Total Distance = %f \n\t Total Ruler Unit = %d \n\t Total Smart Unit = %d "), TotalDis, TotalRulerUnit, TotalSmartUnit);
MessageBox(szResult);
for(i = 0; i<Count;i++)
{
Distance = m_pRasterAnn->GetDistance(i);
RulerUnit = m_pRasterAnn->GetRulerUnit(i);
SmartUnit = m_pRasterAnn->GetSmartUnit(i);
szResult.Format(TEXT("Distance Index = %d \n\t Distance = %f \n\t Ruler Unit = %d \n\t Smart Unit = %d "),i, Distance, RulerUnit, SmartUnit);
MessageBox(szResult) ;
}
return 1;
}