Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method GetTile (Number idx) 
 | 
{ 
 | 
  #keys: '1[103544.0.740665520]' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // Administrator Mar-12-2012 (created) 
 | 
    library := this.LibOSM_OSMGISLibrary(); 
 | 
    utils := library.LibOSM_Utils(); 
 | 
    mapserver := library.LibOSM_MapServer(); 
 | 
     
 | 
    arguments := library.Arguments(); 
 | 
    zoomlevelhandle := arguments.GetHandle( "zoomlevel" ); 
 | 
    tilehandle := arguments.GetHandle( "tile" ); 
 | 
    xhandle := arguments.GetHandle( "x" ); 
 | 
    yhandle := arguments.GetHandle( "y" ); 
 | 
    argumentsroot := arguments.Root(); 
 | 
     
 | 
    requestabletile := argumentsroot.Children( tilehandle ).Element( idx ); 
 | 
    utils.DebugDump( "gettiles_currentrequestabletile.txt", requestabletile ); 
 | 
    zoomlevel := argumentsroot.Child( zoomlevelhandle ).GetValueAsNumber(); 
 | 
    x := requestabletile.Child( xhandle ).GetValueAsNumber(); 
 | 
    y := requestabletile.Child( yhandle ).GetValueAsNumber(); 
 | 
     
 | 
    // Generate the URL 
 | 
    url := mapserver.GenerateTileURL( zoomlevel, x, y ); 
 | 
     
 | 
    // Generate the HTTPInterface instance that will be used to send the request to the OpenStreetMap map server 
 | 
    httpinterface := mapserver.CreateHTTPInterface(); 
 | 
    httpinterface.URL(url ); 
 | 
    onsuccesscallback := Reflection::FindMethodBySignature( typeof( LibOSM_MapServer ).Name(), "ProcessTileResponse", typeof( HTTPInterface ).Name() ); 
 | 
    assert( not isnull( onsuccesscallback ), "GetTilesCall.GetTile: failed to retrieve the method that will serve as the OnSuccess callback" ); 
 | 
    httpinterface.OnSuccessCallback( onsuccesscallback, mapserver ); 
 | 
    onfailurecallback := Reflection::FindMethodBySignature( typeof( LibOSM_MapServer ).Name(), "ProcessTileErrorResponse", typeof( HTTPInterface ).Name() ); 
 | 
    assert( not isnull( onfailurecallback ), "GetTilesCall.GetTile: failed to retrieve the method that will serve as the OnFailure callback" ); 
 | 
    httpinterface.OnFailureCallback( onfailurecallback, mapserver ); 
 | 
     
 | 
    // Send the request, asynchronously 
 | 
    key := httpinterface.ASyncCall(); 
 | 
    library.LibOSM_OSMServerCall( relinsert, construct( LibOSM_OSMServerCall, ArgumentID := idx, SentRequestID := key ) ); 
 | 
  *] 
 | 
} 
 |