C# 如何在c中从bing地图中删除航路点
我无法在c WPF中从bing地图中删除航路点,我使用了航路点删除、清除、删除,但仍然没有删除 如何在c中从bing地图中删除航路点 还提供代码以删除航路点之间的路径 源和目标是位置纬度、经度C# 如何在c中从bing地图中删除航路点,c#,bing-maps,C#,Bing Maps,我无法在c WPF中从bing地图中删除航路点,我使用了航路点删除、清除、删除,但仍然没有删除 如何在c中从bing地图中删除航路点 还提供代码以删除航路点之间的路径 源和目标是位置纬度、经度 startWaypoint = new Bing.Maps.Directions.Waypoint(Source); endWaypoint = new Bing.Maps.Directions.Waypoint(Destination); waypoints = new Bing.Maps.Direc
startWaypoint = new Bing.Maps.Directions.Waypoint(Source);
endWaypoint = new Bing.Maps.Directions.Waypoint(Destination);
waypoints = new Bing.Maps.Directions.WaypointCollection();
waypoints.Add(startWaypoint);
waypoints.Add(endWaypoint);
//Start = waypoints.IndexOf(startWaypoint);
//End = waypoints.IndexOf(endWaypoint);
directionsManager = GuideMap.DirectionsManager;
directionsManager.Waypoints = waypoints;
// Calculate route directions
Bing.Maps.Directions.RouteResponse response = await directionsManager.CalculateDirectionsAsync();
route = response.Routes[0];
// Display the route on the map
directionsManager.ShowRoutePath(response.Routes[0]);
我想这会管用的
directionsManager.Waypoints.Remove(startWaypoint);
我不确定,我还没有测试过
扫清道路
directionsManager.ClearActiveRoute();
我得到了同样的代码:- //清除路径或路线& //清除或删除路径或路线的路径
GuideMap.DirectionsManager.HideRoutePath(GuideMap.DirectionsManager.ActiveRoute);
GuideMap.DirectionsManager.ClearActiveRoute();
MapLayer directionsLayer = VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(GuideMap, 0), 0), 0) as MapLayer;
directionsLayer.Children.Clear();
我花了很长时间才得到答案,但我正在研究同样的问题,即清除路线 替换:
directionsManager.ShowRoutePath(response.Routes[0]);
与:
然后:
directionsManager.ClearActiveRoute();
谢谢Sybren…我使用了代码_startWaypoint=new Bing.Maps.Directions.WaypointSource;endWaypoint=新Bing.Maps.Directions.WaypointDestination;航路点=新Bing.Maps.Directions.WaypointCollection;waypoints.AddstartWaypoint;航路点。添加航路点;\u现在我正在使用Waypoint.removestartpoint;但是我仍然不能删除它。你能提供代码部分在哪里添加起始点吗?请编辑你的问题并在那里输入代码,而不是在评论中。我用对应的C代码编辑了我的问题。。。我想在某个特定事件中删除这些瓦特点我也已经使用过了,即使我使用了waypoint.removeatindex和waypoint.clear,它们都不起作用。。。那么,您是否可以使用其他选项删除这些波点。如果您清除当前路线,删除一个航路点并重新计算路线,会发生什么情况?要检查航路点是否已从航路点集合中删除,请打印航路点。计数;我仍然没有得到任何解决我的问题的办法,所以如果有任何人有任何解决办法,我们都非常欢迎。
directionsManager.ClearActiveRoute();