using DevExpress.Charts.Native;
using DevExpress.Internal.WinApi.Windows.UI.Notifications;
using DevExpress.XtraPrinting;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using XdCxRhDW.App.Api.时差线;
using XdCxRhDW.App.DTO;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
namespace XzXdDw.App.Api.低轨GDOP误差椭圆
{
public class ErrorEllipseDTFOTSOption
{
///
/// 主星星历
///
public double[] MsEph { get; set; }
///
/// 邻星星历
///
public double[] NsEph { get; set; }
///
/// 参考站位置
///
public double[] RefGeod { get; set; }
///
/// 定位点
///
public double[] SelectPoint { get; set; }
///
/// 时差误差(Hz)
///
public double DtoErr { get; set; }
///
/// 频差误差(Hz)
///
public double DfoErr { get; set; }
///
/// 星历位置误差
///
public double EphPosErr { get; set; }
///
///星历速度误差
///
public double EphVelErr { get; set; }
///
/// 上行频点(Hz)
///
public double fu { get; set; }
///
/// 概率 默认0.5
///
public double Pe { get; set; } = 0.5;
}
public static class ErrEllipseHelper
{
public static IEnumerable<(double lon, double lat)> ErrorEllipseDTFOTwoStart(ErrorEllipseDTFOTSOption opt)
{
List list = new List();
int LOP_Len = 0;
IntPtr LOP_ValuePtr = GdopHelper.Error_Ellipse_DTFO(
opt.MsEph,
opt.NsEph,
opt.RefGeod,
opt.SelectPoint,
opt.DtoErr,
opt.DfoErr,
opt.EphPosErr,
opt.EphVelErr,
opt.fu, opt.Pe, ref LOP_Len);
double[] LOP_Value = new double[LOP_Len];
if (LOP_Len > 0)
{
Marshal.Copy(LOP_ValuePtr, LOP_Value, 0, LOP_Value.Length);
int len = LOP_Len / 2;
for (int i = 0; i < len; i++)
{
int temp = i * 2;
list.Add(new DtoLinePoint()
{
Lon = LOP_Value[temp],
Lat = LOP_Value[temp + 1]
});
}
}
var Lines = list.Select(p => (p.Lon, p.Lat));
return Lines;
}
}
}