增加过度航点属性,通过颜色区分
加入起飞检测额外时间,默认4秒,加入参数控制时间和高度 加入自动计算航线碰撞检测间距参数 加入2D计算返航
This commit is contained in:
parent
17e4c8bd97
commit
2614dc2f59
@ -1,80 +1,83 @@
|
||||
<Application x:Class="Plane.FormationCreator.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:Plane.FormationCreator"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
d1p1:Ignorable="d"
|
||||
xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:cnv="clr-namespace:Plane.Windows.Converters;assembly=Plane.Windows"
|
||||
xmlns:lcnv="clr-namespace:Plane.FormationCreator.Converters"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
ShutdownMode="OnMainWindowClose">
|
||||
|
||||
<Application.Resources>
|
||||
<materialDesign:PackIcon x:Key="CheckIcon"
|
||||
x:Shared="False"
|
||||
Kind="Check"
|
||||
Foreground="#2196F3" />
|
||||
<materialDesign:PackIcon x:Key="CloseIcon"
|
||||
x:Shared="False"
|
||||
Kind="Close"
|
||||
Foreground="White" />
|
||||
<cnv:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
<cnv:BooleanToVisibilityConverter x:Key="InversiveBooleanToVisibilityConverter"
|
||||
False="Visible"
|
||||
True="Collapsed" />
|
||||
<cnv:NullableBooleanToVisibilityConverter x:Key="IsPausedToRunButtonVisibilityConverter"
|
||||
False="Collapsed"
|
||||
Null="Visible"
|
||||
True="Visible" />
|
||||
<cnv:NullableBooleanToVisibilityConverter x:Key="IsPausedToPauseButtonVisibilityConverter"
|
||||
False="Visible"
|
||||
Null="Collapsed"
|
||||
True="Collapsed" />
|
||||
<cnv:InverseBooleanConverter x:Key="InverseBooleanConverter" />
|
||||
<cnv:BooleanToStringConverter x:Key="ShowModifyTaskViewButtonContentConverter"
|
||||
False="【飞行模式】"
|
||||
True="【设计模式】" />
|
||||
|
||||
|
||||
<cnv:BooleanToStringConverter x:Key="MainColorConverterDes"
|
||||
False="White"
|
||||
True="DeepSkyBlue" />
|
||||
<cnv:BooleanToStringConverter x:Key="MainFontSizeConverterDes"
|
||||
False="12"
|
||||
True="14" />
|
||||
|
||||
|
||||
|
||||
<cnv:BooleanToStringConverter x:Key="MainColorConverterFly"
|
||||
False="DeepSkyBlue"
|
||||
True="White" />
|
||||
<cnv:BooleanToStringConverter x:Key="MainFontSizeConverterFly"
|
||||
False="14"
|
||||
True="12" />
|
||||
|
||||
|
||||
|
||||
<cnv:BooleanToStringConverter x:Key="Show2d3dButtonContentConverter"
|
||||
False="平面视图"
|
||||
True="立体视图" />
|
||||
|
||||
|
||||
<cnv:BooleanToResourceConverter x:Key="CheckSignConverter"
|
||||
FalseKey="CloseIcon"
|
||||
TrueKey="CheckIcon" />
|
||||
<cnv:BooleanToResourceConverter x:Key="CheckSignConverter2"
|
||||
FalseKey="CloseIcon"
|
||||
TrueKey="CheckIcon" />
|
||||
<cnv:BooleanToStringConverter x:Key="ColorConverter"
|
||||
False="Red"
|
||||
True="Green" />
|
||||
<cnv:BooleanToStringConverter x:Key="SendConverter"
|
||||
False="发送"
|
||||
True="关闭" />
|
||||
<lcnv:HeartbeatCountToBrushConverter x:Key="HeartbeatCountToBrushConverter" />
|
||||
<lcnv:AppModeToVisibilityConverter x:Key="AppModeToVisibilityConverter" />
|
||||
<lcnv:FlightTaskStatusToFillConverter x:Key="FlightTaskStatusToFillConverter" />
|
||||
<lcnv:FlightTaskIsSelectedToEffectConverter x:Key="FlightTaskIsSelectedToEffectConverter" />
|
||||
</Application.Resources>
|
||||
<Application x:Class="Plane.FormationCreator.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:Plane.FormationCreator"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
d1p1:Ignorable="d"
|
||||
xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:cnv="clr-namespace:Plane.Windows.Converters;assembly=Plane.Windows"
|
||||
xmlns:lcnv="clr-namespace:Plane.FormationCreator.Converters"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
ShutdownMode="OnMainWindowClose">
|
||||
|
||||
<Application.Resources>
|
||||
<materialDesign:PackIcon x:Key="CheckIcon"
|
||||
x:Shared="False"
|
||||
Kind="Check"
|
||||
Foreground="#2196F3" />
|
||||
<materialDesign:PackIcon x:Key="CloseIcon"
|
||||
x:Shared="False"
|
||||
Kind="Close"
|
||||
Foreground="White" />
|
||||
<cnv:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
<cnv:BooleanToVisibilityConverter x:Key="InversiveBooleanToVisibilityConverter"
|
||||
False="Visible"
|
||||
True="Collapsed" />
|
||||
<cnv:NullableBooleanToVisibilityConverter x:Key="IsPausedToRunButtonVisibilityConverter"
|
||||
False="Collapsed"
|
||||
Null="Visible"
|
||||
True="Visible" />
|
||||
<cnv:NullableBooleanToVisibilityConverter x:Key="IsPausedToPauseButtonVisibilityConverter"
|
||||
False="Visible"
|
||||
Null="Collapsed"
|
||||
True="Collapsed" />
|
||||
<cnv:InverseBooleanConverter x:Key="InverseBooleanConverter" />
|
||||
<cnv:BooleanToStringConverter x:Key="ShowModifyTaskViewButtonContentConverter"
|
||||
False="【飞行模式】"
|
||||
True="【设计模式】" />
|
||||
|
||||
|
||||
<cnv:BooleanToStringConverter x:Key="MainColorConverterDes"
|
||||
False="White"
|
||||
True="DeepSkyBlue" />
|
||||
<cnv:BooleanToStringConverter x:Key="MainFontSizeConverterDes"
|
||||
False="12"
|
||||
True="14" />
|
||||
|
||||
|
||||
|
||||
<cnv:BooleanToStringConverter x:Key="MainColorConverterFly"
|
||||
False="DeepSkyBlue"
|
||||
True="White" />
|
||||
<cnv:BooleanToStringConverter x:Key="MainFontSizeConverterFly"
|
||||
False="14"
|
||||
True="12" />
|
||||
|
||||
|
||||
|
||||
<cnv:BooleanToStringConverter x:Key="Show2d3dButtonContentConverter"
|
||||
False="平面视图"
|
||||
True="立体视图" />
|
||||
|
||||
|
||||
<cnv:BooleanToResourceConverter x:Key="CheckSignConverter"
|
||||
FalseKey="CloseIcon"
|
||||
TrueKey="CheckIcon" />
|
||||
<cnv:BooleanToResourceConverter x:Key="CheckSignConverter2"
|
||||
FalseKey="CloseIcon"
|
||||
TrueKey="CheckIcon" />
|
||||
<cnv:BooleanToStringConverter x:Key="ColorConverter"
|
||||
False="Red"
|
||||
True="Green" />
|
||||
<cnv:BooleanToStringConverter x:Key="SendConverter"
|
||||
False="发送"
|
||||
True="关闭" />
|
||||
<lcnv:HeartbeatCountToBrushConverter x:Key="HeartbeatCountToBrushConverter" />
|
||||
<lcnv:AppModeToVisibilityConverter x:Key="AppModeToVisibilityConverter" />
|
||||
<lcnv:FlightTaskStatusToFillConverter x:Key="FlightTaskStatusToFillConverter" />
|
||||
|
||||
<lcnv:FlightTaskStatusAndTransitionToFillConverter x:Key="FlightTaskStatusAndTransitionToFillConverter" />
|
||||
|
||||
<lcnv:FlightTaskIsSelectedToEffectConverter x:Key="FlightTaskIsSelectedToEffectConverter" />
|
||||
</Application.Resources>
|
||||
</Application>
|
@ -1,179 +1,194 @@
|
||||
using Plane.Copters;
|
||||
using Plane.Logging;
|
||||
using GalaSoft.MvvmLight;
|
||||
using Microsoft.Practices.ServiceLocation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Plane.FormationCreator.Formation
|
||||
{
|
||||
public partial class FlightTask : ObservableObject
|
||||
{
|
||||
public FlightTask(FlightTaskType type)
|
||||
{
|
||||
TaskType = type;
|
||||
}
|
||||
|
||||
private FlightTaskManager _flightTaskManager = ServiceLocator.Current.GetInstance<FlightTaskManager>();
|
||||
|
||||
private ILogger _logger = ServiceLocator.Current.GetInstance<ILogger>();
|
||||
|
||||
private FlightTaskStatus _Status = FlightTaskStatus.Stop;
|
||||
public FlightTaskStatus Status
|
||||
{
|
||||
get { return _Status; }
|
||||
set { Set(nameof(Status), ref _Status, value); }
|
||||
}
|
||||
|
||||
private FlightTaskType _TaskType;
|
||||
public FlightTaskType TaskType
|
||||
{
|
||||
get { return _TaskType; }
|
||||
set
|
||||
{
|
||||
Set(nameof(TaskType), ref _TaskType, value);
|
||||
RaisePropertyChanged(nameof(TaskTypeIndex));
|
||||
RaisePropertyChanged(nameof(TaskCnName));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
public int TaskTypeIndex
|
||||
{
|
||||
get { return (int)TaskType; }
|
||||
set
|
||||
{
|
||||
TaskType = (FlightTaskType)value;
|
||||
VerticalLift = false;
|
||||
if ( (value == (int)FlightTaskType.Loiter) || (value == (int)FlightTaskType.Circle) )
|
||||
{
|
||||
VerticalLift = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
private string _TaskName = "";
|
||||
public string TaskCnName
|
||||
{
|
||||
get
|
||||
{
|
||||
string name = "";
|
||||
switch (TaskType)
|
||||
{
|
||||
case FlightTaskType.TakeOff: name = "起飞"; break;
|
||||
case FlightTaskType.FlyTo: name = _TaskName == "" ? "航点" : _TaskName; break;
|
||||
case FlightTaskType.Land: name = "降落"; break;
|
||||
}
|
||||
//name = (TaskIndex + 1).ToString() + "." + name;
|
||||
return name;
|
||||
}
|
||||
set {
|
||||
|
||||
Set(nameof(TaskCnName), ref _TaskName, value);
|
||||
RaisePropertyChanged(nameof(TaskCnName));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public int TaskTypeIndex
|
||||
{
|
||||
get {
|
||||
int index = 1;
|
||||
switch (TaskType)
|
||||
{
|
||||
case FlightTaskType.TakeOff:index = 0; break;
|
||||
case FlightTaskType.FlyTo: index = 1; break;
|
||||
case FlightTaskType.Land: index = 2; break;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 0: TaskType = FlightTaskType.TakeOff; break;
|
||||
case 1: TaskType = FlightTaskType.FlyTo; break;
|
||||
case 2: TaskType = FlightTaskType.Land; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//task在所以任务中的index
|
||||
public int TaskIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _flightTaskManager.Tasks.IndexOf(this);
|
||||
}
|
||||
}
|
||||
|
||||
public int TaskNum
|
||||
{
|
||||
get
|
||||
{
|
||||
return TaskIndex + 1;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _IsSelected;
|
||||
public bool IsSelected
|
||||
{
|
||||
get { return _IsSelected; }
|
||||
set { Set(nameof(IsSelected), ref _IsSelected, value); }
|
||||
}
|
||||
|
||||
// 右键单击任务,用于隐藏任务图标, added by ZJF
|
||||
private bool _IsRightSelected;
|
||||
public bool IsRightSelected
|
||||
{
|
||||
get { return _IsRightSelected; }
|
||||
set { Set(nameof(IsRightSelected), ref _IsRightSelected, value); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public List<FlightTaskSingleCopterInfo> SingleCopterInfos { get; set; } = new List<FlightTaskSingleCopterInfo>();
|
||||
|
||||
private FlightTaskSingleCopterInfo _ModifyingSingleCopterInfo;
|
||||
public FlightTaskSingleCopterInfo ModifyingSingleCopterInfo
|
||||
{
|
||||
get { return _ModifyingSingleCopterInfo; }
|
||||
set { Set(nameof(ModifyingSingleCopterInfo), ref _ModifyingSingleCopterInfo, value); }
|
||||
}
|
||||
|
||||
public async Task RunAsync()
|
||||
{
|
||||
switch (TaskType)
|
||||
{
|
||||
case FlightTaskType.FlyTo:
|
||||
await RunFlyToTaskAsync().ConfigureAwait(false);
|
||||
break;
|
||||
case FlightTaskType.TakeOff:
|
||||
//多架同时起飞
|
||||
//await MutilRunTakeOffTaskAsync().ConfigureAwait(false);
|
||||
await NewMutilRunTakeOffTaskAsync().ConfigureAwait(false);
|
||||
break;
|
||||
case FlightTaskType.Land:
|
||||
await MutilLandTaskAsync().ConfigureAwait(false);
|
||||
break;
|
||||
default:
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum FlightTaskType
|
||||
{
|
||||
FlyTo = 0,
|
||||
Land = 6,
|
||||
TakeOff = 100
|
||||
}
|
||||
}
|
||||
using Plane.Copters;
|
||||
using Plane.Logging;
|
||||
using GalaSoft.MvvmLight;
|
||||
using Microsoft.Practices.ServiceLocation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Plane.FormationCreator.Formation
|
||||
{
|
||||
public partial class FlightTask : ObservableObject
|
||||
{
|
||||
public FlightTask(FlightTaskType type)
|
||||
{
|
||||
TaskType = type;
|
||||
}
|
||||
|
||||
private FlightTaskManager _flightTaskManager = ServiceLocator.Current.GetInstance<FlightTaskManager>();
|
||||
|
||||
private ILogger _logger = ServiceLocator.Current.GetInstance<ILogger>();
|
||||
|
||||
private FlightTaskStatus _Status = FlightTaskStatus.Stop;
|
||||
public FlightTaskStatus Status
|
||||
{
|
||||
get { return _Status; }
|
||||
set { Set(nameof(Status), ref _Status, value); }
|
||||
}
|
||||
|
||||
private FlightTaskType _TaskType;
|
||||
public FlightTaskType TaskType
|
||||
{
|
||||
get { return _TaskType; }
|
||||
set
|
||||
{
|
||||
Set(nameof(TaskType), ref _TaskType, value);
|
||||
RaisePropertyChanged(nameof(TaskTypeIndex));
|
||||
RaisePropertyChanged(nameof(TaskCnName));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
public int TaskTypeIndex
|
||||
{
|
||||
get { return (int)TaskType; }
|
||||
set
|
||||
{
|
||||
TaskType = (FlightTaskType)value;
|
||||
VerticalLift = false;
|
||||
if ( (value == (int)FlightTaskType.Loiter) || (value == (int)FlightTaskType.Circle) )
|
||||
{
|
||||
VerticalLift = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
private string _TaskName = "";
|
||||
public string TaskCnName
|
||||
{
|
||||
get
|
||||
{
|
||||
string name = "";
|
||||
switch (TaskType)
|
||||
{
|
||||
case FlightTaskType.TakeOff: name = "起飞"; break;
|
||||
case FlightTaskType.FlyTo: name = _TaskName == "" ? "航点" : _TaskName; break;
|
||||
case FlightTaskType.Land: name = "降落"; break;
|
||||
}
|
||||
//name = (TaskIndex + 1).ToString() + "." + name;
|
||||
return name;
|
||||
}
|
||||
set {
|
||||
|
||||
Set(nameof(TaskCnName), ref _TaskName, value);
|
||||
RaisePropertyChanged(nameof(TaskCnName));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public int TaskTypeIndex
|
||||
{
|
||||
get {
|
||||
int index = 1;
|
||||
switch (TaskType)
|
||||
{
|
||||
case FlightTaskType.TakeOff:index = 0; break;
|
||||
case FlightTaskType.FlyTo: index = 1; break;
|
||||
case FlightTaskType.Land: index = 2; break;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 0: TaskType = FlightTaskType.TakeOff; break;
|
||||
case 1: TaskType = FlightTaskType.FlyTo; break;
|
||||
case 2: TaskType = FlightTaskType.Land; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//task在所以任务中的index
|
||||
public int TaskIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _flightTaskManager.Tasks.IndexOf(this);
|
||||
}
|
||||
}
|
||||
|
||||
public int TaskNum
|
||||
{
|
||||
get
|
||||
{
|
||||
return TaskIndex + 1;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _IsTransition=false;
|
||||
public bool IsTransition
|
||||
{
|
||||
get { return _IsTransition; }
|
||||
set {
|
||||
|
||||
Set(nameof(IsTransition), ref _IsTransition, value);
|
||||
if ((value)&& (TaskCnName == "航点"))
|
||||
TaskCnName = "过度";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private bool _IsSelected;
|
||||
public bool IsSelected
|
||||
{
|
||||
get { return _IsSelected; }
|
||||
set { Set(nameof(IsSelected), ref _IsSelected, value); }
|
||||
}
|
||||
|
||||
// 右键单击任务,用于隐藏任务图标, added by ZJF
|
||||
private bool _IsRightSelected;
|
||||
public bool IsRightSelected
|
||||
{
|
||||
get { return _IsRightSelected; }
|
||||
set { Set(nameof(IsRightSelected), ref _IsRightSelected, value); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public List<FlightTaskSingleCopterInfo> SingleCopterInfos { get; set; } = new List<FlightTaskSingleCopterInfo>();
|
||||
|
||||
private FlightTaskSingleCopterInfo _ModifyingSingleCopterInfo;
|
||||
public FlightTaskSingleCopterInfo ModifyingSingleCopterInfo
|
||||
{
|
||||
get { return _ModifyingSingleCopterInfo; }
|
||||
set { Set(nameof(ModifyingSingleCopterInfo), ref _ModifyingSingleCopterInfo, value); }
|
||||
}
|
||||
|
||||
public async Task RunAsync()
|
||||
{
|
||||
switch (TaskType)
|
||||
{
|
||||
case FlightTaskType.FlyTo:
|
||||
await RunFlyToTaskAsync().ConfigureAwait(false);
|
||||
break;
|
||||
case FlightTaskType.TakeOff:
|
||||
//多架同时起飞
|
||||
//await MutilRunTakeOffTaskAsync().ConfigureAwait(false);
|
||||
await NewMutilRunTakeOffTaskAsync().ConfigureAwait(false);
|
||||
break;
|
||||
case FlightTaskType.Land:
|
||||
await MutilLandTaskAsync().ConfigureAwait(false);
|
||||
break;
|
||||
default:
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum FlightTaskType
|
||||
{
|
||||
FlyTo = 0,
|
||||
Land = 6,
|
||||
TakeOff = 100
|
||||
}
|
||||
}
|
||||
|
@ -375,9 +375,32 @@ namespace Plane.FormationCreator.Formation
|
||||
set { Set(nameof(FC_defvel_down), ref _FC_defvel_down, value); }
|
||||
}
|
||||
|
||||
//起飞检测额外时间,默认4秒
|
||||
private float _FC_takeoff_ct = 4000;
|
||||
public float FC_takeoff_ct
|
||||
{
|
||||
get { return _FC_takeoff_ct; }
|
||||
set { Set(nameof(FC_takeoff_ct), ref _FC_takeoff_ct, value); }
|
||||
}
|
||||
|
||||
//起飞检测高度cm
|
||||
private float _FC_takeoff_calt = 100;
|
||||
public float FC_takeoff_calt
|
||||
{
|
||||
get { return _FC_takeoff_calt; }
|
||||
set { Set(nameof(FC_takeoff_calt), ref _FC_takeoff_calt, value); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
//自动计算航线,碰撞检测间距,航线小于1.8米再检测前后距离是否大于_FC_SpaceBetween (cm)
|
||||
private float _FC_SpaceBetween = 250;
|
||||
public float FC_SpaceBetween
|
||||
{
|
||||
get { return _FC_SpaceBetween;}
|
||||
set { Set(nameof(FC_SpaceBetween), ref _FC_SpaceBetween, value); }
|
||||
}
|
||||
|
||||
|
||||
private TasksStatus _TaskState = TasksStatus.Stop;
|
||||
public TasksStatus TaskState
|
||||
@ -1196,7 +1219,7 @@ namespace Plane.FormationCreator.Formation
|
||||
}
|
||||
}
|
||||
|
||||
public void RestoreFlyToTask(bool staggerRoutes, int flytoTime, int loiterTime, string taskName, dynamic singleCopterInfos, bool isMeter)
|
||||
public void RestoreFlyToTask(bool staggerRoutes, int flytoTime, int loiterTime, string taskName, dynamic singleCopterInfos, bool isMeter, bool istrans)
|
||||
{
|
||||
var copters = _copterManager.Copters;
|
||||
float tagalt = 15;
|
||||
@ -1206,7 +1229,7 @@ namespace Plane.FormationCreator.Formation
|
||||
var nullableCenter = copters.GetCenter();
|
||||
if (nullableCenter == null) return;
|
||||
var center = nullableCenter.Value;
|
||||
var newTask = new FlightTask(FlightTaskType.FlyTo) { StaggerRoutes = staggerRoutes, FlytoTime = flytoTime, LoiterTime = loiterTime };
|
||||
var newTask = new FlightTask(FlightTaskType.FlyTo) { StaggerRoutes = staggerRoutes, FlytoTime = flytoTime, LoiterTime = loiterTime,IsTransition= istrans };
|
||||
if (taskName != null) newTask.TaskCnName = taskName;
|
||||
// TODO: 王海, 20150801, 处理实际飞行器数目与记录中数目不一致的情况。
|
||||
for (int i = 0; i < copters.Count; i++)
|
||||
@ -1341,6 +1364,7 @@ namespace Plane.FormationCreator.Formation
|
||||
flytoTime = task.FlytoTime,
|
||||
loiterTime = task.LoiterTime,
|
||||
taskname = task.TaskCnName,
|
||||
istransition = task.IsTransition,
|
||||
singleCopterInfos = task.SingleCopterInfos.Select(info =>
|
||||
{
|
||||
var offset = info.LatLngOffset;
|
||||
@ -1570,7 +1594,10 @@ namespace Plane.FormationCreator.Formation
|
||||
RestoreTakeOffTask((byte)task.takeoffTime, task.singleCopterInfos);
|
||||
break;
|
||||
case FlightTaskType.FlyTo:
|
||||
RestoreFlyToTask((bool)task.staggerRoutes, (int)task.flytoTime, (int)task.loiterTime, (string)task.taskname, task.singleCopterInfos, isMeter);
|
||||
bool isTransition = false;
|
||||
if (task.istransition != null)
|
||||
isTransition = (bool)task.istransition;
|
||||
RestoreFlyToTask((bool)task.staggerRoutes, (int)task.flytoTime, (int)task.loiterTime, (string)task.taskname, task.singleCopterInfos, isMeter, isTransition);
|
||||
break;
|
||||
case FlightTaskType.Land:
|
||||
RestoreLandTask(task.singleCopterInfos);
|
||||
@ -1772,20 +1799,28 @@ namespace Plane.FormationCreator.Formation
|
||||
var curWaypoint = Tasks[taskIndex].SingleCopterInfos.FirstOrDefault(c => c.Copter == copter);
|
||||
|
||||
double copter_maxDistance_up = nextWaypoint.TargetAlt;
|
||||
double copter_maxDistance_show = copter_maxDistance_up;
|
||||
//减去测试起飞高度
|
||||
if (FC_takeoff_ct > 0)
|
||||
copter_maxDistance_up -= FC_takeoff_calt / 100.0f;
|
||||
double time_up = getMinfligthtime((float)copter_maxDistance_up, acc_z, defvel_up, flytimetype);
|
||||
double copter_tasktime = curWaypoint.TakeOffWaitTime + time_up;
|
||||
|
||||
if (copter_tasktime > tasktime)
|
||||
{
|
||||
tasktime = copter_tasktime;
|
||||
maxDistance_up = copter_maxDistance_up;
|
||||
maxDistance_up = copter_maxDistance_show;
|
||||
copterName = copter.Name;
|
||||
waittime = curWaypoint.TakeOffWaitTime;
|
||||
upflytime = time_up;
|
||||
}
|
||||
}
|
||||
//加入起飞测试时间
|
||||
tasktime += FC_takeoff_ct / 1000.0f;
|
||||
Message.Show($"起飞任务{taskIndex + 1}参数:检测起飞高度:{Math.Round(FC_takeoff_calt / 100.0f, 2)}米,检测时间:{Math.Round( FC_takeoff_ct / 1000.0f, 2)}秒"
|
||||
);
|
||||
Message.Show($"起飞任务{taskIndex + 1}起飞高度:{Math.Round(maxDistance_up, 2)}米 " +
|
||||
$"最长耗时:{Math.Round(tasktime, 2)}秒({Math.Round(upflytime, 2)},{Math.Round(waittime, 2)}),编号:{copterName}"
|
||||
$"最长耗时:{Math.Round(tasktime, 2)}秒(飞{Math.Round(upflytime, 2)},等待{Math.Round(waittime, 2)}),编号:{copterName}"
|
||||
);
|
||||
if (settime)
|
||||
{
|
||||
@ -2275,7 +2310,8 @@ namespace Plane.FormationCreator.Formation
|
||||
//选中前一个任务,插入错层
|
||||
SelectTask(SelectedTaskIndex - 1);
|
||||
AddTask();
|
||||
|
||||
//设置为过度航点
|
||||
SelectedTask.IsTransition = true;
|
||||
//第一个错层
|
||||
RouteRes = (FlightRoute.Vector3[])resarray[0];
|
||||
|
||||
@ -2290,7 +2326,7 @@ namespace Plane.FormationCreator.Formation
|
||||
|
||||
//第二个错层
|
||||
AddTask();
|
||||
|
||||
SelectedTask.IsTransition = true;
|
||||
RouteRes = (FlightRoute.Vector3[])resarray[1];
|
||||
|
||||
for (int i = 0; i < _copterManager.Copters.Count; i++)
|
||||
@ -2357,6 +2393,7 @@ namespace Plane.FormationCreator.Formation
|
||||
//设置随机数种子
|
||||
FlyVecFun.RandomSeed = (int)DateTime.Now.Ticks;
|
||||
Message.Show($"开始自动生成任务,种子数:{FlyVecFun.RandomSeed}");
|
||||
FlyVecFun.SpaceBetweenSquare=FC_SpaceBetween* FC_SpaceBetween; //这是个平方值
|
||||
|
||||
//获取当前航点与前一航点所有经纬高
|
||||
for (int i = 0; i < _copterManager.Copters.Count; i++)
|
||||
@ -2422,6 +2459,7 @@ namespace Plane.FormationCreator.Formation
|
||||
//插入错层航点
|
||||
SelectTask(SelectedTaskIndex - 1);
|
||||
AddTask();
|
||||
SelectedTask.IsTransition = true;
|
||||
SelectedTask.LoiterTime = 0;
|
||||
for (int i = 0; i < _copterManager.Copters.Count; i++)
|
||||
{
|
||||
@ -2445,6 +2483,7 @@ namespace Plane.FormationCreator.Formation
|
||||
//插入错层航点
|
||||
SelectTask(SelectedTaskIndex - 1);
|
||||
AddTask();
|
||||
SelectedTask.IsTransition = true;
|
||||
SelectedTask.LoiterTime = 0;
|
||||
for (int i = 0; i < _copterManager.Copters.Count; i++)
|
||||
{
|
||||
@ -2464,6 +2503,7 @@ namespace Plane.FormationCreator.Formation
|
||||
//选中前一个任务,插入错层
|
||||
SelectTask(SelectedTaskIndex - 1);
|
||||
AddTask();
|
||||
SelectedTask.IsTransition = true;
|
||||
SelectedTask.LoiterTime = 0;
|
||||
//第一个中间航点
|
||||
|
||||
@ -2481,6 +2521,7 @@ namespace Plane.FormationCreator.Formation
|
||||
//选中前一个任务,插入错层
|
||||
SelectTask(SelectedTaskIndex - 1);
|
||||
AddTask();
|
||||
SelectedTask.IsTransition = true;
|
||||
SelectedTask.LoiterTime = 0;
|
||||
//第一个中间航点
|
||||
|
||||
@ -2494,6 +2535,7 @@ namespace Plane.FormationCreator.Formation
|
||||
|
||||
//第二个中间航点
|
||||
AddTask();
|
||||
SelectedTask.IsTransition = true;
|
||||
SelectedTask.LoiterTime = 0;
|
||||
for (int i = 0; i < _copterManager.Copters.Count; i++)
|
||||
{
|
||||
@ -2510,6 +2552,7 @@ namespace Plane.FormationCreator.Formation
|
||||
//选中前一个任务,插入错层
|
||||
SelectTask(SelectedTaskIndex - 1);
|
||||
AddTask();
|
||||
SelectedTask.IsTransition = true;
|
||||
SelectedTask.LoiterTime = 0;
|
||||
//第一个中间航点
|
||||
|
||||
@ -2523,6 +2566,7 @@ namespace Plane.FormationCreator.Formation
|
||||
|
||||
//第二个中间航点
|
||||
AddTask();
|
||||
SelectedTask.IsTransition = true;
|
||||
SelectedTask.LoiterTime = 0;
|
||||
for (int i = 0; i < _copterManager.Copters.Count; i++)
|
||||
{
|
||||
@ -2534,6 +2578,7 @@ namespace Plane.FormationCreator.Formation
|
||||
|
||||
//第三个中间航点
|
||||
AddTask();
|
||||
SelectedTask.IsTransition = true;
|
||||
SelectedTask.LoiterTime = 0;
|
||||
for (int i = 0; i < _copterManager.Copters.Count; i++)
|
||||
{
|
||||
@ -2565,6 +2610,7 @@ namespace Plane.FormationCreator.Formation
|
||||
|
||||
//第一个中间航点
|
||||
AddTask();
|
||||
SelectedTask.IsTransition = true;
|
||||
SelectedTask.LoiterTime = 0;
|
||||
for (int i = 0; i < _copterManager.Copters.Count; i++)
|
||||
{
|
||||
@ -2575,6 +2621,7 @@ namespace Plane.FormationCreator.Formation
|
||||
SetTaskFlytime(SelectedTaskIndex);
|
||||
//第二个中间航点
|
||||
AddTask();
|
||||
SelectedTask.IsTransition = true;
|
||||
SelectedTask.LoiterTime = 0;
|
||||
for (int i = 0; i < _copterManager.Copters.Count; i++)
|
||||
{
|
||||
@ -3026,7 +3073,10 @@ namespace Plane.FormationCreator.Formation
|
||||
RestoreTakeOffTask((byte)task.takeoffTime, task.singleCopterInfos);
|
||||
break;
|
||||
case FlightTaskType.FlyTo:
|
||||
RestoreFlyToTask((bool)task.staggerRoutes, (int)task.flytoTime, (int)task.loiterTime, (string)task.taskname, task.singleCopterInfos, isMeter);
|
||||
bool isTransition = false;
|
||||
if (task.istransition != null)
|
||||
isTransition = (bool)task.istransition;
|
||||
RestoreFlyToTask((bool)task.staggerRoutes, (int)task.flytoTime, (int)task.loiterTime, (string)task.taskname, task.singleCopterInfos, isMeter, isTransition);
|
||||
break;
|
||||
|
||||
case FlightTaskType.Land:
|
||||
@ -3377,6 +3427,17 @@ namespace Plane.FormationCreator.Formation
|
||||
if (readvalue != "" && float.TryParse(readvalue, out floatTemp))
|
||||
FC_defvel_down = float.Parse(readvalue);
|
||||
|
||||
readvalue = inifilse.IniReadvalue("Default", "FC_takeoff_ct");
|
||||
if (readvalue != "" && int.TryParse(readvalue, out intTemp))
|
||||
FC_takeoff_ct = int.Parse(readvalue);
|
||||
|
||||
readvalue = inifilse.IniReadvalue("Default", "FC_takeoff_calt");
|
||||
if (readvalue != "" && int.TryParse(readvalue, out intTemp))
|
||||
FC_takeoff_calt = int.Parse(readvalue);
|
||||
|
||||
readvalue = inifilse.IniReadvalue("Default", "FC_spacbetween");
|
||||
if (readvalue != "" && int.TryParse(readvalue, out intTemp))
|
||||
FC_SpaceBetween = int.Parse(readvalue);
|
||||
|
||||
|
||||
}
|
||||
|
@ -167,6 +167,7 @@
|
||||
<Compile Include="AppConfig.cs" />
|
||||
<Compile Include="Converters\AppModeToVisibilityConverter.cs" />
|
||||
<Compile Include="Converters\FlightTaskIsSelectedToEffectConverter.cs" />
|
||||
<Compile Include="Converters\FlightTaskStatusAndTransitionToFillConverter.cs" />
|
||||
<Compile Include="Converters\FlightTaskStatusToFillConverter.cs" />
|
||||
<Compile Include="Converters\HeartbeatCountToBrushConverter.cs" />
|
||||
<Compile Include="Formation\AppMode.cs" />
|
||||
|
@ -950,7 +950,7 @@ namespace Plane.FormationCreator.ViewModels
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
//2D计算,不改变ID,拉开层
|
||||
private ICommand _OptimizeRouteCommandRet;
|
||||
public ICommand OptimizeRouteCommandRet
|
||||
{
|
||||
@ -960,7 +960,7 @@ namespace Plane.FormationCreator.ViewModels
|
||||
{
|
||||
if (_copterManager.FC_VER_NO >= 3)
|
||||
//3D计算,不改变ID,可以错层
|
||||
_flightTaskManager.OptimizeRouteMeter(true, false, true); //采用米计算逻辑,用3D生成,不改变ID,可拉开层(2D回起飞矩阵专用)
|
||||
_flightTaskManager.OptimizeRouteMeter(false, false, true); //采用米计算逻辑,用3D生成,不改变ID,可拉开层(2D回起飞矩阵专用)
|
||||
else
|
||||
_flightTaskManager.OptimizeRouteMeter(false, false); //采用米计算逻辑,用2D生成,不改变ID,不拉开层
|
||||
|
||||
@ -968,6 +968,23 @@ namespace Plane.FormationCreator.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
//3D计算,不改变ID,不拉开层
|
||||
private ICommand _OptimizeRouteCommandRet3D;
|
||||
public ICommand OptimizeRouteCommandRet3D
|
||||
{
|
||||
get
|
||||
{
|
||||
return _OptimizeRouteCommandRet3D ?? (_OptimizeRouteCommandRet3D = new RelayCommand<int>(async =>
|
||||
{
|
||||
if (_copterManager.FC_VER_NO >= 3)
|
||||
//3D计算,不改变ID,可以错层
|
||||
_flightTaskManager.OptimizeRouteMeter(true, false, false); //采用米计算逻辑,用3D生成,不改变ID,不拉开层(3D回起飞矩阵专用)
|
||||
else
|
||||
_flightTaskManager.OptimizeRouteMeter(false, false); //采用米计算逻辑,用2D生成,不改变ID,不拉开层
|
||||
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
private ICommand _OptimizeRouteCommand3D;
|
||||
public ICommand OptimizeRouteCommand3D
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,224 +1,234 @@
|
||||
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Plane.FormationCreator.Views"
|
||||
xmlns:m="clr-namespace:Plane.FormationCreator.Formation"
|
||||
xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
|
||||
x:Class="Plane.FormationCreator.Views.TaskBarView"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="156.968"
|
||||
d:DesignWidth="500">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button HorizontalAlignment="Left" Grid.Column="1"
|
||||
Visibility="{Binding FlightTaskManager.IsPaused, Converter={StaticResource IsPausedToRunButtonVisibilityConverter}}"
|
||||
Command="{Binding RunTasksCommand}">
|
||||
<Button.Template>
|
||||
<ControlTemplate>
|
||||
<Grid Width="40"
|
||||
Height="40"
|
||||
Background="#00FFFFFF"
|
||||
VerticalAlignment="Bottom">
|
||||
<ed:RegularPolygon Fill="MidnightBlue"
|
||||
InnerRadius="1"
|
||||
PointCount="3"
|
||||
Width="40"
|
||||
Height="40"
|
||||
Stretch="Fill"
|
||||
Stroke="Gray">
|
||||
<ed:RegularPolygon.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform />
|
||||
<SkewTransform />
|
||||
<RotateTransform Angle="90" />
|
||||
<TranslateTransform X="40" />
|
||||
</TransformGroup>
|
||||
</ed:RegularPolygon.RenderTransform>
|
||||
</ed:RegularPolygon>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
</Button>
|
||||
<Button HorizontalAlignment="Left" Grid.Column="1"
|
||||
Background="#00FFFFFF"
|
||||
Visibility="{Binding FlightTaskManager.IsPaused, Converter={StaticResource IsPausedToPauseButtonVisibilityConverter}}"
|
||||
Command="{Binding PauseTasksCommand}">
|
||||
<Button.Template>
|
||||
<ControlTemplate>
|
||||
<Grid Width="40"
|
||||
Height="40"
|
||||
VerticalAlignment="Bottom"
|
||||
Background="#00FFFFFF">
|
||||
<Rectangle Fill="Red"
|
||||
HorizontalAlignment="Left"
|
||||
Width="15"
|
||||
Height="40"
|
||||
Stroke="Gray" />
|
||||
<Rectangle Fill="Red"
|
||||
Margin="0,0,3,0"
|
||||
HorizontalAlignment="Right"
|
||||
Width="15"
|
||||
Height="40"
|
||||
Stroke="Gray" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
</Button>
|
||||
|
||||
<ItemsControl Grid.Column="0"
|
||||
VerticalAlignment="Bottom"
|
||||
ItemsSource="{Binding Tasks}"
|
||||
Name="TasksControl">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid x:Name="itemgrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border Background="{Binding Status, Converter={StaticResource FlightTaskStatusToFillConverter}}"
|
||||
Width="88"
|
||||
Height="19"
|
||||
BorderThickness="1"
|
||||
BorderBrush="Black"
|
||||
Effect="{Binding IsSelected, Converter={StaticResource FlightTaskIsSelectedToEffectConverter}}"
|
||||
MouseLeftButtonDown="TaskLeftButtonDown"
|
||||
MouseLeftButtonUp="SelectTask"
|
||||
MouseRightButtonUp="HideTask">
|
||||
|
||||
<WrapPanel VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center" >
|
||||
<TextBlock Width="auto"
|
||||
FontSize="12"
|
||||
Margin="0,0,2,0"
|
||||
Foreground="White"
|
||||
Text="{Binding TaskNum}"/>
|
||||
<TextBlock Width="auto"
|
||||
FontSize="12"
|
||||
Foreground="White"
|
||||
Text="{Binding TaskCnName}"/>
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<Grid Grid.Column="2" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="28"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Height="100" Background="#FF2D2D2D" VerticalAlignment="Bottom">
|
||||
|
||||
<TextBlock x:Name="hintaddtask" Margin="0,25,0,0" Text="请添加或选择飞行任务" Visibility="Collapsed" FontSize="18" TextAlignment="Center"/>
|
||||
|
||||
<TabControl x:Name="tasktabcont"
|
||||
DataContext="{Binding FlightTaskManager.SelectedTask}"
|
||||
SelectedIndex="{Binding TaskTypeIndex,UpdateSourceTrigger=PropertyChanged}">
|
||||
|
||||
|
||||
|
||||
<TabItem Header="1 起飞" x:Name="takeoffpage">
|
||||
<Grid Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="起飞时间:" Margin="2" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Column="1" Margin="2" VerticalAlignment="Center"
|
||||
Text="{Binding TakeOffTime, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</Grid>
|
||||
|
||||
</TabItem>
|
||||
<TabItem x:Name="flytopage" >
|
||||
|
||||
<TabItem.Header>
|
||||
<Label x:Name="flytoLabel" Content="航点" HorizontalAlignment="Stretch" MouseLeftButtonDown="TaskLabelLeftButtonDown"
|
||||
ToolTip="双击修改名称" />
|
||||
</TabItem.Header>
|
||||
|
||||
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Margin="2" Text="飞行时间: " VerticalAlignment="Center" />
|
||||
<TextBox Grid.Column="1" Margin="2" VerticalAlignment="Center"
|
||||
MaxLength="4"
|
||||
Text="{Binding FlytoTime, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBlock Grid.Row="1" Margin="2" Text="悬停时间: " VerticalAlignment="Center" />
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="2" VerticalAlignment="Center"
|
||||
MaxLength="4"
|
||||
Text="{Binding LoiterTime, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="降落" x:Name="landpage">
|
||||
<Grid Margin="10" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
</TabControl>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1"
|
||||
Orientation="Horizontal"
|
||||
VerticalAlignment="Bottom">
|
||||
<Button Content="添加" x:Name="addtaskbtn"
|
||||
Background="#232323"
|
||||
Command="{Binding AddTaskCommand}" />
|
||||
<Button Content="删除"
|
||||
Background="#232323"
|
||||
Command="{Binding DelTaskCommand}" />
|
||||
<Button Content="清除"
|
||||
Background="#232323"
|
||||
Command="{Binding ClearTasksCommand}" />
|
||||
<Button Content="重置"
|
||||
Background="#232323"
|
||||
Command="{Binding ResetTasksCommand}" />
|
||||
|
||||
<Button Content="更名" Visibility="Collapsed"
|
||||
Background="#232323"
|
||||
Command="{Binding renametaskCommand}" />
|
||||
<Button Content="原点"
|
||||
Background="#232323"
|
||||
Command="{Binding SetOriginCommand}" />
|
||||
|
||||
|
||||
<!--<Button Content="保存" />
|
||||
<Button Content="取消" />-->
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Plane.FormationCreator.Views"
|
||||
xmlns:m="clr-namespace:Plane.FormationCreator.Formation"
|
||||
xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
|
||||
x:Class="Plane.FormationCreator.Views.TaskBarView"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="156.968"
|
||||
d:DesignWidth="500">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button HorizontalAlignment="Left" Grid.Column="1"
|
||||
Visibility="{Binding FlightTaskManager.IsPaused, Converter={StaticResource IsPausedToRunButtonVisibilityConverter}}"
|
||||
Command="{Binding RunTasksCommand}">
|
||||
<Button.Template>
|
||||
<ControlTemplate>
|
||||
<Grid Width="40"
|
||||
Height="40"
|
||||
Background="#00FFFFFF"
|
||||
VerticalAlignment="Bottom">
|
||||
<ed:RegularPolygon Fill="MidnightBlue"
|
||||
InnerRadius="1"
|
||||
PointCount="3"
|
||||
Width="40"
|
||||
Height="40"
|
||||
Stretch="Fill"
|
||||
Stroke="Gray">
|
||||
<ed:RegularPolygon.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform />
|
||||
<SkewTransform />
|
||||
<RotateTransform Angle="90" />
|
||||
<TranslateTransform X="40" />
|
||||
</TransformGroup>
|
||||
</ed:RegularPolygon.RenderTransform>
|
||||
</ed:RegularPolygon>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
</Button>
|
||||
<Button HorizontalAlignment="Left" Grid.Column="1"
|
||||
Background="#00FFFFFF"
|
||||
Visibility="{Binding FlightTaskManager.IsPaused, Converter={StaticResource IsPausedToPauseButtonVisibilityConverter}}"
|
||||
Command="{Binding PauseTasksCommand}">
|
||||
<Button.Template>
|
||||
<ControlTemplate>
|
||||
<Grid Width="40"
|
||||
Height="40"
|
||||
VerticalAlignment="Bottom"
|
||||
Background="#00FFFFFF">
|
||||
<Rectangle Fill="Red"
|
||||
HorizontalAlignment="Left"
|
||||
Width="15"
|
||||
Height="40"
|
||||
Stroke="Gray" />
|
||||
<Rectangle Fill="Red"
|
||||
Margin="0,0,3,0"
|
||||
HorizontalAlignment="Right"
|
||||
Width="15"
|
||||
Height="40"
|
||||
Stroke="Gray" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
</Button>
|
||||
|
||||
<ItemsControl Grid.Column="0"
|
||||
VerticalAlignment="Bottom"
|
||||
ItemsSource="{Binding Tasks}"
|
||||
Name="TasksControl">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid x:Name="itemgrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border
|
||||
Width="88"
|
||||
Height="19"
|
||||
BorderThickness="1"
|
||||
BorderBrush="Black"
|
||||
Effect="{Binding IsSelected, Converter={StaticResource FlightTaskIsSelectedToEffectConverter}}"
|
||||
MouseLeftButtonDown="TaskLeftButtonDown"
|
||||
MouseLeftButtonUp="SelectTask"
|
||||
MouseRightButtonUp="HideTask">
|
||||
<Border.Background>
|
||||
<MultiBinding Converter="{StaticResource FlightTaskStatusAndTransitionToFillConverter}">
|
||||
<Binding Path="Status" />
|
||||
<Binding Path="IsTransition" />
|
||||
</MultiBinding>
|
||||
</Border.Background>
|
||||
|
||||
<WrapPanel VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center" >
|
||||
<TextBlock Width="auto"
|
||||
FontSize="12"
|
||||
Margin="0,0,2,0"
|
||||
Foreground="White"
|
||||
Text="{Binding TaskNum}"/>
|
||||
<TextBlock Width="auto"
|
||||
FontSize="12"
|
||||
Foreground="White"
|
||||
Text="{Binding TaskCnName}"/>
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<Grid Grid.Column="2" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="28"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Height="120" Background="#FF2D2D2D" VerticalAlignment="Bottom">
|
||||
|
||||
<TextBlock x:Name="hintaddtask" Margin="0,25,0,0" Text="请添加或选择飞行任务" Visibility="Collapsed" FontSize="18" TextAlignment="Center"/>
|
||||
|
||||
<TabControl x:Name="tasktabcont"
|
||||
DataContext="{Binding FlightTaskManager.SelectedTask}"
|
||||
SelectedIndex="{Binding TaskTypeIndex,UpdateSourceTrigger=PropertyChanged}">
|
||||
|
||||
|
||||
|
||||
<TabItem Header="1 起飞" x:Name="takeoffpage">
|
||||
<Grid Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="起飞时间:" Margin="2" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Column="1" Margin="2" VerticalAlignment="Center"
|
||||
Text="{Binding TakeOffTime, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</Grid>
|
||||
|
||||
</TabItem>
|
||||
<TabItem x:Name="flytopage" >
|
||||
|
||||
<TabItem.Header>
|
||||
<Label x:Name="flytoLabel" Content="航点" HorizontalAlignment="Stretch" MouseLeftButtonDown="TaskLabelLeftButtonDown"
|
||||
ToolTip="双击修改名称" />
|
||||
</TabItem.Header>
|
||||
|
||||
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Margin="2" Text="飞行时间: " VerticalAlignment="Center" />
|
||||
<TextBox Grid.Column="1" Margin="2" VerticalAlignment="Center"
|
||||
MaxLength="4"
|
||||
Text="{Binding FlytoTime, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBlock Grid.Row="1" Margin="2" Text="悬停时间: " VerticalAlignment="Center" />
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="2" VerticalAlignment="Center"
|
||||
MaxLength="4"
|
||||
Text="{Binding LoiterTime, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<CheckBox Grid.Row="2" Grid.Column="2" x:Name="tranBox" Content="过度航点" HorizontalAlignment="Left" Width="75.353"
|
||||
IsChecked="{Binding IsTransition}"/>
|
||||
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="降落" x:Name="landpage">
|
||||
<Grid Margin="10" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
</TabControl>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1"
|
||||
Orientation="Horizontal"
|
||||
VerticalAlignment="Bottom">
|
||||
<Button Content="添加" x:Name="addtaskbtn"
|
||||
Background="#232323"
|
||||
Command="{Binding AddTaskCommand}" />
|
||||
<Button Content="删除"
|
||||
Background="#232323"
|
||||
Command="{Binding DelTaskCommand}" />
|
||||
<Button Content="清除"
|
||||
Background="#232323"
|
||||
Command="{Binding ClearTasksCommand}" />
|
||||
<Button Content="重置"
|
||||
Background="#232323"
|
||||
Command="{Binding ResetTasksCommand}" />
|
||||
|
||||
<Button Content="更名" Visibility="Collapsed"
|
||||
Background="#232323"
|
||||
Command="{Binding renametaskCommand}" />
|
||||
<Button Content="原点"
|
||||
Background="#232323"
|
||||
Command="{Binding SetOriginCommand}" />
|
||||
|
||||
|
||||
<!--<Button Content="保存" />
|
||||
<Button Content="取消" />-->
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
Loading…
Reference in New Issue
Block a user