wyq 1 rok pred
rodič
commit
ff2d0b1d50

+ 1 - 0
DataSimulation.Forms/DataSimulation.Forms.csproj

@@ -203,6 +203,7 @@
     <Compile Include="MainForm.Designer.cs">
       <DependentUpon>MainForm.cs</DependentUpon>
     </Compile>
+    <Compile Include="Model\FlightImportInfo.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="UserControl\CtrlHistoryTask.cs">

+ 4 - 4
DataSimulation.Forms/EditForms/FlightEditor.cs

@@ -62,9 +62,9 @@ namespace DataSimulation.Forms.EditForms
                 this.txtFlightName.Text = info.SimulationName;
                 this.txtSpeed.Text = $"{info.SimulationSpeed}";
                 var points = await SimulationCache.GetAllByIDAsync(info.ID, info.CreateTime);
-                var flinfo = new FlightInfo(info.SimulationName, info.SimulationSpeed);
-                points.ForEach(m => flinfo.flights.Add(new FlightData(m.SimulationLon, m.SimulationLat)));
-                mapControl.SetFlightLine(new FlightInfo[1] { flinfo });
+                List<FlightInfo> flights = new List<FlightInfo>();
+                points.ForEach(m => flights.Add(new FlightInfo(info.SimulationName, info.SimulationSpeed, m.SimulationLon, m.SimulationLat)));
+                mapControl.SetFlightLine(flights);
                 layoutControlItem12.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                 layoutControlItem2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
             }
@@ -150,7 +150,7 @@ namespace DataSimulation.Forms.EditForms
                     var sinfo = db.SimulationInfos.Add(info);
 
                     await db.SaveChangesAsync();
-                    var points = fligth.flights.Select(f => new SimulationPonit()
+                    var points = fligths.Select(f => new SimulationPonit()
                     {
                         SimulationId = sinfo.ID,
                         SimulationLon = f.FlightLon,

+ 30 - 29
DataSimulation.Forms/EditForms/FlightImport.cs

@@ -1,7 +1,9 @@
-using DataSimulation.Repostory;
+using DataSimulation.Forms.Model;
+using DataSimulation.Repostory;
 using DataSimulation.Repostory.EFContext;
 using DataSimulation.Repostory.Model;
 using DevExpress.Utils.About;
+using DevExpress.Utils.Extensions;
 using DevExpress.XtraEditors;
 using DevExpress.XtraEditors.Controls;
 using DevExpress.XtraEditors.DXErrorProvider;
@@ -21,6 +23,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
+using System.Xml.Linq;
 
 namespace DataSimulation.Forms.EditForms
 {
@@ -28,7 +31,7 @@ namespace DataSimulation.Forms.EditForms
     {
         public List<SimulationInfo> Addinfo;
         private List<SimulationInfo> simulationInfos;
-        private List<FlightInfo> flightInfos = new List<FlightInfo>();
+        private List<FlightImportInfo> flightInfos = new List<FlightImportInfo>();
         public FlightImport(List<SimulationInfo> simulationInfos)
         {
             InitializeComponent();
@@ -54,7 +57,7 @@ namespace DataSimulation.Forms.EditForms
                   (double startLon, double startLat, double centerLon, double centerLat, double endLon, double endLat, double lonRange, double latRange) = rect;
               });
             gridView1.SelectionChanged += GridView1_SelectionChanged;
-            gridImprot.Init<FlightInfo>().UseSort().UseFilter().UseMultiSelect().UseRowNumber();
+            gridImprot.Init<FlightImportInfo>().UseSort().UseFilter().UseMultiSelect().UseRowNumber();
             gridView1.OptionsSelection.MultiSelectMode = GridMultiSelectMode.CheckBoxRowSelect;
             gridImprot.DataSource = flightInfos;
             gridView1.RefreshData();
@@ -63,13 +66,13 @@ namespace DataSimulation.Forms.EditForms
         private void GridView1_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
         {
             var ids = gridView1.GetSelectedRows();
-            List<FlightInfo> selects = new List<FlightInfo>();
+            List<FlightImportInfo> selects = new List<FlightImportInfo>();
             foreach (var id in ids)
             {
-                var item = gridView1.GetRow(id) as FlightInfo;
+                var item = gridView1.GetRow(id) as FlightImportInfo;
                 selects.Add(item);
             }
-            mapControl.SetFlightLine(selects);
+            mapControl.SetFlightLine(selects.SelectMany(m => m.flights));
         }
 
         private async void btnSave_Click(object sender, EventArgs e)
@@ -77,8 +80,9 @@ namespace DataSimulation.Forms.EditForms
             try
             {
                 var fligths = mapControl.GetFlightLine<FlightInfo>();
+                var group = fligths.GroupBy(m => new { m.FlightName, m.Speed });
                 Addinfo = new List<SimulationInfo>();
-                var sims = fligths.Select(f => new SimulationInfo() { SimulationName = f.FlightName, SimulationSpeed = f.Speed });
+                var sims = group.Select(f => new SimulationInfo() { SimulationName = f.Key.FlightName, SimulationSpeed = f.Key.Speed });
                 Addinfo.AddRange(sims);
 
                 using (SimulationPartContext db = SimulationPartContext.GetContext(sims.First().CreateTime))
@@ -89,8 +93,8 @@ namespace DataSimulation.Forms.EditForms
                     List<SimulationPonit> ponits = new List<SimulationPonit>();
                     foreach (var sinfo in sinfos)
                     {
-                        var flight = fligths.FirstOrDefault(s => s.FlightName == sinfo.SimulationName);
-                        var fpoints = flight.flights.Select(f => new SimulationPonit()
+                        var flight = group.First(m => m.Key.FlightName == sinfo.SimulationName).ToList();
+                        var fpoints = flight.Select(f => new SimulationPonit()
                         {
                             SimulationId = sinfo.ID,
                             SimulationLon = f.FlightLon,
@@ -116,11 +120,10 @@ namespace DataSimulation.Forms.EditForms
         private List<FlightInfo> AnalysisFlight(string filePath)
         {
 
-            List<FlightInfo> fs = new List<FlightInfo>();
+            List<FlightInfo> fights = new List<FlightInfo>();
             try
             {
 
-                List<FightDataCsv> fights = new List<FightDataCsv>();
                 var allLines = File.ReadAllLines(filePath);
                 int count = 0;
                 foreach (var item in allLines)
@@ -132,28 +135,19 @@ namespace DataSimulation.Forms.EditForms
                     {
                         throw new Exception("格式错误");
                     }
-                    FightDataCsv fight = new FightDataCsv();
+                    FlightInfo fight = new FlightInfo();
                     int i = 0;
                     fight.FlightName = strs[i++];
+                    if (simulationInfos.Any(m => m.SimulationName == fight.FlightName))
+                    {
+                        fight.FlightName = $"{fight.FlightName}{DateTime.Now:yyyyMMddHHmmss}";
+                    }
                     fight.Speed = Convert.ToDouble(strs[i++]);
                     fight.FlightLon = Convert.ToDouble(strs[i++]);
                     fight.FlightLat = Convert.ToDouble(strs[i++]);
                     fights.Add(fight);
                 }
-                var groupfilghts = fights.GroupBy(f => f.FlightName);
-                foreach (var flight in groupfilghts)
-                {
-                    string name = flight.Key;
-                    if (simulationInfos.Any(m => m.SimulationName == name))
-                    {
-                        name = $"{name}{DateTime.Now:yyyyMMddHHmmss}";
-                    }
-                    double speed = flight.First().Speed;
-                    var fligths = flight.Select(f => new FlightData(f.FlightLon, f.FlightLat)).ToList();
-                    FlightInfo flightInfo = new FlightInfo(name, speed);
-                    flightInfo.flights.AddRange(fligths);
-                    fs.Add(flightInfo);
-                }
+
             }
             catch (Exception ex)
             {
@@ -161,7 +155,7 @@ namespace DataSimulation.Forms.EditForms
                 DxHelper.MsgBoxHelper.ShowError($"导入航迹解析异常:{ex.Message}");
             }
 
-            return fs;
+            return fights;
 
         }
 
@@ -175,11 +169,18 @@ namespace DataSimulation.Forms.EditForms
             {
                 string filePath = xtraOpenFileDialog1.FileName;
                 var ff = AnalysisFlight(filePath);
-                flightInfos.AddRange(ff);
+
+                var group = ff.GroupBy(m => new { m.FlightName, m.Speed });
+                foreach (var item in group)
+                {
+                    var fi = new FlightImportInfo(item.Key.FlightName, item.Key.Speed);
+                    fi.flights.AddRange(item.ToList());
+                    flightInfos.Add(fi);
+                }
             }
             gridView1.RefreshData();
             gridView1.SelectAll();
-            mapControl.SetFlightLine(flightInfos);
+            mapControl.SetFlightLine(flightInfos.SelectMany(m => m.flights));
 
         }
     }

+ 3 - 4
DataSimulation.Forms/EditForms/TaskEditor.cs

@@ -228,10 +228,9 @@ namespace DataSimulation.Forms.EditForms
                 foreach (var item in selectedValue)
                 {
                     var simulationPonitInfo = SimulationCache.GetAllByIDAsync(item.ID, item.CreateTime).Result;
-                    var flinfo = new FlightInfo(item.SimulationName, item.SimulationSpeed);
-                    var fpoinits = simulationPonitInfo.Select(s => new FlightData(s.SimulationLon, s.SimulationLat));
-                    flinfo.flights.AddRange(fpoinits);
-                    flightInfos.Add(flinfo);
+                    var fpoinits = simulationPonitInfo.Select(s => new FlightInfo(item.SimulationName, item.SimulationSpeed, s.SimulationLon, s.SimulationLat));
+
+                    flightInfos.AddRange(fpoinits);
                 }
                 mapControl.SetFlightLine(flightInfos);
             }

+ 37 - 41
DataSimulation.Forms/ExtensionsDev/MapControlEx.cs

@@ -1,11 +1,14 @@
 using DataSimulation.Repostory;
+using DataSimulation.Repostory.EFContext;
 using DevExpress.Export.Xl;
 using DevExpress.Map;
 using DevExpress.Map.Native;
 using DevExpress.Utils;
+using DevExpress.Utils.Filtering;
 using DevExpress.Utils.Svg;
 using DevExpress.XtraBars;
 using DevExpress.XtraEditors;
+using DevExpress.XtraEditors.Popup;
 using DevExpress.XtraGrid;
 using DevExpress.XtraGrid.Columns;
 using DevExpress.XtraGrid.Views.Grid;
@@ -14,6 +17,7 @@ using DevExpress.XtraMap.ItemEditor;
 using DevExpress.XtraPrinting;
 using DxHelper;
 using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
 using System.Data.Common;
@@ -78,7 +82,7 @@ public static class MapControlEx
         /// 航迹线
         /// </summary>
         internal MapSpline flightpath;
-        internal Dictionary<string, FlightInfo> _flightCache = new Dictionary<string, FlightInfo>();
+        internal List<FlightInfo> _flightCache = new List<FlightInfo>();
         internal MapDot hoverPoint;
         internal ToolTipControllerShowEventArgs hoverTip;
         internal ToolTipController mapToolTip;
@@ -403,7 +407,7 @@ public static class MapControlEx
     /// <param name="img"></param>
     /// <param name="action">一个回调,参数为选中的定位点</param>
     /// <returns></returns>
-    public static MapControl AddPosMenu<T>(this MapControl ctrl, string caption, SvgImage img, Action<T> action, Func<T, bool> showCondition = null) where T : PosData, new()
+    public static MapControl AddMenu<T>(this MapControl ctrl, string caption, SvgImage img, Action<T> action, Func<T, bool> showCondition = null) where T : FlightInfo, new()
     {
         var btnCustom = new BarButtonItem() { Caption = caption };
         btnCustom.ImageOptions.SvgImage = img;
@@ -470,14 +474,14 @@ public static class MapControlEx
     /// <param name="img"></param>
     /// <param name="action">一个回调,参数为框选的定位点</param>
     /// <returns></returns>
-    public static MapControl AddRectMenu<T>(this MapControl ctrl, string caption, SvgImage img, Action<IEnumerable<T>> action) where T : PosData, new()
+    public static MapControl AddRectMenu<T>(this MapControl ctrl, string caption, SvgImage img, Action<IEnumerable<T>> action) where T : FlightInfo, new()
     {
         var btnCustom = new BarButtonItem() { Caption = caption };
         btnCustom.ImageOptions.SvgImage = img;
         btnCustom.Tag = ctrl;
         btnCustom.ItemClick += (sender, e) =>
          {
-             var data = ctrl.GetRectPosItem<T>();
+             var data = ctrl.GetRectItem<T>();
              action(data);
          };
         var innerData = ctrl.Tag as InnerData;
@@ -560,7 +564,7 @@ public static class MapControlEx
     /// </summary>
     /// <param name="ctrl"></param>
     /// <returns></returns>
-    public static IEnumerable<T> GetRectPosItem<T>(this MapControl ctrl) where T : PosData, new()
+    public static IEnumerable<T> GetRectItem<T>(this MapControl ctrl) where T : FlightInfo, new()
     {
         var innerData = ctrl.Tag as InnerData;
         if (innerData.CurrentRect == default) return new List<T>();
@@ -569,7 +573,7 @@ public static class MapControlEx
         double startLat = rect.startLat;
         double endLon = rect.endLon;
         double endLat = rect.endLat;
-        var temp = innerData._dataCache.Keys.Where(p => p.InRectangle(startLon, startLat, endLon, endLat));
+        var temp = innerData._flightCache.Where(p => p.InRectangle(startLon, startLat, endLon, endLat));
         var res = temp.Select(p => (T)p);
         return res;
     }
@@ -592,7 +596,7 @@ public static class MapControlEx
         return ctrl;
     }
 
-   
+
 
     /// <summary>
     /// 为地图添加右键测距功能
@@ -625,21 +629,19 @@ public static class MapControlEx
         var innerData = ctrl.Tag as InnerData;
         btnFlight.ItemClick += (sender, e) =>
         {
-            var flights = innerData._flightCache.Keys.ToList();
-            var frm = new MapFlightLineView(flights);
+            var flights = innerData._flightCache.GroupBy(m => m.FlightName);
+            var frm = new MapFlightLineView(flights.Select(f => f.Key).ToList());
             frm.onClick = (reslut) =>
             {
-                (bool isOk, string caption, double speed) = reslut;
+                (bool isOk, string fligthName, double speed) = reslut;
 
                 ShowPopup?.Invoke((false, frm));
                 if (!isOk)
                 {
                     return;
                 }
-                var filghtInfo = new FlightInfo(caption, speed);
-                innerData._flightCache.Add(filghtInfo.FlightName, filghtInfo);
 
-                string filghtName = $"DrawFlightLine{caption}";
+                string filghtName = $"DrawFlightLine_{fligthName}_{speed}";
                 ctrl.MapEditor.SetEditMode();
                 var items = innerData.flightStorge.Items.ToArray();
                 innerData.flightpath = new MapSpline()
@@ -709,10 +711,8 @@ public static class MapControlEx
         {
             innerData.distinctPath.Points.Clear();
         }
-        var filghtInfo = new FlightInfo(fligthName, speed);
-        innerData._flightCache.Add(filghtInfo.FlightName, filghtInfo);
 
-        string filghtName = $"DrawFlightLine{fligthName}";
+        string filghtName = $"DrawFlightLine_{fligthName}_{speed}";
         ctrl.MapEditor.SetEditMode();
         innerData.flightpath = new MapSpline()
         {
@@ -760,7 +760,7 @@ public static class MapControlEx
     public static IEnumerable<T> GetFlightLine<T>(this MapControl ctrl) where T : FlightInfo
     {
         var innerData = ctrl.Tag as InnerData;
-        return innerData._flightCache.Select(m => (T)m.Value);
+        return innerData._flightCache.Select(m => (T)m);
     }
 
     private static void AddFlightPoint(object sender, MouseEventArgs e)
@@ -769,14 +769,16 @@ public static class MapControlEx
         var ctrl = sender as MapControl;
 
         var location = ctrl.ScreenPointToCoordPoint(e.Location);
-        string Name = innerData.flightpath.Tag.ToString().Replace("DrawFlightLine", "");
+        var strs = innerData.flightpath.Tag.ToString().Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries);
+        string name = strs[1];
+        double speed = Convert.ToDouble(strs[2]);
         double lon = Math.Round(location.GetX(), 3);
         double lat = Math.Round(location.GetY(), 3);
         innerData.hoverPoint = new MapDot()
         {
             CanResize = false,
             CanMove = false,
-            ToolTipPattern = $"航迹:{Name}\r\n{lon},{lat}°",
+            ToolTipPattern = $"航迹:{name}\r\n{lon},{lat}°",
             Tag = innerData.flightpath.Tag,
             Size = 8
         };
@@ -784,9 +786,9 @@ public static class MapControlEx
         innerData.hoverPoint.Fill = ColorHelper.GetColor(innerData.hoverPoint.Tag.ToString());
         innerData.flightStorge.Items.Add(innerData.hoverPoint);
         innerData.flightpath.Points.Add(innerData.hoverPoint.Location);
-        if (!innerData._flightCache[Name].flights.Any(m => m.FlightLon == lon && m.FlightLat == lat))
+        if (!innerData._flightCache.Any(m => m.FlightLon == lon && m.FlightName == name && m.Speed == speed && m.FlightLat == lat))
         {
-            innerData._flightCache[Name].flights.Add(new FlightData(lon, lat));
+            innerData._flightCache.Add(new FlightInfo(name, speed, lon, lat));
         }
     }
 
@@ -805,19 +807,20 @@ public static class MapControlEx
             ctrl.Refresh();
             return;
         }
-
-        for (int i = 0; i < items.Count(); i++)
+        var group = items.GroupBy(m => m.FlightName);
+        foreach (var item in group)
         {
-            var f = items.ElementAt(i);
+            var f = item.ToList();
             ctrl.ShowFlightLine(innerData, f);
 
         }
 
 
     }
-    private static void ShowFlightLine(this MapControl ctrl, InnerData innerData, FlightInfo flight)
+    private static void ShowFlightLine<T>(this MapControl ctrl, InnerData innerData, List<T> points) where T : FlightInfo, new()
     {
-        string filghtName = $"DrawFlightLine{flight.FlightName}";
+        var first = points.First();
+        string filghtName = $"DrawFlightLine_{first.FlightName}_{first.Speed}";
         var flightpath = new MapSpline()
         {
             Stroke = Color.FromArgb(127, 255, 0, 199),
@@ -834,14 +837,15 @@ public static class MapControlEx
         var hoverPoint = new MapDot() { CanResize = false, CanMove = false, Tag = filghtName, Size = 8 };
         hoverPoint.Fill = ColorHelper.GetColor(hoverPoint.Tag.ToString());
         innerData.flightStorge.Items.Add(hoverPoint);
-        if (flight.flights.Count > 0)
+        if (points.Count > 0)
         {
-            var center = new GeoPoint(flight.flights.First().FlightLat, flight.flights.First().FlightLon);
+
+            var center = new GeoPoint(first.FlightLat, first.FlightLon);
             ctrl.SetCenterPoint(center, true);
         }
         Task.Run(() =>
           {
-              flight.flights.ForEach((finfo) =>
+              points.ForEach((finfo) =>
                 {
                     var location = new GeoPoint(finfo.FlightLat, finfo.FlightLon);
 
@@ -849,7 +853,7 @@ public static class MapControlEx
                     {
                         CanResize = false,
                         CanMove = false,
-                        ToolTipPattern = $"航迹:{flight.FlightName}\r\n{finfo.FlightLon},{finfo.FlightLat}°",
+                        ToolTipPattern = $"航迹:{finfo.FlightName}\r\n{finfo.FlightLon},{finfo.FlightLat}°",
                         Tag = flightpath.Tag,
                         Size = 8
                     };
@@ -861,7 +865,7 @@ public static class MapControlEx
                 });
 
           });
-        innerData._flightCache.Add(flight.FlightName, flight);
+        innerData._flightCache.AddRange(points);
 
     }
 
@@ -874,15 +878,7 @@ public static class MapControlEx
         btnExportFlightLine.ItemClick += (sender, e) =>
         {
             if (!innerData._flightCache.Any()) return;
-            List<FightDataCsv> list = new List<FightDataCsv>();
-            foreach (var item in innerData._flightCache.Values)
-            {
-                foreach (var fitem in item.flights)
-                {
-                    list.Add(new FightDataCsv(item.FlightName, item.Speed, fitem.FlightLon, fitem.FlightLat));
-                }
-
-            }
+            List<FlightInfo> list = innerData._flightCache;
             Dictionary<string, string> cellFormats = new Dictionary<string, string>();//单元格的format
             var props = list.First().GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
             List<(int ColumnIndex, PropertyInfo Prop, string Header)> listPorps = new List<(int, PropertyInfo, string)>();
@@ -1383,7 +1379,7 @@ public static class MapControlEx
         if (recCallback)
             innerData.mOnRectChanged?.Invoke(ctrl.GetCurrentRect());
     }
-   
+
     public static void ClearRect(this MapControl ctrl)
     {
         var innerDate = ctrl.Tag as InnerData;

+ 31 - 0
DataSimulation.Forms/Model/FlightImportInfo.cs

@@ -0,0 +1,31 @@
+using DataSimulation.Repostory;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DataSimulation.Forms.Model
+{
+    public class FlightImportInfo
+    {
+        public FlightImportInfo(string name,double speed)
+        {
+            FlightName = name;
+            Speed = speed;
+            flights = new List<FlightInfo>();
+        }
+
+        [Display(Name = "航迹名称")]
+        public string FlightName { get; set; }
+
+        /// <summary>
+        /// 速度m/s
+        /// </summary>
+        [Display(Name = "航迹速度(m/s)")]
+        public double Speed { get; set; }
+
+        public List<FlightInfo> flights { get; set; }
+    }
+}

+ 16 - 51
DataSimulation.Repostory/PosData.cs

@@ -173,62 +173,14 @@ namespace DataSimulation.Repostory
         public FlightInfo()
         {
         }
-        public FlightInfo(string name, double Speed)
-        {
-            this.FlightName = name;
-            this.Speed = Speed;
-            flights = new List<FlightData>();
-
-        }
-        [Display(Name = "航迹名称")]
-        public string FlightName { get; set; }
-
-        /// <summary>
-        /// 速度m/s
-        /// </summary>
-        [Display(Name = "航迹速度(m/s)")]
-        public double Speed { get; set; }
 
-        /// <summary>
-        /// 航迹数据点
-        /// </summary>
-        [Display(Name = "航迹数据点", AutoGenerateField = false)]
-        [ExportCell()]
-        public List<FlightData> flights { get; set; }
-
-    }
-    [Serializable]
-    public class FlightData
-    {
-        public FlightData()
-        { 
-        }
-        public FlightData(double lon, double lat)
-        {
-            this.FlightLon = lon;
-            this.FlightLat = lat;
-        }
-        [Display(Name = "航迹经度")]
-        public double FlightLon { get; set; }
-
-        [Display(Name = "航迹纬度")]
-        public double FlightLat { get; set; }
-
-    }
-
-    public class FightDataCsv
-    {
-        public FightDataCsv()
-        { }
-
-        public FightDataCsv(string name, double speed, double lon, double lat)
+        public FlightInfo(string name, double speed, double lon, double lat)
         {
             FlightName = name;
             Speed = speed;
             FlightLon = lon;
             FlightLat = lat;
         }
-
         [Display(Name = "航迹名称")]
         [ExportCell("")]
         public string FlightName { get; set; }
@@ -240,13 +192,26 @@ namespace DataSimulation.Repostory
         [ExportCell("f3")]
         public double Speed { get; set; }
 
-        [Display(Name = "航迹经度(°)")]
+
+        [Display(Name = "航迹经度(°)", AutoGenerateField = false)]
         [ExportCell("f3")]
         public double FlightLon { get; set; }
 
-        [Display(Name = "航迹纬度(°)")]
+        [Display(Name = "航迹纬度(°)", AutoGenerateField = false)]
         [ExportCell("f3")]
         public double FlightLat { get; set; }
 
+        /// <summary>
+        /// 判断定位点是否在一个框选的矩形区域内
+        /// </summary>
+        /// <param name="startLon"></param>
+        /// <param name="startLat"></param>
+        /// <param name="endLon"></param>
+        /// <param name="endLat"></param>
+        /// <returns></returns>
+        public bool InRectangle(double startLon, double startLat, double endLon, double endLat)
+        {
+            return FlightLon >= startLon && FlightLon <= endLon && FlightLat >= startLat && FlightLat <= endLat;
+        }
     }
 }