修改删除飞机没有吧原点清空的bug

地图切换后操作不同的bug
This commit is contained in:
xu 2020-01-29 02:42:26 +08:00
parent 7ea00c6855
commit beb927a08c
4 changed files with 20 additions and 17 deletions

View File

@ -602,7 +602,7 @@ namespace Plane.FormationCreator.Formation
Tasks.Add(newTask); Tasks.Add(newTask);
TaskAdded?.Invoke(this, new FlightTaskAddedEventArgs { LastTask = lastTask, AddedTask = newTask }); TaskAdded?.Invoke(this, new FlightTaskAddedEventArgs { LastTask = lastTask, AddedTask = newTask });
} }
Alert.Show("导入完成!"); // Alert.Show("导入完成!");
/* /*
Dictionary<int, string[]> PointDic = new Dictionary<int, string[]>(); Dictionary<int, string[]> PointDic = new Dictionary<int, string[]>();
foreach (string line in lines) foreach (string line in lines)
@ -1982,7 +1982,7 @@ namespace Plane.FormationCreator.Formation
int destNum = kv.Key; int destNum = kv.Key;
Message.Show(moveCopterNum); Message.Show(moveCopterNum);
} }
AvoidCrashLog.Clear(); AvoidCrashLog.Clear(); //可能有丢失
} }
catch // 林俊清, 20151102, 通常是“集合已修改”异常。 catch // 林俊清, 20151102, 通常是“集合已修改”异常。
{ {
@ -2011,9 +2011,8 @@ namespace Plane.FormationCreator.Formation
{ {
if (copter != anotherCopter && copter.IsTooCloseTo(anotherCopter, out distance)) if (copter != anotherCopter && copter.IsTooCloseTo(anotherCopter, out distance))
{ {
//防止卡顿 //防止卡顿,单加任务来显示
AvoidCrashLog.Add(1, $"{copter.Name} 与 {anotherCopter.Name} 距离过近,间距{distance}米。"); AvoidCrashLog.Add(1, $"{copter.Name} 与 {anotherCopter.Name} 距离过近,间距{distance}米。");
// Message.Show($"{copter.Name} 与 {anotherCopter.Name} 距离过近,间距{distance}米。");
} }
} }
} }

View File

@ -283,9 +283,9 @@ namespace Plane.FormationCreator.ViewModels
await copter.GetCopterDataAsync(); await copter.GetCopterDataAsync();
_copterManager.Copters.AddCopter(copter); _copterManager.Copters.AddCopter(copter);
_copterManager.CopterStatus.Add(false); _copterManager.CopterStatus.Add(false);
if (_flightTaskManager.OriginLat == 0 && _flightTaskManager.OriginLng == 0)
_flightTaskManager.SetOriginal();
} }
if (_flightTaskManager.OriginLat == 0 && _flightTaskManager.OriginLng == 0)
_flightTaskManager.SetOriginal();
})); }));
} }
} }
@ -371,6 +371,8 @@ namespace Plane.FormationCreator.ViewModels
//UdpServerConnectionManager.Instance.ClearConnections(); //UdpServerConnectionManager.Instance.ClearConnections();
_virtualCopterId = 1; _virtualCopterId = 1;
_lastVirtualCopterLocation = null; _lastVirtualCopterLocation = null;
_flightTaskManager.OriginLat = 0;
_flightTaskManager.OriginLng = 0;
})); }));
} }
} }

View File

@ -357,7 +357,7 @@ namespace Plane.FormationCreator.ViewModels
} }
Alert.Show("导入完成!", "提示"); // Alert.Show("导入完成!", "提示");
})); }));
} }
} }

View File

@ -41,17 +41,23 @@ namespace Plane.FormationCreator.Views
/// </summary> /// </summary>
public partial class MapView : UserControl public partial class MapView : UserControl
{ {
public void initmap()
{
gmap.MinZoom = 2; //最小缩放
gmap.MaxZoom = 30; //最大缩放
gmap.Zoom = 19; //当前缩放
gmap.ShowCenter = true; //不显示中心十字点
gmap.DragButton = MouseButton.Middle; //中键拖拽地图
}
public MapView() public MapView()
{ {
InitializeComponent(); InitializeComponent();
this.DataContext = ServiceLocator.Current.GetInstance<MapViewModel>(); this.DataContext = ServiceLocator.Current.GetInstance<MapViewModel>();
gmap.MapProvider = GMapProviders.BingHybridMap; //google china 地图 gmap.MapProvider = GMapProviders.BingHybridMap; //google china 地图
gmap.MinZoom = 2; //最小缩放 initmap();
gmap.MaxZoom = 30; //最大缩放
gmap.Zoom = 19; //当前缩放
gmap.ShowCenter = true; //不显示中心十字点
gmap.DragButton = MouseButton.Middle; //左键拖拽地图
gmap.Position = new LatLng(40.07734857737275, 116.34323845862502).ToGCJ02(); gmap.Position = new LatLng(40.07734857737275, 116.34323845862502).ToGCJ02();
_mapManager.MapView = this; _mapManager.MapView = this;
@ -509,11 +515,7 @@ namespace Plane.FormationCreator.Views
break; break;
} }
gmap.MinZoom = 2; //最小缩放 initmap();
gmap.MaxZoom = 30; //最大缩放
gmap.Zoom = 19; //当前缩放
gmap.ShowCenter = false; //不显示中心十字点
gmap.DragButton = MouseButton.Left; //左键拖拽地图
/* /*
switch ((e.AddedItems[0] as FrameworkElement).Tag.ToString()) switch ((e.AddedItems[0] as FrameworkElement).Tag.ToString())