本文整理匯總了C#中OsmSharp.Routing.Vehicle.MaxSpeed方法的典型用法代碼示例。如果您正苦於以下問題:C# Vehicle.MaxSpeed方法的具體用法?C# Vehicle.MaxSpeed怎麽用?C# Vehicle.MaxSpeed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OsmSharp.Routing.Vehicle
的用法示例。
在下文中一共展示了Vehicle.MaxSpeed方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CalculateArcMetrics
/// <summary>
/// Calculate metrics for a given arc.
/// </summary>
/// <param name="vehicle"></param>
/// <param name="result"></param>
/// <param name="arc"></param>
private void CalculateArcMetrics(Vehicle vehicle, Dictionary<string, double> result, AggregatedArc arc)
{
// update the distance.
result[DISTANCE_KEY] = result[DISTANCE_KEY] + arc.Distance.Value;
// update the time.
KilometerPerHour speed = vehicle.MaxSpeed(arc.Tags);
Second time = arc.Distance / speed;
// FOR NOW USE A METRIC OF 75% MAX SPEED.
// TODO: improve this for a more realistic estimated based on the type of road.
result[TIME_KEY] = result[TIME_KEY] + time.Value;
}