⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lmsdlg.cpp

📁 用于移动通信计算场强
💻 CPP
字号:
// lmsDlg.cpp : implementation file
//

#include "stdafx.h"
#include "lms.h"
#include "lmsDlg.h"
#include "Cdraw1.h"
#include "math.h"
#include "Ckk.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
		// No message handlers
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CLmsDlg dialog

CLmsDlg::CLmsDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CLmsDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CLmsDlg)
	m_distance = 0.0;
	m_fa = 0.0;
	m_fb = 0.0;
	m_fc = 0.0;
	m_frequency = 0.0;
	m_highb = 0.0;
	m_highu = 0.0;
	m_la = 0.0;
	m_lb = 0.0;
	m_lc = 0.0;
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CLmsDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CLmsDlg)
	DDX_Text(pDX, IDC_distance, m_distance);
	DDV_MinMaxDouble(pDX, m_distance, 1., 300.);
	DDX_Text(pDX, IDC_fa, m_fa);
	DDX_Text(pDX, IDC_fb, m_fb);
	DDX_Text(pDX, IDC_fc, m_fc);
	DDX_Text(pDX, IDC_frequency, m_frequency);
	DDV_MinMaxDouble(pDX, m_frequency, 150., 2000.);
	DDX_Text(pDX, IDC_highb, m_highb);
	DDV_MinMaxDouble(pDX, m_highb, 20., 2500.);
	DDX_Text(pDX, IDC_highu, m_highu);
	DDV_MinMaxDouble(pDX, m_highu, 1., 10.);
	DDX_Text(pDX, IDC_la, m_la);
	DDX_Text(pDX, IDC_lb, m_lb);
	DDX_Text(pDX, IDC_lc, m_lc);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CLmsDlg, CDialog)
	//{{AFX_MSG_MAP(CLmsDlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(IDC_calculate, Oncalculate)
	ON_BN_CLICKED(IDC_huatu1, Onhuatu1)
	ON_BN_CLICKED(IDC_huatu2, Onhuatu2)
	ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
	ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
	ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
	ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
	ON_BN_CLICKED(IDC_RADIO5, OnRadio5)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CLmsDlg message handlers

BOOL CLmsDlg::OnInitDialog()
{
	m_frequency=150;
	m_highb=45;
	m_highu=1.5;
	m_distance=1;
	CDialog::OnInitDialog();

	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CLmsDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CLmsDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CLmsDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CLmsDlg::Oncalculate() 
{
		
			UpdateData(true);
	if(m_num==1&&m_num2==1)
	{
			m_fa=39.82+30.81-6.16*log10(m_frequency)+13.82*log10(m_highb)+8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10-(44.9-6.55*log10(m_highb))*log10(m_distance)-0.8;
			m_fb=39.82+30.81-6.16*log10(m_frequency)+13.82*log10(m_highb)+8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10-(44.9-6.55*log10(m_highb))*log10(m_distance)-0.795;
			m_fc=39.82+30.81-6.16*log10(m_frequency)+13.82*log10(m_highb)+8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10-(44.9-6.55*log10(m_highb))*log10(m_distance)+2.61;
			m_la=69.55+26.16*log10(m_frequency)-13.82*log10(m_highb)-8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10+(44.9-6.55*log10(m_highb))*log10(m_distance)+2.2;
			m_lb=69.55+26.16*log10(m_frequency)-13.82*log10(m_highb)-8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10+(44.9-6.55*log10(m_highb))*log10(m_distance)+2.2;
			m_lc=69.55+26.16*log10(m_frequency)-13.82*log10(m_highb)-8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10+(44.9-6.55*log10(m_highb))*log10(m_distance)-0.7;
	}
			
	if(m_num==1&&m_num2==2)
	{
			m_fa=39.82+30.81-6.16*log10(m_frequency)+13.82*log10(m_highb)+8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10-(44.9-6.55*log10(m_highb))*log10(m_distance)-1.3;
			m_fb=39.82+30.81-6.16*log10(m_frequency)+13.82*log10(m_highb)+8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10-(44.9-6.55*log10(m_highb))*log10(m_distance)-1.295;
			m_fc=39.82+30.81-6.16*log10(m_frequency)+13.82*log10(m_highb)+8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10-(44.9-6.55*log10(m_highb))*log10(m_distance)+5.61;
			m_la=69.55+26.16*log10(m_frequency)-13.82*log10(m_highb)-8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10+(44.9-6.55*log10(m_highb))*log10(m_distance)+2.25;
			m_lb=69.55+26.16*log10(m_frequency)-13.82*log10(m_highb)-8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10+(44.9-6.55*log10(m_highb))*log10(m_distance)+2.25;
			m_lc=69.55+26.16*log10(m_frequency)-13.82*log10(m_highb)-8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10+(44.9-6.55*log10(m_highb))*log10(m_distance)-3.7;
	}
	if(m_num==2)
	{
	m_fa=39.82+30.81-6.16*log10(m_frequency)+13.82*log10(m_highb)+8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10-(44.9-6.55*log10(m_highb))*log10(m_distance)+2*log10(m_frequency/28)*log10(m_frequency/28)+5.4-0.9;
			m_fb=39.82+30.81-6.16*log10(m_frequency)+13.82*log10(m_highb)+8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10-(44.9-6.55*log10(m_highb))*log10(m_distance)+2*log10(m_frequency/28)*log10(m_frequency/28)+5.4-0.9;
			m_fc=39.82+30.81-6.16*log10(m_frequency)+13.82*log10(m_highb)+8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10-(44.9-6.55*log10(m_highb))*log10(m_distance)+2*log10(m_frequency/28)*log10(m_frequency/28)+5.4+5.5;
			m_la=69.55+26.16*log10(m_frequency)-13.82*log10(m_highb)-8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10+(44.9-6.55*log10(m_highb))*log10(m_distance)+2.25-2*log10(m_frequency/28)*log10(m_frequency/28)-5.4;
			m_lb=69.55+26.16*log10(m_frequency)-13.82*log10(m_highb)-8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10+(44.9-6.55*log10(m_highb))*log10(m_distance)+2.25-2*log10(m_frequency/28)*log10(m_frequency/28)-5.4;
			m_lc=69.55+26.16*log10(m_frequency)-13.82*log10(m_highb)-8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10+(44.9-6.55*log10(m_highb))*log10(m_distance)-3.7-2*log10(m_frequency/28)*log10(m_frequency/28)-5.4-0.4;
	}
	if(m_num==3)
	{
		m_fa=39.82+30.81-6.16*log10(m_frequency)+13.82*log10(m_highb)+8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10-(44.9-6.55*log10(m_highb))*log10(m_distance)+4.78*log10(m_frequency)*log10(m_frequency)-18.33*log10(m_frequency)+40.94-0.8;
		m_fb=39.82+30.81-6.16*log10(m_frequency)+13.82*log10(m_highb)+8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10-(44.9-6.55*log10(m_highb))*log10(m_distance)+4.78*log10(m_frequency)*log10(m_frequency)-18.33*log10(m_frequency)+40.94-0.8;
			m_fc=39.82+30.81-6.16*log10(m_frequency)+13.82*log10(m_highb)+8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10-(44.9-6.55*log10(m_highb))*log10(m_distance)+4.78*log10(m_frequency)*log10(m_frequency)-18.33*log10(m_frequency)+40.94+5.6;
			m_la=69.55+26.16*log10(m_frequency)-13.82*log10(m_highb)-8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10+(44.9-6.55*log10(m_highb))*log10(m_distance)+2.25-4.78*log10(m_frequency)*log10(m_frequency)+18.33*log10(m_frequency)-40.94;
			m_lb=69.55+26.16*log10(m_frequency)-13.82*log10(m_highb)-8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10+(44.9-6.55*log10(m_highb))*log10(m_distance)+2.25-4.78*log10(m_frequency)*log10(m_frequency)+18.33*log10(m_frequency)-40.94;
			m_lc=69.55+26.16*log10(m_frequency)-13.82*log10(m_highb)-8.29*log10(1.54*m_highu)*log10(1.54*m_highu)-1.10+(44.9-6.55*log10(m_highb))*log10(m_distance)-3.7-4.78*log10(m_frequency)*log10(m_frequency)+18.33*log10(m_frequency)-40.94;
	}
	UpdateData(false);

	
		if(m_distance>100||m_frequency>1500||m_highb>200)
		{
		GetDlgItem(IDC_fa)->EnableWindow(false);
		GetDlgItem(IDC_la)->EnableWindow(false);
		}
		else
		{
			GetDlgItem(IDC_fa)->EnableWindow(true);
			GetDlgItem(IDC_la)->EnableWindow(true);
		}// TODO: Add your control notification handler code here
	  
		if(m_frequency<1500||m_distance>100||m_highb>200)
		{
		GetDlgItem(IDC_fc)->EnableWindow(false);
		GetDlgItem(IDC_lc)->EnableWindow(false);
		}
	else
		{
			GetDlgItem(IDC_fc)->EnableWindow(true);
			GetDlgItem(IDC_lc)->EnableWindow(true);
		}

	
		if(m_frequency>1500)
		{
		GetDlgItem(IDC_fb)->EnableWindow(false);
		GetDlgItem(IDC_lb)->EnableWindow(false);
		}
			else
		{
			GetDlgItem(IDC_fb)->EnableWindow(true);
			GetDlgItem(IDC_lb)->EnableWindow(true);
		}

}


void CLmsDlg::Onhuatu1() 
{
		UpdateData(true);
	CCdraw1 dlg;
	dlg.m_d1=m_distance;
	dlg.m_f1=m_frequency;
	dlg.m_hb1=m_highb;
	dlg.m_hu1=m_highu;
	dlg.DoModal();// TODO: Add your control notification handler code here
	UpdateData(false);
}

void CLmsDlg::Onhuatu2() 
{
	UpdateData(true);
	CCkk dlg;
	dlg.m_d2=m_distance;
	dlg.m_f2=m_frequency;
	dlg.m_hb2=m_highb;
	dlg.m_hu2=m_highu;
	dlg.DoModal();// TODO: Add your control notification handler code here
		UpdateData(false);
}

void CLmsDlg::OnRadio1() 
{
	m_num=1;
	GetDlgItem(IDC_RADIO4)->EnableWindow(true);
	GetDlgItem(IDC_RADIO5)->EnableWindow(true);// TODO: Add your control notification handler code here
	
}

void CLmsDlg::OnRadio2() 
{
	m_num=2;
	GetDlgItem(IDC_RADIO4)->EnableWindow(false);
	GetDlgItem(IDC_RADIO5)->EnableWindow(false);// TODO: Add your control notification handler code here
	
}

void CLmsDlg::OnRadio3() 
{
	m_num=3;
	GetDlgItem(IDC_RADIO4)->EnableWindow(false);
	GetDlgItem(IDC_RADIO5)->EnableWindow(false);// TODO: Add your control notification handler code here
	
}

void CLmsDlg::OnRadio4() 
{
	m_num2=1;// TODO: Add your control notification handler code here
	
}

void CLmsDlg::OnRadio5() 
{
	m_num2=2;// TODO: Add your control notification handler code here
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -