当前位置: 首页>>代码示例>>C#>>正文


C# Vehicle.MaxSpeed方法代码示例

本文整理汇总了C#中Vehicle.MaxSpeed方法的典型用法代码示例。如果您正苦于以下问题:C# Vehicle.MaxSpeed方法的具体用法?C# Vehicle.MaxSpeed怎么用?C# Vehicle.MaxSpeed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vehicle的用法示例。


在下文中一共展示了Vehicle.MaxSpeed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildDummyRoute

        /// <summary>
        /// Builds a dummy route (as the crow flies) for segments of a route not found.
        /// </summary>
        /// <returns></returns>
        public virtual Route BuildDummyRoute(Vehicle vehicle, GeoCoordinate coordinate1, GeoCoordinate coordinate2)
        {
            var route = new Route();
            route.Vehicle = vehicle.UniqueName;

            var segments = new RouteSegment[2];
            segments[0] = new RouteSegment();
            segments[0].Distance = 0;
            segments[0].Time = 0;
            segments[0].Type = RouteSegmentType.Start;
            segments[0].Vehicle = vehicle.UniqueName;
            segments[0].Latitude = (float)coordinate1.Latitude;
            segments[0].Longitude = (float)coordinate1.Longitude;

            var distance = coordinate1.DistanceReal(coordinate2).Value;
            var timeEstimage = distance / (vehicle.MaxSpeed().Value) * 3.6;
            var tags = new TagsCollection();
            tags.Add("route", "not_found");
            segments[1] = new RouteSegment();
            segments[1].Distance = distance;
            segments[1].Time = timeEstimage;
            segments[1].Type = RouteSegmentType.Stop;
            segments[1].Vehicle = vehicle.UniqueName;
            segments[1].Latitude = (float)coordinate2.Latitude;
            segments[1].Longitude = (float)coordinate2.Longitude;
            segments[1].Tags = RouteTagsExtensions.ConvertFrom(tags);

            route.Segments = segments;

            return route;
        }
开发者ID:nagyistoce,项目名称:OsmSharp-routing-api,代码行数:35,代码来源:RouterApi.cs


注:本文中的Vehicle.MaxSpeed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。