ErrEllipseHelper.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. using DevExpress.Charts.Native;
  2. using DevExpress.Internal.WinApi.Windows.UI.Notifications;
  3. using DevExpress.XtraPrinting;
  4. using Newtonsoft.Json;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Diagnostics;
  8. using System.IO;
  9. using System.Linq;
  10. using System.Runtime.InteropServices;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using XdCxRhDW.App.Api.时差线;
  14. using XdCxRhDW.App.DTO;
  15. using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
  16. namespace XzXdDw.App.Api.低轨GDOP误差椭圆
  17. {
  18. public class ErrorEllipseDTFOTSOption
  19. {
  20. /// <summary>
  21. /// 主星星历
  22. /// </summary>
  23. public double[] MsEph { get; set; }
  24. /// <summary>
  25. /// 邻星星历
  26. /// </summary>
  27. public double[] NsEph { get; set; }
  28. /// <summary>
  29. /// 参考站位置
  30. /// </summary>
  31. public double[] RefGeod { get; set; }
  32. /// <summary>
  33. /// 定位点
  34. /// </summary>
  35. public double[] SelectPoint { get; set; }
  36. /// <summary>
  37. /// 时差误差(Hz)
  38. /// </summary>
  39. public double DtoErr { get; set; }
  40. /// <summary>
  41. /// 频差误差(Hz)
  42. /// </summary>
  43. public double DfoErr { get; set; }
  44. /// <summary>
  45. /// 星历位置误差
  46. /// </summary>
  47. public double EphPosErr { get; set; }
  48. /// <summary>
  49. ///星历速度误差
  50. /// </summary>
  51. public double EphVelErr { get; set; }
  52. /// <summary>
  53. /// 上行频点(Hz)
  54. /// </summary>
  55. public double fu { get; set; }
  56. /// <summary>
  57. /// 概率 默认0.5
  58. /// </summary>
  59. public double Pe { get; set; } = 0.5;
  60. }
  61. public static class ErrEllipseHelper
  62. {
  63. public static IEnumerable<(double lon, double lat)> ErrorEllipseDTFOTwoStart(ErrorEllipseDTFOTSOption opt)
  64. {
  65. List<DtoLinePoint> list = new List<DtoLinePoint>();
  66. int LOP_Len = 0;
  67. IntPtr LOP_ValuePtr = GdopHelper.Error_Ellipse_DTFO(
  68. opt.MsEph,
  69. opt.NsEph,
  70. opt.RefGeod,
  71. opt.SelectPoint,
  72. opt.DtoErr,
  73. opt.DfoErr,
  74. opt.EphPosErr,
  75. opt.EphVelErr,
  76. opt.fu, opt.Pe, ref LOP_Len);
  77. double[] LOP_Value = new double[LOP_Len];
  78. if (LOP_Len > 0)
  79. {
  80. Marshal.Copy(LOP_ValuePtr, LOP_Value, 0, LOP_Value.Length);
  81. int len = LOP_Len / 2;
  82. for (int i = 0; i < len; i++)
  83. {
  84. int temp = i * 2;
  85. list.Add(new DtoLinePoint()
  86. {
  87. Lon = LOP_Value[temp],
  88. Lat = LOP_Value[temp + 1]
  89. });
  90. }
  91. }
  92. var Lines = list.Select(p => (p.Lon, p.Lat));
  93. return Lines;
  94. }
  95. }
  96. }