當前位置: 首頁>>代碼示例>>C#>>正文


C# Vehicle.ProbableSpeed方法代碼示例

本文整理匯總了C#中OsmSharp.Routing.Vehicle.ProbableSpeed方法的典型用法代碼示例。如果您正苦於以下問題:C# Vehicle.ProbableSpeed方法的具體用法?C# Vehicle.ProbableSpeed怎麽用?C# Vehicle.ProbableSpeed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OsmSharp.Routing.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.
            SimpleTagsCollection tagsCollection = new SimpleTagsCollection();
            for (int idx = 0; idx < tags.Length; idx = idx + 2)
            {
                tagsCollection.Add(tags[idx], tags[idx + 1]);
            }

            Assert.AreEqual(speed, vehicle.ProbableSpeed(tagsCollection).Value);
        }
開發者ID:jboneng,項目名稱:OsmSharp,代碼行數:17,代碼來源:VehicleBaseTests.cs

示例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;
        }
開發者ID:OpenMaps,項目名稱:OsmSharp,代碼行數:19,代碼來源:TimeCalculator.cs


注:本文中的OsmSharp.Routing.Vehicle.ProbableSpeed方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。