wyq vor 1 Jahr
Ursprung
Commit
803e722b2e

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

@@ -243,7 +243,6 @@
     <EmbeddedResource Include="MainForm.resx">
       <DependentUpon>MainForm.cs</DependentUpon>
     </EmbeddedResource>
-    <EmbeddedResource Include="Properties\licenses.licx" />
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>

+ 29 - 18
DataSimulation.Forms/EditForms/FlightEditor.cs

@@ -28,31 +28,42 @@ namespace DataSimulation.Forms.EditForms
         {
             InitializeComponent();
             this.Text = "添加航迹";
-            info = new SimulationInfo();
             this.simulationInfos = simulationInfos;
             this.StartPosition = FormStartPosition.CenterParent;
         }
 
-        public FlightEditor(List<SimulationInfo> simulationInfos,SimulationInfo info)
+        public FlightEditor(List<SimulationInfo> simulationInfos, SimulationInfo info)
           : this(simulationInfos)
         {
             this.Text = "编辑航迹";
             this.info = info;
         }
 
-        private void Editor_Load(object sender, EventArgs e)
+        private async void Editor_Load(object sender, EventArgs e)
         {
             mapControl.UseDefalutOptions()
-            .UseClearAll()
-            .UseDistanceLine()
-            .UseMarkDot()
-            .UseExportImg()
-            .UseExportXlsx()
-            .UseExportCsv()
-            .SetMapLayerType(null);
+           .UseClearAll()
+           .UseDistanceLine()
+           .UseMarkDot()
+           .UseExportImg()
+           .UseExportXlsx()
+           .UseExportCsv()
+           .UseExportFlightLine()
+           .SetMapLayerType(null);
             txtFlightName.EditValueChanged += TxtFlightName_EditValueChanged;
             txtSpeed.EditValueChanged += TxtSpeed_EditValueChanged;
 
+            if (this.Text == "编辑航迹" && info != null)
+            {
+                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 });
+                layoutControlItem12.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+                layoutControlItem2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+            }
 
         }
 
@@ -61,16 +72,16 @@ namespace DataSimulation.Forms.EditForms
             double speed;
             if (!double.TryParse(txtSpeed.Text, out speed))
             {
-                dxErrorProvider.SetError(txtSpeed, "请设置正确的航迹速度(Km/s)");
+                dxErrorProvider.SetError(txtSpeed, "请设置正确的航迹速度(m/s)");
                 return;
             }
             if (speed <= 0)
             {
-                dxErrorProvider.SetError(txtSpeed, "航迹速度范围不能小于等于0Km/s");
+                dxErrorProvider.SetError(txtSpeed, "航迹速度范围不能小于等于0(m/s)");
                 return;
             }
             dxErrorProvider.SetError(txtSpeed, string.Empty);
-            
+
         }
 
         private void TxtFlightName_EditValueChanged(object sender, EventArgs e)
@@ -127,12 +138,12 @@ namespace DataSimulation.Forms.EditForms
 
                 var fligths = mapControl.GetFlightLine<FlightInfo>();
                 var fligth = fligths.First();
-                SimulationInfo simulationInfo = new SimulationInfo();
-                simulationInfo.SimulationName = fligth.FlightName;
-                simulationInfo.SimulationSpeed = fligth.Speed;
-                using (SimulationPartContext db = SimulationPartContext.GetContext(simulationInfo.CreateTime))
+                info = new SimulationInfo();
+                info.SimulationName = fligth.FlightName;
+                info.SimulationSpeed = fligth.Speed;
+                using (SimulationPartContext db = SimulationPartContext.GetContext(info.CreateTime))
                 {
-                    var sinfo = db.SimulationInfos.Add(simulationInfo);
+                    var sinfo = db.SimulationInfos.Add(info);
 
                     await db.SaveChangesAsync();
                     var points = fligth.flights.Select(f => new SimulationPonit()

+ 103 - 0
DataSimulation.Forms/ExtensionsDev/MapControlEx.cs

@@ -1076,6 +1076,109 @@ public static class MapControlEx
         innerData._flightCache.Add(flight.FlightName, flight);
 
     }
+
+    public static MapControl UseExportFlightLine(this MapControl ctrl, bool exportHeader = true)
+    {
+        var innerData = ctrl.Tag as InnerData;
+        var btnExportFlightLine = new BarButtonItem() { Caption = "导出航迹" };
+        btnExportFlightLine.ImageOptions.SvgImage = SvgHelper.CreateExportCsv();
+        btnExportFlightLine.Tag = ctrl;
+        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));
+                }
+
+            }
+            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)>();
+            foreach (var prop in props)
+            {
+                ExportCellAttribute attrExport = prop.GetCustomAttribute<ExportCellAttribute>();
+                if (attrExport == null) continue;
+                if (!string.IsNullOrWhiteSpace(attrExport.Format))
+                {
+                    cellFormats.Add(prop.Name, attrExport.Format);
+                }
+                if (attrExport.ColumnIndex == -1)
+                    attrExport.ColumnIndex = 10000;
+                var attrDisplay = prop.GetCustomAttribute<DisplayAttribute>();
+                if (attrDisplay != null && !string.IsNullOrWhiteSpace(attrDisplay.Name))
+                    listPorps.Add((attrExport.ColumnIndex, prop, attrDisplay.Name));
+                else
+                    listPorps.Add((attrExport.ColumnIndex, prop, prop.Name));
+
+            }
+            listPorps = listPorps.OrderBy(p => p.ColumnIndex).ToList();
+            using (var dialog = new SaveFileDialog())
+            {
+                dialog.Filter = "CSV文件|*.csv";
+                dialog.AddExtension = true;
+                dialog.FileName = $"FlightLine{DateTime.Now:yyyyMMddHHmmss}.csv";
+                if (dialog.ShowDialog() == DialogResult.OK)
+                {
+                    StreamWriter sw = new StreamWriter(dialog.FileName, false, new UTF8Encoding(true));//utf8-bom
+
+                    if (exportHeader)
+                    {
+                        foreach (var prop in listPorps)
+                        {
+                            sw.Write($"{prop.Header},");
+                        }
+                        sw.WriteLine();
+                    }
+                    WaitHelper.ShowOverlayForm(ctrl);
+                    long count = list.Count() * listPorps.Count;
+                    int idx = 1;
+                    foreach (var item in list)
+                    {
+                        foreach (var prop in listPorps)
+                        {
+                            WaitHelper.UpdateOverlyText($"{idx * 100 / count}%");
+                            var value = prop.Prop.GetValue(item);
+                            string str = null;
+                            if (cellFormats.ContainsKey(prop.Prop.Name))
+                            {
+                                str = ((dynamic)value).ToString(cellFormats[prop.Prop.Name]);
+                            }
+                            else
+                            {
+                                if (value is DateTime)
+                                    str = $"{(DateTime)value:yyyy-MM-dd HH:mm:ss}";
+                                else if (value is float || value is double || value is decimal)
+                                {
+                                    dynamic valD = value;
+                                    str = ((dynamic)value).ToString("f4");
+                                }
+                                else if (value is string)
+                                {
+                                    str = value.ToString();
+                                }
+                            }
+                            sw.Write($"{str},");
+                            idx++;
+                        }
+
+                        sw.WriteLine();
+                    }
+                    sw.Close();
+                    WaitHelper.CloseOverlayForm();
+                }
+            }
+            GC.Collect();
+        };
+        innerData.barM.BeginInit();
+        innerData.barM.Items.Add(btnExportFlightLine);
+        innerData.mapMenu.LinksPersistInfo.Add(new LinkPersistInfo(btnExportFlightLine));
+        innerData.barM.EndInit();
+        return ctrl;
+    }
     #endregion
     /// <summary>
     /// 为地图添加右键标点功能

+ 0 - 13
DataSimulation.Forms/Properties/licenses.licx

@@ -1,13 +0,0 @@
-DevExpress.XtraEditors.ImageComboBoxEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraEditors.DateEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraCharts.Heatmap.HeatmapControl, DevExpress.XtraCharts.v23.2.UI, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraEditors.SearchLookUpEdit, DevExpress.XtraGrid.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraBars.Docking.DockManager, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraBars.Docking2010.DocumentManager, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraEditors.ButtonEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraMap.MapControl, DevExpress.XtraMap.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraBars.BarManager, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

+ 151 - 4
DataSimulation.Forms/UserControl/CtrlFlight.Designer.cs

@@ -41,19 +41,37 @@
             this.btnDel = new DevExpress.XtraBars.BarButtonItem();
             this.btnEdit = new DevExpress.XtraBars.BarButtonItem();
             this.popupMenu1 = new DevExpress.XtraBars.PopupMenu(this.components);
+            this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl();
+            this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
+            this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.txtFlightName = new DevExpress.XtraEditors.TextEdit();
+            this.ll = new DevExpress.XtraLayout.LayoutControlItem();
+            this.btnQuery = new DevExpress.XtraEditors.SimpleButton();
+            this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.btnImport = new DevExpress.XtraEditors.SimpleButton();
+            this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem();
             ((System.ComponentModel.ISupportInitialize)(this.gridFlight)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.barManager1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.popupMenu1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
+            this.layoutControl1.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtFlightName.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.ll)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit();
             this.SuspendLayout();
             // 
             // gridFlight
             // 
-            this.gridFlight.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.gridFlight.Location = new System.Drawing.Point(0, 0);
+            this.gridFlight.Location = new System.Drawing.Point(12, 38);
             this.gridFlight.MainView = this.gridView1;
             this.gridFlight.Name = "gridFlight";
-            this.gridFlight.Size = new System.Drawing.Size(647, 422);
+            this.gridFlight.Size = new System.Drawing.Size(623, 372);
             this.gridFlight.TabIndex = 0;
             this.gridFlight.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
             this.gridView1});
@@ -143,11 +161,121 @@
             this.popupMenu1.Manager = this.barManager1;
             this.popupMenu1.Name = "popupMenu1";
             // 
+            // layoutControl1
+            // 
+            this.layoutControl1.Controls.Add(this.btnImport);
+            this.layoutControl1.Controls.Add(this.btnQuery);
+            this.layoutControl1.Controls.Add(this.txtFlightName);
+            this.layoutControl1.Controls.Add(this.gridFlight);
+            this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.layoutControl1.Location = new System.Drawing.Point(0, 0);
+            this.layoutControl1.Name = "layoutControl1";
+            this.layoutControl1.Root = this.Root;
+            this.layoutControl1.Size = new System.Drawing.Size(647, 422);
+            this.layoutControl1.TabIndex = 5;
+            this.layoutControl1.Text = "layoutControl1";
+            // 
+            // Root
+            // 
+            this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
+            this.Root.GroupBordersVisible = false;
+            this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
+            this.layoutControlItem1,
+            this.ll,
+            this.layoutControlItem2,
+            this.layoutControlItem3,
+            this.emptySpaceItem1});
+            this.Root.Name = "Root";
+            this.Root.Size = new System.Drawing.Size(647, 422);
+            this.Root.TextVisible = false;
+            // 
+            // layoutControlItem1
+            // 
+            this.layoutControlItem1.Control = this.gridFlight;
+            this.layoutControlItem1.Location = new System.Drawing.Point(0, 26);
+            this.layoutControlItem1.Name = "layoutControlItem1";
+            this.layoutControlItem1.Size = new System.Drawing.Size(627, 376);
+            this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0);
+            this.layoutControlItem1.TextVisible = false;
+            // 
+            // txtFlightName
+            // 
+            this.txtFlightName.Location = new System.Drawing.Point(76, 12);
+            this.txtFlightName.MenuManager = this.barManager1;
+            this.txtFlightName.Name = "txtFlightName";
+            this.txtFlightName.Size = new System.Drawing.Size(400, 20);
+            this.txtFlightName.StyleController = this.layoutControl1;
+            this.txtFlightName.TabIndex = 4;
+            // 
+            // ll
+            // 
+            this.ll.Control = this.txtFlightName;
+            this.ll.Location = new System.Drawing.Point(0, 0);
+            this.ll.Name = "ll";
+            this.ll.Size = new System.Drawing.Size(468, 26);
+            this.ll.Text = "航迹名称:";
+            this.ll.TextSize = new System.Drawing.Size(52, 14);
+            // 
+            // btnQuery
+            // 
+            this.btnQuery.Location = new System.Drawing.Point(495, 12);
+            this.btnQuery.Name = "btnQuery";
+            this.btnQuery.Size = new System.Drawing.Size(68, 22);
+            this.btnQuery.StyleController = this.layoutControl1;
+            this.btnQuery.TabIndex = 5;
+            this.btnQuery.Text = "查询";
+            this.btnQuery.Click += new System.EventHandler(this.btnQuery_Click);
+            // 
+            // layoutControlItem2
+            // 
+            this.layoutControlItem2.Control = this.btnQuery;
+            this.layoutControlItem2.Location = new System.Drawing.Point(483, 0);
+            this.layoutControlItem2.MaxSize = new System.Drawing.Size(72, 26);
+            this.layoutControlItem2.MinSize = new System.Drawing.Size(72, 26);
+            this.layoutControlItem2.Name = "layoutControlItem2";
+            this.layoutControlItem2.Size = new System.Drawing.Size(72, 26);
+            this.layoutControlItem2.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0);
+            this.layoutControlItem2.TextVisible = false;
+            // 
+            // btnImport
+            // 
+            this.btnImport.Location = new System.Drawing.Point(567, 12);
+            this.btnImport.Name = "btnImport";
+            this.btnImport.Size = new System.Drawing.Size(68, 22);
+            this.btnImport.StyleController = this.layoutControl1;
+            this.btnImport.TabIndex = 6;
+            this.btnImport.Text = "导入";
+            this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
+            // 
+            // layoutControlItem3
+            // 
+            this.layoutControlItem3.Control = this.btnImport;
+            this.layoutControlItem3.Location = new System.Drawing.Point(555, 0);
+            this.layoutControlItem3.MaxSize = new System.Drawing.Size(72, 26);
+            this.layoutControlItem3.MinSize = new System.Drawing.Size(72, 26);
+            this.layoutControlItem3.Name = "layoutControlItem3";
+            this.layoutControlItem3.Size = new System.Drawing.Size(72, 26);
+            this.layoutControlItem3.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.layoutControlItem3.TextSize = new System.Drawing.Size(0, 0);
+            this.layoutControlItem3.TextVisible = false;
+            // 
+            // emptySpaceItem1
+            // 
+            this.emptySpaceItem1.AllowHotTrack = false;
+            this.emptySpaceItem1.Location = new System.Drawing.Point(468, 0);
+            this.emptySpaceItem1.MaxSize = new System.Drawing.Size(15, 26);
+            this.emptySpaceItem1.MinSize = new System.Drawing.Size(15, 26);
+            this.emptySpaceItem1.Name = "emptySpaceItem1";
+            this.emptySpaceItem1.Size = new System.Drawing.Size(15, 26);
+            this.emptySpaceItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0);
+            // 
             // CtrlFlight
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.Controls.Add(this.gridFlight);
+            this.Controls.Add(this.layoutControl1);
             this.Controls.Add(this.barDockControlLeft);
             this.Controls.Add(this.barDockControlRight);
             this.Controls.Add(this.barDockControlBottom);
@@ -159,6 +287,15 @@
             ((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.barManager1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.popupMenu1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit();
+            this.layoutControl1.ResumeLayout(false);
+            ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtFlightName.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.ll)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit();
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -177,5 +314,15 @@
         private DevExpress.XtraBars.BarButtonItem btnDel;
         private DevExpress.XtraBars.PopupMenu popupMenu1;
         private DevExpress.XtraBars.BarButtonItem btnEdit;
+        private DevExpress.XtraLayout.LayoutControl layoutControl1;
+        private DevExpress.XtraLayout.LayoutControlGroup Root;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1;
+        private DevExpress.XtraEditors.TextEdit txtFlightName;
+        private DevExpress.XtraLayout.LayoutControlItem ll;
+        private DevExpress.XtraEditors.SimpleButton btnImport;
+        private DevExpress.XtraEditors.SimpleButton btnQuery;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem3;
+        private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem1;
     }
 }

+ 13 - 4
DataSimulation.Forms/UserControl/CtrlFlight.cs

@@ -75,10 +75,11 @@ namespace DataSimulation.Forms.UserControl
         {
             try
             {
-                //var editItem = gridView1.GetFocusedRow() as RefInfo;
-                //RefEditor frm = new RefEditor(editItem);
-                //if (frm.ShowDialog() != DialogResult.OK) return;
-                //gridView1.RefreshData();
+                var editItem = gridView1.GetFocusedRow() as SimulationInfo;
+                var all = list.Where(l => l.ID != editItem.ID).ToList();
+                FlightEditor frm = new FlightEditor(all, editItem);
+                if (frm.ShowDialog() != DialogResult.OK) return;
+                gridView1.RefreshData();
             }
             catch (Exception ex)
             {
@@ -144,6 +145,14 @@ namespace DataSimulation.Forms.UserControl
             }
         }
 
+        private void btnImport_Click(object sender, EventArgs e)
+        {
+
+        }
+
+        private void btnQuery_Click(object sender, EventArgs e)
+        {
 
+        }
     }
 }

+ 46 - 5
DataSimulation.Repostory/PosData.cs

@@ -1,10 +1,8 @@
 using System;
 using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
 using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder.Spatial;
 
 namespace DataSimulation.Repostory
 {
@@ -173,7 +171,7 @@ namespace DataSimulation.Repostory
     public class FlightInfo
     {
         public FlightInfo()
-        { 
+        {
         }
         public FlightInfo(string name, double Speed)
         {
@@ -182,13 +180,20 @@ namespace DataSimulation.Repostory
             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 = "航迹数据点")]
+        [ExportCell()]
         public List<FlightData> flights { get; set; }
 
     }
@@ -199,9 +204,45 @@ namespace DataSimulation.Repostory
             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)
+        {
+            FlightName = name;
+            Speed = speed;
+            FlightLon = lon;
+            FlightLat = lat;
+        }
+
+        [Display(Name = "航迹名称")]
+        [ExportCell("")]
+        public string FlightName { get; set; }
+
+        /// <summary>
+        /// 速度m/s
+        /// </summary>
+        [Display(Name = "航迹速度(m/s)")]
+        [ExportCell("f3")]
+        public double Speed { get; set; }
+
+        [Display(Name = "航迹经度(°)")]
+        [ExportCell("f3")]
+        public double FlightLon { get; set; }
+
+        [Display(Name = "航迹纬度(°)")]
+        [ExportCell("f3")]
         public double FlightLat { get; set; }
+
     }
 }

+ 26 - 0
DataSimulation.Repostory/SimulationCache.cs

@@ -44,6 +44,32 @@ namespace DataSimulation.Repostory
                 return null;
             }
         }
+        /// <summary>
+        /// 根据编号查询航迹点
+        /// </summary>
+        /// <param name="simulationId">航迹编号</param>
+        /// <param name="createTime">航迹创建时间</param>
+        /// <returns></returns>
+        public static async Task<List<SimulationPonit>> GetAllByIDAsync(long simulationId, DateTime createTime)
+        {
+            try
+            {
+                List<SimulationPonit> list = new List<SimulationPonit>();
+                var dir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DbPart");
+                if (!Directory.Exists(dir)) return list;
+                using (SimulationPartContext db = SimulationPartContext.GetContext(createTime))
+                {
+                    var points = await db.SimulationPonits.Where(s => s.SimulationId == simulationId).ToListAsync();
+                    list.AddRange(points);
+                }
+                return list;
+            }
+            catch (Exception ex)
+            {
+                Serilog.Log.Error(ex, $"查询仿真航迹{simulationId}信息异常");
+                return null;
+            }
+        }
 
 
     }