194 lines
7.9 KiB
C#
194 lines
7.9 KiB
C#
using JiangsuEarthquake.Common;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using System.Windows;
|
||
using System.Windows.Controls;
|
||
using System.Windows.Data;
|
||
using System.Windows.Documents;
|
||
using System.Windows.Input;
|
||
using System.Windows.Media;
|
||
using System.Windows.Media.Imaging;
|
||
using System.Windows.Media.Media3D;
|
||
using System.Windows.Navigation;
|
||
using System.Windows.Shapes;
|
||
|
||
namespace JiangsuEarthquake.Views.UserControls
|
||
{
|
||
/// <summary>
|
||
/// InitialView.xaml 的交互逻辑
|
||
/// </summary>
|
||
public partial class InitialView : UserControl
|
||
{
|
||
///<summary>
|
||
/// 翻滚角
|
||
/// </summary>
|
||
public float Roll_Angle
|
||
{
|
||
get { return (float)this.GetValue(Roll_AngleProperty); }
|
||
set { this.SetValue(Roll_AngleProperty, value); }
|
||
}
|
||
|
||
public static readonly DependencyProperty Roll_AngleProperty = DependencyProperty.Register("Roll_Angle", typeof(float), typeof(InitialView), new PropertyMetadata(default(float), new PropertyChangedCallback(OnPropertyChanged)));
|
||
|
||
///<summary>
|
||
/// 俯仰角
|
||
/// </summary>
|
||
public float Pitch_Angle
|
||
{
|
||
get { return (float)this.GetValue(Pitch_AngleProperty); }
|
||
set { this.SetValue(Pitch_AngleProperty, value); }
|
||
}
|
||
|
||
public static readonly DependencyProperty Pitch_AngleProperty = DependencyProperty.Register("Pitch_Angle", typeof(float), typeof(InitialView), new PropertyMetadata(default(float), new PropertyChangedCallback(OnPropertyChanged)));
|
||
|
||
///<summary>
|
||
/// 航向角
|
||
/// </summary>
|
||
public float Heading_Angle
|
||
{
|
||
get { return (float)this.GetValue(Heading_AngleProperty); }
|
||
set { this.SetValue(Heading_AngleProperty, value); }
|
||
}
|
||
|
||
public static readonly DependencyProperty Heading_AngleProperty = DependencyProperty.Register("Heading_Angle", typeof(float), typeof(InitialView), new PropertyMetadata(default(float), new PropertyChangedCallback(OnPropertyChanged)));
|
||
|
||
|
||
///<summary>
|
||
/// 横滚角偏移度数
|
||
/// </summary>
|
||
public float PY_HG
|
||
{
|
||
get { return (float)this.GetValue(PY_HGProperty); }
|
||
set { this.SetValue(PY_HGProperty, value); }
|
||
}
|
||
|
||
public static readonly DependencyProperty PY_HGProperty = DependencyProperty.Register("PY_HG", typeof(float), typeof(InitialView), new PropertyMetadata(default(float), new PropertyChangedCallback(OnPropertyChanged)));
|
||
|
||
///<summary>
|
||
/// 俯仰角偏移度数
|
||
/// </summary>
|
||
public float PY_FY
|
||
{
|
||
get { return (float)this.GetValue(PY_FYProperty); }
|
||
set { this.SetValue(PY_FYProperty, value); }
|
||
}
|
||
|
||
public static readonly DependencyProperty PY_FYProperty = DependencyProperty.Register("PY_FY", typeof(float), typeof(InitialView), new PropertyMetadata(default(float), new PropertyChangedCallback(OnPropertyChanged)));
|
||
|
||
///<summary>
|
||
/// 偏航角偏移度数
|
||
/// </summary>
|
||
public float PY_PH
|
||
{
|
||
get { return (float)this.GetValue(PY_PHProperty); }
|
||
set { this.SetValue(PY_PHProperty, value); }
|
||
}
|
||
|
||
public static readonly DependencyProperty PY_PHProperty = DependencyProperty.Register("PY_PH", typeof(float), typeof(InitialView), new PropertyMetadata(default(float), new PropertyChangedCallback(OnPropertyChanged)));
|
||
|
||
///<summary>
|
||
/// 横滚角偏移百分比
|
||
/// </summary>
|
||
public float PYPercent_HG
|
||
{
|
||
get { return (float)this.GetValue(PYPercent_HGProperty); }
|
||
set { this.SetValue(PYPercent_HGProperty, value); }
|
||
}
|
||
|
||
public static readonly DependencyProperty PYPercent_HGProperty = DependencyProperty.Register("PYPercent_HG", typeof(float), typeof(InitialView), new PropertyMetadata(default(float), new PropertyChangedCallback(OnPropertyChanged)));
|
||
|
||
///<summary>
|
||
/// 俯仰角度偏移度数
|
||
/// </summary>
|
||
public float PYPercent_FY
|
||
{
|
||
get { return (float)this.GetValue(PYPercent_FYProperty); }
|
||
set { this.SetValue(PYPercent_FYProperty, value); }
|
||
}
|
||
|
||
public static readonly DependencyProperty PYPercent_FYProperty = DependencyProperty.Register("PYPercent_FY", typeof(float), typeof(InitialView), new PropertyMetadata(default(float), new PropertyChangedCallback(OnPropertyChanged)));
|
||
|
||
///<summary>
|
||
/// 偏航角偏移百分比
|
||
/// </summary>
|
||
public float PYPercent_PH
|
||
{
|
||
get { return (float)this.GetValue(PYPercent_PHProperty); }
|
||
set { this.SetValue(PYPercent_PHProperty, value); }
|
||
}
|
||
|
||
public static readonly DependencyProperty PYPercent_PHProperty = DependencyProperty.Register("PYPercent_PH", typeof(float), typeof(InitialView), new PropertyMetadata(default(float), new PropertyChangedCallback(OnPropertyChanged)));
|
||
|
||
|
||
public static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||
{
|
||
(d as InitialView).Refresh();
|
||
}
|
||
|
||
public InitialView()
|
||
{
|
||
InitializeComponent();
|
||
|
||
Xrole.Content = Draw.DrawCylinderX(0.9, new Vector3D(0, 0, 0), new Vector3D(1, 0, 0), 0.03, Brushes.Blue, Brushes.Blue);
|
||
Xarrow.Content = Draw.DrawConeX(0.5, new Vector3D(0.9, 0, 0), new Vector3D(1, 0, 0), 0.05, Brushes.Blue, Brushes.Blue);
|
||
Yrole.Content = Draw.DrawCylinderY(0.8, new Vector3D(0, 0, 0), new Vector3D(0, 1, 0), 0.03, Brushes.Red, Brushes.Red);
|
||
Yarrow.Content = Draw.DrawConeY(0.5, new Vector3D(0, 0.8, 0), new Vector3D(0, 1, 0), 0.05, Brushes.Red, Brushes.Red);
|
||
Zrole.Content = Draw.DrawCylinderZ(1.5, new Vector3D(0, 0, 0), new Vector3D(0, 0, 1), 0.03, Brushes.Green, Brushes.Green);
|
||
Zarrow.Content = Draw.DrawConeZ(0.5, new Vector3D(0, 0, 1.5), new Vector3D(0, 0, 1), 0.05, Brushes.Green, Brushes.Green);
|
||
}
|
||
|
||
private void Refresh()
|
||
{
|
||
this.Rotate_Y.Text = "Y:" + Pitch_Angle.ToString() + "°";
|
||
this.Rotate_Z.Text = "Z:" + Heading_Angle.ToString() + "°";
|
||
this.Rotate_X.Text = "X:" + Roll_Angle.ToString() + "°";
|
||
|
||
this.Rotate_Y_PY.Text = "(" + PY_FY.ToString("0.00") + "°)";
|
||
//if (PYPercent_FY < 0.75)
|
||
//{
|
||
// this.Rotate_Y_PY.Foreground = new SolidColorBrush(Colors.Green);
|
||
//}
|
||
//else if (PYPercent_FY >= 0.75 && PYPercent_FY < 1)
|
||
//{
|
||
// this.Rotate_Y_PY.Foreground = new SolidColorBrush(Colors.Yellow);
|
||
//}
|
||
//else if (PYPercent_FY >= 1)
|
||
//{
|
||
// this.Rotate_Y_PY.Foreground = new SolidColorBrush(Colors.Red);
|
||
//}
|
||
|
||
this.Rotate_X_PY.Text = "(" + PY_HG.ToString("0.00") + "°)";
|
||
//if (PYPercent_HG < 0.75)
|
||
//{
|
||
// this.Rotate_X_PY.Foreground = new SolidColorBrush(Colors.Green);
|
||
//}
|
||
//else if (PYPercent_HG >= 0.75 && PYPercent_HG < 1)
|
||
//{
|
||
// this.Rotate_X_PY.Foreground = new SolidColorBrush(Colors.Yellow);
|
||
//}
|
||
//else if (PYPercent_HG >= 1)
|
||
//{
|
||
// this.Rotate_X_PY.Foreground = new SolidColorBrush(Colors.Red);
|
||
//}
|
||
|
||
this.Rotate_Z_PY.Text = "(" + PY_PH.ToString("0.00") + "°)";
|
||
//if (PYPercent_PH < 0.75)
|
||
//{
|
||
// this.Rotate_Z_PY.Foreground = new SolidColorBrush(Colors.Green);
|
||
//}
|
||
//else if (PYPercent_PH >= 0.75 && PYPercent_PH < 1)
|
||
//{
|
||
// this.Rotate_Z_PY.Foreground = new SolidColorBrush(Colors.Yellow);
|
||
//}
|
||
//else if (PYPercent_PH >= 1)
|
||
//{
|
||
// this.Rotate_Z_PY.Foreground = new SolidColorBrush(Colors.Red);
|
||
//}
|
||
}
|
||
}
|
||
}
|