1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel.DataAnnotations;
- 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="dto">推算参数</param>
- /// <returns></returns>
- [HttpPost]
- public AjaxResult<SatEphDto> Calc(XlCalcDto dto)
- {
- try
- {
- var p = EphHelper.Calc(dto.tleStr, dto.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,
- });
- }
- catch (Exception ex)
- {
- return Error<SatEphDto>(ex.Message);
- }
- }
- /// <summary>
- /// 推算某个时间段星星历
- /// </summary>
- /// <param name="dto">推算参数</param>
- /// <returns></returns>
- [HttpPost]
- public AjaxResult<List<EphResDto>> CalcMult(XlCalcMultDto dto)
- {
- try
- {
- var eph = EphHelper.CalcMult(dto.tleStr, dto.start, dto.end, dto.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());
- }
- catch (Exception ex)
- {
- return Error<List<EphResDto>>(ex.Message);
- }
- }
- }
- }
|