1.自动计算模拟飞机更新间隔

2.增加通讯模块测试功能
3.增加检测电池电压功能
4.间隔选中飞机每行重新计算
5.计算飞机距离,增加所有任务的,并计算最大距离
6.整体旋转增加起始结束任务号
This commit is contained in:
xu 2021-04-02 01:26:12 +08:00
parent ba8eb6b2e2
commit 7dfe36a7f8
14 changed files with 416 additions and 105 deletions

View File

@ -28,6 +28,14 @@ namespace Plane.FormationCreator.Formation
//RaiseLocationChangedIfNeeded();
}
internal static SolidColorBrush BlueBrush { get; } = new SolidColorBrush(Color.FromRgb(28, 151, 234));
internal static SolidColorBrush RedBrush { get; } = new SolidColorBrush(Color.FromRgb(255, 100, 100));
internal static SolidColorBrush GreenBrush { get; } = new SolidColorBrush(Color.FromRgb(100, 255, 100));
internal static SolidColorBrush YellowBrush { get; } = new SolidColorBrush(Color.FromRgb(255, 215, 0));
static SolidColorBrush[] _brushes = new[]
{
new SolidColorBrush(Color.FromArgb(180, 255, 0, 0)),
@ -44,9 +52,11 @@ namespace Plane.FormationCreator.Formation
return _brushIndex++ % _brushes.Length;
}
//真实飞机列表默认颜色
internal static SolidColorBrush DefaultBrush { get; } = new SolidColorBrush(Color.FromRgb(50, 205, 50));
internal static SolidColorBrush DefaultBrush { get; } = GreenBrush;// new SolidColorBrush(Color.FromRgb(50, 205, 50));
//虚拟飞机列表默认颜色
internal static SolidColorBrush DefaultFakeBrush { get; } = new SolidColorBrush(Color.FromRgb(28, 151, 234));
internal static SolidColorBrush DefaultFakeBrush { get; } = BlueBrush;
private SolidColorBrush _Brush;

View File

@ -2258,6 +2258,18 @@ namespace Plane.FormationCreator.Formation
taskStartTime = DateTime.Now;
Message.Show($"{DateTime.Now.ToString("HH:mm:ss")}:任务开始");
}
//设置模拟飞行更新间隔都是I7配置下
int update_int = 50; //300以内50流畅
if ((_copterManager.Copters.Count() > 300) && ((_copterManager.Copters.Count() <= 500)))
update_int = 100; //300-500, 100才能模拟有些跳动
if ((_copterManager.Copters.Count() > 500) )
update_int = 150; //极限了 500-1000可以用
foreach (var copter in _copterManager.Copters)
copter.sim_update_int = update_int;
await RunAsync();
if ((IsPaused ?? false) == false)
{

View File

@ -303,6 +303,7 @@
TextChanged="LogTextChange"
IsReadOnly="True"
TextWrapping="Wrap"
FontSize="14"
ContextMenu="{StaticResource LogMenu}"/>
</DockPanel>
<GridSplitter Grid.Row="0" Grid.Column="1" Width="3" Margin="0,0,0,0" Background="MidnightBlue"

View File

@ -241,6 +241,9 @@
<Compile Include="Views\ChangePasswordView.xaml.cs">
<DependentUpon>ChangePasswordView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\InputDialog.xaml.cs">
<DependentUpon>InputDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Views\LoginView.xaml.cs">
<DependentUpon>LoginView.xaml</DependentUpon>
</Compile>
@ -387,6 +390,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\InputDialog.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\LoginView.xaml">
<SubType>Form</SubType>
<Generator>MSBuild:Compile</Generator>
@ -466,6 +473,9 @@
<ItemGroup>
<Resource Include="Resources\Logo_small.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\logo_big.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\System.Data.SQLite.Core.1.0.109.1\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.109.1\build\net46\System.Data.SQLite.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

@ -242,6 +242,21 @@ namespace Plane.FormationCreator.ViewModels
}));
}
}
private ICommand _TestModuleCommand;
public ICommand TestModuleCommand
{
get
{
return _TestModuleCommand ?? (_TestModuleCommand = new RelayCommand(async () =>
{
await commModule.TestModule((short)scale3d);
}));
}
}
private ICommand _CommDataAsync;
public ICommand CommDataAsync
{
@ -266,7 +281,7 @@ namespace Plane.FormationCreator.ViewModels
{
int channel = int.Parse(CopterColor);
if (channel >= 0 && channel <= 4)
await commModule.TestFire((short)CopterNum, channel);
await commModule.TestFire((short)CopterNum, channel);
}
catch
{ }

View File

@ -119,7 +119,25 @@ namespace Plane.FormationCreator.ViewModels
{
return _DetectionVoltage ?? (_DetectionVoltage = new RelayCommand(async () =>
{
Message.Show("--------------开始检测电压--------------");
float minVol;
InputDialog inputDialog = new InputDialog("最低检测电压( 0 恢复灯光):", "15.6");
if (inputDialog.ShowDialog() == true)
minVol = float.Parse(inputDialog.Answer);
else return;
//测试电池
await _commModuleManager.TestBattery((short)0, minVol);
if (minVol == 0.0) return;
Message.Show("---请检查飞机灯光---");
Message.Show(string.Format("---绿 色 电压高于 {0:F2}v (单节高于 {1:F2}v)--- ", minVol , minVol / 4.0f));
Message.Show(string.Format("---黄 色 电压低于 {0:F2}v (单节低于 {1:F2}v)--- ", minVol , minVol / 4.0f));
Message.Show(string.Format("---棕 色 电压低于 {0:F2}v (单节低于 {1:F2}v)--- ", minVol - 0.2, (minVol - 0.2) / 4.0f));
Message.Show(string.Format("---洋红色 电压低于 {0:F2}v (单节低于 {1:F2}v)--- ", minVol - 0.4, (minVol - 0.4) / 4.0f));
Message.Show(string.Format("---亮红色 电压低于 {0:F2}v (单节低于 {1:F2}v)--- ", minVol - 0.6, (minVol - 0.6) / 4.0f));
Message.Show("---输入0恢复灯光---");
Message.Show("--------------开始检测单机电压--------------");
Dictionary<string, float> dic_voltage = new Dictionary<string, float>();
await Task.WhenAll(_copterManager.Copters.Select(async c =>
{
@ -143,14 +161,20 @@ namespace Plane.FormationCreator.ViewModels
})).ConfigureAwait(false);
await Task.Run(async () => {
Dictionary<string, float> dic_voltage_Order = dic_voltage.OrderByDescending(o => o.Value).ToDictionary(o => o.Key, o => o.Value);
bool showch = false;
foreach (KeyValuePair<string, float> kv in dic_voltage_Order)
{
Message.Show(string.Format("{0} --> 5秒平均电压{1}", kv.Key, kv.Value));
if ((!showch) &&(minVol>0.00) && (kv.Value<=minVol))
{
Message.Show(string.Format("以下飞机电压低于[{0}V]更换值:", minVol));
showch = true;
}
Message.Show(string.Format("{0} --> 5秒平均电压{1:F2},单节{2:F2}", kv.Key, kv.Value, kv.Value/4));
await Task.Delay(5).ConfigureAwait(false);
}
Message.Show(string.Format("----检测电压完成,检测总数:{0}----", dic_voltage.Count));
}).ConfigureAwait(false);
//todo:增加电压阈值变成不同颜色灯
}));
}
}
@ -1496,7 +1520,7 @@ namespace Plane.FormationCreator.ViewModels
await _RtcmInfoViewModel.RtcmManager.Close(_RtcmInfoViewModel.SerialPortsSelectdValue);
}
Alert.Show("开始写入航点,请稍等!", "提示");
Alert.Show("开始写入航点,请稍等!(先关灯再开可恢复飞机灯光)", "提示");
_commModuleManager.ClearMissionWriteState();
for (int i = 0; i < coptercount; i++)
{
@ -1509,7 +1533,7 @@ namespace Plane.FormationCreator.ViewModels
}
/// <summary>
/// 收集航点信息
/// 用通讯模块 写入航点信息
/// </summary>
/// <param name="i">copterIndex</param>
/// <returns></returns>

View File

@ -93,6 +93,12 @@ namespace Plane.FormationCreator.ViewModels
get { return _IntervalNum; }
set { Set(nameof(IntervalNum), ref _IntervalNum, value); }
}
private int _RowNum;
public int RowNum
{
get { return _RowNum; }
set { Set(nameof(RowNum), ref _RowNum, value); }
}
private int _ContinuousNum;
public int ContinuousNum
@ -111,6 +117,19 @@ namespace Plane.FormationCreator.ViewModels
public ObservableCollection<string[]> CopterGroups { get; } = new ObservableCollection<string[]>();
private int getNextcopterindex( int currindex)
{
//每行数量
int colcount = _flightTaskManager.ColumnCount;
int newind = currindex;
for (int i = 0;i< IntervalNum;i++)
{
newind +=1;
if ((newind % colcount) == 0)
newind += RowNum * colcount;
}
return newind;
}
private ICommand _IntervalSelectCoptersCommand;
public ICommand IntervalSelectCoptersCommand
@ -126,6 +145,21 @@ namespace Plane.FormationCreator.ViewModels
_copterManager.Select(null);
int index = _copterManager.Copters.IndexOf(copter);
_copterManager.shiftkeydown = true;
int colcount = _flightTaskManager.ColumnCount;
for (; index < _copterManager.Copters.Count; index= getNextcopterindex( index) )
{
for (int i = 0; i < ContinuousNum; i++)
{
if (index >= _copterManager.Copters.Count) break;
_copterManager.Select(_copterManager.Copters[index]);
index += 1;
if ((index % colcount) == 0)
index += RowNum * colcount;
getNextcopterindex(index);
}
}
/*
for (; index < _copterManager.Copters.Count; index += IntervalNum)
{
for (int i = 0; i < ContinuousNum; i++)
@ -135,6 +169,7 @@ namespace Plane.FormationCreator.ViewModels
index++;
}
}
*/
_copterManager.shiftkeydown = false;
}));

View File

@ -265,7 +265,7 @@ namespace Plane.FormationCreator.ViewModels
{
get
{
return _MitTaskVrotationCommand ?? (_MitTaskVrotationCommand = new RelayCommand<float>(async =>
return _MitTaskVrotationCommand ?? (_MitTaskVrotationCommand = new RelayCommand<float>(async =>
{
@ -278,15 +278,29 @@ namespace Plane.FormationCreator.ViewModels
double centalt = 0;
if ((taskstartno<=1)||(taskendno> _flightTaskManager.Tasks.Count()))
{
Alert.Show("任务范围不正确", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
int _taskstartno = 0;
int _taskendno = 0;
if (taskstartno == 0)
_taskstartno = 0;
else _taskstartno = taskstartno - 1;
if (taskendno == 0)
_taskendno = _flightTaskManager.Tasks.Count()-1;
else _taskendno = taskendno - 1;
//计算旋转中心轴
for (int i = taskstartno-1; i < taskendno; i++)
for (int i = _taskstartno ; i <= _taskendno; i++)
{
if ((_flightTaskManager.Tasks[i].TaskType == FlightTaskType.TakeOff) || (_flightTaskManager.Tasks[i].TaskType == FlightTaskType.Land))
continue;
for (int j = 0; j < _flightTaskManager.Tasks[i].SingleCopterInfos.Count; j++)
{
@ -315,8 +329,11 @@ namespace Plane.FormationCreator.ViewModels
double tlat = 0;
for (int i = taskstartno-1; i < taskendno; i++)
for (int i = _taskstartno; i <= _taskendno; i++)
{
if ((_flightTaskManager.Tasks[i].TaskType == FlightTaskType.TakeOff) || (_flightTaskManager.Tasks[i].TaskType == FlightTaskType.Land))
continue;
for (int j = 0; j < _flightTaskManager.Tasks[i].SingleCopterInfos.Count; j++)
{
@ -396,9 +413,22 @@ namespace Plane.FormationCreator.ViewModels
float lowalt = 200;
int itaskendno = taskendno;
if (taskendno == 0) itaskendno = _flightTaskManager.Tasks.Count - 1;
else itaskendno = taskendno - 1;
if (itaskendno > _flightTaskManager.Tasks.Count-1) itaskendno = _flightTaskManager.Tasks.Count-1;
// for (int i = taskstartno; i < itaskendno; i++)
int _startindex = 0;
int _endindex = _flightTaskManager.Tasks.Count - 1;
int _startindex = taskstartno;
if (taskstartno == 0)
_startindex = 0;
else
_startindex = taskstartno - 1;
int _endindex = itaskendno;
int lowtask = 0;
int lowCopter = 0;
@ -411,7 +441,7 @@ namespace Plane.FormationCreator.ViewModels
for (int i = _startindex; i <= _endindex; i++)
{
if ((_flightTaskManager.Tasks[i].TaskType == FlightTaskType.TakeOff))
if ((_flightTaskManager.Tasks[i].TaskType == FlightTaskType.TakeOff)|| (_flightTaskManager.Tasks[i].TaskType == FlightTaskType.Land))
continue;
@ -1264,11 +1294,20 @@ public ICommand VerticlAlignmentCommand
double copterlat = 0;
double lng_out1 = 0;
double lat_out1 = 0;
for (int i = 0; i < _flightTaskManager.Tasks.Count; i++)
int itaskendno = taskendno;
if (itaskendno == 0) itaskendno = _flightTaskManager.Tasks.Count - 1;
else itaskendno = taskendno - 1;
if (itaskendno > _flightTaskManager.Tasks.Count-1) itaskendno = _flightTaskManager.Tasks.Count-1;
int _taskstartno = 0;
if (taskstartno == 0) _taskstartno = 0;
else _taskstartno = taskstartno - 1;
for (int i = _taskstartno; i <= itaskendno; i++)
{
for (int j = 0; j < _flightTaskManager.Tasks[i].SingleCopterInfos.Count; j++)
for (int j = 0; j < _flightTaskManager.Tasks[i].SingleCopterInfos.Count; j++)
{
copterlng=_flightTaskManager.Tasks[i].SingleCopterInfos[j].TargetLng;
copterlat = _flightTaskManager.Tasks[i].SingleCopterInfos[j].TargetLat;
@ -1554,8 +1593,15 @@ public ICommand VerticlAlignmentCommand
float lowalt = 200;
int _startindex = 0;
int _endindex = _flightTaskManager.Tasks.Count-1;
int itaskendno = taskendno;
if (itaskendno == 0) itaskendno = _flightTaskManager.Tasks.Count - 1;
else itaskendno = taskendno - 1;
if (itaskendno > _flightTaskManager.Tasks.Count-1) itaskendno = _flightTaskManager.Tasks.Count-1;
// for (int i = taskstartno; i < itaskendno; i++)
int _startindex = taskstartno;
if (_startindex != 0) _startindex = taskstartno - 1;
int _endindex = itaskendno ;
int lowtask = 0;
int lowCopter = 0;
@ -1568,10 +1614,8 @@ public ICommand VerticlAlignmentCommand
for (int i = _startindex; i <= _endindex; i++)
{
if ((_flightTaskManager.Tasks[i].TaskType == FlightTaskType.TakeOff))
if ((_flightTaskManager.Tasks[i].TaskType == FlightTaskType.TakeOff)|| (_flightTaskManager.Tasks[i].TaskType == FlightTaskType.Land))
continue;
for (int j = 0; j < _flightTaskManager.Tasks[i].SingleCopterInfos.Count; j++)
{
_flightTaskManager.Tasks[i].SingleCopterInfos[j].TargetAlt +=(float) cModialtvalue;
@ -1602,44 +1646,85 @@ public ICommand VerticlAlignmentCommand
{
get
{
return _calDistinceCommand ?? (_calDistinceCommand = new RelayCommand<double>(async =>
return _calDistinceCommand ?? (_calDistinceCommand = new RelayCommand<double>(async =>
{
if (_copterManager.AcceptingControlCopters.Count() < 2)
return;
double minDistance = double.MaxValue;
var flightTask = _flightTaskManager.SelectedTask;
List<ICopter> selectedCopter = new List<ICopter>();
selectedCopter.AddRange(_copterManager.AcceptingControlCopters);
string minCopterId1 = "0";
string minCopterId2 = "0";
for (int i = 0; i < selectedCopter.Count; i++)
string currselectstr = "";
for (int tsi = 1; tsi < _flightTaskManager.Tasks.Count ; tsi++)
{
var copter1 = selectedCopter[i];
var copterInfo1 = _flightTaskManager.SelectedTask.SingleCopterInfos.FirstOrDefault(c =>c.Copter == copter1);
for (int j = i + 1; j < selectedCopter.Count; j++)
if ((_flightTaskManager.Tasks[tsi].TaskType == FlightTaskType.TakeOff) || (_flightTaskManager.Tasks[tsi].TaskType == FlightTaskType.Land))
continue;
double minDistance = double.MaxValue;
double maxDistance = 0.0;
var flightTask = _flightTaskManager.Tasks[tsi];
List<ICopter> selectedCopter = new List<ICopter>();
selectedCopter.AddRange(_copterManager.AcceptingControlCopters);
string minCopterId1 = "0";
string minCopterId2 = "0";
string maxCopterId1 = "0";
string maxCopterId2 = "0";
for (int i = 0; i < selectedCopter.Count; i++)
{
var copter2 = selectedCopter[j];
var copterInfo2 = _flightTaskManager.SelectedTask.SingleCopterInfos.FirstOrDefault(c => c.Copter == copter2);
var copter1 = selectedCopter[i];
var copterInfo1 = flightTask.SingleCopterInfos.FirstOrDefault(c => c.Copter == copter1);
double distance = GeographyUtils.CalcDistance(
copterInfo1.TargetLat, copterInfo1.TargetLng, copterInfo1.TargetAlt,
copterInfo2.TargetLat, copterInfo2.TargetLng, copterInfo2.TargetAlt);
//minDistance = Math.Min(minDistance, distance);
if (distance < minDistance)
for (int j = i + 1; j < selectedCopter.Count; j++)
{
minDistance = distance;
minCopterId1 = copter1.Id;
minCopterId2 = copter2.Id;
}
}
}
var copter2 = selectedCopter[j];
var copterInfo2 = flightTask.SingleCopterInfos.FirstOrDefault(c => c.Copter == copter2);
double distance = GeographyUtils.CalcDistance(
copterInfo1.TargetLat, copterInfo1.TargetLng, copterInfo1.TargetAlt,
copterInfo2.TargetLat, copterInfo2.TargetLng, copterInfo2.TargetAlt);
//minDistance = Math.Min(minDistance, distance);
if (distance < minDistance)
{
minDistance = distance;
minCopterId1 = copter1.Id;
minCopterId2 = copter2.Id;
}
if (distance > maxDistance)
{
maxDistance = distance;
maxCopterId1 = copter1.Id;
maxCopterId2 = copter2.Id;
}
}
}
minDistance = Math.Round(minDistance, 2);
maxDistance = Math.Round(maxDistance, 2);
string showstr = string.Format("[{0}{1}] 最小距离 = {2:F2} 飞机: {3} 和 {4}; 最大距离 = {5:F2} 飞机: {6} 和 {7}",
flightTask.TaskIndex + 1, flightTask.TaskCnName, minDistance, minCopterId1, minCopterId2, maxDistance,
maxCopterId1, maxCopterId2);
Message.Show(showstr);
// Message.Show($"[{0:flightTask.TaskIndex + 1}{flightTask.TaskCnName}]最小距离 = {minDistance} 飞机:{minCopterId1}和{minCopterId2} ; 最大距离 = {maxDistance} 飞机:{maxCopterId1}和{maxCopterId2}");
if (flightTask == _flightTaskManager.SelectedTask)
currselectstr = showstr;
}
Message.Show("选中任务:");
Message.Show(currselectstr);
//Distancevalue = minDistance;
Message.Show($"最小距离 = {minDistance} 飞机:{minCopterId1}和{minCopterId2}");
}));
}
@ -2221,11 +2306,42 @@ public ICommand VerticlAlignmentCommand
if (_copterManager.SelectedCopters.Count() <= 1)
return;
List<FlightTaskSingleCopterInfo> TempSingleCopterInfos = new List<FlightTaskSingleCopterInfo>();
//旋转飞机矩阵
if (CopterDirection != 0)
{
LevelRotateCommand.Execute(CopterDirection);
await Task.Delay(100);
var selectedCopter = _copterManager.SelectedCopters.FirstOrDefault();
if (_flightTaskManager.SelectedTask != null)
{
for (int i = 0; i < _flightTaskManager.SelectedTask.SingleCopterInfos.Count; i++)
{
//得到每个选择的飞机
selectedCopter = _flightTaskManager.SelectedTask.SingleCopterInfos[i].Copter;
//根据飞机查找任务中的位置信息
foreach (var capter in _copterManager.SelectedCopters)
{
//如果是选择的那架飞机
if (capter == selectedCopter)
{
FlightTaskSingleCopterInfo vFlightTaskSingleCopterInfo = new FlightTaskSingleCopterInfo(capter);
vFlightTaskSingleCopterInfo.TargetLng = _flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetLng;
vFlightTaskSingleCopterInfo.TargetAlt = _flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetAlt;
vFlightTaskSingleCopterInfo.TargetLat = _flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetLat;
TempSingleCopterInfos.Add(vFlightTaskSingleCopterInfo);
}
}
}
}
LevelRotateCommand.Execute(CopterDirection);
await Task.Delay(100);
}
@ -2290,9 +2406,35 @@ public ICommand VerticlAlignmentCommand
}
await Task.Delay(100);
//旋转飞机矩阵
if (CopterDirection != 0)
LevelRotateCommand.Execute(0 - CopterDirection);
//使用之前保存的位置回到飞机原来的位置,不使用旋转因为转回去和原来的位置有一点点偏差
if (CopterDirection != 0)
{
int j = 0;
var selectedCopter1 = _copterManager.SelectedCopters.FirstOrDefault();
if (_flightTaskManager.SelectedTask != null)
{
for (int i = 0; i < _flightTaskManager.SelectedTask.SingleCopterInfos.Count; i++)
{
selectedCopter1 = _flightTaskManager.SelectedTask.SingleCopterInfos[i].Copter;
foreach (var capter in _copterManager.SelectedCopters)
{
if (capter == selectedCopter1)
{
_flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetLat = TempSingleCopterInfos[j].TargetLat;
_flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetLng = TempSingleCopterInfos[j].TargetLng;
_flightTaskManager.SelectedTask.SingleCopterInfos[i].TargetAlt = TempSingleCopterInfos[j].TargetAlt;
j++;
}
}
}
}
// LevelRotateCommand.Execute(0 - CopterDirection);
}
}));
}

View File

@ -55,9 +55,10 @@
Grid.Row="1"
Name="panel4" >
<Button Content="立体缩放" Width="90" Margin="5,5,5,5" Command="{Binding UpdateAllCopterCommand}"></Button>
<TextBlock Margin="5" VerticalAlignment="Center" Text="比例:" />
<TextBlock Margin="5" VerticalAlignment="Center" Text="比例/模块号:" />
<TextBox Width="30" VerticalContentAlignment="Center" Text="{Binding scale3d}" Margin="5,5,5,5" />
<Button Content="更改密码" Width="90" Margin="5,5,5,5" Command="{Binding ChangepasswordCommand}"></Button>
<Button Content="测试模块" Width="90" Margin="5,5,5,5" Command="{Binding TestModuleCommand}"></Button>
</StackPanel>

View File

@ -91,6 +91,9 @@
<TextBox Width="30" Margin="5,0" VerticalContentAlignment="Center" Text="{Binding ContinuousNum}"/>
<TextBlock Text="间隔数量" Margin="5,5,0,0"/>
<TextBox Width="30" Margin="5,0" VerticalContentAlignment="Center" Text="{Binding IntervalNum}"/>
<TextBlock Text="间隔排数" Margin="5,5,0,0"/>
<TextBox Width="30" Margin="5,0" VerticalContentAlignment="Center" Text="{Binding RowNum}"/>
<TextBlock Text="选中个数" Margin="5,5,0,0"/>
<TextBlock Width="30" Margin="5,5,0,0" Text="{Binding CopterManager.SeletedCopterCount, UpdateSourceTrigger=PropertyChanged}"/>

View File

@ -0,0 +1,30 @@
<Window x:Class="Plane.FormationCreator.Views.InputDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ignore="http://www.galasoft.ch/ignore"
Title="输入窗口" SizeToContent="WidthAndHeight" WindowStartupLocation="CenterScreen"
ContentRendered="Window_ContentRendered" ResizeMode="NoResize">
<Grid Margin="15">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Image Source="/FGCS;component/Resources/logo_big.png" Width="40" Height="40" Grid.RowSpan="2" Margin="20,0" />
<Label Name="lblQuestion" Grid.Column="1">最低更换电压:</Label>
<TextBox Name="txtAnswer" Grid.Column="1" Grid.Row="1" MinWidth="250">15.6</TextBox>
<WrapPanel Grid.Row="2" Grid.ColumnSpan="2" HorizontalAlignment="Right" Margin="0,15,0,0">
<Button IsDefault="True" Name="btnDialogOk" Click="btnDialogOk_Click" MinWidth="60" Margin="0,0,10,0">确定</Button>
<Button IsCancel="True" MinWidth="60">取消</Button>
</WrapPanel>
</Grid>
</Window>

View File

@ -0,0 +1,31 @@
using System;
using System.Windows;
namespace Plane.FormationCreator.Views
{
public partial class InputDialog : Window
{
public InputDialog(string question, string defaultAnswer = "")
{
InitializeComponent();
lblQuestion.Content = question;
txtAnswer.Text = defaultAnswer;
}
private void btnDialogOk_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = true;
}
private void Window_ContentRendered(object sender, EventArgs e)
{
txtAnswer.SelectAll();
txtAnswer.Focus();
}
public string Answer
{
get { return txtAnswer.Text; }
}
}
}

View File

@ -580,28 +580,52 @@
<StackPanel x:Name="PanelDesign2">
<StackPanel Orientation="Horizontal" Margin="0,5,0,5" >
<Button Content="整体水平旋转" Width="120"
<TextBlock Text="开始任务" Margin="10, 5, 5, 0" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBox
Width="35"
Margin="6,5,0,5" Height="26"
HorizontalContentAlignment="Right"
Text="{Binding taskstartno, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="结束任务" Margin="20, 5, 5, 0" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBox
Width="35"
Margin="0,5,0,5" Height="26"
HorizontalContentAlignment="Right"
Text="{Binding taskendno, UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,0,5" >
<Button Content="水平旋转" Width="120"
Margin="10,5,0,5" Height="26"
ToolTip="用于整体飞行方向调整,地面飞机矩阵同时旋转"
Command="{Binding TaskRotateCommand}"
CommandParameter="{Binding ElementName=txtAlignmentLine1, Path=Text}"/>
<Button Content="垂直旋转" Width="120"
Margin="10,5,5,5" Height="26"
ToolTip="用于多个任务同时倾斜角度,旋转中心为各任务的共同中心,各任务图案位置尽量重叠"
Command="{Binding MitTaskVrotationCommand}"
CommandParameter="{Binding ElementName=txtAlignmentLine1, Path=Text}" />
<TextBox x:Name="txtAlignmentLine1"
Width="120"
Margin="10,5,0,5" Height="26"
Text="0"
VerticalContentAlignment="Center" />
<TextBlock Text="度" Margin="10, 10, 5, 0" VerticalAlignment="Center" HorizontalAlignment="Left"/>
Width="40"
Margin="6,5,0,5" Height="26"
HorizontalContentAlignment="Right"
VerticalContentAlignment="Center"
Text="{Binding taskdirection, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Text="度" Margin="10, 5, 5, 0" VerticalAlignment="Center" HorizontalAlignment="Left"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,0,5" >
<Button Content="整体调整高度"
<Button Content="调整高度"
Width="120"
Margin="10,5,0,5" Height="26"
Command="{Binding ModiAltCommand}"
CommandParameter="{Binding ElementName=txtModialtvalue, Path=Text}"
/>
<Button Content="整体移动"
<Button Content="移动"
Width="120"
Margin="10,5,0,5" Height="26"
Command="{Binding ModiAllPosCommand}"
@ -610,20 +634,24 @@
<TextBox x:Name="txtModialtvalue"
Grid.Column="1"
Width="35"
Width="40"
Margin="10,5,0,5" Height="26"
HorizontalContentAlignment="Right"
Text="0"/>
<TextBlock Text="米 方向" Margin="5, 10, 5, 0" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBlock Text="米 方向" Margin="10, 5, 5, 0" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBox Grid.Column="1" x:Name="txtdirectionvalue"
Width="35"
Width="40"
Margin="0,5,0,5" Height="26"
HorizontalContentAlignment="Right"
Text="{Binding directionvalueall, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="度" Margin="5, 10, 5, 0" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBlock Text="度" Margin="5, 5, 5, 0" VerticalAlignment="Center" HorizontalAlignment="Left"/>
</StackPanel>
<Separator Margin="5,0,5,0" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,0,5" >
@ -633,38 +661,7 @@
Command="{Binding ShowallTaskpointCommand}"
/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,0,5" >
<Button Content="垂直旋转" Width="120"
Margin="10,5,5,5" Height="26"
ToolTip="用于多个任务同时倾斜角度,旋转中心为各任务的共同中心,各任务图案位置尽量重叠"
Command="{Binding MitTaskVrotationCommand}"
/>
<TextBlock Text="开始任务" Margin="5, 10, 5, 0" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBox
Width="35"
Margin="5,5,0,5" Height="26"
HorizontalContentAlignment="Right"
Text="{Binding taskstartno, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="结束任务" Margin="5, 10, 5, 0" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBox
Width="35"
Margin="0,5,0,5" Height="26"
HorizontalContentAlignment="Right"
Text="{Binding taskendno, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="角度" Margin="5, 10, 5, 0" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBox
Width="35"
Margin="0,5,0,5" Height="26"
HorizontalContentAlignment="Right"
Text="{Binding taskdirection, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="度" Margin="5, 10, 5, 0" VerticalAlignment="Center" HorizontalAlignment="Left"/>
</StackPanel>