本文整理汇总了C#中Route.AddPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Route.AddPoint方法的具体用法?C# Route.AddPoint怎么用?C# Route.AddPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Route
的用法示例。
在下文中一共展示了Route.AddPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRoute
/// <summary>
/// Generate random route
/// </summary>
private void CreateRoute()
{
var latLon = _initLatLon;
var previousLatLon = _initLatLon;
// Get liters
var liters = double.Parse(TxLiters.Text, System.Globalization.NumberStyles.Any);
// Get consumption
var consumption = double.Parse(TxConsumption.Text, System.Globalization.NumberStyles.Any);
// Route instance
_route = new Route(new List<GLatLng>(), liters, consumption);
// Create A point
GMapControl.Add(new GMarkerWrapper(latLon, "A", Color.DarkMagenta));
// Add initial point to route
_route.AddPoint(latLon);
// Save initial distance in the current latlon
_route.SaveRemainingDistance(latLon);
var i = 0;
do
{
// Generate random route changing his lat or lan depending the condition
latLon = i % 2 == 0 ? latLon.GetRandomLon(20000, 40000) : latLon.GetRandomLat(20000, 40000);
// Add to points list
_route.AddPoint(latLon);
// Get remaining distance in this latlon
_route.CalculateRemainigDistance(latLon, previousLatLon);
// Save remaining distance in the current latlon
_route.SaveRemainingDistance(latLon);
previousLatLon = latLon;
i++;
} while (_initLatLon.distanceFrom(latLon) <= 230000);
// Create B point
GMapControl.Add(new GMarkerWrapper(latLon, "B", Color.DarkMagenta));
// Create route
GMapControl.Add(_route);
}