I want to calculate distance between two places(A and B) based on the positions in the route from A to B.I was given a IEnumerble collection.
I tried calculating the total distance by calculating distance between and point 1 AND POINT 2 AND THEN adding that to distance between point 2 and point 3..and so on..
I want to know if there is an elegant way of doing the same.
public static double GetDistanceTravelled(IEnumerable<System.Device.Location.GeoCoordinate> pointsInPath)
{
double TotalDistanceTravelled = 0.0;
//loop for each item in collection
// item1geocordinate.GetDistanceTo(<with second Geocoordinate>) + item2geocordinate.GetDistanceTo(<with third Geocoordinate>);
}
return TotalDistanceTravelled;
}
I want to calculate distance between two places(A and B) based on the positions in the route from A to B.I was given a IEnumerble collection.
I tried calculating the total distance by calculating distance between and point 1 AND POINT 2 AND THEN adding that to distance between point 2 and point 3..and so on..
I want to know if there is an elegant way of doing the same.
public static double GetDistanceTravelled(IEnumerable<System.Device.Location.GeoCoordinate> pointsInPath)
{
double TotalDistanceTravelled = 0.0;
//loop for each item in collection
// item1geocordinate.GetDistanceTo(<with second Geocoordinate>) + item2geocordinate.GetDistanceTo(<with third Geocoordinate>);
}
return TotalDistanceTravelled;
}
0 commentaires:
Enregistrer un commentaire