Thetype exposes the following members.
Construct a DistanceMeter with no starting point and zero distance already traveled.
Construct a DistanceMeter with a start point and an initial distance (in radians) already traveled.
Returns the current distance traveled between all points (as the crow flies) in miles.
Add a new point. The distance from the previous point to this point (as the crow flies) is calculated and added to the total distance traveled.
Add a list of points. Equivalent to calling Add for each point in the list.
Zero the distance traveled, but retain the last point on the route.
Clears both the accumulated distance and the last point.
Returns a clone. Operations performed on the clone are independent.
Get total distance traveled (as the crow flies) from the starting point, through any intermediate points, to the last point that was added.
Determines whether the specified object is equal to the current object.(Inherited from .)
Serves as the default hash function.(Inherited from .)
Gets the(Inherited from of the current instance. .)
Returns a string that represents the current object.(Inherited from .)
This is useful for recording the total distance traveled along a route consisting of a number of LatLon points.
Consider using a RouteMatrix if you'd like to calculate the distance between stops on a route.
/* this example shows how to use a DistanceMeter with an IGps member (your GPS unit) */ IGps myGps = new ... // see "Tutorials -> Navigation -> The IGps Interface" for more info // start the DistanceMeter, with current GPS location and zero-distance DistanceMeter dm = new DistanceMeter(myGps.Position.location, 0); ... // suppose that this line of code gets called regularly, say once every 20 seconds dm.Add(myGps.Position.location); ... // whenever we want to get the as-the-crow-flies distance, we just need to call: double distanceTravelled = dm.Distance(DistanceUnit.Kilometers); ... // if we restart our journey we can call: dm.ClearDelta(); // ... this is like hitting 'reset' on your car odometer trip-counter. NOTE: If we // called dm.ClearAll() instead, we wouldn't start counting the distance until the // next dm.Add() - probably 20 seconds away (given our assumption about the rate // at which dd.Add() is called, above).