X1D1GDOPParam.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. using DevExpress.XtraMap;
  2. using ExtensionsDev;
  3. using System;
  4. using System.Data;
  5. using System.Linq;
  6. using XdCxRhDW.App.Model;
  7. using XdCxRhDW.App.EFContext;
  8. using XdCxRhDW.App.Api.GDOP误差椭圆;
  9. using System.Collections.Generic;
  10. namespace XdCxRhDW.App.UserControl
  11. {
  12. public partial class X1D1GDOPParam : DevExpress.XtraEditors.XtraUserControl
  13. {
  14. public MapControl mapControl1;
  15. public GDOP星地一星一地接口 Model => new GDOP星地一星一地接口()
  16. {
  17. TleMain = txtTleMain.Text.Trim(),
  18. CapTime = txtCapTime.DateTime,
  19. StationLon = Convert.ToDouble(txtStationLocation1.Text.Replace(",", ",").Split(',')[0].Trim()),
  20. StationLat = Convert.ToDouble(txtStationLocation1.Text.Replace(",", ",").Split(',')[1].Trim()),
  21. RefLon = Convert.ToDouble(txtRefLocation1.Text.Replace(",", ",").Split(',')[0].Trim()),
  22. RefLat = Convert.ToDouble(txtRefLocation1.Text.Replace(",", ",").Split(',')[1].Trim()),
  23. DtousErr = Convert.ToDouble(txtDtousErr1.Text),
  24. SatLocErr = Convert.ToDouble(txtSatLocErr1.Text),
  25. };
  26. public X1D1GDOPParam(PosRes item)
  27. {
  28. InitializeComponent();
  29. txtCapTime.UseDefault();
  30. txtTleMain.UseDoubleClickToSelectAll();
  31. txtStationLocation1.UseDoubleClickToSelectAll();
  32. txtRefLocation1.UseDoubleClickToSelectAll();
  33. this.txtCapTime.DateTime = item.SigTime;
  34. this.txtDtousErr1.EditValue = 1;
  35. this.txtSatLocErr1.EditValue = 1000;
  36. List<string> xlall = new List<string>();
  37. string mainTle = string.Empty;
  38. string adjaTle = string.Empty;
  39. using (RHDWContext db = new RHDWContext())
  40. {
  41. var sats = db.SatInfos.ToList();
  42. var cg = db.CgRes.Where(m => m.ID == item.CgResID).FirstOrDefault();
  43. var station = db.StationRes.Where(m => m.ID == item.StationResID).FirstOrDefault();
  44. if (station != null)
  45. {
  46. this.txtStationLocation1.Text = $"{station.CdbTxLon},{station.CdbTxLat}";
  47. this.txtRefLocation1.Text = $"{station.RefLon},{station.RefLat}";
  48. }
  49. var xlList = db.XlInfos.OrderBy(p => p.SatName).OrderByDescending(p => p.TimeBJ).ToList();
  50. xlall.AddRange(xlList.Select(m => m.TwoLine));
  51. if (xlall.Count() == 0) return;
  52. if (xlList.Any(m => m.SatCode == cg.MainCode.Value))
  53. {
  54. mainTle = xlList.First(m => m.SatCode == cg.MainCode.Value).TwoLine;
  55. }
  56. else
  57. {
  58. mainTle = xlList.First().TwoLine;
  59. }
  60. }
  61. txtTleMain.UseDefault().SetStringData(xlall).Text = mainTle;
  62. }
  63. private void btnOK_Click(object sender, EventArgs e)
  64. {
  65. mapControl1.ClearMap();
  66. var (listSat, data) = GdopHelper.Gdop2Sat1DRef(Model.TleMain,"", Model.CapTime, new double[] { Model.StationLon, Model.StationLat, 0 },
  67. new double[] { Model.RefLon, Model.RefLat, 0 }, Model.DtousErr, Model.SatLocErr);
  68. if (data == null)
  69. {
  70. return;
  71. }
  72. foreach (var errLins in data)//画GDOP
  73. {
  74. var mapDots = errLins.MapDots.Select(p => p).Select(p => (p.Lon, p.Lat));
  75. mapControl1.DrawGdopLineTwo(errLins.ErrDistanceKm, mapDots, 1);
  76. }
  77. }
  78. private void btnClose_Click(object sender, EventArgs e)
  79. {
  80. DxHelper.PopupHelper.HidePopup(this);
  81. }
  82. }
  83. public class GDOP星地一星一地接口
  84. {
  85. /// <summary>
  86. /// 主星星历(Tle)
  87. /// </summary>
  88. public string TleMain { get; set; }
  89. /// <summary>
  90. /// 采集时刻
  91. /// </summary>
  92. public DateTime CapTime { get; set; }
  93. /// <summary>
  94. /// 超短接收站-经度
  95. /// </summary>
  96. public double StationLon { get; set; }
  97. /// <summary>
  98. /// 超短接收站-纬度
  99. /// </summary>
  100. public double StationLat { get; set; }
  101. /// <summary>
  102. /// 参考站位置经度
  103. /// </summary>
  104. public double RefLon { get; set; }
  105. /// <summary>
  106. /// 参考站位置纬度
  107. /// </summary>
  108. public double RefLat { get; set; }
  109. /// <summary>
  110. /// 时差误差(单位us)
  111. /// </summary>
  112. public double DtousErr { get; set; } = 1;
  113. /// <summary>
  114. /// 星历位置误差(单位米)
  115. /// </summary>
  116. public double SatLocErr { get; set; } = 10000;
  117. }
  118. }