diff --git a/Plane.FormationCreator/Formation/CopterManager.cs b/Plane.FormationCreator/Formation/CopterManager.cs
index 599f797..b427042 100644
--- a/Plane.FormationCreator/Formation/CopterManager.cs
+++ b/Plane.FormationCreator/Formation/CopterManager.cs
@@ -111,6 +111,10 @@ namespace Plane.FormationCreator.Formation
SelectedCoptersChanged?.Invoke(this, new SelectedCoptersChangedEventArgs { AddedCopters = addedCopters, RemovedCopters = removedCopters });
}
+ ///
+ /// 选择飞机
+ ///
+ /// Null表示清除所有选择
public void Select(ICopter copter)
{
_selectCopterAction(copter);
diff --git a/Plane.FormationCreator/Formation/FlightTaskSingleCopterInfo_FlyTo.cs b/Plane.FormationCreator/Formation/FlightTaskSingleCopterInfo_FlyTo.cs
index 786bd21..1906ed6 100644
--- a/Plane.FormationCreator/Formation/FlightTaskSingleCopterInfo_FlyTo.cs
+++ b/Plane.FormationCreator/Formation/FlightTaskSingleCopterInfo_FlyTo.cs
@@ -63,7 +63,7 @@ namespace Plane.FormationCreator.Formation
{
return _ModiFlytoLEDCommand ?? (_ModiFlytoLEDCommand = new RelayCommand(async =>
{
- Alert.Show("sfsdf");
+ Alert.Show("灯光控制");
}));
}
}
diff --git a/Plane.FormationCreator/Views/CopterListView.xaml.cs b/Plane.FormationCreator/Views/CopterListView.xaml.cs
index 3dc6ce7..e3821d6 100644
--- a/Plane.FormationCreator/Views/CopterListView.xaml.cs
+++ b/Plane.FormationCreator/Views/CopterListView.xaml.cs
@@ -43,12 +43,27 @@ namespace Plane.FormationCreator.Views
private CopterManager _copterManager = ServiceLocator.Current.GetInstance();
private void SelectitemMessage(ICopter copter)
{
-
-
- if (!_copterManager.shiftkeydown)
- lvwDrones.SelectedItem = copter;
+ if (copter == null)
+ {
+ lvwDrones.SelectedItems.Clear();
+ }
else
- lvwDrones.SelectedItems.Add(copter);
+ {
+ if (!_copterManager.shiftkeydown)
+ {
+ lvwDrones.SelectedItems.Clear();
+ lvwDrones.SelectedItem = copter;
+ }
+ else
+ lvwDrones.SelectedItems.Add(copter);
+ }
+
+
+ }
+
+ private void SelectitemClearMessage(ICopter copter)
+ {
+ lvwDrones.SelectedItems.Clear();
}
}
}
diff --git a/Plane.FormationCreator/Views/MapView.xaml b/Plane.FormationCreator/Views/MapView.xaml
index 98af68e..3e17f0e 100644
--- a/Plane.FormationCreator/Views/MapView.xaml
+++ b/Plane.FormationCreator/Views/MapView.xaml
@@ -28,7 +28,7 @@
>
c.Longitude);
var latDelta = pos.Latitude - centerLat;
var lngDelta = pos.Longitude - centerLng;
+
+
await Task.WhenAll(copters.Select(copter => copter.FlyToAsync(copter.Latitude + latDelta, copter.Longitude + lngDelta, copter.Altitude)));
};
var center = _appConfig.Center;
map.Center = new Location(center.Lat, center.Lng);
map.ZoomLevel = _appConfig.ZoomLevel;
+
+
map.ViewChangeOnFrame += (object sender, MapEventArgs e) =>
{
if ( map.Mode.GetType().ToString() == "Microsoft.Maps.MapControl.WPF.AerialMode")
@@ -145,8 +150,76 @@ namespace Plane.FormationCreator.Views
map.ZoomLevel = 19;
};
+ Rectangle rectangle = new Rectangle();
+ bool drawRectangle = false;
+ Point startPosition = new Point();
+ Point leftTopPoint = new Point();
+ map.MouseRightButtonDown += (sender, e) =>
+ {
+ rectangle = new Rectangle();
+ rectangle.Width = 0;
+ rectangle.Height = 0;
+ rectangle.StrokeThickness = 1;
+ rectangle.Stroke = new SolidColorBrush(Color.FromRgb(0, 120, 215));
+
+ rectangle.Fill = new SolidColorBrush(Color.FromArgb(80, 0, 120, 215));
+ rectangle.Tag = "Rectangle";
+
+ map.Children.Add(rectangle);
+ startPosition = e.GetPosition(this);
+ MapLayer.SetPosition(rectangle, map.ViewportPointToLocation(startPosition));
+ drawRectangle = true;
+ };
+ map.MouseMove += (sender, e) =>
+ {
+ if (drawRectangle)
+ {
+ Point mousePosition = e.GetPosition(this);
+ rectangle.Width = Math.Abs(mousePosition.X - startPosition.X);
+ rectangle.Height = Math.Abs(mousePosition.Y - startPosition.Y);
+ leftTopPoint = new Point(Math.Min(mousePosition.X, startPosition.X), Math.Min(mousePosition.Y, startPosition.Y));
+ MapLayer.SetPosition(rectangle, map.ViewportPointToLocation(leftTopPoint));
+ }
+ };
+ int selectedCount = 0;
+ map.MouseRightButtonUp += (sender, e) =>
+ {
+ selectedCount = 0;
+ if (rectangle != null && map.Children.Contains(rectangle))
+ {
+ map.Children.Remove(rectangle);
+ if (_flightTaskManager.SelectedTask != null)
+ {
+ _copterManager.shiftkeydown = true;
+ _copterManager.Select(null);
+ foreach (FlightTaskSingleCopterInfo taskCopterInfo in _flightTaskManager.SelectedTask.SingleCopterInfos)
+ {
+ Location seekLocation = new Location(taskCopterInfo.TargetLat, taskCopterInfo.TargetLng);
+ Point seekPoint = map.LocationToViewportPoint(seekLocation);
+ if ((seekPoint.X > leftTopPoint.X && seekPoint.X < leftTopPoint.X + rectangle.Width) &&
+ seekPoint.Y > leftTopPoint.Y && seekPoint.Y < leftTopPoint.Y + rectangle.Height)
+ {
+ selectedCount++;
+ _copterManager.Select(taskCopterInfo.Copter);
+ }
+ }
+ _copterManager.shiftkeydown = false;
+ }
+ }
+ rectangle = null;
+ drawRectangle = false;
+ };
+ map.MouseLeave += (sender, e) =>
+ {
+ if (map.Children.Contains(rectangle))
+ {
+ map.Children.Remove(rectangle);
+ }
+ rectangle = null;
+ drawRectangle = false;
+ };
}
private CopterManager _copterManager = ServiceLocator.Current.GetInstance();
diff --git a/Plane.FormationCreator/Views/MapView_CopterDrawing.cs b/Plane.FormationCreator/Views/MapView_CopterDrawing.cs
index 4fa3016..1147c4f 100644
--- a/Plane.FormationCreator/Views/MapView_CopterDrawing.cs
+++ b/Plane.FormationCreator/Views/MapView_CopterDrawing.cs
@@ -291,21 +291,46 @@ namespace Plane.FormationCreator.Views
};
}
+ private Dictionary selectWayOriginPoint = new Dictionary();
private Dictionary