2023-12-20 09:58:16 +00:00
|
|
|
|
using _20230724_MBJC_upperpc.Models;
|
|
|
|
|
|
using System;
|
2023-12-18 09:31:28 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
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.Navigation;
|
|
|
|
|
|
using System.Windows.Shapes;
|
|
|
|
|
|
|
|
|
|
|
|
namespace _20230724_MBJC_upperpc.Views
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// FirstPageAnchorControl.xaml 的交互逻辑
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public partial class FirstPageAnchorControl : UserControl
|
|
|
|
|
|
{
|
2023-12-20 09:58:16 +00:00
|
|
|
|
|
|
|
|
|
|
//字体颜色
|
|
|
|
|
|
public Brush Text_Color
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return (Brush)GetValue(Text_ColorProperty); }
|
|
|
|
|
|
set { SetValue(Text_ColorProperty, value); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Using a DependencyProperty as the backing store for _color. This enables animation, styling, binding, etc...
|
|
|
|
|
|
public static readonly DependencyProperty Text_ColorProperty =
|
|
|
|
|
|
DependencyProperty.Register("Text_Color", typeof(Brush), typeof(FirstPageAnchorControl), new PropertyMetadata(default(Brush), new PropertyChangedCallback(OnPropertyChanged)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//字体大小
|
|
|
|
|
|
public int Font_Size
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return (int)GetValue(Font_SizeProperty); }
|
|
|
|
|
|
set { SetValue(Font_SizeProperty, value); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty Font_SizeProperty =
|
|
|
|
|
|
DependencyProperty.Register("Font_Size", typeof(int), typeof(FirstPageAnchorControl), new PropertyMetadata(default(int), new PropertyChangedCallback(OnPropertyChanged)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///<summary>
|
|
|
|
|
|
/// 告警信息
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string AlarmInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return (string)this.GetValue(AlarmInfoProperty); }
|
|
|
|
|
|
set { this.SetValue(AlarmInfoProperty, value); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty AlarmInfoProperty = DependencyProperty.Register("AlarmInfo", typeof(string), typeof(FirstPageAnchorControl), new PropertyMetadata(default(string), new PropertyChangedCallback(OnPropertyChanged)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///<summary>
|
|
|
|
|
|
/// Beacon
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public BeaconModel Beacon
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return (BeaconModel)this.GetValue(BeaconProperty); }
|
|
|
|
|
|
set { this.SetValue(BeaconProperty, value); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty BeaconProperty = DependencyProperty.Register("Beacon", typeof(BeaconModel), typeof(FirstPageAnchorControl), new PropertyMetadata(default(BeaconModel), new PropertyChangedCallback(OnPropertyChanged)));
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否可以使用鼠标跟随
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool TBDEnable
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return (bool)this.GetValue(TBDEnableProperty); }
|
|
|
|
|
|
set { this.SetValue(TBDEnableProperty, value); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty TBDEnableProperty = DependencyProperty.Register("TBDEnable", typeof(bool), typeof(FirstPageAnchorControl), new PropertyMetadata(default(bool), new PropertyChangedCallback(OnPropertyChanged)));
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 模型位置
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public int Model_Position
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return (int)GetValue(Model_PositionProperty); }
|
|
|
|
|
|
set { SetValue(Model_PositionProperty, value); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty Model_PositionProperty =
|
|
|
|
|
|
DependencyProperty.Register("Model_Position", typeof(int), typeof(FirstPageAnchorControl), new PropertyMetadata(default(int), new PropertyChangedCallback(OnPropertyChanged)));
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 选择那个模型进行显示
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public int Model_Visibility
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return (int)GetValue(MModel_VisibilityProperty); }
|
|
|
|
|
|
set { SetValue(MModel_VisibilityProperty, value); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly DependencyProperty MModel_VisibilityProperty =
|
|
|
|
|
|
DependencyProperty.Register("Model_Visibility", typeof(int), typeof(FirstPageAnchorControl), new PropertyMetadata(default(int), new PropertyChangedCallback(OnPropertyChanged)));
|
|
|
|
|
|
|
|
|
|
|
|
public static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
(d as FirstPageAnchorControl).Refresh();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-12-18 09:31:28 +00:00
|
|
|
|
public FirstPageAnchorControl()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
2023-12-20 09:58:16 +00:00
|
|
|
|
|
|
|
|
|
|
private void Refresh()
|
|
|
|
|
|
{
|
|
|
|
|
|
//将其余值进行赋值
|
|
|
|
|
|
if (Beacon != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.AnchorModel.Rotate_X = Beacon.Beacon_Pitch_Angle;
|
|
|
|
|
|
this.AnchorModel.Rotate_Y = Beacon.Beacon_Heading_Angle;
|
|
|
|
|
|
this.AnchorModel.Rotate_Z = Beacon.Beacon_Roll_Angle;
|
2023-12-23 03:35:57 +00:00
|
|
|
|
this.SupportModel.Rotate_X = Beacon.Beacon_Pitch_Angle;
|
|
|
|
|
|
this.SupportModel.Rotate_Y = Beacon.Beacon_Heading_Angle;
|
|
|
|
|
|
this.SupportModel.Rotate_Z = Beacon.Beacon_Roll_Angle;
|
2023-12-20 09:58:16 +00:00
|
|
|
|
|
|
|
|
|
|
this.DateTime.Text = Beacon.Datetime.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
this.TextID.Text = Beacon.ID + "";
|
|
|
|
|
|
this.TextJD.Text = Beacon.Beacon_JD + "°";
|
|
|
|
|
|
this.TextWD.Text = Beacon.Beacon_WD + "°";
|
|
|
|
|
|
this.TextSD.Text = Beacon.Beacon_Depth + "米";
|
|
|
|
|
|
this.TextHGJ.Text = Beacon.Beacon_Roll_Angle + "°";
|
|
|
|
|
|
this.TextFYJ.Text = Beacon.Beacon_Pitch_Angle + "°";
|
|
|
|
|
|
this.TextPHJ.Text = Beacon.Beacon_Heading_Angle + "°";
|
|
|
|
|
|
this.DWJL.Text = Beacon.Position_Distance + "米";
|
|
|
|
|
|
this.Temp.Text = Beacon.Temp + "℃";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//设置告警信息
|
|
|
|
|
|
//this.TextAlarm.Text = AlarmInfo;
|
|
|
|
|
|
//是否可以使用鼠标跟随
|
|
|
|
|
|
this.AnchorModel.TBDEnable = TBDEnable;
|
2023-12-23 03:35:57 +00:00
|
|
|
|
this.SupportModel.TBDEnable = TBDEnable;
|
2023-12-20 09:58:16 +00:00
|
|
|
|
//设置字体颜色和字体大小
|
|
|
|
|
|
this.TextID.Foreground = this.Text_Color;
|
|
|
|
|
|
if (this.Font_Size != 0)
|
|
|
|
|
|
this.TextID.FontSize = this.Font_Size;
|
|
|
|
|
|
|
|
|
|
|
|
//显示锚的模型还是基准点的模型
|
|
|
|
|
|
if (Model_Visibility == 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
AnchorModel.Visibility = Visibility.Visible;
|
|
|
|
|
|
SupportModel.Visibility = Visibility.Collapsed;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Model_Visibility == 2)
|
|
|
|
|
|
{
|
|
|
|
|
|
AnchorModel.Visibility = Visibility.Collapsed;
|
|
|
|
|
|
SupportModel.Visibility = Visibility.Visible;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//区分模型在左还是在右
|
|
|
|
|
|
if (Model_Position == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Grid.SetColumn(AnchorModel, 0);
|
|
|
|
|
|
Grid.SetColumn(SupportModel, 0);
|
|
|
|
|
|
Grid.SetColumn(Data_Area, 1);
|
|
|
|
|
|
grid.ColumnDefinitions[0].Width = new GridLength(3, GridUnitType.Star);
|
|
|
|
|
|
grid.ColumnDefinitions[1].Width = new GridLength(2, GridUnitType.Star);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Model_Position == 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
Grid.SetColumn(AnchorModel, 1);
|
|
|
|
|
|
Grid.SetColumn(SupportModel, 1);
|
|
|
|
|
|
Grid.SetColumn(Data_Area, 0);
|
|
|
|
|
|
grid.ColumnDefinitions[0].Width = new GridLength(2, GridUnitType.Star);
|
|
|
|
|
|
grid.ColumnDefinitions[1].Width = new GridLength(3, GridUnitType.Star);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-12-18 09:31:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|