界面小调整,选中任务更明显
双击任务可直接运行到这个任务,改名可右键单击 修改小bug
This commit is contained in:
parent
f7a638159e
commit
b80026ff8c
@ -17,7 +17,8 @@ namespace Plane.FormationCreator.Converters
|
||||
{
|
||||
static DropShadowEffect _effect = new DropShadowEffect
|
||||
{
|
||||
Color = Colors.LightGray,
|
||||
//任务选中颜色
|
||||
Color = Colors.Azure, // Colors.LightGray,
|
||||
// Color = Colors.White,
|
||||
Direction = 90,
|
||||
BlurRadius = 10
|
||||
|
@ -398,7 +398,9 @@ namespace Plane.FormationCreator.Formation
|
||||
{
|
||||
var copters = _copterManager.Copters;
|
||||
|
||||
if (CurrentRunningTaskIndex == Tasks.Count - 1)
|
||||
|
||||
|
||||
if ((TaskState == TasksStatus.Stop) ||( CurrentRunningTaskIndex == Tasks.Count - 1))
|
||||
return;
|
||||
|
||||
Pause();
|
||||
@ -446,7 +448,7 @@ namespace Plane.FormationCreator.Formation
|
||||
|
||||
|
||||
|
||||
public async void ResetTasks()
|
||||
public async Task ResetTasks()
|
||||
{
|
||||
var copters = _copterManager.Copters;
|
||||
|
||||
@ -462,6 +464,7 @@ namespace Plane.FormationCreator.Formation
|
||||
k++;
|
||||
}
|
||||
}
|
||||
TaskState = TasksStatus.Stop;
|
||||
|
||||
CurrentRunningTaskIndex = 0;
|
||||
if (CurrentRunningTask != null)
|
||||
|
@ -13,7 +13,9 @@ namespace Plane.FormationCreator.Formation
|
||||
{
|
||||
var info = new FlightTaskSingleCopterInfo(copter)
|
||||
{
|
||||
TargetAlt = targetAlt
|
||||
TargetAlt = targetAlt,
|
||||
TargetLat = copter.Latitude,
|
||||
TargetLng=copter.Longitude
|
||||
};
|
||||
return info;
|
||||
}
|
||||
|
@ -42,8 +42,9 @@ namespace Plane.FormationCreator.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ClearTasksCommand ?? (_ClearTasksCommand = new RelayCommand(() =>
|
||||
return _ClearTasksCommand ?? (_ClearTasksCommand = new RelayCommand(async () =>
|
||||
{
|
||||
await _flightTaskManager.ResetTasks();
|
||||
_flightTaskManager.ClearTasks();
|
||||
}));
|
||||
}
|
||||
@ -73,18 +74,46 @@ namespace Plane.FormationCreator.ViewModels
|
||||
{
|
||||
return _flyTotaskCommand ?? (_flyTotaskCommand = new RelayCommand(async () =>
|
||||
{
|
||||
// await _flightTaskManager.RunAsync();
|
||||
await _flightTaskManager.FlyToTasks();
|
||||
// Message.Show("任务开始");
|
||||
// await _flightTaskManager.RunAsync();
|
||||
// Message.Show(_flightTaskManager.IsPaused == true ? "任务暂停" : "任务完成");
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private ICommand _renametaskCommand;
|
||||
public ICommand renametaskCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return _renametaskCommand ?? (_renametaskCommand = new RelayCommand( () =>
|
||||
{
|
||||
|
||||
private ICommand _SetOriginCommand;
|
||||
FlightTask task = _flightTaskManager.SelectedTask;
|
||||
if (task.TaskType != FlightTaskType.FlyTo) return;
|
||||
|
||||
string newName = task.TaskCnName;
|
||||
if (PlaneMessageBox.OnShow("请输入新的名称", "重命名", ref newName))
|
||||
{
|
||||
task.TaskCnName = newName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private ICommand _SetOriginCommand;
|
||||
public ICommand SetOriginCommand
|
||||
{
|
||||
get
|
||||
|
@ -133,7 +133,7 @@ namespace Plane.FormationCreator.ViewModels
|
||||
var meshBuilderwaypoint = new MeshBuilder(false, false);
|
||||
|
||||
//meshBuilderwaypoint.AddTriangle(new Point3D(-0.1, -0.1, 0), new Point3D(0.1, -0.1, 0), new Point3D(0, 0.2, 0));
|
||||
meshBuilderwaypoint.AddSphere(new Point3D(0, 0, 0), 0.2);
|
||||
meshBuilderwaypoint.AddSphere(new Point3D(0, 0, 0), 0.3);
|
||||
var meshwaypoint = meshBuilderwaypoint.ToMesh(true);
|
||||
|
||||
double y = GeographyUtils.CalcDistance(0, observationLatLng.Item1, 0, 0, copter.Latitude, 0) / 2;
|
||||
|
@ -6,7 +6,7 @@
|
||||
xmlns:local="clr-namespace:Plane.FormationCreator.Views"
|
||||
mc:Ignorable="d"
|
||||
BorderThickness="1"
|
||||
Background="#FF2D2D2D" Width="464" Height="260" BorderBrush="#FF006595">
|
||||
Background="#FF2D2D2D" Width="340" Height="260" BorderBrush="#FF006595">
|
||||
<Grid>
|
||||
<StackPanel>
|
||||
<StackPanel>
|
||||
|
@ -7,7 +7,7 @@
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300"
|
||||
BorderThickness="1"
|
||||
Background="#FF2D2D2D" Width="464">
|
||||
Background="#FF2D2D2D" Width="340">
|
||||
<UserControl.BorderBrush>
|
||||
<SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ActiveBorderColorKey}}"/>
|
||||
</UserControl.BorderBrush>
|
||||
|
@ -6,7 +6,7 @@
|
||||
xmlns:local="clr-namespace:Plane.FormationCreator.Views"
|
||||
mc:Ignorable="d"
|
||||
BorderThickness="1"
|
||||
Background="#FF2D2D2D" Width="464" Height="300">
|
||||
Background="#FF2D2D2D" Width="340" Height="300">
|
||||
<UserControl.BorderBrush>
|
||||
<SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ActiveBorderColorKey}}"/>
|
||||
</UserControl.BorderBrush>
|
||||
@ -14,14 +14,14 @@
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="70"/>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="80"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Margin="5,0" Content="分组设置" HorizontalAlignment="Left" />
|
||||
<Label Margin="15,0" Grid.Column="1" Content="最后选中:" HorizontalAlignment="Left"/>
|
||||
<Label Grid.Column="1" Content="{Binding GroupManager.LastSelectedGroup}" HorizontalAlignment="Right"/>
|
||||
<Button Margin="5,0" Grid.Column="2" Content="添加分组" HorizontalAlignment="Right"
|
||||
<Label Margin="0,0" Grid.Column="1" Content="最后选中:" HorizontalAlignment="Left"/>
|
||||
<Label Margin="0,0" Grid.Column="1" Content="{Binding GroupManager.LastSelectedGroup}" HorizontalAlignment="Right"/>
|
||||
<Button Margin="0,0" Grid.Column="2" Content="添加" HorizontalAlignment="Right"
|
||||
Command="{Binding Path=GroupManager.AddGroupsCommand}"/>
|
||||
</Grid>
|
||||
<Separator></Separator>
|
||||
@ -48,9 +48,9 @@
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBox Width="95" Text="{Binding groupName,UpdateSourceTrigger=PropertyChanged}"/>
|
||||
<Button Margin="20,0,0,0" Width="90" Content="删除" Command="{Binding RemoveGroupCommand}"/>
|
||||
<Button Margin="20,0,0,0" Width="90" Content="设置" Command="{Binding SetGroupCoptersCommand}"/>
|
||||
<Button Margin="20,0,0,0" Width="90" Content="选中" Command="{Binding SelectCoptersCommand}"/>
|
||||
<Button Margin="5,0,0,0" Width="65" Content="删除" Command="{Binding RemoveGroupCommand}"/>
|
||||
<Button Margin="5,0,0,0" Width="65" Content="设置" Command="{Binding SetGroupCoptersCommand}"/>
|
||||
<Button Margin="5,0,0,0" Width="65" Content="选中" Command="{Binding SelectCoptersCommand}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
|
@ -194,10 +194,10 @@
|
||||
Background="#232323"
|
||||
Command="{Binding ResetTasksCommand}" />
|
||||
|
||||
<Button Content="飞到任务"
|
||||
<Button Content="更名"
|
||||
Background="#232323"
|
||||
Command="{Binding flyTotaskCommand}" />
|
||||
<Button Content="重设原点"
|
||||
Command="{Binding renametaskCommand}" />
|
||||
<Button Content="设原点"
|
||||
Background="#232323"
|
||||
Command="{Binding SetOriginCommand}" />
|
||||
<!--<Button Content="保存" />
|
||||
|
@ -37,15 +37,8 @@ namespace Plane.FormationCreator.Views
|
||||
{
|
||||
if (e.ClickCount > 1)
|
||||
{
|
||||
var elem = sender as FrameworkElement;
|
||||
var task = elem.DataContext as FlightTask;
|
||||
if (task.TaskType != FlightTaskType.FlyTo) return;
|
||||
TasksControl.Focus();
|
||||
string newName = task.TaskCnName;
|
||||
if (PlaneMessageBox.OnShow("请输入新的名称", "重命名", ref newName))
|
||||
{
|
||||
task.TaskCnName = newName;
|
||||
}
|
||||
|
||||
_flightTaskManager.FlyToTasks();
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,75 +51,30 @@ namespace Plane.FormationCreator.Views
|
||||
{
|
||||
_flightTaskManager.Select(task);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//以前的右键隐藏航点,已不用
|
||||
public void setRightSelect(FlightTask task, bool vRightSelect)
|
||||
{
|
||||
|
||||
// var borderBrush = new SolidColorBrush(vRightSelect ? Colors.Gray : Colors.OrangeRed);
|
||||
var borderBrush = new SolidColorBrush( Colors.OrangeRed);
|
||||
|
||||
if (task.TaskType == FlightTaskType.TakeOff) return;
|
||||
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(TasksControl); i++)
|
||||
{
|
||||
DependencyObject child = VisualTreeHelper.GetChild(TasksControl, i);
|
||||
if (child != null && child is FrameworkElement)
|
||||
{
|
||||
var taskdata = (child as FrameworkElement).DataContext as FlightTask;
|
||||
if (taskdata == task)
|
||||
{
|
||||
if (child is Rectangle)
|
||||
{
|
||||
(child as Rectangle).Stroke = borderBrush;
|
||||
}
|
||||
else if (child is Border)
|
||||
{
|
||||
(child as Border).BorderBrush = borderBrush;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
if (elem is Rectangle)
|
||||
{
|
||||
(elem as Rectangle).Stroke = borderBrush;
|
||||
}
|
||||
else if (elem is Border)
|
||||
{
|
||||
(elem as Border).BorderBrush = borderBrush;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//右键功能 ---改名
|
||||
private void HideTask(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var elem = sender as FrameworkElement;
|
||||
var task = elem.DataContext as FlightTask;
|
||||
// int a = _flightTaskManager.RightSelectedTaskIndex;
|
||||
//右键任务条显示橙红色
|
||||
if (task.TaskType != FlightTaskType.TakeOff) // 不让选起飞任务。
|
||||
if (task.TaskType != FlightTaskType.FlyTo) return;
|
||||
TasksControl.Focus();
|
||||
string newName = task.TaskCnName;
|
||||
if (PlaneMessageBox.OnShow("请输入新的名称", "重命名", ref newName))
|
||||
{
|
||||
var borderBrush = new SolidColorBrush(task.IsRightSelected ? Colors.Gray : Colors.OrangeRed);
|
||||
if (elem is Rectangle)
|
||||
{
|
||||
(elem as Rectangle).Stroke = borderBrush;
|
||||
}
|
||||
else if (elem is Border)
|
||||
{
|
||||
(elem as Border).BorderBrush = borderBrush;
|
||||
}
|
||||
//显示隐藏任务航点
|
||||
_flightTaskManager.RightSelect(task);
|
||||
task.TaskCnName = newName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||
|
@ -31,20 +31,15 @@ namespace Plane.FormationCreator.Views
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var camera = view3d.Camera as PerspectiveCamera;
|
||||
camera.Position = new Point3D(0, 0, 1);
|
||||
camera.LookDirection = new Vector3D(0,1,0);//new Vector3D(0, 1, 0);
|
||||
camera.UpDirection = new Vector3D(0, 0, 1);
|
||||
camera.FieldOfView = 120;
|
||||
ResetCamera();
|
||||
|
||||
_flightTaskManager = ServiceLocator.Current.GetInstance<FlightTaskManager>();
|
||||
_view3DManager = ServiceLocator.Current.GetInstance<View3DViewModel>();
|
||||
this.DataContext = _view3DManager;
|
||||
//view3d.ShowCameraInfo = true;
|
||||
//view3d.ShowFieldOfView = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void ResetCamera_Click(object sender, RoutedEventArgs e)
|
||||
private void ResetCamera()
|
||||
{
|
||||
// view3d.CameraController.CameraPosition = new Point3D(0, 40, 1);
|
||||
// view3d.CameraController.CameraUpDirection = new Vector3D(0, -1, 10);
|
||||
@ -53,12 +48,27 @@ namespace Plane.FormationCreator.Views
|
||||
// view3d.CameraController.CameraRotationMode = CameraRotationMode.Turntable;
|
||||
|
||||
var camera = view3d.Camera as PerspectiveCamera;
|
||||
camera.Position = new Point3D(0, 0, 0);
|
||||
camera.LookDirection = new Vector3D(0, 1, 0);
|
||||
camera.UpDirection = new Vector3D(0, 0, 1);
|
||||
camera.FieldOfView = 120;
|
||||
camera.Position = new Point3D(0, 0, 1);
|
||||
//用于180度
|
||||
camera.LookDirection = new Vector3D(-0.025, -0.911, 0.411);
|
||||
camera.UpDirection = new Vector3D(0.011, 0.411, 0.912);
|
||||
|
||||
//用于0度
|
||||
//camera.LookDirection = new Vector3D(0, 1, 0);
|
||||
//camera.UpDirection = new Vector3D(0,0, 1);
|
||||
|
||||
|
||||
camera.FieldOfView = 120;
|
||||
_view3DManager.Clear3DCopters();
|
||||
//for test 用来确定上面的参数
|
||||
//view3d.ShowCameraInfo = true;
|
||||
//view3d.ShowFieldOfView = true;
|
||||
|
||||
}
|
||||
|
||||
private void ResetCamera_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ResetCamera();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user