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

Remote Interface Documentation

Classes | Functions | Variables

LinkMercator2Map: Link a mercator coordinate to a map coordinate

Classes

struct  RI_CLinkMercator2Map
 Data structure for the Request "link mercator to map". More...

Functions

LRESULT RI_LinkMercator2Map_ReadData (LPARAM, RI_CLinkMercator2Map &)
 Read data from shared memory for "LinkMercator2Map".
LRESULT RI_LinkMercator2Map_WriteData (LPARAM, RI_CLinkMercator2Map &)
 Write data to shared memory for "LinkMercator2Map".

Variables

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

Variable Documentation

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

Message ID for the Request "link mercator to map":
RI_MESSAGE_LinkMercator2Map

Write Memory:

RI_LinkMercator2Map_WriteData(LPARAM id, RI_CLinkMercator2Map data );

Read Memory:

RI_LinkMercator2Map_ReadData(LPARAM id, RI_CLinkMercator2Map data );

Return Values for LinkMercator2Map:

RI_NOERROR = Link Mercator to Map succeeded
RI_NOTLINKABLE = the coordinates are not linkable

Description:

Formerly this call matched the pos set by RI_LinkMercator2Map_WriteData() to a street.
In the current implementation, RI_LinkMercator2Map_ReadData() returns the pos set by the writer.

Returns a single package.

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_LinkMercator2Map::WindowProc ( UINT  message , WPARAM  wParam , LPARAM  lParam )
{
    //check messages for answer from RI
    if ( message == RI_MESSAGE_LinkMercator2Map )
    {
        if ( (LRESULT)wParam == RI_NOERROR )
        {
            //LinkMercator2Map succeeded. errorcode (0)
            //get the data from the shared memory
            RI_CLinkMercator2Map data;
            LRESULT read_suc = RI_LinkMercator2Map_ReadData( lParam, data );
            if ( read_suc != RI_NOERROR )
                //...data was overwritten. errorcode (-2)
            else
            {
                TRACE(TEXT("X-Koordinate: %i\n"), data.m_linked_mercator_x);
                TRACE(TEXT("Y-Koordinate: %i\n"), data.m_linked_mercator_y);
            }
        }
        else if ( (LRESULT)wParam == RI_NOTLINKABLE )
        {
            //LinkMercator2Map is not linkable. errorcode (10)
        }
        else
            //LinkMercator2Map not succeeded. unkown error
    }
    return CDialog::WindowProc( message, wParam, lParam );
}

void CDlgMFC_LinkMercator2Map::foo()
{
    //*** copy data ***
    RI_CLinkMercator2Map data;
    data.m_mercator_x = 935040;
    data.m_mercator_y = 6269625;

    //*** write data to shared memory ***
    LPARAM id = GetUniqueID();
    LRESULT sharing_ret = RI_LinkMercator2Map_WriteData( id, data );
    if ( sharing_ret != RI_NOERROR )
        return;
    if ( RI_MESSAGE( RI_MESSAGE_LinkMercator2Map, GetSafeHwnd(), id ) == RI_NOERROR )
        //message sending succeeded
    else
        //navigation software not running
}

© PTV AG 2011 Generated on Fri Oct 14 2011 10:17:32 for RI by doxygen 1.7.1