www.pudn.com > RADAR-ALARM.rar > ThresholdSetDlg.cpp, change:2011-07-31,size:4540b


// ThresholdSetDlg.cpp : 实现文件 
// 
 
#include "stdafx.h" 
#include "RadarView.h" 
#include "ThresholdSetDlg.h" 
 
 
// CThresholdSetDlg 对话框 
 
IMPLEMENT_DYNAMIC(CThresholdSetDlg, CDialog) 
 
CThresholdSetDlg::CThresholdSetDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CThresholdSetDlg::IDD, pParent) 
	, RBinNum(2) 
	, RAziNum(2) 
	, RRange(60) 
	, R05ValueThreshold(40) 
	, R15ValueThreshold(40) 
	, V05ValueThreshold(20) 
	, V15ValueThreshold(20) 
	, VBinNum(2) 
	, VAziNum(2) 
	, VRange(60) 
	, R05TotalAreaThreshold(1000) 
	, R15TotalAreaThreshold(1000) 
	, V05TotalAreaThreshold(1000) 
	, V15TotalAreaThreshold(1000) 
	, R05SingleAreaThreshold(100) 
	, R15SingleAreaThreshold(100) 
	, V05SingleAreaThreshold(100) 
	, V15SingleAreaThreshold(100) 
{ 
 
} 
 
CThresholdSetDlg::~CThresholdSetDlg() 
{ 
} 
 
void CThresholdSetDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	DDX_Text(pDX, IDC_EDIT1, RBinNum); 
	DDV_MinMaxInt(pDX, RBinNum, 0, 460); 
	DDX_Text(pDX, IDC_EDIT2, RAziNum); 
	DDV_MinMaxInt(pDX, RAziNum, 0, 360); 
	DDX_Text(pDX, IDC_EDIT3, RRange); 
	DDV_MinMaxInt(pDX,RRange, 0, 460); 
	DDX_Text(pDX, IDC_EDIT4, R05ValueThreshold); 
	DDV_MinMaxInt(pDX, R05ValueThreshold, 0, 80); 
	DDX_Text(pDX, IDC_EDIT7, R15ValueThreshold); 
	DDV_MinMaxInt(pDX, R15ValueThreshold, 0, 80); 
	DDX_Text(pDX, IDC_EDIT13, V05ValueThreshold); 
	DDV_MinMaxInt(pDX, V05ValueThreshold, 0, 30); 
	DDX_Text(pDX, IDC_EDIT16, V15ValueThreshold); 
	DDV_MinMaxInt(pDX, V15ValueThreshold, 0, 30); 
	DDX_Text(pDX, IDC_EDIT10, VBinNum); 
	DDV_MinMaxInt(pDX, VBinNum, 0, 460); 
	DDX_Text(pDX, IDC_EDIT11, VAziNum); 
	DDV_MinMaxInt(pDX, VAziNum, 0, 360); 
	DDX_Text(pDX, IDC_EDIT12, VRange); 
	DDV_MinMaxInt(pDX, VRange, 0, 460); 
	DDX_Text(pDX, IDC_EDIT5, R05TotalAreaThreshold); 
	DDX_Text(pDX, IDC_EDIT8, R15TotalAreaThreshold); 
	DDX_Text(pDX, IDC_EDIT14, V05TotalAreaThreshold); 
	DDX_Text(pDX, IDC_EDIT17, V15TotalAreaThreshold); 
	DDX_Text(pDX, IDC_EDIT6, R05SingleAreaThreshold); 
	DDX_Text(pDX, IDC_EDIT9, R15SingleAreaThreshold); 
	DDX_Text(pDX, IDC_EDIT15, V05SingleAreaThreshold); 
	DDX_Text(pDX, IDC_EDIT18, V15SingleAreaThreshold); 
} 
 
 
BEGIN_MESSAGE_MAP(CThresholdSetDlg, CDialog) 
	ON_BN_CLICKED(IDOK, &CThresholdSetDlg::OnBnClickedOk) 
END_MESSAGE_MAP() 
 
 
// CThresholdSetDlg 消息处理程序 
 
void CThresholdSetDlg::OnBnClickedOk() 
{ 
	// TODO: 在此添加控件通知处理程序代码 
	UpdateData(true); 
	CFile file; 
	file.Open(_T("config.dat"),CFile::modeWrite|CFile::modeCreate); 
	file.Write (&RAziNum,sizeof(RAziNum)); 
    file.Write (&RBinNum,sizeof(int)); 
	file.Write (&RRange,sizeof(int)); 
	file.Write (&R05ValueThreshold,sizeof(int)); 
	file.Write (&R05SingleAreaThreshold,sizeof(int)); 
	file.Write (&R05TotalAreaThreshold,sizeof(int)); 
	file.Write (&R15ValueThreshold,sizeof(int)); 
	file.Write (&R15SingleAreaThreshold,sizeof(int)); 
	file.Write (&R15TotalAreaThreshold,sizeof(int)); 
 
	file.Write (&VAziNum,sizeof(RAziNum)); 
    file.Write (&VBinNum,sizeof(int)); 
	file.Write (&VRange,sizeof(int)); 
	file.Write (&V05ValueThreshold,sizeof(int)); 
	file.Write (&V05SingleAreaThreshold,sizeof(int)); 
	file.Write (&V05TotalAreaThreshold,sizeof(int)); 
	file.Write (&V15ValueThreshold,sizeof(int)); 
	file.Write (&V15SingleAreaThreshold,sizeof(int)); 
	file.Write (&V15TotalAreaThreshold,sizeof(int)); 
	 
	file.Close(); 
	OnOK(); 
} 
 
BOOL CThresholdSetDlg::OnInitDialog() 
{ 
	CDialog::OnInitDialog(); 
 
	// TODO:  在此添加额外的初始化 
 
	CFile file; 
	if(file.Open(_T("config.dat"),CFile::modeRead)==true) 
	{ 
		file.Read (&RAziNum,sizeof(RAziNum)); 
		file.Read (&RBinNum,sizeof(int)); 
		file.Read (&RRange,sizeof(int)); 
		file.Read (&R05ValueThreshold,sizeof(int)); 
		file.Read (&R05SingleAreaThreshold,sizeof(int)); 
		file.Read (&R05TotalAreaThreshold,sizeof(int)); 
		file.Read (&R15ValueThreshold,sizeof(int)); 
		file.Read (&R15SingleAreaThreshold,sizeof(int)); 
		file.Read (&R15TotalAreaThreshold,sizeof(int)); 
 
		file.Read (&VAziNum,sizeof(RAziNum)); 
		file.Read (&VBinNum,sizeof(int)); 
		file.Read (&VRange,sizeof(int)); 
		file.Read (&V05ValueThreshold,sizeof(int)); 
		file.Read (&V05SingleAreaThreshold,sizeof(int)); 
		file.Read (&V05TotalAreaThreshold,sizeof(int)); 
		file.Read (&V15ValueThreshold,sizeof(int)); 
		file.Read (&V15SingleAreaThreshold,sizeof(int)); 
		file.Read (&V15TotalAreaThreshold,sizeof(int)); 
		file.Close(); 
	} 
	UpdateData(false); 
	 
 
	return TRUE;  // return TRUE unless you set the focus to a control 
	// 异常: OCX 属性页应返回 FALSE 
}