wyq 1 年之前
父節點
當前提交
619734c18d

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

@@ -268,6 +268,7 @@
     <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>

+ 49 - 34
DataSimulation.Forms/EditForms/FlightImport.Designer.cs

@@ -29,18 +29,19 @@
         private void InitializeComponent()
         {
             this.components = new System.ComponentModel.Container();
-            DevExpress.XtraEditors.Controls.EditorButtonImageOptions editorButtonImageOptions1 = new DevExpress.XtraEditors.Controls.EditorButtonImageOptions();
-            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject1 = new DevExpress.Utils.SerializableAppearanceObject();
-            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject2 = new DevExpress.Utils.SerializableAppearanceObject();
-            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject3 = new DevExpress.Utils.SerializableAppearanceObject();
-            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject4 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.XtraEditors.Controls.EditorButtonImageOptions editorButtonImageOptions2 = new DevExpress.XtraEditors.Controls.EditorButtonImageOptions();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject5 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject6 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject7 = new DevExpress.Utils.SerializableAppearanceObject();
+            DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject8 = new DevExpress.Utils.SerializableAppearanceObject();
             this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl();
-            this.cbAll = new DevExpress.XtraEditors.ComboBoxEdit();
             this.btnImport = new DevExpress.XtraEditors.SimpleButton();
             this.mapControl = new DevExpress.XtraMap.MapControl();
             this.btnSave = new DevExpress.XtraEditors.SimpleButton();
             this.txtSpeed = new DevExpress.XtraEditors.ButtonEdit();
             this.txtFlightName = new DevExpress.XtraEditors.TextEdit();
+            this.searchHj = new DevExpress.XtraEditors.SearchLookUpEdit();
+            this.searchLookUpEdit1View = new DevExpress.XtraGrid.Views.Grid.GridView();
             this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
             this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItem13 = new DevExpress.XtraLayout.LayoutControlItem();
@@ -50,14 +51,15 @@
             this.emptySpaceItem2 = new DevExpress.XtraLayout.EmptySpaceItem();
             this.layoutControlItem12 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
-            this.所有航迹 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.航迹 = new DevExpress.XtraLayout.LayoutControlItem();
             this.dxErrorProvider = new DevExpress.XtraEditors.DXErrorProvider.DXErrorProvider(this.components);
             ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
             this.layoutControl1.SuspendLayout();
-            ((System.ComponentModel.ISupportInitialize)(this.cbAll.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.mapControl)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtSpeed.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtFlightName.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.searchHj.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.searchLookUpEdit1View)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem13)).BeginInit();
@@ -67,18 +69,18 @@
             ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem12)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.所有航迹)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.航迹)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.dxErrorProvider)).BeginInit();
             this.SuspendLayout();
             // 
             // layoutControl1
             // 
-            this.layoutControl1.Controls.Add(this.cbAll);
             this.layoutControl1.Controls.Add(this.btnImport);
             this.layoutControl1.Controls.Add(this.mapControl);
             this.layoutControl1.Controls.Add(this.btnSave);
             this.layoutControl1.Controls.Add(this.txtSpeed);
             this.layoutControl1.Controls.Add(this.txtFlightName);
+            this.layoutControl1.Controls.Add(this.searchHj);
             this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill;
             this.layoutControl1.Location = new System.Drawing.Point(0, 0);
             this.layoutControl1.Name = "layoutControl1";
@@ -87,17 +89,6 @@
             this.layoutControl1.TabIndex = 0;
             this.layoutControl1.Text = "layoutControl1";
             // 
-            // cbAll
-            // 
-            this.cbAll.Location = new System.Drawing.Point(12, 29);
-            this.cbAll.Name = "cbAll";
-            this.cbAll.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
-            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
-            this.cbAll.Size = new System.Drawing.Size(278, 20);
-            this.cbAll.StyleController = this.layoutControl1;
-            this.cbAll.TabIndex = 18;
-            this.cbAll.SelectedValueChanged += new System.EventHandler(this.cbAll_SelectedValueChanged);
-            // 
             // btnImport
             // 
             this.btnImport.Location = new System.Drawing.Point(154, 475);
@@ -132,7 +123,7 @@
             this.txtSpeed.MinimumSize = new System.Drawing.Size(0, 20);
             this.txtSpeed.Name = "txtSpeed";
             this.txtSpeed.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
-            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "m/s", -1, false, true, false, editorButtonImageOptions1, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject1, serializableAppearanceObject2, serializableAppearanceObject3, serializableAppearanceObject4, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)});
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "m/s", -1, false, true, false, editorButtonImageOptions2, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject5, serializableAppearanceObject6, serializableAppearanceObject7, serializableAppearanceObject8, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)});
             this.txtSpeed.Properties.MaskSettings.Set("MaskManagerType", typeof(DevExpress.Data.Mask.NumericMaskManager));
             this.txtSpeed.Properties.MaskSettings.Set("mask", "f3");
             this.txtSpeed.Properties.MaxLength = 10;
@@ -149,6 +140,28 @@
             this.txtFlightName.StyleController = this.layoutControl1;
             this.txtFlightName.TabIndex = 4;
             // 
+            // searchHj
+            // 
+            this.searchHj.Location = new System.Drawing.Point(12, 29);
+            this.searchHj.Name = "searchHj";
+            this.searchHj.Properties.AdvancedModeOptions.AllowSelectionAnimation = DevExpress.Utils.DefaultBoolean.True;
+            this.searchHj.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.searchHj.Properties.NullText = "";
+            this.searchHj.Properties.PopupSizeable = false;
+            this.searchHj.Properties.PopupView = this.searchLookUpEdit1View;
+            this.searchHj.Size = new System.Drawing.Size(278, 20);
+            this.searchHj.StyleController = this.layoutControl1;
+            this.searchHj.TabIndex = 18;
+            this.searchHj.EditValueChanged += new System.EventHandler(this.searchHj_EditValueChanged);
+            // 
+            // searchLookUpEdit1View
+            // 
+            this.searchLookUpEdit1View.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
+            this.searchLookUpEdit1View.Name = "searchLookUpEdit1View";
+            this.searchLookUpEdit1View.OptionsSelection.EnableAppearanceFocusedCell = false;
+            this.searchLookUpEdit1View.OptionsView.ShowGroupPanel = false;
+            // 
             // Root
             // 
             this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
@@ -162,7 +175,7 @@
             this.emptySpaceItem2,
             this.layoutControlItem12,
             this.layoutControlItem2,
-            this.所有航迹});
+            this.航迹});
             this.Root.Name = "Root";
             this.Root.Size = new System.Drawing.Size(1189, 509);
             this.Root.TextVisible = false;
@@ -240,14 +253,14 @@
             this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0);
             this.layoutControlItem2.TextVisible = false;
             // 
-            // 所有航迹
+            // 航迹
             // 
-            this.所有航迹.Control = this.cbAll;
-            this.所有航迹.Location = new System.Drawing.Point(0, 0);
-            this.所有航迹.Name = "所有航迹";
-            this.所有航迹.Size = new System.Drawing.Size(282, 41);
-            this.所有航迹.TextLocation = DevExpress.Utils.Locations.Top;
-            this.所有航迹.TextSize = new System.Drawing.Size(48, 14);
+            this.航迹.Control = this.searchHj;
+            this.航迹.Location = new System.Drawing.Point(0, 0);
+            this.航迹.Name = "航迹";
+            this.航迹.Size = new System.Drawing.Size(282, 41);
+            this.航迹.TextLocation = DevExpress.Utils.Locations.Top;
+            this.航迹.TextSize = new System.Drawing.Size(48, 14);
             // 
             // dxErrorProvider
             // 
@@ -265,10 +278,11 @@
             this.Load += new System.EventHandler(this.Editor_Load);
             ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit();
             this.layoutControl1.ResumeLayout(false);
-            ((System.ComponentModel.ISupportInitialize)(this.cbAll.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.mapControl)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtSpeed.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtFlightName.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.searchHj.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.searchLookUpEdit1View)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem13)).EndInit();
@@ -278,7 +292,7 @@
             ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem12)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.所有航迹)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.航迹)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.dxErrorProvider)).EndInit();
             this.ResumeLayout(false);
 
@@ -302,7 +316,8 @@
         private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem1;
         private DevExpress.XtraEditors.SimpleButton btnImport;
         private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2;
-        private DevExpress.XtraEditors.ComboBoxEdit cbAll;
-        private DevExpress.XtraLayout.LayoutControlItem 所有航迹;
+        private DevExpress.XtraLayout.LayoutControlItem 航迹;
+        private DevExpress.XtraEditors.SearchLookUpEdit searchHj;
+        private DevExpress.XtraGrid.Views.Grid.GridView searchLookUpEdit1View;
     }
 }

+ 8 - 12
DataSimulation.Forms/EditForms/FlightImport.cs

@@ -55,9 +55,7 @@ namespace DataSimulation.Forms.EditForms
             try
             {
                 var fligths = mapControl.GetFlightLine<FlightInfo>();
-               
                 Addinfo = new List<SimulationInfo>();
-
                 var sims = fligths.Select(f => new SimulationInfo() { SimulationName = f.FlightName, SimulationSpeed = f.Speed });
                 Addinfo.AddRange(sims);
 
@@ -158,10 +156,12 @@ namespace DataSimulation.Forms.EditForms
             }
             try
             {
-                cbAll.Properties.Items.AddRange(flightInfos.Select(m => m.FlightName).ToList());
+                this.searchHj.Properties.DataSource = flightInfos;
+                this.searchHj.Properties.ValueMember = nameof(FlightInfo);
+                this.searchHj.Properties.DisplayMember = nameof(FlightInfo.FlightName);
+                this.searchHj.SetSearchGridLookUpEditMultiSelected<FlightInfo>();
                 if (flightInfos.Count > 0)
                 {
-                    cbAll.SelectedIndex = 0;
                     mapControl.SetFlightLine(flightInfos);
                 }
             }
@@ -172,17 +172,13 @@ namespace DataSimulation.Forms.EditForms
             }
 
         }
-
-        private void cbAll_SelectedValueChanged(object sender, EventArgs e)
+        private void searchHj_EditValueChanged(object sender, EventArgs e)
         {
-            if (flightInfos != null && flightInfos.Count > 0)
+            var selectedValue = searchHj.Properties.Tag.MapTo<List<FlightInfo>>();
+            if (selectedValue != null)
             {
-                var name = cbAll.SelectedItem.ToString();
-                var firstFlight = flightInfos.First(f => f.FlightName == name);
-                this.txtFlightName.Text = firstFlight.FlightName;
-                this.txtSpeed.Text = $"{firstFlight.Speed}";
+                mapControl.SetFlightLine(selectedValue);
             }
-
         }
     }
 }

+ 3 - 0
DataSimulation.Forms/ExtensionsDev/SearchLookUpEditExtension.cs

@@ -1,4 +1,5 @@
 using DevExpress.XtraEditors;
+using DevExpress.XtraEditors.Controls;
 using DevExpress.XtraGrid.Columns;
 using DevExpress.XtraGrid.Views.Grid;
 using System;
@@ -11,6 +12,7 @@ using System.Linq;
 using System.Reflection;
 using System.Text;
 using System.Threading.Tasks;
+using System.Windows.Forms;
 
 namespace ExtensionsDev
 {
@@ -106,6 +108,7 @@ namespace ExtensionsDev
         public static SearchLookUpEdit SetSearchGridLookUpEditMultiSelected<T>(this SearchLookUpEdit ctrl,string nullText = "请选择")
         {
             var view = ctrl.Properties.PopupView as DevExpress.XtraGrid.Views.Grid.GridView;
+          
             view.OptionsSelection.MultiSelect = true;
             view.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CheckBoxRowSelect;
             view.OptionsSelection.CheckBoxSelectorColumnWidth = 45;

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

@@ -0,0 +1,7 @@
+DevExpress.XtraEditors.ButtonEdit, DevExpress.XtraEditors.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.XtraEditors.TextEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraEditors.ImageComboBoxEdit, 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.XtraLayout.LayoutControl, DevExpress.XtraLayout.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraEditors.ComboBoxEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

+ 5 - 1
DataSimulation.Repostory/PosData.cs

@@ -2,7 +2,6 @@
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
 using System.ComponentModel.DataAnnotations.Schema;
-using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder.Spatial;
 
 namespace DataSimulation.Repostory
 {
@@ -168,6 +167,7 @@ namespace DataSimulation.Repostory
         public int ClusterKey { get; set; } = int.MinValue;
     }
 
+    [Serializable]
     public class FlightInfo
     {
         public FlightInfo()
@@ -197,8 +197,12 @@ namespace DataSimulation.Repostory
         public List<FlightData> flights { get; set; }
 
     }
+    [Serializable]
     public class FlightData
     {
+        public FlightData()
+        { 
+        }
         public FlightData(double lon, double lat)
         {
             this.FlightLon = lon;