|
@@ -30,7 +30,7 @@ using XdDw.App.Api.星地GDOP误差椭圆;
|
|
|
using XdDw.App.EditForms;
|
|
|
using XdDw.App.EFContext;
|
|
|
using XzXdDw.App.Model;
|
|
|
-
|
|
|
+using XzXdDw;
|
|
|
namespace XdDw.App.UserControl
|
|
|
{
|
|
|
/// <summary>
|
|
@@ -39,9 +39,11 @@ namespace XdDw.App.UserControl
|
|
|
public partial class CtrlPosXd : DevExpress.XtraEditors.XtraUserControl
|
|
|
{
|
|
|
DtXDParam dtxdctrl = null;
|
|
|
+ TcpServer tcpServer;
|
|
|
public CtrlPosXd()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
+ tcpServer = new TcpServer();
|
|
|
}
|
|
|
|
|
|
private async void CtrlXdPos_Load(object sender, EventArgs e)
|
|
@@ -86,8 +88,9 @@ namespace XdDw.App.UserControl
|
|
|
.AddMenu("手动定位", SvgHelper.LoadFromFile("Image\\Pos.svg"), XdPos)
|
|
|
.AddMenu("绘制时差线", SvgHelper.LoadFromFile("Image\\DrawLine.svg"), DrawDtoLine)
|
|
|
.AddMenu("加载仿真数据", SvgHelper.LoadFromFile("Image\\LoadData.svg"), LoadSimulationData)
|
|
|
- .AddMenu("绘制误差椭圆", SvgHelper.LoadFromFile("Image\\误差椭圆.svg"),()=> {
|
|
|
- var ctrl = new X2D1ErrEllipseParam();
|
|
|
+ .AddMenu("绘制误差椭圆", SvgHelper.LoadFromFile("Image\\误差椭圆.svg"), () =>
|
|
|
+ {
|
|
|
+ var ctrl = new X2D1ErrEllipseParam();
|
|
|
PopupHelper.ShowPopup(ctrl, mapControl1, mapControl1.Width / 4, onHide: hideReason =>
|
|
|
{
|
|
|
if (hideReason == HideReason.Defalut) return;
|
|
@@ -208,15 +211,16 @@ namespace XdDw.App.UserControl
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- //"Simulation_Data2023.dat"
|
|
|
+
|
|
|
string simulationFile = editor.SimulationFile;
|
|
|
+
|
|
|
stoped = false;
|
|
|
|
|
|
//在列表控件中全选+右键可以删除所有测试结果
|
|
|
using (RHDWContext db = new RHDWContext())
|
|
|
{
|
|
|
var listTx = db.TxInfos.ToList();
|
|
|
+ var sysSetings = await db.SysSetings.FirstOrDefaultAsync();
|
|
|
var lines = File.ReadAllLines(simulationFile);
|
|
|
Random r = new Random();
|
|
|
foreach (var item in lines)
|
|
@@ -268,6 +272,8 @@ namespace XdDw.App.UserControl
|
|
|
};
|
|
|
db.XDPosRes.Add(posRes);//定位结果入库
|
|
|
await db.SaveChangesAsync();
|
|
|
+
|
|
|
+ SendPosData(posRes, sysSetings);
|
|
|
//更新定位结果UI列表和地图
|
|
|
var currentTask = gridView1.GetFocusedRow() as TaskInfo;
|
|
|
var ds = this.gridPos.DataSource as List<XDPosRes>;
|
|
@@ -281,7 +287,15 @@ namespace XdDw.App.UserControl
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ private void SendPosData(XDPosRes pos, SysSetings setings)
|
|
|
+ {
|
|
|
+ if (setings == null || string.IsNullOrEmpty(setings.ServerIp) || setings.Port < 0 || setings.Port > 65535)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ string json = Newtonsoft.Json.JsonConvert.SerializeObject(pos);
|
|
|
+ tcpServer.SendData(setings.ServerIp, setings.Port, json);
|
|
|
+ }
|
|
|
private async void XdPos()
|
|
|
{
|
|
|
try
|
|
@@ -390,7 +404,7 @@ namespace XdDw.App.UserControl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void DrawErrorEllipse2X1D(double[] MsEph, double[] NsEph, double[] CDBAnt, double[] RefGeod,double DtoErr,double EphErr)
|
|
|
+ private void DrawErrorEllipse2X1D(double[] MsEph, double[] NsEph, double[] CDBAnt, double[] RefGeod, double DtoErr, double EphErr)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -410,13 +424,13 @@ namespace XdDw.App.UserControl
|
|
|
}
|
|
|
var satTx = listTx.Find(p => p.TxType == EnumTxType.MainSat);
|
|
|
var satNTx = listTx.Find(p => p.TxType == EnumTxType.AdjaSat);
|
|
|
- XdDw.App.Api.低轨GDOP误差椭圆.ErrorEllipseDTO2X1DOption Option = new XdDw.App.Api.低轨GDOP误差椭圆.ErrorEllipseDTO2X1DOption();
|
|
|
+ XdDw.App.Api.低轨GDOP误差椭圆.ErrorEllipseDTO2X1DOption Option = new XdDw.App.Api.低轨GDOP误差椭圆.ErrorEllipseDTO2X1DOption();
|
|
|
Option.MsEph = MsEph;
|
|
|
Option.NsEph = NsEph;
|
|
|
Option.CDBAnt = CDBAnt;
|
|
|
Option.RefGeod = RefGeod;
|
|
|
Option.SelectPoint = new double[3] { item.PosLon, item.PosLat, 0 };
|
|
|
- Option.DtoErr = DtoErr*1e-6;
|
|
|
+ Option.DtoErr = DtoErr * 1e-6;
|
|
|
Option.EphErr = EphErr;
|
|
|
var points = XdDw.App.Api.低轨GDOP误差椭圆.ErrEllipseHelper.ErrorEllipse2X1D(Option);
|
|
|
mapControl1.DrawDtoPonit($"双星[{listSat.FirstOrDefault(m => m.ID == satTx.ID)?.Sat},{listSat.FirstOrDefault(m => m.ID == satNTx.ID)?.Sat}]误差椭圆线", points);
|