数字高程模型作业_dem编程

上传人:第*** 文档编号:34590334 上传时间:2018-02-26 格式:DOCX 页数:26 大小:671.42KB
返回 下载 相关 举报
数字高程模型作业_dem编程_第1页
第1页 / 共26页
数字高程模型作业_dem编程_第2页
第2页 / 共26页
数字高程模型作业_dem编程_第3页
第3页 / 共26页
数字高程模型作业_dem编程_第4页
第4页 / 共26页
数字高程模型作业_dem编程_第5页
第5页 / 共26页
点击查看更多>>
资源描述

《数字高程模型作业_dem编程》由会员分享,可在线阅读,更多相关《数字高程模型作业_dem编程(26页珍藏版)》请在金锄头文库上搜索。

1、此次作业主要采用 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()

2、;/ 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_MA

3、P();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_

4、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 n

5、ot 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_

6、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,

7、 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_

8、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

9、_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_S

10、EPARATOR);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

11、 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.DoModa

12、l();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); /

13、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 +

14、 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

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 解决方案

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号