GIS实验报告.doc

上传人:飞****9 文档编号:133847514 上传时间:2020-05-31 格式:DOC 页数:14 大小:681KB
返回 下载 相关 举报
GIS实验报告.doc_第1页
第1页 / 共14页
GIS实验报告.doc_第2页
第2页 / 共14页
GIS实验报告.doc_第3页
第3页 / 共14页
GIS实验报告.doc_第4页
第4页 / 共14页
GIS实验报告.doc_第5页
第5页 / 共14页
点击查看更多>>
资源描述

《GIS实验报告.doc》由会员分享,可在线阅读,更多相关《GIS实验报告.doc(14页珍藏版)》请在金锄头文库上搜索。

1、实验报告GIS应用软件开发专 业: 测绘工程 班 级: 10级测绘三班姓 名: 学 号: 指导教师: 胡 亚 撰写时间:2013年5月20日星期一目录一、程序运行演示2二、问题及解决方案6三、源程序代码7四、心得体会14一、程序运行演示1. 新建项目文件,并实现file中的基本功能,显示地图基本要素。如图1图12. 在工具栏加载按钮,按钮功能是对当前视图缩小3倍;在工具栏加载工具,工具功能在地图上标注当前日期。如图2图2按钮实现缩小3倍功能操作,如图3图33. 点击地图节点,弹出如图4,图5菜单并实现菜单中的内容:图4图54. 点击图层节点,弹出如图6菜单并需要实现菜单中的内容图65. 点击L

2、egend Class,弹出符号选择对话框,该对话框供用户按需要选择符号并进行更改。如图7图76. 打开图层属性表,用户选择某条记录,可弹出如图8,9所示的右键菜单,并实现右键菜单中的内容图8图9二、问题及解决方案问题1.VS2008与2010之间要进行格式转换,按照所导向的步骤进行,否则程序将无法正常运行,出现错误问题2.构建好基本框架后,地图文档中要素显示出现问题。此问题要添加licence控件,否则无法显示地图要素。问题3.使用Toolbar和Toc功能时无法进行操作此问题应在属性设置时建立关联功能。问题4.程序Program文件中要添加相应功能键语句,否则将无法实现功能。问题5.引用接

3、口,方法,例如ADF,要添加相应的引用,否则程序出现错误。问题6. 在实现两个自定义按钮与工具时,遇到的问题:先直接引用现有项未实现,发现缺少一些东西,后自己直接创建的Basetool和Basecommand类;在代码中报错,重新生成解决方案后顺利解决这个问题。问题7. 在实现地图和图层节点的右键功能时,遇到琐碎的问题,在这个过程中直接引用老师所给的几个类,但是报错,是因为命名空间未做修改;缺少引用,需要根据错误提示添加相应的引用三、源程序代码using System;using System.Collections.Generic;using System.ComponentModel;us

4、ing System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.IO;using System.Runtime.InteropServices;using ESRI.ArcGIS.esriSystem;using ESRI.ArcGIS.Carto;using ESRI.ArcGIS.Controls;using ESRI.ArcGIS.ADF;using ESRI.ArcGIS.SystemUI;using ESRI.ArcGIS.

5、Display;namespace WindowsFormsApplication2 public partial class MainForm : Form #region class private members private IMapControl3 m_mapControl = null; private string m_mapDocumentName = string.Empty; #endregion IMapDocument m_MapDocument = new MapDocument(); #region class constructor private ITOCCo

6、ntrol2 m_tocControl; private IToolbarMenu m_menuMap; private IToolbarMenu m_menuLayer; private ZoomIn3XCMD1 test = new ZoomIn3XCMD1(); public MainForm() InitializeComponent(); private void newDocumentToolStripMenuItem_Click(object sender, EventArgs e) ICommand command = new CreateNewDocument(); comm

7、and.OnCreate(m_mapControl.Object); command.OnClick(); private void openDocumentToolStripMenuItem_Click(object sender, EventArgs e) openFileDialog1.Title = Save Map Document As; openFileDialog1.Filter = Map Documents (*.mxd)|*.mxd; openFileDialog1.ShowDialog(); string sFilePath = openFileDialog1.File

8、Name; if (axMapControl1.CheckMxFile(sFilePath) axMapControl1.MousePointer = esriControlsMousePointer.esriPointerHourglass; axMapControl1.LoadMxFile(sFilePath, 0, Type.Missing); axMapControl1.MousePointer = esriControlsMousePointer.esriPointerDefault; else MessageBox.Show(sFilePath + is not a valid A

9、rcMap document); return; private void MainForm_Load(object sender, EventArgs e) /get the MapControl m_mapControl = (IMapControl3)axMapControl1.Object; /disable the Save menu (since there is no document yet) this.menuSaveDoc.Enabled = false; /定义地图右键菜单,图层右键菜单 m_tocControl = (ITOCControl2)axTOCControl1

10、.Object; m_mapControl = (IMapControl3)axMapControl1.Object; /添加菜单到地图节点 m_menuMap = new ToolbarMenu(); m_menuMap.AddItem(esriControls.ControlsAdddataCommand, -1, 0, false, esriCommandStyles.esriCommandStyleTextOnly); m_menuMap.AddItem(new LayerVisibility(), 1, 1, false, esriCommandStyles.esriCommandS

11、tyleTextOnly); m_menuMap.AddItem(new LayerVisibility(), 2, 2, false, esriCommandStyles.esriCommandStyleTextOnly); /添加菜单到图层节点 m_menuLayer = new ToolbarMenu(); m_menuLayer.AddItem(new OpenAttributeTableCmd(), -1, 0, false, esriCommandStyles.esriCommandStyleIconAndText);/右键添加属性表 m_menuLayer.AddItem(new

12、 RemoveLayer(), 1, 1, false, esriCommandStyles.esriCommandStyleTextOnly); m_menuLayer.AddItem(new RemoveLayer(), 1, 2, true, esriCommandStyles.esriCommandStyleTextOnly); m_menuLayer.AddItem(new ScaleThresholds(), 2, 3, false, esriCommandStyles.esriCommandStyleTextOnly); m_menuLayer.AddItem(new Scale

13、Thresholds(), 3, 4, false, esriCommandStyles.esriCommandStyleTextOnly); m_menuLayer.AddItem(new LayerSelectable(), 1, 5, true, esriCommandStyles.esriCommandStyleTextOnly); m_menuLayer.AddItem(new LayerSelectable(), 2, 6, false, esriCommandStyles.esriCommandStyleTextOnly); m_menuLayer.AddItem(new ZoomToLayer(), -1, 7, true, esriComman

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 总结/报告

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