123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using System;
- using System.Collections.Generic;
- using System.Data.Entity;
- using System.Data.SqlClient;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Web.Http;
- using Serilog;
- using XdCxRhDw.Dto;
- using XdCxRhDW.App.Api;
- using XdCxRhDW.Core.Api;
- using XdCxRhDW.Dto;
- namespace XdCxRhDW.WebApi.Controllers
- {
- /// <summary>
- /// 星历推算功能相关接口
- /// </summary>
- public class XlController : BaseController
- {
- /// <summary>
- /// 推算某个时间点星历
- /// </summary>
- /// <param name="tleStr">双行根</param>
- /// <param name="dt">推算时刻(北京时刻)</param>
- /// <returns></returns>
- [HttpGet]
- public async Task<AjaxResult<SatEphDto>> Calc(string tleStr, DateTime dt)
- {
- var p = EphHelper.Calc(tleStr, dt);
- return Success(new SatEphDto()
- {
- SatId = p.SatId,
- SatTime = p.SatTime,
- TleTime = p.TleTime,
- X = p.X,
- Y = p.Y,
- Z = p.Z,
- VX = p.VX,
- VY = p.VY,
- VZ = p.VZ,
- });
- }
- /// <summary>
- /// 推算某个时间段星星历
- /// </summary>
- /// <param name="tleStr">双行根</param>
- /// <param name="start">开始时刻(北京时刻)</param>
- /// <param name="end">结束时刻(北京时刻)</param>
- /// <param name="spanSeconds">推算间隔(秒)</param>
- /// <returns></returns>
- [HttpGet]
- public async Task<AjaxResult<List<EphResDto>>> CalcMult(string tleStr, DateTime start, DateTime end, int spanSeconds)
- {
- var eph = EphHelper.CalcMult(tleStr, start, end, spanSeconds);
- return Success(eph.Select(p => new EphResDto()
- {
- SatId = p.SatId,
- SatTime = p.SatTime,
- TleTime = p.TleTime,
- X = p.X,
- Y = p.Y,
- Z = p.Z,
- VX = p.VX,
- VY = p.VY,
- VZ = p.VZ,
- }).ToList());
- }
- }
- }
|