DXGDOPParam.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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,DateTime sigTime)
  34. {
  35. InitializeComponent();
  36. txtTleLeo1.UseDoubleClickToSelectAll();
  37. txtTleLeo1.UseDefault().SetStringData(TestData.AllTle).Text = TestData.tleleo1;
  38. this.txtCapTime1.DateTime = sigTime;
  39. this.txtCapTime2.DateTime = sigTime.AddMinutes(5);
  40. this.txtCapTime3.DateTime = sigTime.AddMinutes(10);
  41. this.txtDfoErr1.EditValue = TestData.DfoHzErr;
  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. mapControl1.ClearMap();
  49. var (listSat, data) = GdopHelper.GdopSingleSatDRef(
  50. 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);
  51. if (data == null)
  52. {
  53. return;
  54. }
  55. if (listSat != null)//画卫星
  56. {
  57. foreach (var sat in listSat)
  58. {
  59. mapControl1.Invoke(new Action(() =>
  60. {
  61. string satCode = sat.SatCode == null ? "未知" : sat.SatCode.ToString();
  62. mapControl1.DrawFixedImg("sat", sat.SatLat, sat.SatLon, DxHelper.SvgHelper.CreateSat(), new Size(32, 32), $"卫星编号:{satCode}\r\n轨道经度:{sat.SatLon}°\r\n轨道纬度:{sat.SatLat}°");
  63. }));
  64. }
  65. }
  66. foreach (var errLins in data)//画GDOP
  67. {
  68. foreach (var line in errLins.MapLines)
  69. {
  70. var newLine = SampleDots(line);
  71. mapControl1.Invoke(new Action(() =>
  72. {
  73. var mapLines = newLine.Line.Select(p => (errLins.ErrDistanceKm, p.Lon, p.Lat));
  74. mapControl1.DrawGdopLine(mapLines);
  75. }));
  76. }
  77. }
  78. }
  79. public XdCxRhDW.App.DTO.MapLine SampleDots(XdCxRhDW.App.DTO.MapLine line)
  80. {
  81. var dots = line.Line;
  82. if (dots.Count < 30) return line;
  83. var tmp = dots.Count / 30;
  84. var newLine = new XdCxRhDW.App.DTO.MapLine();
  85. for (int i = 0; i < dots.Count; i += tmp)
  86. {
  87. newLine.Line.Add(dots[i]);
  88. }
  89. if (!newLine.Line.Contains(dots.Last()))
  90. newLine.Line.Add(dots.Last());
  91. return newLine;
  92. }
  93. private void btnClose_Click(object sender, EventArgs e)
  94. {
  95. PopupHelper.HidePopup(this);
  96. }
  97. }
  98. public class GDOP单星协同接口
  99. {
  100. /// <summary>
  101. /// 主星星历
  102. /// </summary>
  103. public string TleLeo1 { get; set; }
  104. /// <summary>
  105. ///采集时刻1
  106. /// </summary>
  107. public DateTime CapTime1 { get; set; }
  108. /// <summary>
  109. /// 采集时刻2
  110. /// </summary>
  111. public DateTime CapTime2 { get; set; }
  112. /// <summary>
  113. /// 采集时刻3
  114. /// </summary>
  115. public DateTime CapTime3 { get; set; }
  116. /// <summary>
  117. /// 频差误差(Hz)
  118. /// </summary>
  119. public double DfoErr { get; set; }
  120. /// <summary>
  121. /// 星历位置误差
  122. /// </summary>
  123. public double SatLocErr { get; set; } = 10000;
  124. /// <summary>
  125. ///星历速度误差
  126. /// </summary>
  127. public double EphVelErr { get; set; }
  128. /// <summary>
  129. /// 上行频点(Hz)
  130. /// </summary>
  131. public double fu { get; set; }
  132. }
  133. }