using DevExpress.XtraEditors;
using DevExpress.XtraMap;
using DxHelper;
using ExtensionsDev;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using XzXdDw.App;
using XzXdDw.App.Api.星地GDOP误差椭圆;
using XzXdDw.App.Model;
namespace XdCxRhDW.App.UserControl
{
public partial class DXGDOPParam : DevExpress.XtraEditors.XtraUserControl
{
public MapControl mapControl1;
public GDOP单星协同接口 Model => new GDOP单星协同接口()
{
TleLeo1 = txtTleLeo1.Text.Trim(),
CapTime1 = txtCapTime1.DateTime,
CapTime2 = txtCapTime2.DateTime,
CapTime3 = txtCapTime3.DateTime,
DfoErr = Convert.ToDouble(txtDfoErr1.Text),
SatLocErr = Convert.ToDouble(txtSatLocErr1.Text),
EphVelErr = Convert.ToDouble(txtEphVelErr1.Text),
fu = Convert.ToDouble(txtFu1.Text) * 1e6,
};
public DXGDOPParam(double MBfu,DateTime sigTime)
{
InitializeComponent();
txtTleLeo1.UseDoubleClickToSelectAll();
txtTleLeo1.UseDefault().SetStringData(TestData.AllTle).Text = TestData.tleleo1;
this.txtCapTime1.DateTime = sigTime;
this.txtCapTime2.DateTime = sigTime.AddMinutes(5);
this.txtCapTime3.DateTime = sigTime.AddMinutes(10);
this.txtDfoErr1.EditValue = TestData.DfoHzErr;
this.txtSatLocErr1.EditValue = TestData.SatLocErr;
this.txtEphVelErr1.EditValue = TestData.EphVelErr;
this.txtFu1.EditValue = MBfu * 1e-6;
}
private void btnOK_Click(object sender, EventArgs e)
{
mapControl1.ClearMap();
var (listSat, data) = GdopHelper.GdopSingleSatDRef(
txtTleLeo1.Text, txtCapTime1.DateTime, txtCapTime2.DateTime, txtCapTime3.DateTime, Convert.ToDouble(txtDfoErr1.Text), Convert.ToDouble(txtSatLocErr1.Text), Convert.ToDouble(txtEphVelErr1.Text), Convert.ToDouble(txtFu1.Text) * 1e6);
if (data == null)
{
return;
}
if (listSat != null)//画卫星
{
foreach (var sat in listSat)
{
mapControl1.Invoke(new Action(() =>
{
string satCode = sat.SatCode == null ? "未知" : sat.SatCode.ToString();
mapControl1.DrawFixedImg("sat", sat.SatLat, sat.SatLon, DxHelper.SvgHelper.CreateSat(), new Size(32, 32), $"卫星编号:{satCode}\r\n轨道经度:{sat.SatLon}°\r\n轨道纬度:{sat.SatLat}°");
}));
}
}
foreach (var errLins in data)//画GDOP
{
foreach (var line in errLins.MapLines)
{
var newLine = SampleDots(line);
mapControl1.Invoke(new Action(() =>
{
var mapLines = newLine.Line.Select(p => (errLins.ErrDistanceKm, p.Lon, p.Lat));
mapControl1.DrawGdopLine(mapLines);
}));
}
}
}
public XdCxRhDW.App.DTO.MapLine SampleDots(XdCxRhDW.App.DTO.MapLine line)
{
var dots = line.Line;
if (dots.Count < 30) return line;
var tmp = dots.Count / 30;
var newLine = new XdCxRhDW.App.DTO.MapLine();
for (int i = 0; i < dots.Count; i += tmp)
{
newLine.Line.Add(dots[i]);
}
if (!newLine.Line.Contains(dots.Last()))
newLine.Line.Add(dots.Last());
return newLine;
}
private void btnClose_Click(object sender, EventArgs e)
{
PopupHelper.HidePopup(this);
}
}
public class GDOP单星协同接口
{
///
/// 主星星历
///
public string TleLeo1 { get; set; }
///
///采集时刻1
///
public DateTime CapTime1 { get; set; }
///
/// 采集时刻2
///
public DateTime CapTime2 { get; set; }
///
/// 采集时刻3
///
public DateTime CapTime3 { get; set; }
///
/// 频差误差(Hz)
///
public double DfoErr { get; set; }
///
/// 星历位置误差
///
public double SatLocErr { get; set; } = 10000;
///
///星历速度误差
///
public double EphVelErr { get; set; }
///
/// 上行频点(Hz)
///
public double fu { get; set; }
}
}