123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- using DevExpress.XtraEditors;
- using DevExpress.XtraEditors.DXErrorProvider;
- using DevExpress.XtraLayout;
- 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 System.Xml.Serialization;
- namespace XdCxRhDW.App.UserControl
- {
- public partial class UCEphXYZParam : DevExpress.XtraEditors.XtraUserControl
- {
- private int? SatCode;
- private string _title;
- public UCEphXYZParam()
- {
- InitializeComponent();
- }
- public void SetParam(string title, int? satCode, (double? x, double? y, double? z, double? vx, double? vy, double? vz) eph, Color color)
- {
- SatCode = satCode;
- _title = $"{title}[{SatCode}]";
- layoutControlItemx.AllowHtmlStringInCaption = true;
- ephX.EditValue = eph.x.HasValue ? eph.x.Value : 0;
- layoutControlItemx.Text = $"{title}<size=12><color=0,103,192> [{satCode}]</color></size>星历X";
- ephY.EditValue = eph.y.HasValue ? eph.y.Value: 0;
- layoutControlItemy.Text = $"{title}星历Y";
- ephZ.EditValue = eph.z.HasValue ? eph.z.Value : 0;
- layoutControlItemz.Text = $"{title}星历Z";
- ephVX.EditValue = eph.vx.HasValue ? eph.vx.Value : 0;
- layoutControlItemvx.Text = $"{title}星历VX";
- ephVY.EditValue = eph.vy.HasValue ? eph.vy.Value : 0;
- layoutControlItemvy.Text = $"{title}星历VY";
- ephVZ.EditValue = eph.vz.HasValue ? eph.vz.Value : 0;
- layoutControlItemvz.Text = $"{title}星历VZ";
- ephX.ForeColor = ephY.ForeColor = ephZ.ForeColor = ephVX.ForeColor = ephVY.ForeColor = ephVZ.ForeColor = color;
- }
- public (bool, string) ValidateParam()
- {
- if (!double.TryParse(ephX.Text, out double _))
- {
- return (false, $"{_title}星历X格式错误!");
- }
- if (!double.TryParse(ephY.Text, out double _))
- {
- return (false, $"{_title}星历Y格式错误!");
- }
- if (!double.TryParse(ephZ.Text, out double _))
- {
- return (false, $"{_title}星历Z格式错误!");
- }
- if (!double.TryParse(ephVX.Text, out double _))
- {
- return (false, $"{_title}星历VX格式错误!");
- }
- if (!double.TryParse(ephVY.Text, out double _))
- {
- return (false, $"{_title}星历VY格式错误!");
- }
- if (!double.TryParse(ephVZ.Text, out double _))
- {
- return (false, $"{_title}星历VZ格式错误!");
- }
- return (true, string.Empty);
- }
- public bool CheckEphXYZ(DXErrorProvider dxErrorProvider)
- {
- if (!ephX.CheckDouble(dxErrorProvider, $"{_title}星历X"))
- {
- return false;
- }
- if (!ephY.CheckDouble(dxErrorProvider, $"{_title}星历Y"))
- {
- return false;
- }
- if (!ephZ.CheckDouble(dxErrorProvider, $"{_title}星历Z"))
- {
- return false;
- }
- if (!ephVX.CheckDouble(dxErrorProvider, $"{_title}星历VX"))
- {
- return false;
- }
- if (!ephVY.CheckDouble(dxErrorProvider, $"{_title}星历VY"))
- {
- return false;
- }
- if (!ephVZ.CheckDouble(dxErrorProvider, $"{_title}星历VZ"))
- {
- return false;
- }
- return true;
- }
- public double[] EphParam()
- {
- var x = Convert.ToDouble(ephX.EditValue);
- var y = Convert.ToDouble(ephY.EditValue);
- var z = Convert.ToDouble(ephZ.EditValue);
- var vx = Convert.ToDouble(ephVX.EditValue);
- var vy = Convert.ToDouble(ephVY.EditValue);
- var vz = Convert.ToDouble(ephVZ.EditValue);
- return new double[6] { x, y, z, vx, vy, vz };
- }
- public int GetSatCode()
- {
- return SatCode.HasValue ? SatCode.Value : 0;
- }
- }
- }
|