DXGDOPParam.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. using DevExpress.XtraEditors;
  2. using DevExpress.XtraMap;
  3. using DxHelper;
  4. using ExtensionsDev;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.ComponentModel;
  8. using System.Data;
  9. using System.Drawing;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using System.Windows.Forms;
  14. using XzXdDw.App;
  15. using XzXdDw.App.Api.星地GDOP误差椭圆;
  16. using XzXdDw.App.Model;
  17. namespace XdCxRhDW.App.UserControl
  18. {
  19. public partial class DXGDOPParam : DevExpress.XtraEditors.XtraUserControl
  20. {
  21. public MapControl mapControl1;
  22. public GDOP单星协同接口 Model => new GDOP单星协同接口()
  23. {
  24. TleLeo1 = txtTleLeo1.Text.Trim(),
  25. CapTime1 = txtCapTime1.DateTime,
  26. CapTime2 = txtCapTime2.DateTime,
  27. CapTime3 = txtCapTime3.DateTime,
  28. DfoErr = Convert.ToDouble(txtDfoErr1.Text),
  29. SatLocErr = Convert.ToDouble(txtSatLocErr1.Text),
  30. EphVelErr = Convert.ToDouble(txtEphVelErr1.Text),
  31. fu = Convert.ToDouble(txtFu1.Text) * 1e6,
  32. };
  33. public DXGDOPParam(double MBfu)
  34. {
  35. InitializeComponent();
  36. txtTleLeo1.UseDoubleClickToSelectAll();
  37. txtTleLeo1.UseDefault().SetStringData(TestData.AllTle).Text = TestData.tleleo1;
  38. this.txtCapTime1.DateTime = TestData.leoTime;
  39. this.txtCapTime2.DateTime = TestData.leoTime;
  40. this.txtCapTime3.DateTime = TestData.leoTime;
  41. this.txtDfoErr1.EditValue = TestData.DtousErr;
  42. this.txtSatLocErr1.EditValue = TestData.SatLocErr;
  43. this.txtEphVelErr1.EditValue = TestData.EphVelErr;
  44. this.txtFu1.EditValue = MBfu * 1e-6;
  45. }
  46. private void btnOK_Click(object sender, EventArgs e)
  47. {
  48. var (listSat, data) = GdopHelper.GdopSingleSatDRef(
  49. txtTleLeo1.Text, txtCapTime1.DateTime, txtCapTime2.DateTime, txtCapTime3.DateTime, Convert.ToDouble(txtDfoErr1.Text), Convert.ToDouble(txtSatLocErr1.Text), Convert.ToDouble(txtEphVelErr1.Text), Convert.ToDouble(txtFu1.Text) * 1e6);
  50. if (data == null)
  51. {
  52. return;
  53. }
  54. if (listSat != null)//画卫星
  55. {
  56. foreach (var sat in listSat)
  57. {
  58. mapControl1.Invoke(new Action(() =>
  59. {
  60. string satCode = sat.SatCode == null ? "未知" : sat.SatCode.ToString();
  61. mapControl1.DrawFixedImg("sat", sat.SatLat, sat.SatLon, DxHelper.SvgHelper.CreateSat(), new Size(32, 32), $"卫星编号:{satCode}\r\n轨道经度:{sat.SatLon}°\r\n轨道纬度:{sat.SatLat}°");
  62. }));
  63. }
  64. }
  65. foreach (var errLins in data)//画GDOP
  66. {
  67. foreach (var line in errLins.MapLines)
  68. {
  69. var newLine = SampleDots(line);
  70. mapControl1.Invoke(new Action(() =>
  71. {
  72. var mapLines = newLine.Line.Select(p => (errLins.ErrDistanceKm, p.Lon, p.Lat));
  73. mapControl1.DrawGdopLine(mapLines);
  74. }));
  75. }
  76. }
  77. }
  78. public XdCxRhDW.App.DTO.MapLine SampleDots(XdCxRhDW.App.DTO.MapLine line)
  79. {
  80. var dots = line.Line;
  81. if (dots.Count < 30) return line;
  82. var tmp = dots.Count / 30;
  83. var newLine = new XdCxRhDW.App.DTO.MapLine();
  84. for (int i = 0; i < dots.Count; i += tmp)
  85. {
  86. newLine.Line.Add(dots[i]);
  87. }
  88. if (!newLine.Line.Contains(dots.Last()))
  89. newLine.Line.Add(dots.Last());
  90. return newLine;
  91. }
  92. private void btnClose_Click(object sender, EventArgs e)
  93. {
  94. PopupHelper.HidePopup(this);
  95. }
  96. }
  97. public class GDOP单星协同接口
  98. {
  99. /// <summary>
  100. /// 主星星历
  101. /// </summary>
  102. public string TleLeo1 { get; set; }
  103. /// <summary>
  104. ///采集时刻1
  105. /// </summary>
  106. public DateTime CapTime1 { get; set; }
  107. /// <summary>
  108. /// 采集时刻2
  109. /// </summary>
  110. public DateTime CapTime2 { get; set; }
  111. /// <summary>
  112. /// 采集时刻3
  113. /// </summary>
  114. public DateTime CapTime3 { get; set; }
  115. /// <summary>
  116. /// 频差误差(Hz)
  117. /// </summary>
  118. public double DfoErr { get; set; }
  119. /// <summary>
  120. /// 星历位置误差
  121. /// </summary>
  122. public double SatLocErr { get; set; } = 10000;
  123. /// <summary>
  124. ///星历速度误差
  125. /// </summary>
  126. public double EphVelErr { get; set; }
  127. /// <summary>
  128. /// 上行频点(Hz)
  129. /// </summary>
  130. public double fu { get; set; }
  131. }
  132. }