Ver Fonte

添加频差线

wyq há 1 ano atrás
pai
commit
9e70fdf7e4

+ 1 - 1
XzXdDw.App/Api/PosApi.cs

@@ -86,7 +86,7 @@ namespace XzXdDw.App.Api
         /// <param name="LOP_Len"></param>
         [DllImport(gzdw, EntryPoint = "TwoStar_PCX", CallingConvention = CallingConvention.Cdecl)]//两星一地
         public extern static void TwoStar_PCX(double[] main_sat, double[] neigh_sat, double[] ref_pos,
-            double[] Zone, double target_dfo, double ref_dfo, double fu1, double fu2, IntPtr LOP_Value, int[] LOP_Len);
+            double[] Zone, double target_dfo, double ref_dfo, double fu1, double fu2, out IntPtr LOP_Value, ref int LOP_Len);
 
         /// <summary>
         /// 单星频差线

+ 76 - 0
XzXdDw.App/Api/时差线/DrawDtoLineHelper.cs

@@ -159,5 +159,81 @@ namespace XdCxRhDW.App.Api.时差线
             return Lines;
         }
 
+
+        public static IEnumerable<(double lon, double lat)> HandleDtoLineXZTwoStart(DtoLineTwoStartOption opt)
+        {
+
+            List<DtoLinePoint> list = new List<DtoLinePoint>();
+            IntPtr LOP_ValuePtr;
+            int LOP_Len = 0;
+            double[] zone = new double[] { -85, 85, -180, 180 }; //定位区域
+
+            PosApi.TwoStar_SCX(
+                opt.MsEph,
+                 opt.NsEph,
+                opt.RefGeod,
+                 zone,
+                opt.TargetDto * 1e-6,
+                opt.RefDto * 1e-6, out LOP_ValuePtr, ref LOP_Len);
+            double[] LOP_Value = new double[LOP_Len * 3];
+            if (LOP_Len > 0)
+            {
+                Marshal.Copy(LOP_ValuePtr, LOP_Value, 0, LOP_Value.Length);
+
+                list = OutputHelper.WriteDtoLine(LOP_Value, LOP_Len);
+            }
+            var Lines = list.Select(p => (p.Lon, p.Lat));
+            return Lines;
+        }
+
+        public static IEnumerable<(double lon, double lat)> HandleDfoLineXZTwoStart(DfoLineTwoStartOption opt)
+        {
+
+            List<DtoLinePoint> list = new List<DtoLinePoint>();
+            IntPtr LOP_ValuePtr;
+            int LOP_Len = 0;
+            double[] zone = new double[] { -85, 85, -180, 180 }; //定位区域
+
+            PosApi.TwoStar_PCX(
+                opt.MsEph,
+                 opt.NsEph,
+                opt.RefGeod,
+                 zone,
+                opt.TargetDfo * 1e-6,
+                opt.RefDfo * 1e-6,
+               opt.fu1,
+               opt.fu2, out LOP_ValuePtr, ref LOP_Len);
+            double[] LOP_Value = new double[LOP_Len * 3];
+            if (LOP_Len > 0)
+            {
+                Marshal.Copy(LOP_ValuePtr, LOP_Value, 0, LOP_Value.Length);
+                for (int idx = 0; idx < LOP_Len; ++idx)
+                {
+                    if (LOP_Value[3 * idx + 1] != -1)
+                    {
+                        list.Add(new DtoLinePoint()
+                        {
+                            Lon = LOP_Value[3 * idx + 1],
+                            Lat = LOP_Value[3 * idx]
+                        });
+                    }
+                }
+                for (int idx = 0; idx < LOP_Len; ++idx)
+                {
+                    if (LOP_Value[3 * idx + 2] != -1)
+                    {
+                        list.Add(new DtoLinePoint()
+                        {
+                            Lon = LOP_Value[3 * idx + 2],
+                            Lat = LOP_Value[3 * idx]
+                        });
+                    }
+                }
+            }
+            var Lines = list.Select(p => (p.Lon, p.Lat));
+            return Lines;
+        }
+
+
     }
 }

+ 37 - 0
XzXdDw.App/Api/时差线/DtoLineModel.cs

@@ -103,4 +103,41 @@ namespace XdCxRhDW.App.Api.时差线
         public double PosLat { get; set; }
 
     }
+
+    public class DfoLineTwoStartOption
+    {
+        /// <summary>
+        /// 主星星历
+        /// </summary>
+        public double[] MsEph { get; set; }
+
+        /// <summary>
+        /// 邻星星历
+        /// </summary>
+        public double[] NsEph { get; set; }
+
+        /// <summary>
+        /// 参考站位置
+        /// </summary>
+        public double[] RefGeod { get; set; }
+
+        /// <summary>
+        /// 目标频差 (us)
+        /// </summary>
+        public double TargetDfo { get; set; }
+        /// <summary>
+        /// 参考频差 (us)
+        /// </summary>
+        public double RefDfo { get; set; }
+
+        /// <summary>
+        /// 上行频点1
+        /// </summary>
+        public double fu1 { get; set; }
+        /// <summary>
+        /// 上行频点2
+        /// </summary>
+        public double fu2 { get; set; }
+
+    }
 }

+ 110 - 1
XzXdDw.App/UserControl/CtrlPosXz.cs

@@ -21,6 +21,7 @@ using System.Windows.Controls;
 using System.Windows.Documents;
 using System.Windows.Forms;
 using XdCxRhDW.App.Api.时差粗值预测;
+using XdCxRhDW.App.Api.时差线;
 using XdCxRhDW.App.DTO;
 using XdCxRhDW.App.UserControl;
 using XzXdDw.App.Api;
@@ -82,6 +83,8 @@ namespace XzXdDw.App.UserControl
                         }
                     })
                     .AddMenu("加载仿真数据", SvgHelper.LoadFromFile("Image\\LoadData.svg"), LoadTestData)
+                     .AddMenu("绘制时差线", SvgHelper.LoadFromFile("Image\\DrawLine.svg"), DrawDtoLine)
+                       .AddMenu("绘制频差线", SvgHelper.LoadFromFile("Image\\DrawLine.svg"), DrawDfoLine)
                     .AddMenu("停止加载", SvgHelper.LoadFromFile("Image\\Stop.svg"), () => stoped = true);
 
 
@@ -147,7 +150,7 @@ namespace XzXdDw.App.UserControl
         {
             stoped = false;
 
-         
+
 
             //在列表控件中全选+右键可以删除所有测试结果
             using (RHDWContext db = new RHDWContext())
@@ -249,7 +252,113 @@ namespace XzXdDw.App.UserControl
             }
         }
 
+        private  void DrawDtoLine()
+        {
+            try
+            {
+                var ids = gridView1.GetSelectedRows();
+                if (ids.Length <= 0)
+                {
+                    XtraMessageBox.Show("请选择需要绘制时差线的定位数据信息!");
+                    return;
+                }
+                var item = gridView1.GetRow(ids[0]) as PosRes;
+                //List<TxInfo> listTx = new List<TxInfo>();
+                //List<Model.SatInfo> listSat = new List<Model.SatInfo>();
+                //CgRes cg;
+                //using (RHDWContext db = new RHDWContext())
+                //{
+                //    listTx = db.TxInfos.ToList();
+                //    listSat = db.SatInfos.ToList();
+                //    cg = await db.CgRes.Where(m => m.ID == item.CgResID).FirstOrDefaultAsync();
+
+                //}
+                //if (cg == null)
+                //{
+                //    XtraMessageBox.Show($"未找到定位相关的计算[{item.CgResID}]信息");
+                //    return;
+                //}
+                //var satTx = listTx.Find(p => p.TxType == EnumTxType.MainSat);
+                //var satNTx = listTx.Find(p => p.TxType == EnumTxType.AdjaSat);
+                //var cdbTx = listTx.Find(p => p.TxType == EnumTxType.Cdb);
+                //var refTx = listTx.Find(p => p.TxType == EnumTxType.Ref);
+
+
+
+                double[] main_sat = { -1608409.905, 5994264.071, 3139843.443, -6633.016931, -374.023436, -2678.158046 };
+                double[] neigh_sat = { -4629566.829, 4978943.601, 1487242.596, -4890.245126, -3337.702797, -4031.339975 };
+                double[] Ref_Station_LLH = { 112.33, 16.3, 0 };
+                double[] Zone = { -80, 80, -150, 150 };
 
+                double target_dto = -0.010246009710722;
+
+                double ref_dto = 0.002823291225258;
+
+
+                DtoLineTwoStartOption twoStartOption = new DtoLineTwoStartOption();
+                twoStartOption.MsEph = main_sat;
+                twoStartOption.NsEph = neigh_sat;
+                twoStartOption.RefGeod = Ref_Station_LLH;
+                twoStartOption.TargetDto = target_dto * 1e6;
+                twoStartOption.RefDto = ref_dto * 1e6;
+
+                var tsDtoLine = DrawDtoLineHelper.HandleDtoLineXZTwoStart(twoStartOption);
+                mapControl1.DrawDtoLine($"双星时差线", tsDtoLine);
+
+
+            }
+            catch (Exception ex)
+            {
+                Serilog.Log.Error("绘制时差线失败", ex);
+                XtraMessageBox.Show($"绘制时差线失败,失败信息:{ex.Message}");
+            }
+        }
+        private  void DrawDfoLine()
+        {
+            try
+            {
+                var ids = gridView1.GetSelectedRows();
+                if (ids.Length <= 0)
+                {
+                    XtraMessageBox.Show("请选择需要绘制频差线的定位数据信息!");
+                    return;
+                }
+                var item = gridView1.GetRow(ids[0]) as PosRes;
+              
+
+                double[] main_sat = { -1608409.905, 5994264.071, 3139843.443, -6633.016931, -374.023436, -2678.158046 };
+                double[] neigh_sat = { -4629566.829, 4978943.601, 1487242.596, -4890.245126, -3337.702797, -4031.339975 };
+                double[] Ref_Station_LLH = { 112.33, 16.3, 0 };
+                double[] Zone = { -80, 80, -150, 150 };
+
+              
+                double target_dfo = 1.595360344349182e+03;
+
+                double ref_dfo = 1.132007974492508e+04;
+
+                double fu1 = 3.1085e8;
+                double fu2 = 2.95e8;
+
+                DfoLineTwoStartOption twoStartOption = new DfoLineTwoStartOption();
+                twoStartOption.MsEph = main_sat;
+                twoStartOption.NsEph = neigh_sat;
+                twoStartOption.RefGeod = Ref_Station_LLH;
+                twoStartOption.TargetDfo = target_dfo * 1e6;
+                twoStartOption.RefDfo = ref_dfo * 1e6;
+                twoStartOption.fu1 = fu1;
+                twoStartOption.fu2 = fu2;
+
+                var tsDtoLine = DrawDtoLineHelper.HandleDfoLineXZTwoStart(twoStartOption);
+                mapControl1.DrawDtoLine($"双星频差线", tsDtoLine);
+
+
+            }
+            catch (Exception ex)
+            {
+                Serilog.Log.Error("绘制频差线失败", ex);
+                XtraMessageBox.Show($"绘制频差线失败,失败信息:{ex.Message}");
+            }
+        }
         public XdCxRhDW.App.DTO.MapLine SampleDots(XdCxRhDW.App.DTO.MapLine line)
         {
             var dots = line.Line;