[ModifyTaskView.xaml] 加入任务整体位置调整

[MapView_CopterDrawing.cs]正在飞行中前面加尖改为编号变色
[ModifyTaskViewModel.cs]加入任务整体位置调整
This commit is contained in:
pxzleo 2017-09-11 20:07:01 +08:00
parent dae8be8e18
commit 1b574fa118
3 changed files with 100 additions and 39 deletions

View File

@ -159,8 +159,13 @@ namespace Plane.FormationCreator.ViewModels
get { return _Modialtvalue; } get { return _Modialtvalue; }
set { Set(nameof(Modialtvalue), ref _Modialtvalue, value); } set { Set(nameof(Modialtvalue), ref _Modialtvalue, value); }
} }
private float _directionvalue=0;
public float directionvalue
{
get { return _directionvalue; }
set { Set(nameof(directionvalue), ref _directionvalue, value); }
}
private int _txtStarindex=0; private int _txtStarindex=0;
public int txtStarindex public int txtStarindex
{ {
@ -1012,9 +1017,57 @@ public ICommand VerticlAlignmentCommand
} }
} }
//调整所有任务经度
private ICommand _ModiAllPosCommand;
public ICommand ModiAllPosCommand
{
get
{
return _ModiAllPosCommand ?? (_ModiAllPosCommand = new RelayCommand<double>(async =>
{
if (_flightTaskManager.Tasks.Count < 2) return;
float lowalt = 200;
int _startindex = 0;
int _endindex = _flightTaskManager.Tasks.Count - 1;
int lowtask = 0;
int lowCopter = 0;
if ((txtStarindex != 0) && (txtendindex != 0))
{
_startindex = txtStarindex;
_endindex = txtendindex;
}
for (int i = _startindex; i <= _endindex; i++)
{
if ((_flightTaskManager.Tasks[i].TaskType == FlightTaskType.TakeOff) ||
(_flightTaskManager.Tasks[i].TaskType == FlightTaskType.ReturnToLand))
continue;
for (int j = 0; j < _flightTaskManager.Tasks[i].SingleCopterInfos.Count; j++)
{
Tuple<double, double> targetLatLng = new Tuple<double, double>(0, 0);
targetLatLng=GeographyUtils.CalcLatLngSomeMetersAway2D(
_flightTaskManager.Tasks[i].SingleCopterInfos[j].TargetLat,
_flightTaskManager.Tasks[i].SingleCopterInfos[j].TargetLng,
directionvalue,
Modialtvalue
);
_flightTaskManager.Tasks[i].SingleCopterInfos[j].TargetLat = targetLatLng.Item1;
_flightTaskManager.Tasks[i].SingleCopterInfos[j].TargetLng= targetLatLng.Item2;
}
}
Alert.Show("指定步骤任务位置已向"+ directionvalue + "度改变" + Modialtvalue + "米,注意是否有障碍物!");
}));
}
}
//计算距离 //计算距离

View File

@ -73,6 +73,9 @@ namespace Plane.FormationCreator.Views
public ICopter Copter { get; set; } public ICopter Copter { get; set; }
public Grid DotContainer { get; set; } public Grid DotContainer { get; set; }
public Polygon Dot { get; set; } public Polygon Dot { get; set; }
public TextBlock CopterText { get; set; }
public MapPolyline Track { get; set; } public MapPolyline Track { get; set; }
public Location LastLocation { get; set; } public Location LastLocation { get; set; }
@ -130,14 +133,19 @@ namespace Plane.FormationCreator.Views
DotContainer = new Grid { Tag = COPTER_TAG }; DotContainer = new Grid { Tag = COPTER_TAG };
DotContainer.Children.Add(Dot); DotContainer.Children.Add(Dot);
//飞机里面的编号 //飞机里面的编号
DotContainer.Children.Add(new TextBlock
CopterText = new TextBlock
{ {
Text = Copter.Name, Text = Copter.Name,
Foreground = new SolidColorBrush(Colors.White), Foreground = new SolidColorBrush(Colors.Black),
Margin = new Thickness(-COPTER_RADIUS * 2, -COPTER_RADIUS * 1.5, 0, 0), Margin = new Thickness(-COPTER_RADIUS * 2, -COPTER_RADIUS * 1.5, 0, 0),
HorizontalAlignment = HorizontalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center VerticalAlignment = VerticalAlignment.Center
}); };
DotContainer.Children.Add(CopterText);
//飞机加入地图 //飞机加入地图
_map.Children.Add(DotContainer); _map.Children.Add(DotContainer);
@ -160,23 +168,14 @@ namespace Plane.FormationCreator.Views
} }
else else
{ {
Dot.Points.Clear();
if (Copter.MissionStatus == 1) if (Copter.MissionStatus == 1)
{ {
Dot.Points.Add(new Point(-4, -COPTER_RADIUS)); CopterText.Foreground = new SolidColorBrush(Colors.White);
Dot.Points.Add(new Point(0, -COPTER_RADIUS));
Dot.Points.Add(new Point(-COPTER_RADIUS * 2 / 3, COPTER_RADIUS));
Dot.Points.Add(new Point(COPTER_RADIUS * 2 / 3, COPTER_RADIUS));
} }
else { else {
Dot.Points.Add(new Point(0, -COPTER_RADIUS)); CopterText.Foreground = new SolidColorBrush(Colors.Black);
Dot.Points.Add(new Point(-COPTER_RADIUS * 2 / 3, COPTER_RADIUS));
Dot.Points.Add(new Point(COPTER_RADIUS * 2 / 3, COPTER_RADIUS));
} }
if (LastLocation != null && location.CalcDistance(LastLocation) < 0.1) if (LastLocation != null && location.CalcDistance(LastLocation) < 0.1)
{ {
locationUpdated = false; locationUpdated = false;

View File

@ -71,18 +71,21 @@
Margin="0,5,5,0" Margin="0,5,5,0"
Command="{Binding VerticlRotateCommand}" Command="{Binding VerticlRotateCommand}"
CommandParameter="{Binding ElementName=txtAlignmentLine, Path=Text}"/> CommandParameter="{Binding ElementName=txtAlignmentLine, Path=Text}"/>
<Button Content="整体旋转"
Margin="0,5,5,0"
Command="{Binding TaskRotateCommand}"
CommandParameter="{Binding ElementName=txtAlignmentLine, Path=Text}"/>
<TextBox x:Name="txtAlignmentLine" <TextBox x:Name="txtAlignmentLine"
Width="45" Width="25"
Margin="0,5,5,0" Margin="0,5,5,0"
Text="0" Text="0"
VerticalContentAlignment="Center" /> VerticalContentAlignment="Center" />
<TextBlock Text="度" Margin="0, 10, 5, 0"/> <TextBlock Text="度" Margin="0, 10, 5, 0"/>
<Button Content="任务整体旋转"
<Button Content="自动高度"
Margin="0,5,5,0" Margin="0,5,5,0"
Command="{Binding TaskRotateCommand}" Visibility="Hidden"
CommandParameter="{Binding ElementName=txtAlignmentLine, Path=Text}"/> Command="{Binding AutoaltCommand}" />
</StackPanel> </StackPanel>
@ -96,11 +99,11 @@
CommandParameter="{Binding ElementName=txtScaleVale, Path=Text}"/> CommandParameter="{Binding ElementName=txtScaleVale, Path=Text}"/>
<TextBox x:Name="txtScaleVale" <TextBox x:Name="txtScaleVale"
Width="40" Width="35"
Margin="0,5,5,0" Margin="0,5,5,0"
Text="100" Text="100"
VerticalContentAlignment="Center" /> VerticalContentAlignment="Center" />
<TextBlock Text="%" Margin="0, 10, 5, 0"/> <TextBlock Text="%" Margin="0, 10, 2, 0"/>
<Button Content="计算距离" <Button Content="计算距离"
Margin="0,5,5,0" Margin="0,5,5,0"
Command="{Binding calDistinceCommand}" Command="{Binding calDistinceCommand}"
@ -109,44 +112,50 @@
<TextBox <TextBox
Grid.Column="1" Grid.Column="1"
Width="40" Width="25"
Margin="0, 5, 5, 0" Margin="0, 5, 5, 0"
HorizontalContentAlignment="Right" HorizontalContentAlignment="Right"
Text="{Binding Distancevalue, UpdateSourceTrigger=PropertyChanged}" Text="{Binding Distancevalue, UpdateSourceTrigger=PropertyChanged}"
/> />
<TextBlock Text="米" Margin="0, 10, 5, 0"/> <TextBlock Text="米" Margin="0, 10, 5, 0"/>
</StackPanel>
<StackPanel>
<Button Content="自动高度"
Margin="0,5,5,0"
Command="{Binding AutoaltCommand}" />
<Button Content="前一高度" <Button Content="前一高度"
Margin="0,5,5,0" Margin="0,5,5,0"
Command="{Binding PrealtCommand}" /> Command="{Binding PrealtCommand}" />
</StackPanel>
<Button Content="修改任务高度" <StackPanel>
<Button Content="整体提高"
Margin="0,5,5,0" Margin="0,5,5,0"
Command="{Binding ModiAltCommand}" Command="{Binding ModiAltCommand}" />
/> <Button Content="整体移动"
Margin="0,5,5,0"
Command="{Binding ModiAllPosCommand}" />
<TextBox <TextBox
Grid.Column="1" Grid.Column="1"
Width="40" Width="25"
Margin="0, 5, 5, 0" Margin="0, 5, 5, 0"
HorizontalContentAlignment="Right" HorizontalContentAlignment="Right"
Text="{Binding Modialtvalue, UpdateSourceTrigger=PropertyChanged}" Text="{Binding Modialtvalue, UpdateSourceTrigger=PropertyChanged}"
/> />
<TextBlock Text="米" Margin="0, 10, 5, 0"/> <TextBlock Text="米 方向" Margin="0, 10, 5, 0"/>
<TextBox
Grid.Column="1"
Width="35"
Margin="0, 5, 5, 0"
HorizontalContentAlignment="Right"
Text="{Binding directionvalue, UpdateSourceTrigger=PropertyChanged}"
/>
<TextBlock Text="度" Margin="0, 10, 5, 0"/>
</StackPanel> </StackPanel>
<Separator /> <Separator />
<TextBlock Text="任务属性" Margin="0, 0, 5, 0" FontWeight="Bold" />
<StackPanel> <StackPanel>
<TextBlock Text="起飞数量:" Margin="5,10,5,0" /> <TextBlock Text="起飞数量:" Margin="5,10,5,0" />