using DevExpress.XtraEditors; using DevExpress.XtraMap; using DxHelper; using ExtensionsDev; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using XdCxRhDW.App.Api.星历推算; using XzXdDw.App; using XzXdDw.App.EFContext; using XzXdDw.App.Model; namespace XdCxRhDW.App.UserControl { public partial class DXErrEllipseParam : DevExpress.XtraEditors.XtraUserControl { public MapControl mapControl1; public double lon; public double lat; public ErrEllipse单星协同接口 Model => new ErrEllipse单星协同接口() { TleMain = txtTleMain.Text.Trim(), CapTime = txtCapTime.DateTime, CapTime1=txtCapTime1.DateTime, CapTime2=txtCapTime2.DateTime, DfoErr = Convert.ToDouble(txtDfoErr1.Text), SatLocErr = Convert.ToDouble(txtSatLocErr1.Text), EphVelErr = Convert.ToDouble(txtEphVelErr1.Text), fu = Convert.ToDouble(txtFu1.Text)*1e6, }; public DXErrEllipseParam(double MBfu, DateTime sigTime) { InitializeComponent(); txtTleMain.UseDoubleClickToSelectAll(); txtTleMain.UseDefault().SetStringData(TestData.AllTle).Text = TestData.tleleo1; this.txtCapTime.DateTime = sigTime; this.txtCapTime1.DateTime = sigTime.AddMinutes(5); this.txtCapTime2.DateTime = sigTime.AddMinutes(10); this.txtDfoErr1.EditValue = TestData.DfoHzErr; this.txtSatLocErr1.EditValue = TestData.SatLocErr; this.txtEphVelErr1.EditValue = TestData.EphVelErr; this.txtFu1.EditValue = MBfu * 1e-6; } private void btnOK_Click(object sender, EventArgs e) { mapControl1.ClearMap(); double[] main_sat = Tle2XYZ.GetXyz(Model.TleMain, Model.CapTime); double[] adja1_sat = Tle2XYZ.GetXyz(Model.TleMain, Model.CapTime1); double[] adja2_sat = Tle2XYZ.GetXyz(Model.TleMain, Model.CapTime2); DrawErrorEllipse1X(lon, lat, main_sat, adja1_sat, adja2_sat, Model.DfoErr, Model.SatLocErr, Model.EphVelErr, Model.fu); } private void DrawErrorEllipse1X(double posLon, double posLat, double[] MsEph, double[] NsEph1, double[] NsEph2, double DfoErr, double EphPosErr, double EphVelErr, double fu) { try { List listTx = new List(); List listSat = new List(); using (RHDWContext db = new RHDWContext()) { listTx = db.TxInfos.ToList(); listSat = db.SatInfos.ToList(); } var satTx = listTx.Find(p => p.TxType == EnumTxType.MainSat); #warning 但凡是和频差相关的 星历必须给速度 XzXdDw.App.Api.低轨GDOP误差椭圆.ErrorEllipseDTO1XOption Option = new XzXdDw.App.Api.低轨GDOP误差椭圆.ErrorEllipseDTO1XOption(); Option.MsEph = MsEph; Option.NsEph1 = NsEph1; Option.NsEph2 = NsEph2; Option.SelectPoint = new double[3] { posLon, posLat, 0 }; Option.DfoErr = DfoErr; Option.EphPosErr = EphPosErr; Option.EphVelErr = EphVelErr; Option.fu = fu; var points = XzXdDw.App.Api.低轨GDOP误差椭圆.ErrEllipseHelper.ErrorEllipseSingleX(Option); mapControl1.DrawDtoPonit($"单星[{listSat.FirstOrDefault(m => m.ID == satTx.ID)?.Sat}]误差椭圆线", points); } catch (Exception ex) { Serilog.Log.Error("绘制误差椭圆线失败", ex); XtraMessageBox.Show($"绘制误差椭圆线失败,失败信息:{ex.Message}"); } } private void btnClose_Click(object sender, EventArgs e) { PopupHelper.HidePopup(this); } } public class ErrEllipse单星协同接口 { /// /// 主星星历 /// public string TleMain { get; set; } /// /// 采集时刻1 /// public DateTime CapTime { get; set; } /// /// 采集时刻2 /// public DateTime CapTime1 { get; set; } /// /// 采集时刻3 /// public DateTime CapTime2 { get; set; } /// /// 频差误差(Hz) /// public double DfoErr { get; set; } /// /// 星历位置误差 /// public double SatLocErr { get; set; } = 10000; /// ///星历速度误差 /// public double EphVelErr { get; set; } /// /// 上行频点(Hz) /// public double fu { get; set; } } }