wyq hace 1 año
padre
commit
dc873df5a6

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

@@ -745,6 +745,9 @@ namespace XdCxRhDW.App.UserControl
                 case EnumPosResType.X2D1:
                     DrawXDtoLine(item);
                     break;
+                case EnumPosResType.X2D1NoRef:
+                    DrawXDNoRefDtoLine(item);
+                    break;
                 case EnumPosResType.X3:
                 case EnumPosResType.X2Dfo:
                     DrawX3toLine(item);
@@ -843,6 +846,80 @@ namespace XdCxRhDW.App.UserControl
             }
         }
 
+        private async void DrawXDNoRefDtoLine(PosRes item)
+        {
+            try
+            {
+                StationRes station;
+                List<SatInfo> listSat = new List<SatInfo>();
+                CgRes cg;
+                using (RHDWContext db = new RHDWContext())
+                {
+
+                    listSat = db.SatInfos.ToList();
+                    cg = await db.CgRes.Where(m => m.ID == item.CgResID).FirstOrDefaultAsync();
+                    station = await db.StationRes.Where(m => m.ID == item.StationResID).FirstOrDefaultAsync();
+                }
+                if (cg == null)
+                {
+                    DxHelper.MsgBoxHelper.ShowWarning($"未找到定位相关的计算[{item.CgResID}]信息");
+                    return;
+                }
+                if (station == null)
+                {
+                    DxHelper.MsgBoxHelper.ShowWarning($"站点信息为空!");
+                    return;
+                }
+                if (station.SatTxLon == 0 || station.SatTxLat == 0)
+                {
+                    DxHelper.MsgBoxHelper.ShowWarning($"天线信息为空!");
+                    return;
+                }
+
+                if (station.CdbTxLon == 0 || station.CdbTxLat == 0)
+                {
+                    DxHelper.MsgBoxHelper.ShowWarning($"超短波信息为空!");
+                    return;
+                }
+                DtoLineXdOption dtoLineXd = new DtoLineXdOption();
+                dtoLineXd.MsEph = new double[] { cg.MainX.Value, cg.MainY.Value, cg.MainZ.Value, 0, 0, 0 };
+                dtoLineXd.MsAnt = new double[] { station.SatTxLon, station.SatTxLat, 0 };
+                dtoLineXd.CDBAnt = new double[] { station.CdbTxLon.Value, station.CdbTxLat.Value, 0 };
+                dtoLineXd.xdDto = cg.DtoCdb.Value;
+                dtoLineXd.PosLon = item.PosLon;
+                dtoLineXd.PosLat = item.PosLat;
+                string msat = string.Empty;
+                if (cg.MainCode.HasValue)
+                {
+                    msat = listSat.FirstOrDefault(m => m.SatCode == cg.MainCode.Value)?.Sat;
+                }
+                var xdDtoLine = DrawDtoLineHelper.DtoLineXdNoRef(dtoLineXd);
+                mapControl1.DrawDtoPonit($"星地[{msat},[{station.CdbTxLon}°]]时差线", xdDtoLine);
+
+                DtoLineTwoStartOption twoStartOption = new DtoLineTwoStartOption();
+                twoStartOption.MsEph = new double[] { cg.MainX.Value, cg.MainY.Value, cg.MainZ.Value, 0, 0, 0 };
+                twoStartOption.NsEph = new double[] { cg.Adja1X.Value, cg.Adja1Y.Value, cg.Adja1Z.Value, 0, 0, 0 };
+                twoStartOption.MsAnt = new double[] { station.SatTxLon, station.SatTxLat, 0 };
+                twoStartOption.NsAnt = new double[] { station.SatTxLon, station.SatTxLat, 0 };
+                twoStartOption.TargetDto = cg.Dto1.Value;
+                twoStartOption.RefDto = 0;
+                twoStartOption.PosLon = item.PosLon;
+                twoStartOption.PosLat = item.PosLat;
+                string ad1sat = string.Empty;
+                if (cg.Adja1Code.HasValue)
+                {
+                    ad1sat = listSat.FirstOrDefault(m => m.SatCode == cg.Adja1Code.Value)?.Sat;
+                }
+                var tsDtoLine = DrawDtoLineHelper.DtoLine2XNoRefStart(twoStartOption);
+                mapControl1.DrawDtoPonit($"双星[{msat},{ad1sat}]时差线", tsDtoLine);
+            }
+            catch (Exception ex)
+            {
+                Serilog.Log.Error($"绘制{item.PosResType.GetEnumDisplayName()}时差线失败", ex);
+                DxHelper.MsgBoxHelper.ShowWarning($"绘制{item.PosResType.GetEnumDisplayName()}时差线失败,失败信息:{ex.Message}");
+            }
+        }
+
         private async void DrawX3toLine(PosRes item)
         {
             try

+ 2 - 2
XdCxRhDW.App/UserControl/X2D1GDOPParam.cs

@@ -19,8 +19,8 @@ namespace XdCxRhDW.App.UserControl
             CapTime = txtCapTime.DateTime,
             StationLon = Convert.ToDouble(txtStationLocation1.Text.Replace(",", ",").Split(',')[0].Trim()),
             StationLat = Convert.ToDouble(txtStationLocation1.Text.Replace(",", ",").Split(',')[1].Trim()),
-            RefLon = Convert.ToDouble(txtRefLocation1.Text.Replace(",", ",").Split(',')[0].Trim()),
-            RefLat = Convert.ToDouble(txtRefLocation1.Text.Replace(",", ",").Split(',')[1].Trim()),
+            RefLon = PosResType == EnumPosResType.X2D1NoRef ? 0 : Convert.ToDouble(txtRefLocation1.Text.Replace(",", ",").Split(',')[0].Trim()),
+            RefLat = PosResType == EnumPosResType.X2D1NoRef ? 0 : Convert.ToDouble(txtRefLocation1.Text.Replace(",", ",").Split(',')[1].Trim()),
             DtousErr = Convert.ToDouble(txtDtousErr1.Text),
             SatLocErr = Convert.ToDouble(txtSatLocErr1.Text),
         };

+ 3 - 3
XdCxRhDW.App/UserControl/X3GDOPParam.cs

@@ -18,8 +18,8 @@ namespace XdCxRhDW.App.UserControl
             TleAdja1 = txtTleAdja1.Text.Trim(),
             TleAdja2 = txtTleAdja2.Text.Trim(),
             CapTime = txtCapTime.DateTime,
-            RefLon = Convert.ToDouble(txtRefLocation1.Text.Replace(",", ",").Split(',')[0].Trim()),
-            RefLat = Convert.ToDouble(txtRefLocation1.Text.Replace(",", ",").Split(',')[1].Trim()),
+            RefLon = PosResType == EnumPosResType.X3NoRef ? 0 : Convert.ToDouble(txtRefLocation1.Text.Replace(",", ",").Split(',')[0].Trim()),
+            RefLat = PosResType == EnumPosResType.X3NoRef ? 0 : Convert.ToDouble(txtRefLocation1.Text.Replace(",", ",").Split(',')[1].Trim()),
             DtousErr = Convert.ToDouble(txtDtousErr1.Text),
             SatLocErr = Convert.ToDouble(txtSatLocErr1.Text),
         };
@@ -36,7 +36,7 @@ namespace XdCxRhDW.App.UserControl
             this.txtDtousErr1.EditValue = 1;
             this.txtSatLocErr1.EditValue = 1000;
 
-            PosResType =  item.PosResType;
+            PosResType = item.PosResType;
             if (PosResType == EnumPosResType.X3NoRef)
             {
                 layoutControlItem14.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;

BIN
XdCxRhDW.Core/Api/GDOP误差椭圆/GDOP/mfc100u.dll


BIN
XdCxRhDW.Core/Api/GDOP误差椭圆/GDOP/msvcr100.dll


+ 10 - 10
XdCxRhDW.Core/Api/GDOP误差椭圆/GDOPAPi.cs

@@ -27,7 +27,7 @@ namespace XdCxRhDW.Core.Api
         /// satllh :卫星位置
         /// 返回值:0 成功
         ///
-        [DllImport(GDOPDll, CallingConvention = CallingConvention.Cdecl)]
+        [DllImport(GDOPDll, EntryPoint = "Gdop3SatRef", CallingConvention = CallingConvention.Cdecl)]
         public static extern int Gdop3SatRef(string mainLines, string adajLines, string adaj2Lines, Int64 captime, double[] refPos
             , double dtousErr, double ephLocErr
             , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
@@ -47,7 +47,7 @@ namespace XdCxRhDW.Core.Api
         /// satllh :卫星位置
         /// 返回值:0 成功
         ///
-        [DllImport(GDOPDll, CallingConvention = CallingConvention.Cdecl)]
+        [DllImport(GDOPDll, EntryPoint = "Gdop3SatNoRef", CallingConvention = CallingConvention.Cdecl)]
         public static extern int Gdop3SatNoRef(string mainLines, string adajLines, string adaj2Lines, Int64 captime
             , double dtousErr, double ephLocErr
             , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
@@ -71,7 +71,7 @@ namespace XdCxRhDW.Core.Api
         /// satllh :卫星位置
         /// 返回值:0 成功
         ///
-        [DllImport(GDOPDll, CallingConvention = CallingConvention.Cdecl)]
+        [DllImport(GDOPDll, EntryPoint = "Gdop2SatDRef", CallingConvention = CallingConvention.Cdecl)]
         public static extern int Gdop2SatDRef(string mainLines, string adajLines, Int64 captime, double[] refPos
             , double fuHz1, double fuHz2, double dtousErr, double dfoHzErr, double ephLocErr, double ephVLocErr
            , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
@@ -95,7 +95,7 @@ namespace XdCxRhDW.Core.Api
         /// satllh :卫星位置
         /// 返回值:0 成功
         ///
-        [DllImport(GDOPDll, CallingConvention = CallingConvention.Cdecl)]
+        [DllImport(GDOPDll, EntryPoint = "Gdop3SatDF", CallingConvention = CallingConvention.Cdecl)]
         public static extern int Gdop3SatDF(string mainLines, string adajLines, string adaj2Lines, Int64 captime, double[] refPos
             , double fuHz1, double fuHz2, double dfo_err, double eph_pos_err, double eph_vel_err
             , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
@@ -116,7 +116,7 @@ namespace XdCxRhDW.Core.Api
         /// satllh :卫星位置  长度6
         /// 返回值:0 成功
         ///
-        [DllImport(GDOPDll, CallingConvention = CallingConvention.Cdecl)]
+        [DllImport(GDOPDll, EntryPoint = "Gdop2Sat1DRef", CallingConvention = CallingConvention.Cdecl)]
         public static extern int Gdop2Sat1DRef(string mainLines, string adajLines, Int64 captime, double[] cdbPos
         , double[] refPos, double dtousErr, double ephLocErr
         , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
@@ -137,7 +137,7 @@ namespace XdCxRhDW.Core.Api
         /// satllh :卫星位置  长度6
         /// 返回值:0 成功
         ///
-        [DllImport(GDOPDll, CallingConvention = CallingConvention.Cdecl)]
+        [DllImport(GDOPDll, EntryPoint = "Gdop2Sat1DNoRef", CallingConvention = CallingConvention.Cdecl)]
         public static extern int Gdop2Sat1DNoRef(string mainLines, string adajLines, Int64 captime, double[] cdbPos,
             double dtousErr, double ephLocErr
         , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
@@ -159,7 +159,7 @@ namespace XdCxRhDW.Core.Api
         /// satllh :卫星位置  长度6
         /// 返回值:0 成功
         ///
-        [DllImport(GDOPDll, CallingConvention = CallingConvention.Cdecl)]
+        [DllImport(GDOPDll, EntryPoint = "GdopXDCXRef", CallingConvention = CallingConvention.Cdecl)]
         public static extern int GdopXDCXRef(string mainLines, Int64 captime, double[] cdbPos, double[] cxPos, double[] refPos
             , double dtoErr, double doaErr, double ephLocErr
             , double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
@@ -181,7 +181,7 @@ namespace XdCxRhDW.Core.Api
         /// satllh :卫星位置  长度6
         /// 返回值:0 成功
         ///
-        [DllImport(GDOPDll, CallingConvention = CallingConvention.Cdecl)]
+        [DllImport(GDOPDll, EntryPoint = "GdopXDCXNoRef", CallingConvention = CallingConvention.Cdecl)]
         public static extern int GdopXDCXNoRef(string mainLines, Int64 captime, double[] cdbPos, double[] cxPos
             , double dtousErr, double doaErr, double ephLocErr, double[] level, int levlen, int[] resCount, out IntPtr res, double[] satllh);
 
@@ -198,12 +198,12 @@ namespace XdCxRhDW.Core.Api
         /// satllh :卫星位置  长度6
         /// 返回值:0 成功
         ///
-        [DllImport(GDOPDll, CallingConvention = CallingConvention.Cdecl)]
+        [DllImport(GDOPDll, EntryPoint = "Gdop2CX", CallingConvention = CallingConvention.Cdecl)]
         public static extern int Gdop2CX(double[] cx1Pos, double[] cx2Pos
             , double doaErr1, double doaErr2, double[] level, int levlen, int[] resCount, out IntPtr res);
 
 
-        [DllImport(GDOPDll, CallingConvention = CallingConvention.Cdecl)]
+        [DllImport(GDOPDll, EntryPoint = "FreeGDOPBuf", CallingConvention = CallingConvention.Cdecl)]
         public static extern void FreeGDOPBuf(IntPtr val);
 
     }

+ 37 - 2
XdCxRhDW.Core/Api/时差线/DrawDtoLineHelper.cs

@@ -12,9 +12,17 @@ namespace XdCxRhDW.Core.Api
 {
     public class DrawDtoLineHelper
     {
-
         private const string XdtsDll = @"Api\时差线\Positioning.dll";
 
+        //三星双时差带参、三星双时差无参、三星双频差带参、双星时频差带参、两星一地无参定位及时差线
+        private const string xddtodll = @"AddIns\DLL_11J_DW.dll";
+
+        [DllImport(xddtodll, EntryPoint = "XingDi_SCX_NoRef", CallingConvention = CallingConvention.Cdecl)]//高轨双星有参时差线
+        public extern static void XingDi_SCX_NoRef(double[] main_sat_pos, double[] mbwx_rec_pos, double[] cdb_rec_pos,
+           double[] Zone, double target_dto, out IntPtr LOP_Value, ref int LOP_Len);
+
+
+
         [DllImport(XdtsDll, EntryPoint = "CurveByTwoTDOA", CallingConvention = CallingConvention.Cdecl)]//高轨双星有参时差线
         public extern static void CurveByTwoTDOA(double[] main_sat_pos, double[] neigh_sat_pos, double[] rec1_pos, double[] rec2_pos, double[] ref_pos, double[] Zone,
       double target_dto, double ref_dto, out IntPtr LOP_Value, ref int LOP_Len);
@@ -38,7 +46,7 @@ namespace XdCxRhDW.Core.Api
 
         private const string locexeName = "locow.exe";
         /// <summary>
-        /// 星地时差线
+        /// 星地有参时差线
         /// </summary>
         /// <param name="opt"></param>
         /// <returns></returns>
@@ -110,6 +118,33 @@ namespace XdCxRhDW.Core.Api
             return Lines;
         }
 
+        /// <summary>
+        /// 星地无参时差线
+        /// </summary>
+        /// <param name="opt"></param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        public static IEnumerable<(double lon, double lat)> DtoLineXdNoRef(DtoLineXdOption opt)
+        {
+
+            List<DtoLinePoint> list = new List<DtoLinePoint>();
+
+            IntPtr LOP_ValuePtr;
+            int LOP_Len = 0;
+
+            XingDi_SCX_NoRef(opt.MsEph, opt.MsAnt, opt.CDBAnt,
+            zone, opt.xdDto * 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;
+        }
+
         /// <summary>
         /// 高轨双星时差线
         /// </summary>

+ 8 - 0
XdCxRhDW.Core/XdCxRhDW.Core.csproj

@@ -152,5 +152,13 @@
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
   </ItemGroup>
+  <ItemGroup>
+    <Content Include="Api\GDOP误差椭圆\GDOP\mfc100u.dll">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Api\GDOP误差椭圆\GDOP\msvcr100.dll">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 2 - 0
XdCxRhDW.WebApi/Startup.cs

@@ -52,7 +52,9 @@ namespace XdCxRhDW.WebApi
         public void Configuration(IAppBuilder app)
         {
             //启用目录浏览和静态文件
+            Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot"));
             var physicalFileSystem = new PhysicalFileSystem(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot"));//目录浏览物理地址
+           
             var options = new FileServerOptions
             {
                 RequestPath = new PathString("/wwwroot"),//目录浏览地址