IPosDet介面可以直接獲得經緯度等相關資訊,應用將這些資訊傳遞給伺服器與GIS系統配合使用就可以開發出各種豐富多彩的應用了,IPosDet的使用樣本如下:
// create the instance for PosDet
ISHELL_CreateInstance(pi->a.m_pIShell, AEECLSID_POSDET, (void **) &(pi->m_pPosDet));
if(pi->m_pPosDet) {
// Initialize the Callback function
CALLBACK_Init(&pi->SimpleGPSCB, simplegps_PosDetCB, pi);
// You also can get seperate information through
IPOSDET_GetGPSInfo(pi->m_pPosDet, AEEGPS_GETINFO_LOCATION|AEEGPS_GETINFO_VELOCITY|AEEGPS_GETINFO_ALTITUDE,AEEGPS_ACCURACY_LEVEL1, &pi->m_gpsInfo, &pi->SimpleGPSCB);
}
return(TRUE);
Simplegps_PosDetCB函數將得到的位置資訊顯示的螢幕上,以顯示緯度為例的代碼如下:
// wasFactor is the factor between AEEGPSInfo and real world data.
STR_TO_WSTR("186413.5111",szNum,sizeof(szNum));
wgsFactor= WSTR_TO_FLOAT(szNum);
//Display Latitude on the screen
val = IntegerToFloat(pMe->m_gpsInfo.dwLat);
val = FDIV(val, wgsFactor);
FLOATTOWSTR(val, szNum, TEXT_BUFFER_SIZE);
STR_TO_WSTR("Lat:", szText, TEXT_BUFFER_SIZE);
WSTRCAT(szText,szNum);
// IDISPLAY_ClearScreen(pMe->a.m_pIDisplay);
IDISPLAY_DrawText(pMe->a.m_pIDisplay, // Display instance
AEE_FONT_BOLD, // Use BOLD font
szText, // Text - Normally comes from resource
-1, // -1 = Use full string length
0, // Ignored - IDF_ALIGN_CENTER
32, // Ignored - IDF_ALIGN_MIDDLE
NULL, // No clipping
IDF_ALIGN_CENTER);