Home · All Commands · First Steps · Tutorials · Demos · FAQ
 

Remote Interface Documentation

Classes | Functions | Variables

VisibleMapRect: Set map rect

Classes

struct  RI_CVisibleMapRect
 Data structure for the Request "VisibleMapRect". More...

Functions

LRESULT RI_VisibleMapRect_WriteData (LPARAM, RI_CVisibleMapRect &)
 Write data to shared memory for "VisibleMapRect".

Variables

const UINT RI_MESSAGE_VISIBLEMAPRECT = RegisterWindowMessage(TEXT("RI_MESSAGE_VISIBLEMAPRECT"))

Variable Documentation

const UINT RI_MESSAGE_VISIBLEMAPRECT = RegisterWindowMessage(TEXT("RI_MESSAGE_VISIBLEMAPRECT"))

Message ID for the Request "VisibleMapRect":
RI_MESSAGE_VISIBLEMAPRECT

Write Memory:

RI_VisibleMapRect_WriteData(LPARAM id, RI_CVisibleMapRect data );

Return Values for VisibleMapRect:

RI_NOERROR = change MapRect success
RI_NODESC = AutoPanning is deactivated.

Description:

Sets the visible map section to the given rect 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).

Example:

#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_VisibleMapRect::WindowProc ( UINT  message , WPARAM  wParam , LPARAM  lParam )
{
    //check messages for answer from RI
    if ( message == RI_MESSAGE_VISIBLEMAPRECT )
    {
        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_VisibleMapRect::foo()
{
    // *** define struct ***
    RI_CVisibleMapRect data;
    // *** copy data ***
    data.m_panning = true;
    // set the input format to mercator
    data.m_flag = true;
    wcscpy(data.m_map_bottom, L"937170");
    wcscpy(data.m_map_left, L"6270165");
    wcscpy(data.m_map_right, L"6270165");
    wcscpy(data.m_map_top, L"937170");
    //write data to shared memory
    LPARAM id = GetUniqueID();
    LRESULT sharing_ret = RI_VisibleMapRect_WriteData( id, data );
    if ( sharing_ret != RI_NOERROR ) 
        return;
    if ( RI_MESSAGE( RI_MESSAGE_VISIBLEMAPRECT, 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 doxygen 1.7.1