XZGDOPParam .cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. using DevExpress.ClipboardSource.SpreadsheetML;
  2. using DevExpress.Mvvm.ModuleInjection.Native;
  3. using DevExpress.XtraEditors;
  4. using DevExpress.XtraMap;
  5. using DevExpress.XtraTreeList.Data;
  6. using DxHelper;
  7. using ExtensionsDev;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.ComponentModel;
  11. using System.Data;
  12. using System.Drawing;
  13. using System.IO;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Threading.Tasks;
  17. using System.Windows.Forms;
  18. using XzXdDw.App;
  19. using XzXdDw.App.Api.星地GDOP误差椭圆;
  20. using XzXdDw.App.Model;
  21. namespace XdCxRhDW.App.UserControl
  22. {
  23. public partial class XZGDOPParam : DevExpress.XtraEditors.XtraUserControl
  24. {
  25. public MapControl mapControl1;
  26. public GDOP星座协同接口 Model => new GDOP星座协同接口()
  27. {
  28. TleLeo1 = txtTleLeo1.Text.Trim(),
  29. TleLeo2 = txtTleLeo2.Text.Trim(),
  30. CapTime = txtCapTime.DateTime,
  31. RefLon = Convert.ToDouble(txtRefLocation1.Text.Replace(",", ",").Split(',')[0].Trim()),
  32. RefLat = Convert.ToDouble(txtRefLocation1.Text.Replace(",", ",").Split(',')[1].Trim()),
  33. DtousErr = Convert.ToDouble(txtDtousErr1.Text),
  34. DfoErr = Convert.ToDouble(txtDfoErr1.Text),
  35. SatLocErr = Convert.ToDouble(txtSatLocErr1.Text),
  36. EphVelErr = Convert.ToDouble(txtEphVelErr1.Text),
  37. fu1 = Convert.ToDouble(txtFu1.Text) * 1e6,
  38. fu2 = Convert.ToDouble(txtFu2.Text) * 1e6,
  39. };
  40. public XZGDOPParam(TxInfo refTx, DateTime sigTime, double upfreqHz1, double upfreqHz2)
  41. {
  42. InitializeComponent();
  43. txtCapTime.UseDefault();
  44. txtTleLeo1.UseDoubleClickToSelectAll();
  45. txtTleLeo2.UseDoubleClickToSelectAll();
  46. txtRefLocation1.UseDoubleClickToSelectAll();
  47. this.txtCapTime.DateTime = sigTime;
  48. this.txtRefLocation1.Text = $"{refTx.Lon},{refTx.Lat}";
  49. txtTleLeo1.UseDefault().SetStringData(TestData.AllTle).Text = TestData.tleleo1;
  50. txtTleLeo2.UseDefault().SetStringData(TestData.AllTle).Text = TestData.tleleo2;
  51. this.txtDtousErr1.EditValue = TestData.DtousErr;
  52. this.txtDfoErr1.EditValue = TestData.DfoHzErr;
  53. this.txtSatLocErr1.EditValue = TestData.SatLocErr;
  54. this.txtEphVelErr1.EditValue = TestData.EphVelErr;
  55. this.txtFu1.EditValue = upfreqHz1 * 1e-6;
  56. this.txtFu2.EditValue = upfreqHz2 * 1e-6;
  57. }
  58. private void btnOK_Click(object sender, EventArgs e)
  59. {
  60. mapControl1.ClearMap();
  61. var (listSat, data) = GdopHelper.GdopLeoTowSatDRef(Model.TleLeo1, Model.TleLeo2, Model.CapTime, new double[] { Model.RefLon, Model.RefLat,0 }, Model.fu1, Model.fu2, Model.DtousErr, Model.DfoErr, Model.SatLocErr, Model.EphVelErr);
  62. if (data == null)
  63. {
  64. return;
  65. }
  66. if (listSat != null)//画卫星
  67. {
  68. foreach (var sat in listSat)
  69. {
  70. mapControl1.Invoke(new Action(() =>
  71. {
  72. string satCode = sat.SatCode == null ? "未知" : sat.SatCode.ToString();
  73. mapControl1.DrawFixedImg("sat", sat.SatLat, sat.SatLon, DxHelper.SvgHelper.CreateSat(), new Size(32, 32), $"卫星编号:{satCode}\r\n轨道经度:{sat.SatLon}°\r\n轨道纬度:{sat.SatLat}°");
  74. mapControl1.DrawEllipse(sat.SatLat, sat.SatLon, 2225);
  75. }));
  76. }
  77. }
  78. foreach (var errLins in data)//画GDOP
  79. {
  80. var mapDots = errLins.MapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
  81. mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, mapDots.Count()/2);
  82. }
  83. }
  84. public XdCxRhDW.App.DTO.MapLine SampleDots(XdCxRhDW.App.DTO.MapLine line)
  85. {
  86. var dots = line.Line;
  87. if (dots.Count < 30) return line;
  88. var tmp = dots.Count / 30;
  89. var newLine = new XdCxRhDW.App.DTO.MapLine();
  90. for (int i = 0; i < dots.Count; i += tmp)
  91. {
  92. newLine.Line.Add(dots[i]);
  93. }
  94. if (!newLine.Line.Contains(dots.Last()))
  95. newLine.Line.Add(dots.Last());
  96. return newLine;
  97. }
  98. private void btnClose_Click(object sender, EventArgs e)
  99. {
  100. PopupHelper.HidePopup(this);
  101. }
  102. }
  103. public class GDOP星座协同接口
  104. {
  105. /// <summary>
  106. /// 主星星历(Tle)
  107. /// </summary>
  108. public string TleLeo1 { get; set; }
  109. /// <summary>
  110. /// 邻星星历(Tle)
  111. /// </summary>
  112. public string TleLeo2 { get; set; }
  113. /// <summary>
  114. /// 采集时刻
  115. /// </summary>
  116. public DateTime CapTime { get; set; }
  117. /// <summary>
  118. /// 参考站位置经度
  119. /// </summary>
  120. public double RefLon { get; set; }
  121. /// <summary>
  122. /// 参考站位置纬度
  123. /// </summary>
  124. public double RefLat { get; set; }
  125. /// <summary>
  126. /// 时差误差(单位us)
  127. /// </summary>
  128. public double DtousErr { get; set; } = 1;
  129. /// <summary>
  130. /// 频差误差(Hz)
  131. /// </summary>
  132. public double DfoErr { get; set; }
  133. /// <summary>
  134. /// 星历位置误差(单位米)
  135. /// </summary>
  136. public double SatLocErr { get; set; } = 10000;
  137. /// <summary>
  138. ///星历速度误差
  139. /// </summary>
  140. public double EphVelErr { get; set; }
  141. /// <summary>
  142. /// 上行频点1(Hz)
  143. /// </summary>
  144. public double fu1 { get; set; }
  145. /// <summary>
  146. /// 上行频点2(Hz)
  147. /// </summary>
  148. public double fu2 { get; set; }
  149. }
  150. }