DXGDOPParam.cs 5.0 KB

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