Please note that the OnCalculateRoute event is triggered after the CalculateRoute call is finished.
You'll have to manually keep track to know if all requests have finished.
if in the sample Route3 (Adressdata) invalid like
"TMSFNCRouteCalculator1.CalculateRoute('xvdve','pepfdlded',nil,'Route3') ;"
then it comes never to
"if ARoute.ID = 'Route3' then Route3Finished := True;"
Is it possible to test the Adressdata for valid before Execute the CalculateRoute or is
an Event / Trigger or something in the OnCalculateRoute or OnGetDirections to check if the Route are created or not?
You can test the if the StartAddress and/or EndAddress is valid by executing a separate GetGeocoding request before calling CalculateRoute.
If the OnGetGeocoding event returns zero items, this means the provided address was invalid.
Example:
procedure TForm1.Button1Click(Sender: TObject);
begin
TMSFNCRouteCalculator1.GetGeocoding('Berlin', nil, 'Geo1');
TMSFNCRouteCalculator1.GetGeocoding('xdve', nil, 'Geo2');
end;
procedure TForm1.TMSFNCRouteCalculator1GetGeocoding(Sender: TObject;
const ARequest: TTMSFNCGeocodingRequest;
const ARequestResult: TTMSFNCCloudBaseRequestResult);
begin
if ARequest.Items.Count = 0 then
TTMSFNCUtils.Log(ARequest.ID + ' is invalid')
else
TTMSFNCUtils.Log(ARequest.ID + ' is valid');
end;