修改任务选中颜色,更明显
可导入ai和obj模型文件 增加删除任务和在任务中插入任务功能(添加改为选中任务后一个添加) 航线改为默认显示,优化右键隐藏航点功能 更改飞机和航点默认颜色 界面加入“飞行前准备”等分组页面,更方便操作 修改bug:清除飞机重新添加后飞行航线发虚,右键隐藏状态没有重置,
This commit is contained in:
parent
84c12a1eb7
commit
f787069624
@ -18,7 +18,7 @@ namespace Plane.FormationCreator.Converters
|
||||
static DropShadowEffect _effect = new DropShadowEffect
|
||||
{
|
||||
//任务选中颜色
|
||||
Color = Colors.Azure, // Colors.LightGray,
|
||||
Color = Colors.Firebrick, // Colors.LightGray,
|
||||
// Color = Colors.White,
|
||||
Direction = 90,
|
||||
BlurRadius = 10
|
||||
|
@ -26,6 +26,9 @@ namespace Plane.FormationCreator.Converters
|
||||
if (status == FlightTaskStatus.Paused)
|
||||
return _PausedFill;
|
||||
|
||||
if (status == FlightTaskStatus.Selected)
|
||||
return _PausedFill;
|
||||
|
||||
|
||||
return _normalFill;
|
||||
}
|
||||
|
@ -139,6 +139,13 @@ namespace Plane.FormationCreator.Formation
|
||||
//用户级别
|
||||
const int LEVEL_NORMAL = 1;
|
||||
const int LEVEL_ADMIN = 0;
|
||||
|
||||
//飞机默认颜色
|
||||
public const string CopterDefaultColor= "1E90FF";
|
||||
//开始起飞颜色//解锁起飞用暗紫色
|
||||
public const string CopterTakeoffColor = "FF00FF";
|
||||
//飞行中颜色
|
||||
public const string CopterFlyingColor = "32CD32";
|
||||
|
||||
|
||||
private string superDispname = "超级用户";
|
||||
|
@ -11,6 +11,8 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Plane.CommunicationManagement;
|
||||
using FlightRoute;
|
||||
using System.IO;
|
||||
|
||||
namespace Plane.FormationCreator.Formation
|
||||
{
|
||||
@ -182,11 +184,23 @@ namespace Plane.FormationCreator.Formation
|
||||
if (_SelectedTask != value)
|
||||
{
|
||||
int starttime=0;
|
||||
|
||||
if (_SelectedTask != null) _SelectedTask.IsSelected = false;
|
||||
|
||||
if (_SelectedTask != null)
|
||||
{
|
||||
|
||||
_SelectedTask.IsSelected = false;
|
||||
if (TaskState == TasksStatus.Stop)
|
||||
_SelectedTask.Status = FlightTaskStatus.Stop;
|
||||
}
|
||||
|
||||
if (value != null)
|
||||
{
|
||||
value.IsSelected = true;
|
||||
value.IsRightSelected = true;
|
||||
RightSelect(value);
|
||||
if (TaskState== TasksStatus.Stop)
|
||||
value.Status = FlightTaskStatus.Selected;
|
||||
|
||||
for (int i = 0; i < value.TaskIndex; i++)
|
||||
starttime += GetTaskTime(i);
|
||||
|
||||
@ -217,7 +231,9 @@ namespace Plane.FormationCreator.Formation
|
||||
public int SelectedTaskIndex
|
||||
{
|
||||
get { return _SelectedTaskIndex; }
|
||||
set { Set(nameof(SelectedTaskIndex), ref _SelectedTaskIndex, value); }
|
||||
set { Set(nameof(SelectedTaskIndex), ref _SelectedTaskIndex, value);
|
||||
// this.SelectedTask = Tasks[value];
|
||||
}
|
||||
}
|
||||
|
||||
// 右键单击任务,用于隐藏任务图标, added by ZJF
|
||||
@ -280,7 +296,21 @@ namespace Plane.FormationCreator.Formation
|
||||
}
|
||||
|
||||
public event EventHandler<FlightTaskAddedEventArgs> TaskAdded;
|
||||
public event EventHandler<FlightTaskDeledEventArgs> TaskDeled;
|
||||
|
||||
public void RaiseTaskDeled(FlightTask vDeledTask,int vTaskIndex)
|
||||
{
|
||||
try
|
||||
{
|
||||
TaskDeled?.Invoke(this, new FlightTaskDeledEventArgs { DeledTask = vDeledTask, TaskIndex= vTaskIndex });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//RaiseExceptionThrown(ex);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public void RaiseTaskAdded(FlightTask lastTask ,FlightTask newTask)
|
||||
{
|
||||
try
|
||||
@ -334,6 +364,8 @@ namespace Plane.FormationCreator.Formation
|
||||
if (Tasks.Count == 0)
|
||||
AddTakeOffTask(copters);
|
||||
var lastTask = Tasks.LastOrDefault();
|
||||
if (SelectedTask !=null)
|
||||
lastTask = SelectedTask;
|
||||
var nullableCenter = copters.GetCenter();
|
||||
if (nullableCenter == null) return;
|
||||
var center = nullableCenter.Value;
|
||||
@ -382,18 +414,31 @@ namespace Plane.FormationCreator.Formation
|
||||
newTask.SingleCopterInfos.Add(newSingleCopterInfo);
|
||||
|
||||
}
|
||||
int selindex = SelectedTaskIndex+1;
|
||||
Tasks.Insert(SelectedTaskIndex+1, newTask);
|
||||
RaiseTaskAdded(lastTask, newTask);
|
||||
SelectTask(selindex);
|
||||
|
||||
|
||||
/*
|
||||
Tasks.Add(newTask);
|
||||
RaiseTaskAdded(lastTask, newTask);
|
||||
SelectedTask = newTask;
|
||||
SelectedTaskIndex = Tasks.Count - 1;
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//是否显示计划航线
|
||||
private bool _showroute = true;
|
||||
public bool showroute
|
||||
{
|
||||
get { return _showroute; }
|
||||
set { Set(nameof(showroute), ref _showroute, value); }
|
||||
}
|
||||
|
||||
private double _OriginLat = 0;
|
||||
public double OriginLat
|
||||
@ -424,9 +469,41 @@ namespace Plane.FormationCreator.Formation
|
||||
this.Tasks.Clear();
|
||||
SelectedTask = null;
|
||||
SelectedTaskIndex = 0;
|
||||
TasksCleared?.Invoke(this, EventArgs.Empty);
|
||||
//取消删除事件
|
||||
/*
|
||||
if (TaskDeled != null)
|
||||
{
|
||||
Delegate[] dels = TaskDeled.GetInvocationList();
|
||||
if (dels != null)
|
||||
{
|
||||
foreach (Delegate d in dels)
|
||||
{
|
||||
TaskDeled -= d as EventHandler<FlightTaskDeledEventArgs>;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
TasksCleared?.Invoke(this, EventArgs.Empty);
|
||||
// AddTakeOffTask(_copterManager.Copters);
|
||||
}
|
||||
//删除选中的任务
|
||||
public void DelSelectedTask()
|
||||
{
|
||||
if (SelectedTask == null) return;
|
||||
if (SelectedTask.TaskType == FlightTaskType.TakeOff) return;
|
||||
int selindex = SelectedTaskIndex;
|
||||
|
||||
// ResetTasks();
|
||||
SelectedTask.SingleCopterInfos.Clear();
|
||||
Tasks.RemoveAt(SelectedTaskIndex);
|
||||
RaiseTaskDeled(SelectedTask,SelectedTaskIndex);
|
||||
|
||||
SelectTask(selindex - 1);
|
||||
|
||||
|
||||
// SelectedTaskIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -597,8 +674,8 @@ namespace Plane.FormationCreator.Formation
|
||||
altitude:0
|
||||
|
||||
);
|
||||
//设置灯光为默认黑色
|
||||
fc.LEDColor = "000000";
|
||||
//设置灯光为默认颜色
|
||||
fc.LEDColor = CopterManager.CopterDefaultColor;// "000000";
|
||||
|
||||
}
|
||||
|
||||
@ -627,6 +704,57 @@ namespace Plane.FormationCreator.Formation
|
||||
return sb.ToString().Trim();
|
||||
}
|
||||
|
||||
//导入外部航点
|
||||
public void ImportDlltoTask(string filename)
|
||||
{
|
||||
Vector3[] vc;
|
||||
|
||||
|
||||
string extname = Path.GetExtension(filename);
|
||||
if (extname == ".svg")
|
||||
{
|
||||
vc = FlyBase.svgToPos(filename);
|
||||
}
|
||||
else if (extname == ".obj")
|
||||
{
|
||||
vc = FlyBase.objToPos(filename);
|
||||
}
|
||||
else return;
|
||||
|
||||
if (vc.Count()!= _copterManager.Copters.Count)
|
||||
{
|
||||
Alert.Show($"飞机数量不匹配!导入{vc.Count()}架,实际{_copterManager.Copters.Count}");
|
||||
return;
|
||||
}
|
||||
var lastTask = Tasks.LastOrDefault();
|
||||
var newTask = new FlightTask(FlightTaskType.FlyTo) { StaggerRoutes = true, FlytoTime = 10, LoiterTime = 1 };
|
||||
newTask.TaskCnName = Path.GetFileNameWithoutExtension(filename).Substring(0,6);
|
||||
int id =0;
|
||||
foreach (Vector3 item in vc)
|
||||
{
|
||||
Tuple<double, double> observationLatLng = null;
|
||||
observationLatLng = GeographyUtils.CalcLatLngSomeMetersAway2D(
|
||||
OriginLat,
|
||||
OriginLng,
|
||||
90,
|
||||
(float)item.x / 100);
|
||||
|
||||
observationLatLng = GeographyUtils.CalcLatLngSomeMetersAway2D(
|
||||
observationLatLng.Item1,
|
||||
observationLatLng.Item2,
|
||||
0,
|
||||
(float)item.z / 100);
|
||||
|
||||
var thisSingleCopterInfo = FlightTaskSingleCopterInfo.CreateForFlyToTask(
|
||||
_copterManager.Copters[id++], new LatLng(observationLatLng.Item1 - OriginLat, observationLatLng.Item2 - OriginLng),
|
||||
(float)item.y / 100, false);
|
||||
newTask.SingleCopterInfos.Add(thisSingleCopterInfo);
|
||||
}
|
||||
Tasks.Add(newTask);
|
||||
RaiseTaskAdded(lastTask, newTask);
|
||||
}
|
||||
|
||||
|
||||
public void ImportC4DFlytoTask(string txt)
|
||||
{
|
||||
string[] lines = txt.Replace("\r\n", "\n").Split('\n');
|
||||
@ -1193,6 +1321,12 @@ namespace Plane.FormationCreator.Formation
|
||||
PLLocation prevLoc = new PLLocation(prevInfo.TargetLat, prevInfo.TargetLng, prevInfo.TargetAlt);
|
||||
prevTaskPoint.Add(i, prevLoc);
|
||||
}
|
||||
|
||||
// int sss = Plane.AutoLine.CalAutoLine(curTaskPoint, prevTaskPoint);
|
||||
|
||||
// Message.Show($"中心点:{sss}");
|
||||
|
||||
|
||||
double farDistance;
|
||||
double nearDistance;
|
||||
int index;
|
||||
@ -1521,13 +1655,12 @@ namespace Plane.FormationCreator.Formation
|
||||
|
||||
}
|
||||
|
||||
public void Select(int taskIndex, ICopter copter)
|
||||
public void SelectTask(int taskIndex)
|
||||
{
|
||||
if (taskIndex == -1) return;
|
||||
this.SelectedTaskIndex = taskIndex;
|
||||
this.SelectedTask = Tasks[taskIndex];
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1804,6 +1937,13 @@ namespace Plane.FormationCreator.Formation
|
||||
public FlightTask AddedTask { get; set; }
|
||||
}
|
||||
|
||||
public class FlightTaskDeledEventArgs : EventArgs
|
||||
{
|
||||
public FlightTask DeledTask { get; set; }
|
||||
public int TaskIndex { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class FlightTaskTypeChangedEventArgs : EventArgs
|
||||
{
|
||||
public FlightTaskTypeChangedEventArgs(FlightTask changedFlightTask)
|
||||
|
@ -2,7 +2,8 @@
|
||||
{
|
||||
Stop,
|
||||
Running,
|
||||
Paused
|
||||
Paused,
|
||||
Selected
|
||||
}
|
||||
public enum TasksStatus
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ namespace Plane.FormationCreator.Formation
|
||||
// await Task.Delay(10).ConfigureAwait(false);
|
||||
// }
|
||||
//解锁起飞用暗紫色
|
||||
info.Copter.LEDColor = "FF00FF";
|
||||
info.Copter.LEDColor = CopterManager.CopterTakeoffColor;
|
||||
|
||||
dtNow = DateTime.Now;
|
||||
ts = dtNow - dtLastTime;
|
||||
@ -141,8 +141,8 @@ namespace Plane.FormationCreator.Formation
|
||||
dtNow = DateTime.Now;
|
||||
ts = dtNow - dtLastTime;
|
||||
}
|
||||
//起飞完成用暗蓝色
|
||||
info.Copter.LEDColor = "0000FF";
|
||||
//起飞完成用默认颜色
|
||||
info.Copter.LEDColor = CopterManager.CopterFlyingColor;
|
||||
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@
|
||||
<StackPanel Grid.Row="1">
|
||||
<StackPanel Grid.Row="2"
|
||||
Visibility="{Binding AppEx.ShowModifyTaskView, Converter={StaticResource InversiveBooleanToVisibilityConverter}}">
|
||||
<Separator Grid.ColumnSpan="2" />
|
||||
<Separator Grid.ColumnSpan="2" Margin="0,5,5,5"/>
|
||||
<v:ControlPanelView />
|
||||
</StackPanel>
|
||||
|
||||
@ -217,8 +217,8 @@
|
||||
|
||||
<StackPanel Grid.Row="2"
|
||||
Visibility="{Binding AppEx.ShowModifyTaskView, Converter={StaticResource InversiveBooleanToVisibilityConverter}}">
|
||||
|
||||
<Separator Grid.ColumnSpan="2" />
|
||||
|
||||
<Separator Grid.ColumnSpan="2" Margin="0,0,5,5" />
|
||||
<v:CopterInfoView DataContext="{Binding Path=CopterListViewModel.SelectedCopter}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
@ -237,7 +237,10 @@
|
||||
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" Margin="0,8" BorderBrush="LightGray" BorderThickness="1"/>
|
||||
<TextBlock Margin="10,4" Width="400"
|
||||
Text="{Binding CopterListViewModel.SelectedCopter.StatusText}" />
|
||||
|
||||
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" Margin="0,8" BorderBrush="LightGray" BorderThickness="1"/>
|
||||
<TextBlock Margin="10,4" Width="400"
|
||||
Text="{Binding ControlPanelViewModel.RTKState}" />
|
||||
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<TextBlock Text="{Binding Loginstate}" Margin="0,4,14,0"/>
|
||||
|
@ -51,6 +51,9 @@
|
||||
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="flyBase">
|
||||
<HintPath>..\..\Tools\flyBase.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GalaSoft.MvvmLight, Version=5.2.0.37222, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MvvmLightLibs.5.2.0.0\lib\net45\GalaSoft.MvvmLight.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
|
@ -549,13 +549,24 @@ namespace Plane.FormationCreator.ViewModels
|
||||
var dialog = new OpenFileDialog
|
||||
{
|
||||
DefaultExt = "txt",
|
||||
Filter = "文本文件|*.txt"
|
||||
Filter = "航点文件(*.txt,*.svg,*.obj) |*.txt;*.svg;*.obj" // "图片文件(*.jpg, *.gif, *.bmp, *.png) | *.jpg; *.gif; *.bmp; *.png"
|
||||
};
|
||||
|
||||
if (dialog.ShowDialog() == true)
|
||||
{
|
||||
var tasksText = File.ReadAllText(dialog.FileName);
|
||||
_flightTaskManager.ImportC4DFlytoTask(tasksText);
|
||||
autoalltasktime();
|
||||
string extname=Path.GetExtension(dialog.FileName);
|
||||
if (extname == ".txt")
|
||||
{
|
||||
var tasksText = File.ReadAllText(dialog.FileName);
|
||||
_flightTaskManager.ImportC4DFlytoTask(tasksText);
|
||||
autoalltasktime();
|
||||
}else
|
||||
if ((extname == ".svg")|| (extname == ".obj"))
|
||||
{
|
||||
_flightTaskManager.ImportDlltoTask(dialog.FileName);
|
||||
};
|
||||
|
||||
|
||||
//_flightTaskManager.ImportBlenderFlyToTask(tasksText);
|
||||
}
|
||||
}));
|
||||
|
@ -106,14 +106,26 @@ namespace Plane.FormationCreator.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private ICommand _DelTaskCommand;
|
||||
public ICommand DelTaskCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return _DelTaskCommand ?? (_DelTaskCommand = new RelayCommand(() =>
|
||||
{
|
||||
// _flightTaskManager
|
||||
// FlightTaskManager _flightTaskManager = ServiceLocator.Current.GetInstance<FlightTaskManager>();
|
||||
_flightTaskManager.DelSelectedTask();
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private ICommand _SetOriginCommand;
|
||||
private ICommand _SetOriginCommand;
|
||||
public ICommand SetOriginCommand
|
||||
{
|
||||
get
|
||||
|
@ -29,103 +29,57 @@
|
||||
Command="{Binding DisconnectCommand}" />
|
||||
</WrapPanel>-->
|
||||
|
||||
<TextBlock Text="飞行控制"
|
||||
Margin="5,0,0,8"/>
|
||||
<WrapPanel>
|
||||
<Button Content="解锁"
|
||||
Command="{Binding UnlockCommand}" />
|
||||
<Button Content="起飞" Visibility="Collapsed"
|
||||
Command="{Binding TakeOffCommand}" />
|
||||
<Button Content="起飞"
|
||||
Command="{Binding GuidAsyncCommand}" />
|
||||
<Button Content="悬停"
|
||||
Command="{Binding HoverCommand}" />
|
||||
<Button Content="手动"
|
||||
Command="{Binding FloatCommand}" />
|
||||
<Button Content="参数"
|
||||
Command="{Binding ParamModify}" />
|
||||
<Button Content="参数文件" Visibility="Collapsed"
|
||||
Command="{Binding LoadParamfile}" />
|
||||
<Button Content="版本"
|
||||
|
||||
<TabControl Margin="0,0,13,0">
|
||||
<TabItem Header="飞行前准备">
|
||||
|
||||
<StackPanel Orientation="Vertical" Margin="0,5,0,0">
|
||||
<WrapPanel>
|
||||
|
||||
<Button Content="电压检测"
|
||||
Command="{Binding DetectionVoltage}" />
|
||||
<Button Content="版本检测"
|
||||
Command="{Binding GetVersionsCommand}" />
|
||||
<Button Content="校准"
|
||||
<Button Content="通讯版本" Command="{Binding DetectionCommModuleVersion}" />
|
||||
<Button Content="统计返回"
|
||||
Command="{Binding DetectionReturnData}" />
|
||||
|
||||
<TextBlock
|
||||
Margin="5,5,5,5" Foreground ="Red" VerticalAlignment="Center"
|
||||
Text="{Binding RTKState}"
|
||||
/>
|
||||
|
||||
</WrapPanel>
|
||||
<WrapPanel>
|
||||
<Button Content="参数设置"
|
||||
Command="{Binding ParamModify}" />
|
||||
<Button Content="读入参数"
|
||||
Command="{Binding LoadParamfile}" />
|
||||
<Button Content="定位统计" Command="{Binding ReportGPSTypeCommand}"/>
|
||||
<Button Content="飞机校准"
|
||||
Command="{Binding CalibrationSingleCommand}" />
|
||||
</WrapPanel>
|
||||
<WrapPanel>
|
||||
<Button Content="返航"
|
||||
Command="{Binding ReturnToLaunchCommand}" />
|
||||
<Button Content="降落"
|
||||
Command="{Binding LandCommand}" />
|
||||
<Button Content="上锁"
|
||||
Command="{Binding LockCommand}" />
|
||||
<Button Content="跳过" Visibility="Collapsed"
|
||||
Command="{Binding FlagCommand}" />
|
||||
<Button Content="闪灯"
|
||||
Command="{Binding LEDFlickerCommand}" />
|
||||
<Button Content="测试" Visibility="Collapsed"
|
||||
Command="{Binding TestCommand}" />
|
||||
<Button Content="开灯"
|
||||
Command="{Binding LEDOnOffCommand}"
|
||||
CommandParameter="0"/>
|
||||
<Button Content="关灯"
|
||||
Command="{Binding LEDOnOffCommand}"
|
||||
CommandParameter="1"/>
|
||||
<Button Content="电机"
|
||||
<Button Content="正式参数" Command="{Binding TurnOffTestLightsCommand}" Visibility="Collapsed" />
|
||||
|
||||
<Button Content="电机测试"
|
||||
|
||||
Command="{Binding MotorTestCommand}" />
|
||||
|
||||
<TextBox Width="50"
|
||||
Visibility="Collapsed"
|
||||
Text="{Binding AltP, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</WrapPanel>
|
||||
<WrapPanel>
|
||||
<Button Margin="0,0,0,0" Content="选写航点" Command="{Binding WriteMissionSingleCommand}" />
|
||||
<Button Margin="3,0,0,0" Content="定位统计" Command="{Binding ReportGPSTypeCommand}"/>
|
||||
<Button Margin="3,0,0,0" Content="统计模块" Command="{Binding DetectionCommModuleVersion}" />
|
||||
<Button Margin="3,0,0,0" Content="正式参数" Command="{Binding TurnOffTestLightsCommand}" />
|
||||
|
||||
<TextBlock Margin="8,0,5,0" Text="起飞高度" VerticalAlignment="Center"></TextBlock>
|
||||
<TextBox Width="30" Height="25" Text="{Binding TaskOffAlt}" />
|
||||
<TextBlock Margin="5,0,5,0" Text="米" VerticalAlignment="Center"></TextBlock>
|
||||
|
||||
<Label Visibility="Collapsed">Lat</Label>
|
||||
<TextBox Visibility="Collapsed" Text="{Binding LatOffset}" Width="50"/>
|
||||
<Label Visibility="Collapsed">Lng</Label>
|
||||
<TextBox Visibility="Collapsed" Text="{Binding LngOffset}" Width="50"/>
|
||||
<Button Visibility="Collapsed" Content="设置返航点" Command="{Binding RLTOffsetCommand}" />
|
||||
</WrapPanel>
|
||||
<Separator/>
|
||||
<WrapPanel>
|
||||
<Button Content="全部降落"
|
||||
Command="{Binding AllLandCommand}" />
|
||||
<Button Content="全部加锁"
|
||||
Command="{Binding LockAllCommand}" />
|
||||
<Button Content="检测电压"
|
||||
Command="{Binding DetectionVoltage}" />
|
||||
<Button Content="统计返回"
|
||||
Command="{Binding DetectionReturnData}" />
|
||||
<Button Content="统计航点"
|
||||
Command="{Binding DetectionMissionData}" />
|
||||
</WrapPanel>
|
||||
<WrapPanel>
|
||||
<Button Content="写入航点"
|
||||
Command="{Binding WriteMissionCommand}" />
|
||||
<Button Content="全部解锁"
|
||||
Command="{Binding UnlockAllCommand}"
|
||||
IsEnabled="{Binding AllowMissionStart, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Button Content="开始任务"
|
||||
Command="{Binding MissionStartCommand}"
|
||||
IsEnabled="{Binding AllowMissionStart, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
<Button Content="暂停任务"
|
||||
Command="{Binding MissionPauseCommand}" />
|
||||
<Button Content="继续任务"
|
||||
Command="{Binding MissionResumeCommand}" />
|
||||
</WrapPanel>
|
||||
|
||||
<WrapPanel>
|
||||
<Button Content="航点续写"
|
||||
<Label Visibility="Collapsed" Content="Lat"/>
|
||||
<TextBox Visibility="Collapsed" Text="{Binding LatOffset}" Width="50"/>
|
||||
<Label Visibility="Collapsed" Content="Lng"/>
|
||||
<TextBox Visibility="Collapsed" Text="{Binding LngOffset}" Width="50"/>
|
||||
<Button Visibility="Collapsed" Content="设置返航点" Command="{Binding RLTOffsetCommand}" />
|
||||
</WrapPanel>
|
||||
|
||||
<WrapPanel>
|
||||
<Button Content="写入航点"
|
||||
Command="{Binding WriteMissionCommand}" />
|
||||
<Button Content="航点续写"
|
||||
Command="{Binding WriteMissionFailedCommand}" />
|
||||
<TextBox
|
||||
<Button Content="选写航点" Command="{Binding WriteMissionSingleCommand}" />
|
||||
<Button Content="统计航点"
|
||||
Command="{Binding DetectionMissionData}" />
|
||||
<TextBox
|
||||
Grid.Column="1"
|
||||
Width="55"
|
||||
Margin="5, 5, 5, 5"
|
||||
@ -133,55 +87,143 @@
|
||||
|
||||
Text="{Binding RTKcomvalue, UpdateSourceTrigger=PropertyChanged}" Visibility="Collapsed"
|
||||
/>
|
||||
|
||||
<Button Content="{Binding Path=RTKbtntxt}"
|
||||
|
||||
<Button Content="{Binding RTKbtntxt}"
|
||||
Command="{Binding SendRTKCommand}" Visibility="Collapsed" />
|
||||
|
||||
<Button Content="{Binding Path=NTRIPbtntxt}"
|
||||
<Button Content="{Binding NTRIPbtntxt}"
|
||||
Command="{Binding SendRTCMCommand}" Visibility="Collapsed"/>
|
||||
|
||||
<Button Content="RTK 控制" Command="{Binding OpenRtcmManageCommand}" />
|
||||
|
||||
<TextBlock
|
||||
Margin="5,5,5,5" Foreground ="Red" VerticalAlignment="Center"
|
||||
Text="{Binding Path=RTKState}"
|
||||
/>
|
||||
</WrapPanel>
|
||||
|
||||
<!--// 林俊清, 20150920, 目前不再使用 FormationController,删除相关按钮。
|
||||
<StackPanel Visibility="{Binding Source={x:Static fc:AppEx.Current}, Path=AppMode, Converter={StaticResource AppModeToVisibilityConverter}, ConverterParameter=ControlPanelView_Formation}">
|
||||
<TextBlock Text="任务" />
|
||||
<WrapPanel>
|
||||
<Button Content="飞到50米高"
|
||||
Command="{Binding FlyToAltitudeCommand}"
|
||||
CommandParameter="50" />
|
||||
<Button Content="飞到15米高"
|
||||
Command="{Binding FlyToAltitudeCommand}"
|
||||
CommandParameter="15" />
|
||||
<Button Content="Test"
|
||||
Command="{Binding TestCommand}" />
|
||||
</WrapPanel>
|
||||
-->
|
||||
<!--<WrapPanel>
|
||||
<Button Content="画圈"
|
||||
Command="{Binding FlyInCircleCommand}" />
|
||||
<Button Content="绕队列中心画圈"
|
||||
Command="{Binding FlyAroundCenterOfCoptersCommand}" />
|
||||
<Button Content="Test"
|
||||
Command="{Binding TestCommand}" />
|
||||
<Button Content="画矩形"
|
||||
Command="{Binding FlyInRectangleCommand}"
|
||||
Visibility="Collapsed" />
|
||||
</WrapPanel>
|
||||
<WrapPanel>
|
||||
<Button Content="飞到一条竖线画圈"
|
||||
Command="{Binding FlyToVerticalLineAndMakeCircleCommand}" />
|
||||
</WrapPanel>-->
|
||||
<!--
|
||||
<WrapPanel>
|
||||
<Button Content="停止"
|
||||
Command="{Binding StopTaskCommand}" />
|
||||
</WrapPanel>
|
||||
</StackPanel>-->
|
||||
<Button Content="RTK 控制" Command="{Binding OpenRtcmManageCommand}" />
|
||||
|
||||
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
|
||||
</TabItem>
|
||||
|
||||
|
||||
<TabItem Header="飞行控制">
|
||||
|
||||
<StackPanel Orientation="Vertical" Margin="0,5,0,0">
|
||||
<WrapPanel >
|
||||
<Button Content="解锁"
|
||||
Command="{Binding UnlockCommand}" />
|
||||
<Button Content="加锁"
|
||||
Command="{Binding LockCommand}" />
|
||||
<Button Content="起飞" Visibility="Collapsed"
|
||||
Command="{Binding TakeOffCommand}" />
|
||||
|
||||
|
||||
|
||||
</WrapPanel>
|
||||
<WrapPanel>
|
||||
<Button Content="起飞"
|
||||
Command="{Binding GuidAsyncCommand}" />
|
||||
<Button Content="悬停"
|
||||
Command="{Binding HoverCommand}" />
|
||||
<Button Content="手动"
|
||||
Command="{Binding FloatCommand}" />
|
||||
<Button Content="返航"
|
||||
Command="{Binding ReturnToLaunchCommand}" />
|
||||
<Button Content="降落"
|
||||
Command="{Binding LandCommand}" />
|
||||
|
||||
<Button Content="跳过" Visibility="Collapsed"
|
||||
Command="{Binding FlagCommand}" />
|
||||
|
||||
|
||||
|
||||
<TextBox Width="50"
|
||||
Visibility="Collapsed"
|
||||
Text="{Binding AltP, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</WrapPanel>
|
||||
|
||||
|
||||
<WrapPanel>
|
||||
<Button Content="闪灯"
|
||||
Command="{Binding LEDFlickerCommand}" />
|
||||
<Button Content="测试" Visibility="Collapsed"
|
||||
Command="{Binding TestCommand}" />
|
||||
<Button Content="开灯"
|
||||
Command="{Binding LEDOnOffCommand}"
|
||||
CommandParameter="0"/>
|
||||
<Button Content="关灯"
|
||||
Command="{Binding LEDOnOffCommand}"
|
||||
CommandParameter="1"/>
|
||||
<TextBlock Margin="8,-3,5,0" Text="起飞高度" VerticalAlignment="Center"/>
|
||||
<TextBox VerticalContentAlignment="Center" Margin="0,0,0,5" Width="30" Height="25" Text="{Binding TaskOffAlt}" />
|
||||
<TextBlock Margin="5,-3,5,0" Text="米" VerticalAlignment="Center"/>
|
||||
</WrapPanel>
|
||||
|
||||
|
||||
|
||||
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
|
||||
|
||||
<TabItem Header="任务控制">
|
||||
|
||||
<StackPanel Orientation="Vertical" Margin="0,5,0,0">
|
||||
<WrapPanel>
|
||||
|
||||
<Button Content="全部解锁"
|
||||
Command="{Binding UnlockAllCommand}"
|
||||
IsEnabled="{Binding AllowMissionStart, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Button Content="全部加锁"
|
||||
Command="{Binding LockAllCommand}" />
|
||||
</WrapPanel>
|
||||
<WrapPanel>
|
||||
|
||||
<Button Content="开始任务"
|
||||
Command="{Binding MissionStartCommand}"
|
||||
IsEnabled="{Binding AllowMissionStart, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
<Button Content="暂停任务"
|
||||
Command="{Binding MissionPauseCommand}" />
|
||||
<Button Content="继续任务"
|
||||
Command="{Binding MissionResumeCommand}" />
|
||||
|
||||
|
||||
|
||||
</WrapPanel>
|
||||
|
||||
<WrapPanel>
|
||||
|
||||
<Button Content="全部降落"
|
||||
Command="{Binding AllLandCommand}" />
|
||||
|
||||
|
||||
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
|
||||
</TabItem>
|
||||
|
||||
|
||||
|
||||
<TabItem Header="飞行报告" Visibility="Collapsed">
|
||||
|
||||
<StackPanel Orientation="Vertical" Margin="0,5,0,0">
|
||||
|
||||
<WrapPanel>
|
||||
|
||||
<Button Content="添加报告"
|
||||
Command="{Binding UnlockAllCommand}"
|
||||
IsEnabled="{Binding AllowMissionStart, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Button Content="查看报告"
|
||||
Command="{Binding LockAllCommand}" />
|
||||
</WrapPanel>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
|
||||
|
||||
|
||||
</TabControl>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
@ -45,7 +45,7 @@
|
||||
/>
|
||||
<CheckBox Grid.Row="0" Content="飞行航线" Margin="5,5,0,0"
|
||||
Click="showpanline_Checked"
|
||||
Foreground="White"
|
||||
Foreground="White" IsChecked="True"
|
||||
/>
|
||||
|
||||
<CheckBox Grid.Row="0" Content="实时航线" Margin="5,5,0,0"
|
||||
|
@ -64,6 +64,7 @@ namespace Plane.FormationCreator.Views
|
||||
_mapManager.SetCenterGetter(() => new LatLng { Lat = gmap.Position.ToWGS84().Lat, Lng = gmap.Position.ToWGS84().Lng });
|
||||
|
||||
_flightTaskManager.TaskAdded += FlightTaskManager_TaskAdded;
|
||||
_flightTaskManager.TaskDeled += FlightTaskManager_TaskDeled;
|
||||
_flightTaskManager.OnOriginalSet += FlightTaskManager_SetOriginal;
|
||||
|
||||
/*
|
||||
@ -105,7 +106,7 @@ namespace Plane.FormationCreator.Views
|
||||
copterDrawing.ShowWaypoint(_flightTaskManager.SelectedTaskIndex);
|
||||
|
||||
copterDrawing.SetTaskEffect(_flightTaskManager.SelectedTaskIndex);
|
||||
//重画计划航线
|
||||
//画计划航线
|
||||
copterDrawing.ResetRoute(_flightTaskManager.SelectedTaskIndex);
|
||||
}
|
||||
break;
|
||||
@ -396,6 +397,11 @@ namespace Plane.FormationCreator.Views
|
||||
*/
|
||||
|
||||
gmap.Markers.Clear();
|
||||
|
||||
|
||||
|
||||
//_copterManager.Copters.ForEach(copter => _copterDrawings[copter]=null );
|
||||
|
||||
_copterDrawings.Clear();
|
||||
}
|
||||
|
||||
@ -417,14 +423,28 @@ namespace Plane.FormationCreator.Views
|
||||
|
||||
private void FlightTaskManager_TaskAdded(object sender, FlightTaskAddedEventArgs e)
|
||||
{
|
||||
//给每个任务在地图上添加航点
|
||||
foreach (var info in e.AddedTask.SingleCopterInfos)
|
||||
{
|
||||
var drawingInfo = _copterDrawings[info.Copter];
|
||||
//计算位置
|
||||
var location = new Microsoft.Maps.MapControl.WPF.Location(info.TargetLat, info.TargetLng, info.TargetAlt);
|
||||
drawingInfo.AddWaypoint(location, e.AddedTask.TaskType);
|
||||
//添加航点
|
||||
drawingInfo.AddWaypoint(location, e.AddedTask.TaskType,e.AddedTask);
|
||||
}
|
||||
}
|
||||
|
||||
private void FlightTaskManager_TaskDeled(object sender, FlightTaskDeledEventArgs e)
|
||||
{
|
||||
//清除每架飞机的这个任务的航点
|
||||
// foreach (var info in e.DeledTask.SingleCopterInfos)
|
||||
// {
|
||||
// _copterDrawings[info.Copter].Waypoints.RemoveAt(e.TaskIndex);
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
GMapMarker originalMarker = null;
|
||||
Microsoft.Expression.Shapes.RegularPolygon original = null;
|
||||
const double ORIGIN_RADIUS = 12;
|
||||
@ -582,7 +602,8 @@ namespace Plane.FormationCreator.Views
|
||||
foreach (var item in _copterDrawings)
|
||||
{
|
||||
var copterDrawing = item.Value;
|
||||
copterDrawing.SetShowroute(chk.IsChecked);
|
||||
_flightTaskManager.showroute = chk.IsChecked??false;
|
||||
copterDrawing.UpdateShowroute();
|
||||
}
|
||||
|
||||
}
|
||||
@ -596,9 +617,6 @@ namespace Plane.FormationCreator.Views
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void RemoveTileLayers()
|
||||
{
|
||||
/*
|
||||
@ -640,9 +658,7 @@ namespace Plane.FormationCreator.Views
|
||||
grid_bg.Background = ib;
|
||||
gmap.Opacity = 0.5;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class LocationExtensions
|
||||
|
@ -40,12 +40,18 @@ namespace Plane.FormationCreator.Views
|
||||
_brush = new SolidColorBrush(_color);
|
||||
}
|
||||
|
||||
_brush = new SolidColorBrush(Color.FromRgb(45,45,45));
|
||||
|
||||
Color Copterdefaultcolor = (Color)ColorConverter.ConvertFromString("#" + CopterManager.CopterDefaultColor);
|
||||
|
||||
_brush = new SolidColorBrush(Copterdefaultcolor);
|
||||
|
||||
_flightTaskManager.TasksCleared += (sender, e) =>
|
||||
{
|
||||
//清除计划航线
|
||||
if (Route!=null)
|
||||
Route.Points.Clear();
|
||||
Route.Points.Clear();
|
||||
|
||||
|
||||
// for (int i = this.Route.Locations.Count - 1; i >= 1; i--)
|
||||
// {
|
||||
// this.Route.Locations.RemoveAt(i);
|
||||
@ -58,7 +64,22 @@ namespace Plane.FormationCreator.Views
|
||||
};
|
||||
|
||||
//_map.ViewChangeOnFrame += new EventHandler<MapEventArgs>(Map_ViewChanged);
|
||||
|
||||
|
||||
|
||||
//删除任务事件
|
||||
_flightTaskManager.TaskDeled += (sender, e) =>
|
||||
{
|
||||
if (this.Waypoints.Count == 0)
|
||||
return;
|
||||
// Waypoints没有起飞任务所以-1
|
||||
int WaypointsIndex = e.TaskIndex - 1;
|
||||
//删除地图上的航点
|
||||
var wp = this.Waypoints[WaypointsIndex];
|
||||
_map.Markers.Remove(wp);
|
||||
//删除航点列表里的航点
|
||||
this.Waypoints.RemoveAt(WaypointsIndex);
|
||||
};
|
||||
|
||||
|
||||
selectMarkup.Width = 7;
|
||||
selectMarkup.Height = 7;
|
||||
@ -100,7 +121,9 @@ namespace Plane.FormationCreator.Views
|
||||
public MapPolyline Track { get; set; }
|
||||
public Location LastLocation { get; set; }
|
||||
|
||||
//计划航线
|
||||
public GMapRoute Route { get; set; }
|
||||
//某架飞机的地图显示航点列表
|
||||
public List<GMapMarker> Waypoints { get; set; } = new List<GMapMarker>();
|
||||
|
||||
GoogleMap.GMap _map;
|
||||
@ -206,13 +229,16 @@ namespace Plane.FormationCreator.Views
|
||||
//MapLayer.SetZIndex(DotContainer, 100);
|
||||
|
||||
this.Route = new GMapRoute(new List<PointLatLng>() { gmapLatLng, gmapLatLng });
|
||||
/*
|
||||
Path path = new Path()
|
||||
{
|
||||
Stroke = _brush,
|
||||
Stroke = new SolidColorBrush(Colors.Red),
|
||||
StrokeThickness = 2.0
|
||||
};
|
||||
|
||||
|
||||
this.Route.Shape = path;
|
||||
*/
|
||||
//显示计划航线
|
||||
//_map.Markers.Add(Route);
|
||||
|
||||
@ -337,18 +363,33 @@ namespace Plane.FormationCreator.Views
|
||||
|
||||
|
||||
|
||||
|
||||
public void AddWaypoint(Location location, FlightTaskType type)
|
||||
//加入航点
|
||||
public void AddWaypoint(Location location, FlightTaskType type, FlightTask vtask)
|
||||
{
|
||||
// Add waypoint.
|
||||
LatLng gmapLatLng = new LatLng(location.Latitude, location.Longitude);
|
||||
|
||||
//创建marker,设定位置
|
||||
GMapMarker marker = new GMapMarker(gmapLatLng.ToGCJ02());
|
||||
ShapesContainer shapesContainer = new ShapesContainer(_brush);
|
||||
|
||||
//航点默认颜色
|
||||
SolidColorBrush Waypoint_brush = new SolidColorBrush(Color.FromRgb(0, 0, 255));
|
||||
//makrer的形状,包含一个圆圈和一个选中方块
|
||||
ShapesContainer shapesContainer = new ShapesContainer(Waypoint_brush);
|
||||
|
||||
shapesContainer.Tag = WAYPOINT_TAG;
|
||||
marker.Tag = WAYPOINT_TAG;
|
||||
//形状设置为shapesContainer
|
||||
marker.Shape = shapesContainer;
|
||||
//加入航点列表Waypoints为某架飞机的航点列表
|
||||
Waypoints.Insert(vtask.TaskIndex-1,marker);
|
||||
//该航点的飞机是否选中
|
||||
bool PontisSelected = _copterManager.SelectedCopters.Contains(Copter);
|
||||
shapesContainer.Ismark = PontisSelected;
|
||||
// 选中飞机在地图上显示一个红色方块---选中时也会调用,这儿可以不调用
|
||||
SetEffect(PontisSelected);
|
||||
|
||||
|
||||
Waypoints.Add(marker);
|
||||
//_map.Markers.Add(marker); //消耗大量时间费时 ,为了提高效率改为选中才添加见ShowWaypoint
|
||||
marker.ZIndex = 100;
|
||||
//MapLayer.SetZIndex(shapesContainer, 100);
|
||||
@ -357,13 +398,12 @@ namespace Plane.FormationCreator.Views
|
||||
//wpPos.Y -= WAYPOINT_RADIUS;
|
||||
//MapLayer.SetPosition(shapesContainer, _map.ViewportPointToLocation(wpPos));
|
||||
|
||||
SetEffect(_copterManager.SelectedCopters.Contains(Copter));
|
||||
|
||||
|
||||
// Register event handlers.
|
||||
RegisterEventHandlersForDraggingWaypoint(marker, taskIndex: Waypoints.Count);
|
||||
RegisterEventHandlersForDraggingWaypoint(marker, vtask);
|
||||
|
||||
// Register event handlers for task info.
|
||||
RegisterEventHandlersForTaskInfo(marker, taskIndex: Waypoints.Count);
|
||||
RegisterEventHandlersForTaskInfo(marker, vtask);
|
||||
}
|
||||
|
||||
private void RegisterEventHandlersForDraggingCopter(GMapMarker copterMarker)
|
||||
@ -417,7 +457,7 @@ namespace Plane.FormationCreator.Views
|
||||
|
||||
private Dictionary<ICopter, GPoint> selectWayOriginPoint = new Dictionary<ICopter, GPoint>();
|
||||
private Dictionary<object, bool> _dictDraggingWp = new Dictionary<object, bool>();
|
||||
private void RegisterEventHandlersForDraggingWaypoint(GMapMarker wpMarker, int taskIndex)
|
||||
private void RegisterEventHandlersForDraggingWaypoint(GMapMarker wpMarker, FlightTask vtask)
|
||||
{
|
||||
Grid wp = wpMarker.Shape as Grid;
|
||||
_dictDraggingWp[wp] = false;
|
||||
@ -430,11 +470,11 @@ namespace Plane.FormationCreator.Views
|
||||
//判断点击的航点
|
||||
//非SelectedTask中的航点 或者 当前SelectedTask中未选择的航点 单选拖动
|
||||
//否则多选拖动
|
||||
if (_flightTaskManager.SelectedTaskIndex != taskIndex || !_copterManager.SelectedCopters.Contains(this.Copter))
|
||||
if (_flightTaskManager.SelectedTask != vtask || !_copterManager.SelectedCopters.Contains(this.Copter))
|
||||
{
|
||||
//_copterManager.Select(null);
|
||||
_copterManager.Select(this.Copter);
|
||||
_flightTaskManager.Select(taskIndex, this.Copter);
|
||||
_flightTaskManager.SelectTask(vtask.TaskIndex);
|
||||
}
|
||||
|
||||
var originPoint = e.GetPosition(_map);
|
||||
@ -460,7 +500,7 @@ namespace Plane.FormationCreator.Views
|
||||
};
|
||||
wp.MouseRightButtonDown += (sender, e) =>
|
||||
{
|
||||
_flightTaskManager.RightSelect(taskIndex, this.Copter);
|
||||
_flightTaskManager.RightSelect(vtask.TaskIndex, this.Copter);
|
||||
};
|
||||
_map.MouseMove += (sender, e) =>
|
||||
{
|
||||
@ -506,10 +546,10 @@ namespace Plane.FormationCreator.Views
|
||||
};
|
||||
}
|
||||
|
||||
private void RegisterEventHandlersForTaskInfo(GMapMarker marker, int taskIndex)
|
||||
private void RegisterEventHandlersForTaskInfo(GMapMarker marker, FlightTask vtask)
|
||||
{
|
||||
var wp = marker.Shape as ShapesContainer;
|
||||
var info = _flightTaskManager.Tasks[taskIndex].SingleCopterInfos.FirstOrDefault(i => i.Copter == this.Copter);
|
||||
var info = vtask.SingleCopterInfos.FirstOrDefault(i => i.Copter == this.Copter);
|
||||
if (info == null) return;
|
||||
info.PropertyChanged += (sender, e) =>
|
||||
{
|
||||
@ -557,21 +597,25 @@ namespace Plane.FormationCreator.Views
|
||||
//_map.ViewChangeOnFrame -= Map_ViewChanged;
|
||||
}
|
||||
|
||||
public void SetShowroute(bool? showroute)
|
||||
//显示或隐藏计划线路
|
||||
public void UpdateShowroute()
|
||||
{
|
||||
if (showroute ?? false )
|
||||
if (_flightTaskManager.showroute)
|
||||
{
|
||||
if (_copterManager.ShowCopter.Count > 0)
|
||||
{
|
||||
if (_copterManager.ShowCopter.Contains(Copter))
|
||||
{
|
||||
_map.Markers.Add(this.Route);
|
||||
if (!_map.Markers.Contains(this.Route))
|
||||
_map.Markers.Add(this.Route);
|
||||
Route.ZIndex = 99;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_map.Markers.Add(this.Route);
|
||||
//将计划线路加入地图
|
||||
if (!_map.Markers.Contains(this.Route))
|
||||
_map.Markers.Add(this.Route);
|
||||
Route.ZIndex = 99;
|
||||
}
|
||||
|
||||
@ -579,7 +623,8 @@ namespace Plane.FormationCreator.Views
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_map.Markers.Contains(this.Route))
|
||||
//将计划线路从地图移除
|
||||
if (_map.Markers.Contains(this.Route))
|
||||
_map.Markers.Remove(this.Route);
|
||||
}
|
||||
|
||||
@ -593,6 +638,7 @@ namespace Plane.FormationCreator.Views
|
||||
// _map.Children.Remove(Track);
|
||||
}
|
||||
|
||||
//选中飞机在地图上显示一个红色方块
|
||||
public void SetEffect(bool selected)
|
||||
{
|
||||
|
||||
@ -620,6 +666,8 @@ namespace Plane.FormationCreator.Views
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
//添加计划航线---只显示两个点
|
||||
public void ResetRoute(int taskIndex)
|
||||
{
|
||||
var wpIndex = taskIndex - 1; // Waypoints 中没有起飞点。
|
||||
@ -627,15 +675,24 @@ namespace Plane.FormationCreator.Views
|
||||
Route.Points.Clear();
|
||||
if (wpIndex >= 0 && wpIndex < Waypoints.Count)
|
||||
{
|
||||
//起始点时
|
||||
var info1 = _flightTaskManager.Tasks[wpIndex].SingleCopterInfos.Find(i => i.Copter == this.Copter);
|
||||
var info2 = _flightTaskManager.Tasks[taskIndex].SingleCopterInfos.Find(i => i.Copter == this.Copter);
|
||||
|
||||
PointLatLng loc1 = new LatLng(info1.TargetLat, info1.TargetLng).ToGCJ02();
|
||||
PointLatLng loc2 = new LatLng(info2.TargetLat, info2.TargetLng).ToGCJ02();
|
||||
Route.Points.Add(loc1);
|
||||
Route.Points.Add(loc2);
|
||||
Route.Points.Add(loc1); //起始点
|
||||
Route.Points.Add(loc2); //结束点
|
||||
}
|
||||
|
||||
Path path = new Path()
|
||||
{
|
||||
Stroke = new SolidColorBrush(Colors.Red),
|
||||
StrokeThickness = 2.0
|
||||
};
|
||||
Route.Shape = path;
|
||||
Route.RegenerateShape(_map);
|
||||
UpdateShowroute();
|
||||
|
||||
}
|
||||
|
||||
@ -665,6 +722,7 @@ namespace Plane.FormationCreator.Views
|
||||
if (!flag)
|
||||
{
|
||||
wp.Visibility = Visibility.Hidden;
|
||||
Route.Shape.Visibility= Visibility.Hidden;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -674,15 +732,18 @@ namespace Plane.FormationCreator.Views
|
||||
if (_copterManager.ShowCopter.Contains(Copter))
|
||||
{
|
||||
wp.Visibility = Visibility.Visible;
|
||||
Route.Shape.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
wp.Visibility = Visibility.Hidden;
|
||||
Route.Shape.Visibility = Visibility.Hidden;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wp.Visibility = Visibility.Visible;
|
||||
Route.Shape.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
//var info = _flightTaskManager.Tasks[taskIndex].SingleCopterInfos.Find(i => i.Copter == this.Copter);
|
||||
@ -692,6 +753,7 @@ namespace Plane.FormationCreator.Views
|
||||
}
|
||||
}
|
||||
|
||||
//航点选中方块
|
||||
public class ShapesContainer : Grid
|
||||
{
|
||||
const double WAYPOINT_RADIUS = 6;
|
||||
@ -713,6 +775,7 @@ namespace Plane.FormationCreator.Views
|
||||
mark.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
mark.VerticalAlignment = VerticalAlignment.Top;
|
||||
mark.Fill = new SolidColorBrush(Colors.GreenYellow);
|
||||
|
||||
this.Children.Add(mark);
|
||||
|
||||
mark.Visibility = Visibility.Hidden;
|
||||
@ -721,8 +784,10 @@ namespace Plane.FormationCreator.Views
|
||||
//public MapPolygon
|
||||
private bool isMarked;
|
||||
public Ellipse wp;
|
||||
public Rectangle mark;
|
||||
//航点选中方块
|
||||
public Rectangle mark;
|
||||
|
||||
//航点是否选中
|
||||
public bool Ismark
|
||||
{
|
||||
get
|
||||
|
@ -78,12 +78,14 @@
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
|
||||
<Button Content="回前一高度"
|
||||
|
||||
<Button Content="回前一任务"
|
||||
Margin="40,5,5,0" Width="105"
|
||||
Command="{Binding PrealtCommand}" />
|
||||
<Button Content="回上一任务"
|
||||
Margin="0,5,5,0" Width="105"
|
||||
Command="{Binding BackToPreviousTaskPoint}" />
|
||||
<Button Content="回前一高度"
|
||||
Margin="0,5,5,0" Width="105"
|
||||
Command="{Binding PrealtCommand}" />
|
||||
|
||||
<Button Content="回起飞点"
|
||||
Margin="0,5,5,0" Width="105"
|
||||
Command="{Binding BackTakeOffPointCommand}" />
|
||||
@ -450,7 +452,7 @@
|
||||
|
||||
<StackPanel x:Name="PanelDesign1">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,5,0,5" >
|
||||
<Button Width="120" Margin="10,5,0,5" Content="C4D导入航点" Command="{Binding ImportBlenderWayPointCommand}"/>
|
||||
<Button Width="120" Margin="10,5,0,5" Content="导入外部航点" Command="{Binding ImportBlenderWayPointCommand}"/>
|
||||
<Button Width="120" Content="自动飞行时间" Margin="10,5,0,5"
|
||||
Command="{Binding AutoWayPointAllTmCommand}" HorizontalAlignment="Right" />
|
||||
<Button Width="120" Content="飞行图案设计" Margin="10,5,0,5"
|
||||
|
@ -120,7 +120,7 @@
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<Grid Grid.Column="2">
|
||||
<Grid Grid.Column="2" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="28"/>
|
||||
@ -196,6 +196,9 @@
|
||||
<Button Content="添加" x:Name="addtaskbtn"
|
||||
Background="#232323"
|
||||
Command="{Binding AddTaskCommand}" />
|
||||
<Button Content="删除"
|
||||
Background="#232323"
|
||||
Command="{Binding DelTaskCommand}" />
|
||||
<Button Content="清除"
|
||||
Background="#232323"
|
||||
Command="{Binding ClearTasksCommand}" />
|
||||
@ -209,6 +212,8 @@
|
||||
<Button Content="原点"
|
||||
Background="#232323"
|
||||
Command="{Binding SetOriginCommand}" />
|
||||
|
||||
|
||||
<!--<Button Content="保存" />
|
||||
<Button Content="取消" />-->
|
||||
</StackPanel>
|
||||
|
@ -52,9 +52,10 @@ namespace Plane.FormationCreator.Views
|
||||
|
||||
_flightTaskManager.PropertyChanged += (sender, e) =>
|
||||
{
|
||||
if (_flightTaskManager.SelectedTaskIndex == -1) return;
|
||||
switch (e.PropertyName)
|
||||
{
|
||||
//选中任务时触发
|
||||
//选中任务时触发--控制任务类型选项卡的显示和是否允许加入新任务
|
||||
case nameof(FlightTaskManager.SelectedTaskIndex):
|
||||
if (_flightTaskManager.Tasks.Count == 0)
|
||||
{
|
||||
@ -67,33 +68,41 @@ namespace Plane.FormationCreator.Views
|
||||
{
|
||||
hintaddtask.Visibility = Visibility.Collapsed;
|
||||
tasktabcont.Visibility = Visibility.Visible;
|
||||
//刷新任务编号--可能删除了任务
|
||||
TasksControl.Items.Refresh();
|
||||
|
||||
//起飞任务
|
||||
if (_flightTaskManager.Tasks[_flightTaskManager.SelectedTaskIndex].TaskType == FlightTaskType.TakeOff)
|
||||
{
|
||||
takeoffpage.Visibility = Visibility.Visible;
|
||||
landpage.Visibility = Visibility.Collapsed;
|
||||
flytopage.Visibility = Visibility.Collapsed;
|
||||
}else
|
||||
//选中中间的任务
|
||||
if (_flightTaskManager.SelectedTaskIndex < (_flightTaskManager.Tasks.Count - 1))
|
||||
{
|
||||
takeoffpage.Visibility = Visibility.Collapsed;
|
||||
landpage.Visibility = Visibility.Collapsed;
|
||||
flytopage.Visibility = Visibility.Visible;
|
||||
|
||||
flytoLabel.Content = (_flightTaskManager.SelectedTaskIndex+1)+" "+ _flightTaskManager.Tasks[_flightTaskManager.SelectedTaskIndex].TaskCnName;
|
||||
|
||||
flytoLabel.Content = (_flightTaskManager.SelectedTaskIndex+1)+" "+ _flightTaskManager.Tasks[_flightTaskManager.SelectedTaskIndex].TaskCnName;
|
||||
//允许添加中途任务
|
||||
addtaskbtn.IsEnabled = true;
|
||||
|
||||
}
|
||||
else
|
||||
//最后一个任务--只有最后一个任务能设置成降落-防止中途降落
|
||||
{
|
||||
|
||||
takeoffpage.Visibility = Visibility.Collapsed;
|
||||
landpage.Visibility = Visibility.Visible;
|
||||
flytopage.Visibility = Visibility.Visible;
|
||||
|
||||
|
||||
//如果不是降落任务
|
||||
if (_flightTaskManager.Tasks[_flightTaskManager.SelectedTaskIndex].TaskType != FlightTaskType.Land)
|
||||
{
|
||||
addtaskbtn.IsEnabled = true;
|
||||
flytoLabel.Content = (_flightTaskManager.SelectedTaskIndex + 1) + " " + _flightTaskManager.Tasks[_flightTaskManager.SelectedTaskIndex].TaskCnName;
|
||||
}
|
||||
else
|
||||
{
|
||||
flytoLabel.Content = (_flightTaskManager.SelectedTaskIndex + 1) + " 航点";
|
||||
@ -159,15 +168,15 @@ namespace Plane.FormationCreator.Views
|
||||
var elem = sender as FrameworkElement;
|
||||
var task = elem.DataContext as FlightTask;
|
||||
_flightTaskManager.Select(task);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//以前的右键隐藏航点,已不用
|
||||
public void setRightSelect(FlightTask task, bool vRightSelect)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//右键功能 ---隐藏航点
|
||||
private void HideTask(object sender, MouseButtonEventArgs e)
|
||||
@ -175,7 +184,9 @@ namespace Plane.FormationCreator.Views
|
||||
var elem = sender as FrameworkElement;
|
||||
var task = elem.DataContext as FlightTask;
|
||||
_flightTaskManager.RightSelect(task);
|
||||
|
||||
setRightSelect(task, true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||
|
Loading…
Reference in New Issue
Block a user