FNCGoogleMaps synchronous execution


When calling the TMSFNCGoogleMaps.AddDirections method it execute the request asynchronously and trigger the OnRetrievedDirectionsData when google return a result.

We call AddDirections multiple times in a loop for multiple routes to be displayed, however I need to have access to the directions data directly after each AddDirections is executed.

Is it possible to have the TMSFNCGoogleMaps.AddDirections to execute synchronously (blocking) until the call is complete to access the directions data directly after the AddDirections call has been made?

If the above is not possible, is it possible to “Tag” an AddDirections request as to identify the matching OnRetrievedDirectionsData event execution when it does return the result?

Thank you for your time

Unfortunately that's not possible directly in TTMSFNCGoogleMaps. You can use TTMSFNCDirections (with the Google service) and use GetDirections, which has parameters to specify the ID or DataPointer to know which request was handled. This will not plot the data on the map, so you will need to plot it manually. We'll investigate if it's possible to handle this synchronously as well or if we can add a reference when calling the AddDirections.

Thanks Pieter, I'll look into the TTMSFNCDirections as suggested.