12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using DevExpress.XtraEditors;
- using DevExpress.XtraLayout;
- 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 UCEphXYZ : DevExpress.XtraEditors.XtraUserControl
- {
- private int? SatCode;
- public UCEphXYZ()
- {
- InitializeComponent();
- }
- public void SetXYZ(string title, int? satCode, (double? x, double? y, double? z) eph, Color color)
- {
- SatCode = satCode;
- layoutControlItemx.AllowHtmlStringInCaption = true;
- double.TryParse(ephX.EditValue?.ToString(), out double x);
- double.TryParse(ephY.EditValue?.ToString(), out double y);
- double.TryParse(ephZ.EditValue?.ToString(), out double z);
- if (ephX.EditValue!=null&&x != eph.x)
- {
- ephX.ForeColor = color;
- }
- if (ephY.EditValue != null && y != eph.y)
- {
- ephY.ForeColor = color;
- }
- if (ephZ.EditValue != null && z != eph.z)
- {
- ephZ.ForeColor = color;
- }
- 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";
- }
- public (bool, string) ValidateParam()
- {
- if (!double.TryParse(ephX.Text, out double _))
- {
- return (false, $"{layoutControlItemx.Text}星历X格式错误!");
- }
- if (!double.TryParse(ephY.Text, out double _))
- {
- return (false, $"{layoutControlItemx.Text}星历Y格式错误!");
- }
- if (!double.TryParse(ephZ.Text, out double _))
- {
- return (false, $"{layoutControlItemx.Text}星历Z格式错误!");
- }
- return (true, string.Empty);
- }
- public double[] EphXYZ()
- {
- var x = Convert.ToDouble(ephX.EditValue);
- var y = Convert.ToDouble(ephY.EditValue);
- var z = Convert.ToDouble(ephZ.EditValue);
- return new double[6] { x, y, z, 0, 0, 0 };
- }
- public int GetSatCode()
- {
- return SatCode.HasValue ? SatCode.Value : 0;
- }
- }
- }
|