Class CLaba1App : public CWinApp



{

public:

CLaba1App();

int count;

// Overrides

public:

virtual BOOL InitInstance();

// Implementation

DECLARE_MESSAGE_MAP()

};

extern CLaba1App theApp;

// Laba1.cpp : Defines the class behaviors for the application.

//

#include "stdafx.h"

#include "Laba1.h"

#include "Laba1Dlg.h"

#ifdef _DEBUG

#define new DEBUG_NEW

#endif

// CLaba1App

BEGIN_MESSAGE_MAP(CLaba1App, CWinApp)

ON_COMMAND(ID_HELP, CWinApp::OnHelp)

END_MESSAGE_MAP()

// CLaba1App construction

CLaba1App::CLaba1App()

{

TODO: add construction code here,

Place all significant initialization in InitInstance

}

// The one and only CLaba1App object

CLaba1App theApp;

// CLaba1App initialization

BOOL CLaba1App::InitInstance()

{

InitCommonControls();

CWinApp::InitInstance();

AfxEnableControlContainer();

CLaba1Dlg dlg;

m_pMainWnd = &dlg;

INT_PTR nResponse = dlg.DoModal();

if (nResponse == IDOK)

{

TODO: Place code here to handle when the dialog is

Dismissed with OK

}

else if (nResponse == IDCANCEL)

{

TODO: Place code here to handle when the dialog is

Dismissed with Cancel

}

Since the dialog has been closed, return FALSE so that we exit the

Application, rather than start the application's message pump.

return FALSE;

}

// Laba1Dlg.h : header file

//

#pragma once

#include "..\chartdll\Chart.h"

#include "afxcmn.h"

#include "afxwin.h"

#include <GdiPlus.h>

// CLaba1Dlg dialog

using namespace Gdiplus;

Class CLaba1Dlg : public CDialog

{

// Construction

public:

CLaba1Dlg(CWnd* pParent = NULL); // standard constructor

Chart::CChart chart1, chart2;

// Dialog Data

enum { IDD = IDD_LABA1_DIALOG };

protected:

virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support

// Implementation

protected:

HICON m_hIcon;

Generated message map functions

virtual BOOL OnInitDialog();

afx_msg void OnPaint();

afx_msg HCURSOR OnQueryDragIcon();

DECLARE_MESSAGE_MAP()

public:

int m_nCount;

CSpinButtonCtrl m_Spin;

CListBox m_FuncList;

CListCtrl m_PointList;

float m_fStep;

bool init;

CArray<PointF> m_pureSignal;

CArray<PointF> m_Noise;

CArray<PointF> m_jammedSignal;

CArray<PointF> m_Signal;

bool not_filtered;

afx_msg void OnLbnSelchangeListFunctions();

void MakePureSignal();

void Filter();

int k;

afx_msg void OnEnChangeEditCount();

afx_msg void OnEnChangeEditStep();

void MakeNoise(void);

float m_fLow;

float m_fHigh;

afx_msg void OnBnClickedRadioNormal();

afx_msg void OnBnClickedRadioUniform();

float m_fDev;

afx_msg void OnBnClickedButtonMesh();

afx_msg void OnBnClickedButtonFilter();

afx_msg void OnBnClickedButtonStop();

afx_msg void OnTimer(UINT nIDEvent);

CSpinButtonCtrl m_SpinSpeed;

int m_nSpeed;

afx_msg void OnEnChangeEditSpeed();

};

// Laba1Dlg.cpp : implementation file

//

#include "stdafx.h"

#include "Laba1.h"

#include "Laba1Dlg.h"

#include "NoiseDlg.h"

#include ".\laba1dlg.h"

#ifdef _DEBUG

#define new DEBUG_NEW

#endif

// CLaba1Dlg dialog

CLaba1Dlg::CLaba1Dlg(CWnd* pParent /*=NULL*/)

CDialog(CLaba1Dlg::IDD, pParent)

M_nCount(0)

M_fStep(0)

Init(false)

M_fLow(0)

M_fHigh(0)

M_fDev(0)

M_nSpeed(0)

{

m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);

}

void CLaba1Dlg::DoDataExchange(CDataExchange* pDX)

{

CDialog::DoDataExchange(pDX);

DDX_Text(pDX, IDC_EDIT_COUNT, m_nCount);

DDX_Control(pDX, IDC_LIST_FUNCTIONS, m_FuncList);

DDX_Control(pDX, IDC_SPIN_COUNT, m_Spin);

DDX_Control(pDX, IDC_LIST_POINTS, m_PointList);

DDX_Text(pDX, IDC_EDIT_STEP, m_fStep);

DDX_Text(pDX, IDC_EDIT_LOW, m_fLow);

DDX_Text(pDX, IDC_EDIT_HIGH, m_fHigh);

DDX_Text(pDX, IDC_EDIT_DEV, m_fDev);

DDX_Control(pDX, IDC_SPIN_SPEED, m_SpinSpeed);

DDX_Text(pDX, IDC_EDIT_SPEED, m_nSpeed);

}

BOOL CLaba1Dlg::OnInitDialog()

{

CDialog::OnInitDialog();

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

chart1.CreateInContainer(GetDlgItem(IDC_STATIC_SIGNAL), "Чистый сигнал");

chart1.SetInterpolationType(Chart::CChart::itCurve);

chart2.CreateInContainer(GetDlgItem(IDC_STATIC_NOISE), "Шум");

chart2.SetInterpolationType(Chart::CChart::itLine);

m_Spin.SetRange(20, 5000);

m_SpinSpeed.SetRange(50, 2000);

m_nCount = 2000;

m_fStep = 0.01;

m_nSpeed = 500;

m_PointList.SetExtendedStyle(LVS_EX_GRIDLINES);

m_PointList.InsertColumn(0, "№",LVCFMT_LEFT, 35);

m_PointList.InsertColumn(1, "X",LVCFMT_LEFT, 40);

m_PointList.InsertColumn(2, "Y",LVCFMT_LEFT, 40);

m_FuncList.AddString("sin(x)");

m_FuncList.AddString("sin(x)+0.5*cos(x)");

m_fLow = -1;

m_fHigh = 1;

m_fDev = 1;

UpdateData(FALSE);

init = true;


Дата добавления: 2018-08-06; просмотров: 174; Мы поможем в написании вашей работы!

Поделиться с друзьями:






Мы поможем в написании ваших работ!