GIS二次开发实验报告学号:201420310115姓名:李梦南班级:1423101专业:地理信息系统任课老师:李小龙二零一七年六月十二日目录1实验一:AOI书签开发....................................................................................................11.1实验目的....................................................................................................................11.2实验内容....................................................................................................................11.3实验步骤与结果........................................................................................................12.1实验目的....................................................................................................................52.2实验内容....................................................................................................................52.3实验步骤与结果........................................................................................................52实验三:地图渲染...........................................................................................................93.1实验目的....................................................................................................................93.2实验内容....................................................................................................................93.3实验步骤结果............................................................................................................93实验四:空间数据处理.................................................................................................164.1实验目的..................................................................................................................164.2实验内容..................................................................................................................164.3实验步骤与结果......................................................................................................164实验五:GIS分析...........................................................................................................255.1实验目的..................................................................................................................255.2实验内容..................................................................................................................255.3实验步骤与结果......................................................................................................255实验六:栅格数据处理.................................................................................................336.1实验目的..................................................................................................................336.2实验内容..................................................................................................................336.3实验步骤与结果......................................................................................................336实验总结.........................................................................................................................431实验一:AOI书签开发1.1实验目的掌握AOI书签程序开发1.2实验内容实现AOI书签的创建实现AOI书签的调用1.3实验步骤与结果实验思路、关键代码(全面注释)、运行结果截图实验思路:空间书签是用户定义创建的标志某个特定地理位置的快捷方式,创建好书签后能够很方便的找到某个地理位置。在本实验中我们需要创建的是AOI书签,即用户所关心的一个范围,通过调用该书签,用户可以马上找到书签所指范围。实现本实验主要包括以下几个方面:1.添加控件和类库引用:添加创建书签控件、保存和调用书签控件,添加Geometry类库2.添加“创建书签”函数:创建书签,保存当前感兴趣范围,将书签名加入组合框,以便调用3.添加“书签名称设置”窗体:获取书签名,传递给主窗体4.添加两个事件响应函数:“创建书签”菜单项的点击事件,作用是打开“书签名称设置”窗体;“确认”按钮的点击事件,作用是调用创建书签函数5.实现与调用书签:添加组合框的事件响应函数,作用是当组合框中选项改变时,地图将刷新显示出书签所记录的范围。实现创建书签的流程图如下:关键代码:1.添加控件和类库引用usingESRI.ArcGIS.Geometry;2.添加“创建书签”函数publicvoidCreateBookmark(stringsBookmarkName)//参数名为书签名{//通过IAOIBookmark接口创建一个变量,用于保存当前地图的范围IAOIBookmarkaoiBookmark=newAOIBookmarkClass();//判断如果变量不为空的话,将当前地图的属性赋给变量,变量名为书签名if(aoiBookmark!=null){aoiBookmark.Location=axMapControl1.ActiveView.Extent;aoiBookmark.Name=sBookmarkName;}//通过IMapBookmarks接口访问当前地图,在地图中加入新建书签IMapBookmarksbookmarks=axMapControl1.MapasIMapBookmarks;if(bookmarks!=null){bookmarks.AddBookmark(aoiBookmark);}//将新建书签名加入组合框,以便调用cbBookmarkList.Items.Add(aoiBookmark.Name);}3.添加“书签名称设置”窗体添加引用、控件、函数运行项目加载地图文档选中感兴趣范围,点击确认书签菜单项输入书签名,点击确认任意改变当前视图范围选中组合框某一书签当前地图视图缩放至书签范围//定义一个主窗体变量,用于保存主窗体对象publicMainFormm_frmMain;//用于传入主窗体对象publicAdmitBookmarkName(MainFormfrm){InitializeComponent();if(frm!=null){m_frmMain=frm;}}//“确认”按钮的“点击”事件响应函数,用于创建书签privatevoidbtAdmit_Click(objectsender,EventArgse){if(m_frmMain!=null||tbBookmarName.Text==){m_frmMain.CreateBookmark(tbBookmarName.Text);}this.Close();}4.实现与调用书签//“创建书签”按钮的“点击”事件响应函数privatevoidmiCreateBookmark_Click(objectsender,EventArgse){AdmitBookmarkNamefrmABN=newAdmitBookmarkName(this);frmABN.Show();}//组合框的事件响应函数,选择不同书签,显示不同范围privatevoidcbBookmarkList_SelectedIndexChanged(objectsender,EventArgse){//访问地图所包含的书签,获取书签序列IMapBookmarksbookmarks=axMapControl1.MapasIMapBookmarks;IEnumSpatialBookmarkenumSpatialBookmark=bookmarks.Bookmarks;//对地图所包含的书签进行遍历,获取与组合框所选项名称相符的书签enumSpatialBookmark.Reset();ISpatialBookmarkspatialBookmark=enumSpatialBookmark.Next();while(spatialBookmark!=null){if(cbBookmarkList.SelectedItem.ToString()==spatialBookmark.Name){spatialBookmark.ZoomTo((IMap)axMapContr