|
Perhaps this helps:
procedure CalculateDistance(dblLonFrom:double; dblLatFrom:double; dblLonTo:double; dblLatTo:double;var KM:double; var ZEIT:double);
var
aFromLocation:Location;
aToLocation:Location;
aRoute: Route;
begin
if (MPApplication=NIL) then
exit;
aFromLocation:=MPApplication.ActiveMap.GetLocation (dblLatFrom, dblLonFrom, 0.0);
aToLocation:=MPApplication.ActiveMap.GetLocation(d blLatTo, dblLonTo, 0.0);
Screen.Cursor := crHourGlass;
aRoute:=MPApplication.ActiveMap.ActiveRoute;
aRoute.Clear;
aRoute.Waypoints.Add(aFromLocation,'S');
aRoute.Waypoints.Add(aToLocation,'E');
aRoute.Calculate;
KM:=aRoute.Distance;
Zeit:=aRoute.DrivingTime;
Screen.Cursor := crDefault;
end; |