为优化速度,2D和3D地图不同时显示位置
This commit is contained in:
parent
7ac2f48500
commit
c0fa7d8ddb
@ -35,6 +35,12 @@
|
||||
<cnv:BooleanToStringConverter x:Key="ShowModifyTaskViewButtonContentConverter"
|
||||
False="【飞行模式】"
|
||||
True="【编辑模式】" />
|
||||
|
||||
<cnv:BooleanToStringConverter x:Key="Show2d3dButtonContentConverter"
|
||||
False="平面地图"
|
||||
True="三维地图" />
|
||||
|
||||
|
||||
<cnv:BooleanToResourceConverter x:Key="CheckSignConverter"
|
||||
FalseKey="CloseIcon"
|
||||
TrueKey="CheckIcon" />
|
||||
|
@ -121,7 +121,20 @@ namespace Plane.FormationCreator.Formation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private bool _TaskRun_2D = true;
|
||||
public bool TaskRun_2D
|
||||
{
|
||||
get { return _TaskRun_2D; }
|
||||
set
|
||||
{
|
||||
if (Set(nameof(TaskRun_2D), ref _TaskRun_2D, value))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddTakeOffTask(IEnumerable<ICopter> copters)
|
||||
{
|
||||
@ -1964,10 +1977,7 @@ namespace Plane.FormationCreator.Formation
|
||||
{
|
||||
if (copter != anotherCopter && copter.IsTooCloseTo(anotherCopter, out distance))
|
||||
{
|
||||
//Pause();
|
||||
Message.Show($"{copter.Name} 与 {anotherCopter.Name} 距离过近,间距{distance}米。");
|
||||
// Alert.Show($"{copter.Name} 与 {anotherCopter.Name} 距离过近,已中止任务。");
|
||||
//return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@
|
||||
|
||||
<Button Content="{Binding AppEx.ShowModifyTaskView, Converter={StaticResource ShowModifyTaskViewButtonContentConverter}}"
|
||||
Command="{Binding ShowOrHideModifyTaskViewCommand}" />
|
||||
<Button Content="切换地图"
|
||||
<Button Content="{Binding b2DMapMode, Converter={StaticResource Show2d3dButtonContentConverter}}"
|
||||
Command="{Binding ChangeMapModeCommand}"/>
|
||||
<Button Content="重启监听"
|
||||
Visibility="Collapsed"
|
||||
|
@ -160,6 +160,14 @@ namespace Plane.FormationCreator.ViewModels
|
||||
set { Set(nameof(MapMode), ref _MapMode, value); }
|
||||
}
|
||||
|
||||
private bool _b2DMapMode = true;
|
||||
public bool b2DMapMode
|
||||
{
|
||||
get { return _b2DMapMode; }
|
||||
set { Set(nameof(b2DMapMode), ref _b2DMapMode, value); }
|
||||
}
|
||||
|
||||
|
||||
private ICommand _ChangeMapModeCommand;
|
||||
public ICommand ChangeMapModeCommand
|
||||
{
|
||||
@ -168,9 +176,21 @@ namespace Plane.FormationCreator.ViewModels
|
||||
return _ChangeMapModeCommand ?? (_ChangeMapModeCommand = new RelayCommand(() =>
|
||||
{
|
||||
if (MapMode == 0)
|
||||
{
|
||||
MapMode = 1;
|
||||
b2DMapMode = false;
|
||||
_flightTaskManager.TaskRun_2D = b2DMapMode; //3D模式模拟显示
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MapMode = 0;
|
||||
b2DMapMode = true;
|
||||
_flightTaskManager.TaskRun_2D = b2DMapMode; //2D模式模拟显示
|
||||
}
|
||||
|
||||
|
||||
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
@ -103,6 +103,7 @@ namespace Plane.FormationCreator.ViewModels
|
||||
|
||||
private void AddOrMove3DCopter(ICopter copter)
|
||||
{
|
||||
if (_flightTaskManager.TaskRun_2D) return; //不在3D模式运行直接退出
|
||||
//var copternum1 = _copterManager.Copters.FirstOrDefault();
|
||||
if (_flightTaskManager.OriginLat == 0 || _flightTaskManager.OriginLng == 0)
|
||||
return;
|
||||
|
@ -44,7 +44,8 @@ namespace Plane.FormationCreator.Views
|
||||
|
||||
_flightTaskManager.TasksCleared += (sender, e) =>
|
||||
{
|
||||
Route.Points.Clear();
|
||||
if (Route!=null)
|
||||
Route.Points.Clear();
|
||||
// for (int i = this.Route.Locations.Count - 1; i >= 1; i--)
|
||||
// {
|
||||
// this.Route.Locations.RemoveAt(i);
|
||||
@ -131,6 +132,8 @@ namespace Plane.FormationCreator.Views
|
||||
|
||||
public void AddOrMoveCopter()
|
||||
{
|
||||
// return;
|
||||
if (!_flightTaskManager.TaskRun_2D) return; //不在2D模式运行直接退出
|
||||
try
|
||||
{
|
||||
var location = new Microsoft.Maps.MapControl.WPF.Location(Copter.Latitude, Copter.Longitude, Copter.Altitude);
|
||||
@ -578,13 +581,13 @@ namespace Plane.FormationCreator.Views
|
||||
|
||||
if (selected)
|
||||
{
|
||||
if (!DotContainer.Children.Contains(selectMarkup))
|
||||
if ((DotContainer!=null)&&(!DotContainer.Children.Contains(selectMarkup)))
|
||||
DotContainer.Children.Add(selectMarkup);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (DotContainer.Children.Contains(selectMarkup))
|
||||
if ((DotContainer != null) && (DotContainer.Children.Contains(selectMarkup)))
|
||||
DotContainer.Children.Remove(selectMarkup);
|
||||
}
|
||||
|
||||
@ -603,6 +606,7 @@ namespace Plane.FormationCreator.Views
|
||||
public void ResetRoute(int taskIndex)
|
||||
{
|
||||
var wpIndex = taskIndex - 1; // Waypoints 中没有起飞点。
|
||||
if (Route == null) return;
|
||||
Route.Points.Clear();
|
||||
if (wpIndex >= 0 && wpIndex < Waypoints.Count)
|
||||
{
|
||||
|
@ -193,9 +193,7 @@
|
||||
<Button Content="重置"
|
||||
Background="#232323"
|
||||
Command="{Binding ResetTasksCommand}" />
|
||||
<Button Content="下一步"
|
||||
Background="#232323"
|
||||
Command="{Binding NextTasksCommand}" />
|
||||
|
||||
<Button Content="飞到任务"
|
||||
Background="#232323"
|
||||
Command="{Binding flyTotaskCommand}" />
|
||||
|
Loading…
Reference in New Issue
Block a user