From 62cde39a918651207e7df97a2d2628ef00c70014 Mon Sep 17 00:00:00 2001 From: xu Date: Wed, 13 May 2020 00:44:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=AE=A1=E7=AE=97=E8=BF=94?= =?UTF-8?q?=E8=88=AA=E7=9A=84=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E5=AE=8C=E6=95=B4=E8=AE=A1=E7=AE=97=E6=95=B4=E4=B8=AA2d?= =?UTF-8?q?=E9=A3=9E=E8=A1=8C=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Formation/FlightTaskManager.cs | 10 ++++++++-- .../ViewModels/ModifyTaskViewModel.cs | 13 +++++++++++++ Plane.FormationCreator/Views/ModifyTaskView.xaml | 7 +++++-- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Plane.FormationCreator/Formation/FlightTaskManager.cs b/Plane.FormationCreator/Formation/FlightTaskManager.cs index 10007a2..79dbf83 100644 --- a/Plane.FormationCreator/Formation/FlightTaskManager.cs +++ b/Plane.FormationCreator/Formation/FlightTaskManager.cs @@ -1427,7 +1427,13 @@ namespace Plane.FormationCreator.Formation return t; } //计算优化线路,采用米计算 - public void OptimizeRouteMeter(bool Is3d=false) + + /// + /// + /// + /// 3D计算 + /// 是否改变线路的结束点顺序--返回起飞点航线不能交换 + public void OptimizeRouteMeter(bool Is3d=false,bool Ischange=true) { Dictionary curTaskPoint = new Dictionary(); Dictionary prevTaskPoint = new Dictionary(); @@ -1467,7 +1473,7 @@ namespace Plane.FormationCreator.Formation } else { - ArrayList resarray = Util.OptimizeRoute.Gen2DRoute(curTaskPoint.Values.ToArray(), prevTaskPoint.Values.ToArray()); + ArrayList resarray = Util.OptimizeRoute.Gen2DRoute(curTaskPoint.Values.ToArray(), prevTaskPoint.Values.ToArray(), Ischange); Vector3[] RouteRes; //有错层,需要插入2个错层任务 if (resarray.Count == 3) diff --git a/Plane.FormationCreator/ViewModels/ModifyTaskViewModel.cs b/Plane.FormationCreator/ViewModels/ModifyTaskViewModel.cs index dda75fb..a40750a 100644 --- a/Plane.FormationCreator/ViewModels/ModifyTaskViewModel.cs +++ b/Plane.FormationCreator/ViewModels/ModifyTaskViewModel.cs @@ -773,6 +773,19 @@ namespace Plane.FormationCreator.ViewModels } } + + private ICommand _OptimizeRouteCommandRet; + public ICommand OptimizeRouteCommandRet + { + get + { + return _OptimizeRouteCommandRet ?? (_OptimizeRouteCommandRet = new RelayCommand(async => + { + _flightTaskManager.OptimizeRouteMeter(false,false); //采用米计算逻辑和OptimizeRouteNew一样 + })); + } + } + private ICommand _OptimizeRouteCommand3D; public ICommand OptimizeRouteCommand3D diff --git a/Plane.FormationCreator/Views/ModifyTaskView.xaml b/Plane.FormationCreator/Views/ModifyTaskView.xaml index 8209560..594894e 100644 --- a/Plane.FormationCreator/Views/ModifyTaskView.xaml +++ b/Plane.FormationCreator/Views/ModifyTaskView.xaml @@ -74,9 +74,11 @@ />