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

Remote Interface Documentation

Classes | Functions | Variables

InverseGeoCoding: Inverse geocode mercator coordinates to an address string

Classes

struct  RI_CInverseGeoCoding
 Data structure for the Request "InverseGeoCoding". More...

Functions

LRESULT RI_InverseGeoCoding_ReadData (LPARAM, RI_CInverseGeoCoding &)
 Read data from shared memory for "Inverse GeoCoding".
LRESULT RI_InverseGeoCoding_WriteData (LPARAM, RI_CInverseGeoCoding &)
 Write data to shared memory for "Inverse GeoCoding".

Variables

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

Variable Documentation

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

Message ID for the Request "inverse geocoding":
RI_MESSAGE_INVERSEGEOCODING

Write Memory:

RI_InverseGeoCoding_WriteData(LPARAM id, RI_CInverseGeoCoding data );

Read Memory:

RI_InverseGeoCoding_ReadData(LPARAM id, RI_CInverseGeoCoding data );

Return Values for InverseGeoCoding:

RI_NOERROR = Inverse GeoCoding succeeded.
RI_NOTADDED = Inverse GeoCoding not succeeded, because address not found in map.

Description:

Returns an address string for a given mercator pos.
The output is given as a formatted string like the following:
D,76131,Karlsruhe,Tullastrasse,1-11|2-20
The housenumber will be given as ranges separated by the pipe '|' symbol. A range of 0-0 means no housenumber found for this side of the segment. The different ranges will always be sorted from lower to upper.

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_InverseGeoCoding::WindowProc ( UINT  message , WPARAM  wParam , LPARAM  lParam )
{
    //check messages for answer from RI
    if ( message == RI_MESSAGE_INVERSEGEOCODING )
    {
        if ( (LRESULT)wParam == RI_NOERROR )
        {
            RI_CInverseGeoCoding data;
            //Read Data from shared memory
            LRESULT read_suc = RI_InverseGeoCoding_ReadData( lParam, data );
            //Inverse GeoCoding succeeded. errorcode (0)
            TRACE(TEXT("Result Address: %s" ),data.m_address); 
            AppendStatusText( TEXT("\r\n") );
        }
        else if ( (LRESULT)wParam == RI_NOTADDED )
            //Inverse GeoCoding not succeeded, because Address not found in map. errorcode (11)
    }
    return CDialog::WindowProc( message, wParam, lParam );
}

void CDlgMFC_InverseGeoCoding::foo()
{
    //define struct
    RI_CInverseGeoCoding data;
    data.m_mercator_x = 937170;
    data.m_mercator_y = 6270165;
    // *** write data in the Shared memory***
    LPARAM id = GetUniqueID();
    LRESULT sharing_ret = RI_InverseGeoCoding_WriteData( id, data );
    if ( sharing_ret != RI_NOERROR ) 
        return;
    if ( RI_MESSAGE( RI_MESSAGE_INVERSEGEOCODING, 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