本文整理汇总了C#中Vehicle.ProbableSpeed方法的典型用法代码示例。如果您正苦于以下问题:C# Vehicle.ProbableSpeed方法的具体用法?C# Vehicle.ProbableSpeed怎么用?C# Vehicle.ProbableSpeed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vehicle
的用法示例。
在下文中一共展示了Vehicle.ProbableSpeed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TextProbableSpeed
/// <summary>
/// Tests the probable speed.
/// </summary>
/// <param name="vehicle"></param>
/// <param name="speed"></param>
/// <param name="tags"></param>
protected void TextProbableSpeed(Vehicle vehicle, double speed, params string[] tags)
{
// build tags collection.
TagsCollection tagsCollection = new TagsCollection();
for (int idx = 0; idx < tags.Length; idx = idx + 2)
{
tagsCollection.Add(tags[idx], tags[idx + 1]);
}
Assert.AreEqual(speed, vehicle.ProbableSpeed(tagsCollection).Value);
}
示例2: 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.ProbableSpeed(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;
}