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

📄 dfb1view.cpp

📁 FF快速傅立叶变换算法构建的DFB
💻 CPP
字号:
// DFB1View.cpp : implementation of the CDFB1View class
//

#include "stdafx.h"
#include "DFB1.h"

#include "DFB1Doc.h"
#include "DFB1View.h"
#include "dialog1.h"
#include "dialog2.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDFB1View

IMPLEMENT_DYNCREATE(CDFB1View, CView)

BEGIN_MESSAGE_MAP(CDFB1View, CView)
	//{{AFX_MSG_MAP(CDFB1View)
	ON_COMMAND(ID_MENUITEM32773, OnMenuitem32773)
	ON_COMMAND(ID_MENUITEM32775, OnMenuitem32775)
	ON_COMMAND(ID_MENUITEM32776, OnMenuitem32776)
	ON_COMMAND(ID_MENUITEM32779, OnMenuitem32779)
	ON_COMMAND(ID_MENUITEM32780, OnMenuitem32780)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDFB1View construction/destruction

CDFB1View::CDFB1View()
{
	// TODO: add construction code here

}

CDFB1View::~CDFB1View()
{
}

BOOL CDFB1View::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CDFB1View drawing

void CDFB1View::OnDraw(CDC* pDC)
{
	CDFB1Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CDFB1View printing

BOOL CDFB1View::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CDFB1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CDFB1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CDFB1View diagnostics

#ifdef _DEBUG
void CDFB1View::AssertValid() const
{
	CView::AssertValid();
}

void CDFB1View::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CDFB1Doc* CDFB1View::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDFB1Doc)));
	return (CDFB1Doc*)m_pDocument;
}
#endif //_DEBUG


void CDFB1View::OnMenuitem32773() 
{

	CDFB1Doc* pDoc = GetDocument();        //获得指向doc类的指针,用于获得doc类中的数据
	ASSERT_VALID(pDoc);
	CPoint m_prepoint,m_nextpoint;       //确定两个点
	m_prepoint.y=long(pDoc->m_folded_output[0]);
	m_prepoint.x=0;
	CClientDC dc(this);
	dc.SetMapMode (MM_TWIPS);    //设置映射模式,确定了绘制图形是所依据的坐标系
	dc.SetWindowOrg(100,7000);          //设置逻辑坐标和设备坐标之间的关系
	double maxnum=0;
    for (int i=0;i<pDoc->bins;i++)
	{
		if (maxnum<pDoc->m_folded_output[i])
			maxnum=pDoc->m_folded_output[i];
	}
	double k=maxnum*maxnum/5000;
	int step=14000/pDoc->bins;
	for (i=0;i<pDoc->bins;i++)
	{   
		m_nextpoint.y=long(pDoc->m_folded_output[i]*pDoc->m_folded_output[i]/k);
		m_nextpoint.x=long(i*step);
		dc.MoveTo(m_prepoint);
		dc.LineTo(m_nextpoint);
		m_prepoint=m_nextpoint;
	}

}

void CDFB1View::OnMenuitem32775() 
{
	CDFB1Doc* pDoc = GetDocument();        //获得指向doc类的指针,用于获得doc类中的数据
	ASSERT_VALID(pDoc);
	CPoint m_prepoint,m_nextpoint;       //确定两个点
	m_prepoint.y=long(pDoc->m_ninco_output[1000]);
	m_prepoint.x=0;
	CClientDC dc(this);
	dc.SetMapMode (MM_TWIPS);    //设置映射模式,确定了绘制图形是所依据的坐标系
	dc.SetWindowOrg(100,7000);          //设置逻辑坐标和设备坐标之间的关系
	double maxnum=0;
    int shownums=pDoc->numspp*3;
    for (int i=0;i<shownums;i++)
	{
		if (maxnum<pDoc->m_ninco_output[i])
			maxnum=pDoc->m_ninco_output[i];
	}
	double k=maxnum*maxnum/5000;
    int step=22000/shownums;
	for (i=0;i<shownums;i++)
	{   
		m_nextpoint.y=long(pDoc->m_ninco_output[i+1000]*pDoc->m_ninco_output[i+1000]/k);
		m_nextpoint.x=long(i*step);
		dc.MoveTo(m_prepoint);
		dc.LineTo(m_nextpoint);
		m_prepoint=m_nextpoint;
	}
	
}

void CDFB1View::OnMenuitem32776() 
{
	CDFB1Doc* pDoc = GetDocument();        //获得指向doc类的指针,用于获得doc类中的数据
	ASSERT_VALID(pDoc);
	CPoint m_prepoint,m_nextpoint;       //确定两个点
	m_prepoint.y=long(pDoc->m_ndocinputdata[0]);
	m_prepoint.x=0;
	CClientDC dc(this);
	dc.SetMapMode (MM_TWIPS);    //设置映射模式,确定了绘制图形是所依据的坐标系
	dc.SetWindowOrg(100,7000);          //设置逻辑坐标和设备坐标之间的关系
	double K;   //K是倍数。用于自适应的调节倍数
	K=1000;
//	for (int i=1;i<pDoc->m_nreadnum;i++)
	for (int i=1;i<70000;i++)
	{   
		m_nextpoint.y=long(pDoc->m_ndocinputdata[i]*pDoc->m_ndocinputdata[i]*K);
		m_nextpoint.x=long(i*0.5);
		dc.MoveTo(m_prepoint);
		dc.LineTo(m_nextpoint);
		m_prepoint=m_nextpoint;
	}
}

void CDFB1View::OnMenuitem32779() 
{
	// TODO: Add your command handler code here
	
}

void CDFB1View::OnMenuitem32780() 
{
	// TODO: Add your command handler code here
	
}

⌨️ 快捷键说明

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