|
|
// ShowFJDataDlg.cpp : 实现文件
|
|
|
//
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
#include "CH91PayloadSoftware.h"
|
|
|
#include "ShowFJDataDlg.h"
|
|
|
#include "afxdialogex.h"
|
|
|
#include "GlobalMessage.h"
|
|
|
|
|
|
// CShowFJDataDlg 对话框
|
|
|
|
|
|
IMPLEMENT_DYNAMIC(CShowFJDataDlg, CDialogEx)
|
|
|
|
|
|
CShowFJDataDlg::CShowFJDataDlg(CWnd* pParent /*=NULL*/)
|
|
|
: CDialogEx(CShowFJDataDlg::IDD, pParent)
|
|
|
, m_PixelProportion_EO(0)
|
|
|
, m_PixelProportion_IR(0)
|
|
|
{
|
|
|
// 对话框收缩、高度等变量控制值初始化
|
|
|
m_shrink = TRUE;// 默认收缩
|
|
|
m_DlgWidth = 0;
|
|
|
m_DlgWidth_Shrink = 0;
|
|
|
// 对话框透明变量,初始设置为不透明
|
|
|
m_bTransParent = FALSE;
|
|
|
// 设定目标初始像素比
|
|
|
m_PixelProportion_EO = 1;
|
|
|
m_PixelProportion_IR = 1;
|
|
|
}
|
|
|
|
|
|
CShowFJDataDlg::~CShowFJDataDlg()
|
|
|
{
|
|
|
}
|
|
|
|
|
|
void CShowFJDataDlg::DoDataExchange(CDataExchange* pDX)
|
|
|
{
|
|
|
CDialogEx::DoDataExchange(pDX);
|
|
|
}
|
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CShowFJDataDlg, CDialogEx)
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
//十进制转化为二进制的函数
|
|
|
CString DectoBin(CString strDec)
|
|
|
{
|
|
|
int nDec = atoi(strDec); //字符串转十进制数字
|
|
|
int nYushu, nShang; //余数、商
|
|
|
CString strBin; //二进制数字代表的字符串
|
|
|
CString strTemp;
|
|
|
char buf[9];
|
|
|
BOOL bContinue = TRUE;
|
|
|
int nCount = 0;
|
|
|
while (bContinue)
|
|
|
{
|
|
|
nYushu = nDec % 2;
|
|
|
nShang = nDec / 2;
|
|
|
nDec = nShang;
|
|
|
buf[nCount] = nYushu+48;
|
|
|
if (0 == nShang)
|
|
|
{
|
|
|
bContinue = FALSE;
|
|
|
}
|
|
|
nCount++;
|
|
|
buf[nCount] = '\0';
|
|
|
}
|
|
|
strBin = buf;
|
|
|
for (int i = 0; i<(strBin.GetLength()/2); i++)
|
|
|
{
|
|
|
char temp;
|
|
|
temp = buf[i];
|
|
|
buf[i] = buf[strBin.GetLength()-1-i];
|
|
|
buf[strBin.GetLength()-1-i] = temp;
|
|
|
}
|
|
|
strBin = buf;
|
|
|
int nTemp = strBin.GetLength()%8;
|
|
|
switch(nTemp)
|
|
|
{
|
|
|
case 1:
|
|
|
strTemp.Format(_T("0000000%s"),strBin);
|
|
|
strBin = strTemp;
|
|
|
break;
|
|
|
case 2:
|
|
|
strTemp.Format(_T("000000%s"),strBin);
|
|
|
strBin = strTemp;
|
|
|
break;
|
|
|
case 3:
|
|
|
strTemp.Format(_T("00000%s"),strBin);
|
|
|
strBin = strTemp;
|
|
|
break;
|
|
|
case 4:
|
|
|
strTemp.Format(_T("0000%s"),strBin);
|
|
|
strBin = strTemp;
|
|
|
break;
|
|
|
case 5:
|
|
|
strTemp.Format(_T("000%s"),strBin);
|
|
|
strBin = strTemp;
|
|
|
break;
|
|
|
case 6:
|
|
|
strTemp.Format(_T("00%s"),strBin);
|
|
|
strBin = strTemp;
|
|
|
break;
|
|
|
case 7:
|
|
|
strTemp.Format(_T("0%s"),strBin);
|
|
|
strBin = strTemp;
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
return strBin;
|
|
|
}
|
|
|
|
|
|
// 键盘/鼠标消息响应函数
|
|
|
BOOL CShowFJDataDlg::PreTranslateMessage(MSG* pMsg)
|
|
|
{
|
|
|
// 键盘消息
|
|
|
if (pMsg->message == WM_KEYDOWN)
|
|
|
{
|
|
|
// 忽略ESC和回车键
|
|
|
if (pMsg->wParam == VK_ESCAPE || pMsg->wParam == VK_RETURN)
|
|
|
{
|
|
|
return TRUE;
|
|
|
}
|
|
|
// F2键控制“视频控制”窗口的现实/隐藏
|
|
|
if (pMsg->wParam == VK_F2)
|
|
|
{
|
|
|
// 关闭窗口
|
|
|
OnOK();
|
|
|
}
|
|
|
}
|
|
|
return CDialogEx::PreTranslateMessage(pMsg);
|
|
|
}
|
|
|
|
|
|
BOOL CShowFJDataDlg::OnInitDialog()
|
|
|
{
|
|
|
CDialogEx::OnInitDialog();
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
|
}
|
|
|
|
|
|
// 显示CH96FJ数据
|
|
|
void CShowFJDataDlg::ShowCH96FJData(const Data96TXD &frame)
|
|
|
{
|
|
|
CString str;
|
|
|
//********************************************载荷状态******************************//
|
|
|
// EO焦距值
|
|
|
str.Format("%.2f", frame.EOFocus);
|
|
|
GetDlgItem(IDC_EDIT_CH96_EOFocalLen)->SetWindowText(str);
|
|
|
// IR焦距值
|
|
|
str.Format("%.2f", frame.IRFocus);
|
|
|
GetDlgItem(IDC_EDIT_CH96_IRFocalLen)->SetWindowText(str);
|
|
|
// 载荷方位角
|
|
|
str.Format("%.2f", frame.ZH_Azimuth);
|
|
|
GetDlgItem(IDC_EDIT_CH96_ZH_Azimuth)->SetWindowText(str);
|
|
|
// 载荷俯仰角
|
|
|
str.Format("%.2f", frame.ZH_Pitch);
|
|
|
GetDlgItem(IDC_EDIT_CH96_ZH_Pitch)->SetWindowText(str);
|
|
|
// 方位脱靶量(dy)
|
|
|
str.Format("%d", frame.dy);
|
|
|
GetDlgItem(IDC_EDIT_CH96_ZH_DeltaY)->SetWindowText(str);
|
|
|
// 俯仰脱靶量
|
|
|
str.Format("%d", frame.dx);
|
|
|
GetDlgItem(IDC_EDIT_CH96_ZH_DeltaX)->SetWindowText(str);
|
|
|
// 像元尺寸
|
|
|
str.Format("%.2f", frame.PixelSize);
|
|
|
GetDlgItem(IDC_EDIT_CH96_ZH_PIXELSIZE)->SetWindowText(str);
|
|
|
// 激光状态
|
|
|
str.Format("%d", frame.LaserState);
|
|
|
GetDlgItem(IDC_EDIT_CH96_LASERSTATE)->SetWindowText(str);
|
|
|
// 激光测距值
|
|
|
str.Format("%d",frame.LaserDis);
|
|
|
GetDlgItem(IDC_EDIT_CH96_ZH_LaserDist)->SetWindowText(str);
|
|
|
// 载荷状态(复接数据有误的情况下,返回值不局限于8位)
|
|
|
UINT8 ZHState = frame.Status2 & 0x0F;
|
|
|
if (ZHState >= 7)
|
|
|
{
|
|
|
ZHState = 7; // 只保留7种类型
|
|
|
}
|
|
|
const CString ZHStr[8] = {"手动跟踪", "自动跟踪", "锁定", "数引", "扫描", "保护态", "初始化", "其他"};
|
|
|
str.Format("%s", ZHStr[ZHState]);
|
|
|
GetDlgItem(IDC_EDIT_CH96_ZHSTATE)->SetWindowText(str);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//********************************************载荷状态******************************//
|
|
|
// 飞机ID
|
|
|
str.Format("%d", frame.PlaneID);
|
|
|
GetDlgItem(IDC_EDIT_UAV_ID)->SetWindowText(str);
|
|
|
// 飞机俯仰角
|
|
|
str.Format("%.2f", frame.Pitch);
|
|
|
GetDlgItem(IDC_EDIT_GPS_FB_Pitch)->SetWindowText(str);
|
|
|
// 飞机滚转角
|
|
|
str.Format("%.2f", frame.Roll);
|
|
|
GetDlgItem(IDC_EDIT_GPS_LR_Roll)->SetWindowText(str);
|
|
|
// 飞机航向角
|
|
|
str.Format("%.2f", frame.Yaw);
|
|
|
GetDlgItem(IDC_EDIT_GPS_LR_Heading)->SetWindowText(str);
|
|
|
|
|
|
// GPS经度
|
|
|
str.Format("%.7f", frame.Satelite_lon);
|
|
|
GetDlgItem(IDC_EDIT_GPS_LR_Lon)->SetWindowText(str);
|
|
|
// GPS纬度
|
|
|
str.Format("%.7f", frame.Satelite_lat);
|
|
|
GetDlgItem(IDC_EDIT_GPS_LR_Lat)->SetWindowText(str);
|
|
|
// GPS高度
|
|
|
str.Format("%.2f", frame.Satelite_height);
|
|
|
GetDlgItem(IDC_EDIT_GPS_LR_Alt)->SetWindowText(str);
|
|
|
// 卫星定位东向速度
|
|
|
str.Format("%.2f", frame.Satelite_Ground_Speed);
|
|
|
GetDlgItem(IDC_EDIT_GPS_LR_VHeading)->SetWindowText(str);
|
|
|
// 卫星定位北向速度
|
|
|
str.Format("%.2f", frame.Satelite_Ground_Speed_Dir);
|
|
|
GetDlgItem(IDC_EDIT_GPS_LR_HoriSpeed)->SetWindowText(str);
|
|
|
// 卫星定位天速
|
|
|
str.Format("%.2f", frame.Satelite_Sky_Speed);
|
|
|
GetDlgItem(IDC_EDIT_GPS_LR_VertSpeed)->SetWindowText(str);
|
|
|
|
|
|
// 导航状态
|
|
|
str.Format("%d", frame.NavigationState);
|
|
|
GetDlgItem(IDC_EDIT_GPS_LR_WorkState)->SetWindowText(str);
|
|
|
// 组合导航俯仰角
|
|
|
str.Format("%.2f", frame.MTI_Pitch);
|
|
|
GetDlgItem(IDC_EDIT_MTI_PITCH)->SetWindowText(str);
|
|
|
// 组合导航滚转角
|
|
|
str.Format("%.2f", frame.MTI_Roll);
|
|
|
GetDlgItem(IDC_EDIT_MTI_ROLL)->SetWindowText(str);
|
|
|
// 组合导航航向角
|
|
|
str.Format("%.2f", frame.MTI_Yaw);
|
|
|
GetDlgItem(IDC_EDIT_MTI_YAW)->SetWindowText(str);
|
|
|
// 组合导航经度
|
|
|
str.Format("%.2f", frame.MTI_lon);
|
|
|
GetDlgItem(IDC_EDIT_MTI_LON)->SetWindowText(str);
|
|
|
// 组合导航纬度
|
|
|
str.Format("%.2f", frame.MTI_lat);
|
|
|
GetDlgItem(IDC_EDIT_MTI_LAT)->SetWindowText(str);
|
|
|
// 组合导航高度
|
|
|
str.Format("%.2f", frame.MTI_height);
|
|
|
GetDlgItem(IDC_EDIT_MTI_ALT)->SetWindowText(str);
|
|
|
// 组合导航东向速度
|
|
|
str.Format("%.2f", frame.MTI_Ground_Speed);
|
|
|
GetDlgItem(IDC_EDIT_MTI_EASTSPEED)->SetWindowText(str);
|
|
|
// 组合导航北向速度
|
|
|
str.Format("%.2f", frame.MTI_Ground_Speed_Dir);
|
|
|
GetDlgItem(IDC_EDIT_MTI_NORTHSPEED)->SetWindowText(str);
|
|
|
// 组合导航天速
|
|
|
str.Format("%.2f", frame.MTI_Sky_Speed);
|
|
|
GetDlgItem(IDC_EDIT_MTI_SKYSPEED)->SetWindowText(str);
|
|
|
|
|
|
// 气压高度
|
|
|
str.Format("%.2f", frame.PressureHEG);
|
|
|
GetDlgItem(IDC_EDIT_UAV_AirPresAlt)->SetWindowText(str);
|
|
|
// 空速
|
|
|
str.Format("%.2f", frame.AirSpeed);
|
|
|
GetDlgItem(IDC_EDIT_UAV_AirPresSpeed)->SetWindowText(str);
|
|
|
// 发动机转速
|
|
|
str.Format("%d", frame.Engine_Speed);
|
|
|
GetDlgItem(IDC_EDIT_EngineSpeed)->SetWindowText(str);
|
|
|
// 左缸温
|
|
|
str.Format("%d", frame.Left_Tmp);
|
|
|
GetDlgItem(IDC_EDIT_TemL)->SetWindowText(str);
|
|
|
// 右缸温
|
|
|
str.Format("%d", frame.Right_Tmp);
|
|
|
GetDlgItem(IDC_EDIT_TemR)->SetWindowText(str);
|
|
|
|
|
|
//卫导1UTC天秒(此处是否需要乘个系数?)
|
|
|
int utc_LR = static_cast<int>(frame.UTC_Second );
|
|
|
CString str_Hour_LR, str_Min_LR, str_Sec_LR;
|
|
|
str_Hour_LR.Format("%02d", (utc_LR / 3600 + 8) % 24);
|
|
|
str_Min_LR.Format("%02d", utc_LR % 3600 / 60);
|
|
|
str_Sec_LR.Format("%02d", utc_LR % 3600 % 60);
|
|
|
CString str_GPS_LR_UTC;
|
|
|
str_GPS_LR_UTC = str_Hour_LR + ":" + str_Min_LR + ":" + str_Sec_LR;
|
|
|
GetDlgItem(IDC_EDIT_GPS_LR_UTC)->SetWindowTextA(str_GPS_LR_UTC);
|
|
|
|
|
|
//卫导1UTC日——与卫导1月,年合并,并显示在年那一栏
|
|
|
CString str_GPS_LR_Day;
|
|
|
str_GPS_LR_Day.Format(_T("%d"), frame.UTC_Day);
|
|
|
|
|
|
//卫导1UTC月——与卫导1日,年合并,并显示在年那一栏
|
|
|
CString str_GPS_LR_Month;
|
|
|
str_GPS_LR_Month.Format(_T("%d"), frame.UTC_Month);
|
|
|
|
|
|
//卫导1UTC年——与卫导1日,月合并,并显示在本栏
|
|
|
CString str_GPS_LR_Year;
|
|
|
str_GPS_LR_Year.Format(_T("%d"), frame.UTC_Year);
|
|
|
str_GPS_LR_Year = str_GPS_LR_Year + "/" + str_GPS_LR_Month + "/" + str_GPS_LR_Day;
|
|
|
GetDlgItem(IDC_EDIT_GPS_LR_Year)->SetWindowTextA(str_GPS_LR_Year);
|
|
|
} |