1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- 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 DW5S.App.UserControl
- {
- public partial class UCEphXYZ : DevExpress.XtraEditors.XtraUserControl
- {
- private int? SatCode;
- private string _title;
- public UCEphXYZ()
- {
- InitializeComponent();
- }
- public void SetXYZ(string title, int? satCode, (double? x, double? y, double? z) eph, Color color)
- {
- SatCode = satCode;
- _title = $"{title}[{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 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;
- }
- return true;
- }
- 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;
- }
- }
- }
|