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

📄 ontrol.cpp

📁 《数字图象工程案例》原码
💻 CPP
字号:
// ontrol.cpp : implementation file
//

#include "stdafx.h"
#include "Designer.h"
#include "ontrol.h"
#include "BaseTexture.h"
#include "TextureJW.h"
#include "BASEPARA.h"
#include "TEXTRUE.h"
#include "MainFrm.h"
#include "DesignerView.h"
#include "EDGESELECT.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//extern float fcoeff;
/////////////////////////////////////////////////////////////////////////////
// Control

IMPLEMENT_DYNCREATE(Control, CFormView)

Control::Control()
	: CFormView(Control::IDD)
{	
	this->m_jingmi =0;
	this->m_weimi = 0;
	this->m_neijingsishu = 0;
	m_BaseCreate = false;
	//{{AFX_DATA_INIT(Control)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}

Control::~Control()
{
}

void Control::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(Control)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(Control, CFormView)
	//{{AFX_MSG_MAP(Control)
	ON_BN_CLICKED(IDC_BUTTON_NEWBASE, OnButtonNewbase)
	ON_BN_CLICKED(IDC_BUTTON_PICTUREDESIGN, OnButtonPicturedesign)
	ON_BN_CLICKED(IDC_BUTTON_BASE_PARA, OnButtonBasePara)
	ON_BN_CLICKED(IDC_BUTTON_OPEN_TEXTURE_FILE, OnButtonOpenTextureFile)
	ON_BN_CLICKED(IDC_BUTTON_PICTURE_DESIGN, OnButtonPictureDesign)
	
	


	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// Control diagnostics

#ifdef _DEBUG
void Control::AssertValid() const
{
	CFormView::AssertValid();
}

void Control::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// Control message handlers

void Control::OnButtonNewbase() //chongxinsheji
{
	// TODO: Add your control notification handler code here
	BaseTexture bt;
	bt.m_jwm = (float)this->m_jingmi /this->m_weimi;
	bt.m_jingmi = this->m_jingmi;
	bt.m_weimi  = this->m_weimi;
	if(bt.DoModal()== IDOK)
		return;

}

void Control::OnButtonPicturedesign() //xinjian zuzhitu
{	
	if(this->m_jingmi ==0 || this->m_weimi ==0)
	{
		AfxMessageBox("请先输入经维密度");
		return;
	}

	TextureJW jw;
    jw.m_coeff = this->m_jingmi/this->m_weimi;
	jw.m_jm = this->m_jingmi;
	jw.m_wm = this->m_weimi;
	if(jw.DoModal() == IDOK)
		return;
	// TODO: Add your control notification handler code here
	
}

void Control::OnButtonBasePara() 
{	
	BASEPARA bp;
	bp.m_jm = this->m_jingmi;
	bp.m_wm = this->m_weimi;
	
	if(bp.DoModal() == IDOK)
	{
		this->m_chengpinmidu = bp.m_cpmd;
		this->m_jingmi = bp.m_jm;
		this->m_weimi = bp.m_wm;
		this->m_neijingsishu = bp.m_njss;
	
	}
	return;
// TODO: Add your control notification handler code here
	
}

void Control::OnButtonOpenTextureFile() //dakai zuzhitu
{
		// TODO: Add your control notification handler code here
		CFileDialog  dlg1(TRUE,"zuz","*.zuz",NULL,"*.zuz",NULL);
		FILE *fp;
		TEXTRUE  *ptextu = new TEXTRUE();
		if(dlg1.DoModal() == IDOK)
		{
			fp = fopen(dlg1.GetPathName(),"r") ;
			 fscanf(fp,"%d",&(ptextu->m_jing_num) );
			 fscanf(fp,"%d",&(ptextu->m_wei_num) );
			 fscanf(fp,"%f",&(ptextu->m_coeff));
			 fscanf(fp,"%f",&(ptextu->m_jm));
			 fscanf(fp,"%f",&(ptextu->m_wm));
			 for(int i = 0;i<ptextu->m_wei_num;i++)
				 for(int j =0;j<ptextu->m_jing_num;j++)
					 fscanf(fp,"%d",&(ptextu->m_jwlabel[j][i]));
				 fclose(fp);
		ptextu->m_type = 1;
		ptextu->m_texture_color = RGB(255,0,0);
		ptextu->m_JN = ptextu->m_jing_num;
		ptextu->m_WN = ptextu->m_wei_num;
		ptextu->Create();
    	ptextu->ShowWindow(SW_SHOW);
		}
		
		//textu.m_jwcoeff = textu.m_coeff;
		
}



void Control::OnButtonPictureDesign() //sheji diban
{
	// TODO: Add your control notification handler code here
	if(this->m_BaseCreate == false)
	{
		AfxMessageBox("请先创建底板  ");
		return;
	}
	EDGESELECT *pedge;
	pedge = new EDGESELECT();
	pedge->Create();
	pedge->ShowWindow(SW_SHOW);
		
}








⌨️ 快捷键说明

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