ArcGIS Engine开发模板及代码
来源:互联网 发布:javascript 清空input 编辑:程序博客网 时间:2024/04/28 14:06
以下为AE开发软件自带的模板及代码,开发工具为VS 2012+ArcGIS Engine 10.2。
using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;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;namespace MapControlApplication1{ public sealed partial class MainForm : Form { private IMapControl3 m_mapControl = null; private string m_mapDocumentName = string.Empty; public MainForm() { InitializeComponent(); } 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) menuSaveDoc.Enabled = false; } private void menuNewDoc_Click(object sender, EventArgs e) { //execute New Document command ICommand command = new CreateNewDocument(); command.OnCreate(m_mapControl.Object); command.OnClick(); } private void menuOpenDoc_Click(object sender, EventArgs e) { //execute Open Document command ICommand command = new ControlsOpenDocCommandClass(); command.OnCreate(m_mapControl.Object); command.OnClick(); } private void menuSaveDoc_Click(object sender, EventArgs e) { //execute Save Document command if (m_mapControl.CheckMxFile(m_mapDocumentName)) { //create a new instance of a MapDocument IMapDocument mapDoc = new MapDocumentClass(); mapDoc.Open(m_mapDocumentName, string.Empty); //Make sure that the MapDocument is not readonly if (mapDoc.get_IsReadOnly(m_mapDocumentName)) { MessageBox.Show("Map document is read only!"); mapDoc.Close(); return; } //Replace its contents with the current map mapDoc.ReplaceContents((IMxdContents)m_mapControl.Map); //save the MapDocument in order to persist it mapDoc.Save(mapDoc.UsesRelativePaths, false); //close the MapDocument mapDoc.Close(); } } private void menuSaveAs_Click(object sender, EventArgs e) { ICommand command = new ControlsSaveAsDocCommandClass(); command.OnCreate(m_mapControl.Object); command.OnClick(); } private void menuExitApp_Click(object sender, EventArgs e) { Application.Exit(); } //listen to MapReplaced evant in order to update the statusbar and the Save menu private void axMapControl1_OnMapReplaced(object sender, IMapControlEvents2_OnMapReplacedEvent e) { //get the current document name from the MapControl m_mapDocumentName = m_mapControl.DocumentFilename; //if there is no MapDocument, diable the Save menu and clear the statusbar if (m_mapDocumentName == string.Empty) { menuSaveDoc.Enabled = false; statusBarXY.Text = string.Empty; } else { //enable the Save manu and write the doc name to the statusbar menuSaveDoc.Enabled = true; statusBarXY.Text = Path.GetFileName(m_mapDocumentName); } } private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { statusBarXY.Text = string.Format("{0}, {1} {2}", e.mapX.ToString("#######.##"), e.mapY.ToString("#######.##"), axMapControl1.MapUnits.ToString().Substring(4)); } }}
0 0
- ArcGIS Engine开发模板及代码
- arcgis engine开发学习
- vc arcgis engine开发
- ArcGIS Engine开发入门教程
- Arcgis Engine 开发初步
- Arcgis engine开发
- arcgis engine 基础开发
- ArcGis Engine 开发
- ArcGIS Engine开发Geodatabase代码(一)——Cursors
- ArcGIS Engine开发Geodatabase代码(四)——Join
- ArcGIS Engine开发Geodatabase代码(六)——TopologyEdit
- ArcGIS Engine 10.1开发环境配置及运行
- 搭建ArcGIS Engine开发环境时,Visual studio中丢失ArcGIS模板的解决办法
- C#,ArcGIS Engine开发入门教程
- C#,ArcGIS Engine开发入门教程
- C#,ArcGIS Engine开发入门教程
- C#,ArcGIS Engine开发入门教程
- C#,ArcGIS Engine开发入门教程
- ACM杭电2020绝对值排序
- hdu3530Subsequence rmq
- 困住
- 谷歌官方控件SwipeRefreshLayout实现下拉刷新
- poj3692 二分图的最大团
- ArcGIS Engine开发模板及代码
- 写给一名初中生——要有效完成该有的知识积累
- Matlab得到二值图像中最大连通区域
- poj 2914 Minimum Cut(全局最小割)
- 算法---冒泡算法
- UVA - 10056 What is the Probability ?
- Android JNI 中级篇
- linux环境下玩转截图
- ReentrantLock源码分析