Home · All Commands · First Steps · Tutorials · Demos · FAQ | ||
Remote Interface Documentation |
Classes | |
struct | RI_CSetMapCenter |
Data structure for the Request "SetMapCenter". More... | |
Functions | |
LRESULT | RI_SetMapCenter_WriteData (LPARAM, RI_CSetMapCenter &) |
Write data to shared memory for "SetMapCenter". | |
Variables | |
const UINT | RI_MESSAGE_SETMAPCENTER = RegisterWindowMessage(TEXT("RI_MESSAGE_SETMAPCENTER")) |
const UINT RI_MESSAGE_SETMAPCENTER = RegisterWindowMessage(TEXT("RI_MESSAGE_SETMAPCENTER")) |
Message ID for the Request "SetMapCenter":
RI_MESSAGE_SETMAPCENTER
RI_SetMapCenter_WriteData(LPARAM id, RI_CSetMapCenter data );
RI_NOERROR = change MapRect success
RI_NODESC = AutoPanning is deactivated.
Sets the map center to the given position if m_panning is true. There is no automatic switch back to the current gps position on the map, so be sure to call this message again with m_panning = false to center the map to the current position !
Possible coordinate formats are mercator and geodecimal (see also the data-struct description).
#define USE_LOADLIBRARY #include "TNSRemoteInterfaceDll.h" LPARAM GetUniqueID() { //generate unique ID static LPARAM id = 0; if (++id == 0) ++id; // do not use 0 !!!!! return id; } inline LRESULT RI_MESSAGE( const UINT request, HWND h_client, LPARAM id ) { //check if RI handle is valid if ( !IsWindow( RI_GetTNS() ) ) return RI_NAVIGATIONNOTACTIVE; //send the request PostMessage( RI_GetTNS(), request, WPARAM(h_client), id ); return RI_NOERROR; } LRESULT CDlgMFC_SetMapCenter::WindowProc ( UINT message , WPARAM wParam , LPARAM lParam ) { //check messages for answer from RI if ( message == RI_MESSAGE_SETMAPCENTER ) { if ( (LRESULT)wParam == RI_NOERROR ) //change MapRect success. errorcode (0) else if ( (LRESULT)wParam == RI_NODESC ) //AutoPanning is deactivated. errorcode (12) else if ( (LRESULT)wParam == RI_NAVIGATIONNOTACTIVE ) //Navigator is not running or the configuration is not complete. errorcode(3) } return CDialog::WindowProc( message, wParam, lParam ); } void CDlgMFC_SetMapCenter::foo() { // *** define struct *** RI_CSetMapCenter data; // *** copy data *** data.m_panning = true; // set the coordinate format to mercator data.m_flag = true; // set the map center to the following mercator coordinates wcscpy(data.m_PosX, L"937170"); wcscpy(data.m_PosY, L"6270165"); //write data to shared memory LPARAM id = GetUniqueID(); LRESULT sharing_ret = RI_SetMapCenter_WriteData( id, data ); if ( sharing_ret != RI_NOERROR ) return; if ( RI_MESSAGE( RI_MESSAGE_SETMAPCENTER, GetSafeHwnd(), id ) == RI_NOERROR ) //message sending succeeded else //navigation software not running }
© PTV AG 2011 | Generated on Fri Oct 14 2011 10:17:33 for RI by 1.7.1 |