zoulei hai 1 ano
pai
achega
57167ea223

+ 1 - 1
XdCxRhDW.App/App.config

@@ -23,7 +23,7 @@
 		<add key="SJZX_URL" value="http://192.168.1.7:5889/MapServer" />
 
 		<!--地图定位点聚合-->
-		<add key="UseMapCluster" value="1" />
+		<add key="UseMapCluster" value="0" />
 
 		<!--两星一地无参定位算法使用新算法-->
 		<add key="UseNewPosX2D1NoRef" value="1" />

+ 17 - 6
XdCxRhDW.App/DxHelper/SvgHelper.cs

@@ -1,5 +1,4 @@
-using DevExpress.Drawing.Internal.Fonts.Interop;
-using DevExpress.Utils;
+using DevExpress.Utils;
 using DevExpress.Utils.Svg;
 using System;
 using System.Collections.Generic;
@@ -333,6 +332,18 @@ namespace DxHelper
             return svg;
         }
 
+        public static SvgImage CreateImport(int width = 24, int height = 24)
+        {
+            string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
+                       + $"<path fill='#727272' d='M12,12H8V6h4V12z M24,17v1v9c0,0.6-0.4,1-1,1H3c-0.6,0-1-0.4-1-1V7c0-0.6,0.4-1,1-1h3v8h14L24,17z M20,18H6v6h14V18z'/>"
+                       + "<polygon fill='#039C23' points='32,6 24,6 24,2 16,8 24,14 24,10 32,10'/>"
+                       + "</svg>";
+            MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
+            var svg = SvgLoader.LoadFromStream(ms);
+            ms.Dispose();
+            return svg;
+        }
+
         /// <summary>
         /// 导出Excel图片
         /// </summary>
@@ -544,7 +555,7 @@ namespace DxHelper
         {
             string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
                 + $"<circle fill='#039C23' cx='9' cy='9' r='7'/>"
-                +$"<path fill='#FFB115' d='M24.5,2.4c0.3-0.6,0.8-0.6,1.1,0l6.3,12.5c0.3,0.6,0.1,1.1-0.5,1.1H18.7c-0.6,0-0.8-0.5-0.5-1.1L24.5,2.4z'/>"
+                + $"<path fill='#FFB115' d='M24.5,2.4c0.3-0.6,0.8-0.6,1.1,0l6.3,12.5c0.3,0.6,0.1,1.1-0.5,1.1H18.7c-0.6,0-0.8-0.5-0.5-1.1L24.5,2.4z'/>"
                 + $"<path fill='#D11C1C' d='M2.4,25.9c-0.5-0.5-0.5-1.3,0-1.8l5.7-5.7c0.5-0.5,1.3-0.5,1.8,0l5.7,5.7c0.5,0.5,0.5,1.3,0,1.8l-5.7,5.7 c-0.5,0.5-1.3,0.5-1.8,0L2.4,25.9z'/>"
                 + "</svg>";
             MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
@@ -561,7 +572,7 @@ namespace DxHelper
             string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
                 + $"<polygon fill='#039C23' points='4,8 10,2 16,8 12,8 12,14 8,14 8,8'/>"
                 + $"<path fill='#FFB115' d='M19.5,4H28v8.5l-2.8-2.8l-4.2,4.2l-2.8-2.8l4.2-4.2L19.5,4z M14,19.5V28H5.5l2.8-2.8l-4.2-4.2l2.8-2.8l4.2,4.2L14,19.5z'/>"
-                +$"<polygon fill='#D11C1C' points='18,24 24,30 30,24 26,24 26,18 22,18 22,24'/>"
+                + $"<polygon fill='#D11C1C' points='18,24 24,30 30,24 26,24 26,18 22,18 22,24'/>"
                 + "</svg>";
             MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
             var svg = SvgLoader.LoadFromStream(ms);
@@ -572,7 +583,7 @@ namespace DxHelper
         /// Info
         /// </summary>
         /// <returns></returns>
-        public static SvgImage CreateInfo (string color= "#1177D7", int width = 24, int height = 24)
+        public static SvgImage CreateInfo(string color = "#1177D7", int width = 24, int height = 24)
         {
             string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
                 + $"<path fill='{color}' d='M16,2C8.3,2,2,8.3,2,16s6.3,14,14,14s14-6.3,14-14S23.7,2,16,2z M16,6c1.1,0,2,0.9,2,2s-0.9,2-2,2s-2-0.9-2-2S14.9,6,16,6z M20,24h-8v-2h2v-8h-2v-2h2h4v10h2V24z'/>"
@@ -587,7 +598,7 @@ namespace DxHelper
         /// Warning
         /// </summary>
         /// <returns></returns>
-        public static SvgImage CreateWarning(string color= "#FFB115", int width = 24, int height = 24)
+        public static SvgImage CreateWarning(string color = "#FFB115", int width = 24, int height = 24)
         {
             string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
                 + $"<path fill='{color}' d='M14.9,4.7c0.6-1,1.5-1,2.1,0l12.7,21.5c0.6,1,0.1,1.8-1,1.8H3.3c-1.2,0-1.6-0.8-1-1.8L14.9,4.7z'/>"

+ 36 - 5
XdCxRhDW.App/ExtensionsDev/MapControlEx.cs

@@ -621,7 +621,7 @@ public static class MapControlEx
     }
 
     /// <summary>
-    /// 定位图层数据源添加一个定位点
+    /// 定位图层数据源添加一个定位点(如果需要一次性添加很多个点,请使用AddPosItems)
     /// </summary>
     /// <typeparam name="T"></typeparam>
     /// <param name="ctrl"></param>
@@ -646,6 +646,37 @@ public static class MapControlEx
         innerData.posStorge.Items.Add(mapItem);
 
     }
+    /// <summary>
+    /// 定位图层数据源添加多个定位点
+    /// </summary>
+    /// <typeparam name="T"></typeparam>
+    /// <param name="ctrl"></param>
+    /// <param name="items"></param>
+    public static void AddPosItems<T>(this MapControl ctrl, IEnumerable<T> items) where T : PosData, new()
+    {
+        var innerData = ctrl.Tag as InnerData;
+        List<MapDot> list = new List<MapDot>();
+        foreach (var item in items)
+        {
+            if (item.PosLon > 180) return;
+            var mapItem = new MapDot()
+            {
+                EnableHighlighting = DefaultBoolean.True,
+                EnableSelection = DefaultBoolean.False,
+                CanMove = false,
+                Visible = item.Visible,
+                IsHitTestVisible = true,
+                Fill = ColorHelper.IsHtmlColor(item.ColorKey) ? ColorTranslator.FromHtml(item.ColorKey) : ColorHelper.GetColor(item.ColorKey),
+                Size = _dotSize,
+                Tag = item,
+                Location = new GeoPoint(item.PosLat, item.PosLon)
+            };
+            list.Add(mapItem);
+            innerData._dataCache.Add(item, mapItem);
+        }
+        innerData.posStorge.Items.AddRange(list);
+    }
+
 
     /// <summary>
     /// 定位图层数据源删除定位点
@@ -1678,12 +1709,12 @@ public static class MapControlEx
         {
             polyLine.TitleOptions.Pattern = title;
         }
-        
+
         foreach (var item in lines)
         {
             if (double.IsNaN(item.lat) || double.IsNaN(item.lon)) continue;
             polyLine.Points.Add(new GeoPoint(item.lat, item.lon));
-            
+
         }
         if (!polyLine.Points.Any())
         {
@@ -1693,11 +1724,11 @@ public static class MapControlEx
         {
             return polyLine;
         }
-       
+
 
     }
 
-    public static MapPolyline GetLine(this MapControl ctrl, string title, IEnumerable<(double lon, double lat)> lines,bool isShowPattern=false)
+    public static MapPolyline GetLine(this MapControl ctrl, string title, IEnumerable<(double lon, double lat)> lines, bool isShowPattern = false)
     {
         if (lines == null || !lines.Any()) return null;
         var polyLine = new MapPolyline()

+ 25 - 0
XdCxRhDW.App/UserControl/CtrlHome.cs

@@ -19,6 +19,7 @@ using System.Linq;
 using System.Net;
 using System.Threading;
 using System.Threading.Tasks;
+using System.Windows.Documents;
 using System.Windows.Forms;
 using XdCxRhDW.Api;
 using XdCxRhDW.App.EditForms;
@@ -120,6 +121,30 @@ namespace XdCxRhDW.App.UserControl
                 mapControl1.UseLocalDb();
                 return;
             }
+
+#warning 项目测试专用
+            mapControl1.AddMapMenu("导入航迹", SvgHelper.CreateImport(), (double lon, double lat) =>
+            {
+                Random r = new Random();
+                List<PosData> list = new List<PosData>();
+                DateTime dt = new DateTime(2024, 03, 18, 13, 42, 53, 125);
+                for (int i = 0; i < 185; i++)
+                {
+                    list.Add(new PosData()
+                    {
+                        ColorKey = "航机目标",
+                        //TODO 这里需要拿到一星一地定位结果导出,然后模拟一些满足定位经度的真实点位,暂时使用随机数
+                        PosLon = r.Next(100, 130) + Math.Round(r.NextDouble(), 4),
+                        PosLat = r.Next(11, 20) + Math.Round(r.NextDouble(), 4),
+                        Confidence = 100,
+                        SigTime = dt,
+                    });
+                    dt = dt.AddSeconds(1000).AddSeconds(i).AddMilliseconds(267);
+                }
+                mapControl1.AddPosItems(list);
+
+            });
+
             OnSysSetingsChanged(SysConfig.Config);
 
             try

+ 3 - 1
XdCxRhDW.Sender/Form1.cs

@@ -60,6 +60,7 @@ namespace XdCxRhDW.Sender
                                     var lines = File.ReadAllLines("Simulation_Data2023.dat");
                                     int idx = 1;
                                     url += "PosX1D1Async";
+                                    DateTime dt = new DateTime(2024, 03, 18, 13, 42, 53, 125);
                                     foreach (var line in lines)
                                     {
                                         if (cts1.IsCancellationRequested) break;
@@ -77,7 +78,7 @@ namespace XdCxRhDW.Sender
                                         };
                                         X1D1PosDto dto = new X1D1PosDto()
                                         {
-                                            SigTime = DateTime.Now,
+                                            SigTime = dt,
                                             MainCode = 23467,
                                             XdDto = Convert.ToDouble(items[1]) * 1e6,
                                             MainYbDto = Convert.ToDouble(items[2]) * 1e6,
@@ -107,6 +108,7 @@ namespace XdCxRhDW.Sender
                                         }
                                         //Thread.Sleep(1000);
                                         Log($"已向[{txtAddr1.Text}]发送第{idx++}条仿真结果");
+                                        dt = dt.AddSeconds(1000).AddSeconds(idx).AddMilliseconds(267);
                                     }
                                 }
                                 if (tskType == "X2D1")//两星一地定位