DXGDOPParam.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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.GdopSingleSat(
  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. var mapDots = errLins.MapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
  71. mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, mapDots.Count() / 2);
  72. }
  73. }
  74. public XdCxRhDW.App.DTO.MapLine SampleDots(XdCxRhDW.App.DTO.MapLine line)
  75. {
  76. var dots = line.Line;
  77. if (dots.Count < 30) return line;
  78. var tmp = dots.Count / 30;
  79. var newLine = new XdCxRhDW.App.DTO.MapLine();
  80. for (int i = 0; i < dots.Count; i += tmp)
  81. {
  82. newLine.Line.Add(dots[i]);
  83. }
  84. if (!newLine.Line.Contains(dots.Last()))
  85. newLine.Line.Add(dots.Last());
  86. return newLine;
  87. }
  88. private void btnClose_Click(object sender, EventArgs e)
  89. {
  90. PopupHelper.HidePopup(this);
  91. }
  92. }
  93. public class GDOP单星协同接口
  94. {
  95. /// <summary>
  96. /// 主星星历
  97. /// </summary>
  98. public string TleLeo1 { get; set; }
  99. /// <summary>
  100. ///采集时刻1
  101. /// </summary>
  102. public DateTime CapTime1 { get; set; }
  103. /// <summary>
  104. /// 采集时刻2
  105. /// </summary>
  106. public DateTime CapTime2 { get; set; }
  107. /// <summary>
  108. /// 采集时刻3
  109. /// </summary>
  110. public DateTime CapTime3 { get; set; }
  111. /// <summary>
  112. /// 频差误差(Hz)
  113. /// </summary>
  114. public double DfoErr { get; set; }
  115. /// <summary>
  116. /// 星历位置误差
  117. /// </summary>
  118. public double SatLocErr { get; set; } = 10000;
  119. /// <summary>
  120. ///星历速度误差
  121. /// </summary>
  122. public double EphVelErr { get; set; }
  123. /// <summary>
  124. /// 上行频点(Hz)
  125. /// </summary>
  126. public double fu { get; set; }
  127. }
  128. }