using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using DevExpress.XtraBars.Docking2010.Views.Widget; using Extensions; using XzXdDw.App.Model; using static System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox; using static DevExpress.XtraPrinting.Native.ExportOptionsPropertiesNames; namespace XdDw.App.Api { public static class PosApi { #region cpp dll Interop //两星一地定位 private const string X2D1 = @"AddIns\DLL_SC_2X1D_DW.dll"; [DllImport(X2D1, EntryPoint = "SC_2X1D_DW", CallingConvention = CallingConvention.Cdecl)]//两星一地 private extern static void X2D1_POS_Core(double[] mainSat, double[] adjaSat, double[] cdbStation, double[] satStation1, double[] satStation2, double[] satStation3, double[] satStation4, double[] satStation5, double[] refStation, double[] zone, double tarSxDto, double tarXdDto, double samp_main_dto, double samp_neigh_dto, double[] res); private const string XdtsDll = @"Api\时差线\Positioning.dll"; /// /// /// /// /// /// /// /// /// /// 目标时差 (s) /// 参考时差 (s) /// /// [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); #endregion /// /// 两星一地,返回经度纬度高度及镜像点,数组长度为6 /// /// /// public static double[] X2D1_POS(CgRes cgRes, List listTx) { var satTx = listTx.Find(p => p.TxType == EnumTxType.MainSat); var cdbTx = listTx.Find(p => p.TxType == EnumTxType.Cdb); var refTx = listTx.Find(p => p.TxType == EnumTxType.Ref); double[] mainSat = new double[3] { cgRes.MainX, cgRes.MainY, cgRes.MainZ }; double[] adjaSat = new double[3] { cgRes.AdjaX, cgRes.AdjaY, cgRes.AdjaZ }; double[] satStation = new double[3] { satTx.Lon, satTx.Lat, 0 }; double[] cdbStation = new double[3] { cdbTx.Lon, cdbTx.Lat, 0 }; double[] refStation = new double[3] { refTx.Lon, refTx.Lat, 0 }; double[] zone = new double[] { -85, 85, -180, 180 }; //定位区域 double[] res = new double[6]; X2D1_POS_Core(mainSat, adjaSat, cdbStation, satStation, satStation, satStation, satStation, satStation, refStation, zone, cgRes.DtoSx / 1e6, cgRes.DtoCdb / 1e6, cgRes.YbMain / 1e6, cgRes.YbAdja / 1e6, res); return res; } public static double[] X2D1_POS(CgRes cgRes, TxInfo satTx, TxInfo cdbTx, TxInfo refTx) { double[] mainSat = new double[3] { cgRes.MainX, cgRes.MainY, cgRes.MainZ }; double[] adjaSat = new double[3] { cgRes.AdjaX, cgRes.AdjaY, cgRes.AdjaZ }; double[] satStation = new double[3] { satTx.Lon, satTx.Lat, 0 }; double[] cdbStation = new double[3] { cdbTx.Lon, cdbTx.Lat, 0 }; double[] refStation = new double[3] { refTx.Lon, refTx.Lat, 0 }; double[] zone = new double[] { -85, 85, -180, 180 }; //定位区域 double[] res = new double[6]; X2D1_POS_Core(mainSat, adjaSat, cdbStation, satStation, satStation, satStation, satStation, satStation, refStation, zone, cgRes.DtoSx / 1e6, cgRes.DtoCdb / 1e6, cgRes.YbMain / 1e6, cgRes.YbAdja / 1e6, res); return res; } } }