View Single Post

  #2 (permalink)  
Old 06-23-2003
rbarthels rbarthels is offline
Member
Green Belt
 
Join Date: Nov 2002
Posts: 52
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;
Reply With Quote