XlController.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data.Entity;
  4. using System.Data.SqlClient;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Web.Http;
  9. using Serilog;
  10. using XdCxRhDw.Dto;
  11. using XdCxRhDW.App.Api;
  12. using XdCxRhDW.Core.Api;
  13. using XdCxRhDW.Dto;
  14. namespace XdCxRhDW.WebApi.Controllers
  15. {
  16. /// <summary>
  17. /// 星历推算功能相关接口
  18. /// </summary>
  19. public class XlController : BaseController
  20. {
  21. /// <summary>
  22. /// 推算某个时间点星历
  23. /// </summary>
  24. /// <param name="dto">推算参数</param>
  25. /// <returns></returns>
  26. [HttpPost]
  27. public AjaxResult<SatEphDto> Calc(XlCalcDto dto)
  28. {
  29. var p = EphHelper.Calc(dto.tleStr, dto.dt);
  30. return Success(new SatEphDto()
  31. {
  32. SatId = p.SatId,
  33. SatTime = p.SatTime,
  34. TleTime = p.TleTime,
  35. X = p.X,
  36. Y = p.Y,
  37. Z = p.Z,
  38. VX = p.VX,
  39. VY = p.VY,
  40. VZ = p.VZ,
  41. });
  42. }
  43. /// <summary>
  44. /// 推算某个时间段星星历
  45. /// </summary>
  46. /// <param name="dto">推算参数</param>
  47. /// <returns></returns>
  48. [HttpPost]
  49. public AjaxResult<List<EphResDto>> CalcMult(XlCalcMultDto dto)
  50. {
  51. var eph = EphHelper.CalcMult(dto.tleStr, dto.start, dto.end, dto.spanSeconds);
  52. return Success(eph.Select(p => new EphResDto()
  53. {
  54. SatId = p.SatId,
  55. SatTime = p.SatTime,
  56. TleTime = p.TleTime,
  57. X = p.X,
  58. Y = p.Y,
  59. Z = p.Z,
  60. VX = p.VX,
  61. VY = p.VY,
  62. VZ = p.VZ,
  63. }).ToList());
  64. }
  65. }
  66. }