资源预览内容
第1页 / 共26页
第2页 / 共26页
第3页 / 共26页
第4页 / 共26页
第5页 / 共26页
第6页 / 共26页
第7页 / 共26页
第8页 / 共26页
第9页 / 共26页
第10页 / 共26页
亲,该文档总共26页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
此次作业主要采用 C+语言编写程序,同时利用了 matlab 进行格网点以及 DEM 三维显示。主要程序如下:#include StdAfx.h#include IDW.h#include IDWDlg.h#include math.h#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif/*/* CAboutDlg dialog used for App About */*/class CAboutDlg : public CDialogpublic: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/ Implementationprotected:/AFX_MSG(CAboutDlg)/AFX_MSGDECLARE_MESSAGE_MAP();CAboutDlg:CAboutDlg() : CDialog(CAboutDlg:IDD)/AFX_DATA_INIT(CAboutDlg)/AFX_DATA_INITvoid CAboutDlg:DoDataExchange(CDataExchange* pDX)CDialog:DoDataExchange(pDX);/AFX_DATA_MAP(CAboutDlg)/AFX_DATA_MAPBEGIN_MESSAGE_MAP(CAboutDlg, CDialog)/AFX_MSG_MAP(CAboutDlg)/ No message handlers/AFX_MSG_MAPEND_MESSAGE_MAP()/*/* CIDWDlg dialog */*/CIDWDlg:CIDWDlg(CWnd* pParent /*=NULL*/): CDialog(CIDWDlg:IDD, pParent)/AFX_DATA_INIT(CIDWDlg)m_strOpenFileName = _T();m_strSaveFileName = _T();m_maxX = 0;m_maxY = 0;m_minX = 0;m_minY = 0;m_rad = 100.0f;m_stepDis = 100.0f;/AFX_DATA_INIT/ Note that LoadIcon does not require a subsequent DestroyIcon in Win32m_hIcon = AfxGetApp()-LoadIcon(IDR_MAINFRAME);void CIDWDlg:DoDataExchange(CDataExchange* pDX)CDialog:DoDataExchange(pDX);/AFX_DATA_MAP(CIDWDlg)DDX_Control(pDX, IDC_PROGRESS1, m_ctrProgress);DDX_Text(pDX, IDC_OPEN_FILE, m_strOpenFileName);DDX_Text(pDX, IDC_SAVE_FILE, m_strSaveFileName);DDX_Text(pDX, IDC_EDIT_MAX_X, m_maxX);DDX_Text(pDX, IDC_EDIT_MAX_Y, m_maxY);DDX_Text(pDX, IDC_EDIT_MIN_X, m_minX);DDX_Text(pDX, IDC_EDIT_MIN_Y, m_minY);DDX_Text(pDX, IDC_EDIT_RAD, m_rad);DDX_Text(pDX, IDC_EDIT_STEP_DIS, m_stepDis);/AFX_DATA_MAPBEGIN_MESSAGE_MAP(CIDWDlg, CDialog)/AFX_MSG_MAP(CIDWDlg)ON_WM_SYSCOMMAND()ON_WM_PAINT()ON_WM_QUERYDRAGICON()ON_BN_CLICKED(IDB_SOURCE_FILE, OnSourceFile)ON_BN_CLICKED(IDB_OUTPUT, OnOutput)ON_BN_CLICKED(IDB_AIM_FILE, OnAimFile)ON_EN_CHANGE(IDC_EDIT_RAD, OnChangeEditRad)ON_EN_CHANGE(IDC_EDIT_STEP_DIS, OnChangeEditStepDis)ON_EN_CHANGE(IDC_EDIT_MIN_X, OnChangeEditMinX)ON_EN_CHANGE(IDC_EDIT_MAX_X, OnChangeEditMaxX)ON_EN_CHANGE(IDC_EDIT_MIN_Y, OnChangeEditMinY)ON_EN_CHANGE(IDC_EDIT_MAX_Y, OnChangeEditMaxY)ON_BN_CLICKED(IDC_BUTTON1, Onmean_weigth)ON_BN_CLICKED(IDC_BUTTON2, Onmean)ON_EN_CHANGE(IDC_OPEN_FILE, OnChangeOpenFile)ON_EN_CHANGE(IDC_SAVE_FILE, OnChangeSaveFile)/AFX_MSG_MAPEND_MESSAGE_MAP()/*/* CIDWDlg message handlers */*/BOOL CIDWDlg:OnInitDialog()CDialog:OnInitDialog();/ Add About. menu item to system menu./ IDM_ABOUTBOX must be in the system command range.ASSERT(IDM_ABOUTBOX ASSERT(IDM_ABOUTBOX AppendMenu(MF_SEPARATOR);pSysMenu-AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);/ Set the icon for this dialog. The framework does this automatically/ when the applications main window is not a dialogSetIcon(m_hIcon, TRUE); / Set big iconSetIcon(m_hIcon, FALSE); / Set small icon/ TODO: Add extra initialization herem_maxX = 0;m_minX = 0;m_maxY = 0;m_minY = 0;m_rad = 100;m_stepDis = 100;UpdateData(FALSE);m_ctrProgress.SetPos(0);return TRUE; / return TRUE unless you set the focus to a controlvoid CIDWDlg:OnSysCommand(UINT nID, LPARAM lParam)if (nID & 0xFFF0) = IDM_ABOUTBOX)CAboutDlg dlgAbout;dlgAbout.DoModal();elseCDialog: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 CIDWDlg:OnPaint() if (IsIconic()CPaintDC dc(this); / device context for paintingSendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);/ Center icon in client rectangleint cxIcon = GetSystemMetrics(SM_CXICON);int cyIcon = GetSystemMetrics(SM_CYICON);CRect rect;GetClientRect(int x = (rect.Width() - cxIcon + 1) / 2;int y = (rect.Height() - cyIcon + 1) / 2;/ Draw the icondc.DrawIcon(x, y, m_hIcon);elseCDialog:OnPaint();/ the system calls this to obtain the cursor to display while the user drags/ the minimized window.HCURSOR CIDWDlg:OnQueryDragIcon()return (HCURSOR) m_hIcon;void CIDWDlg:OnSourceFile() CFileDialog FileDlg(TRUE,*.txt,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, 源数据文件(*.txt)|*.txt|All files (*.*)|*.*|); if(FileDlg.DoModal()=IDOK)m_strOpenFile
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号