GIS应用开发教学实务-ArcGIS-应用程序框架

上传人:xmg****18 文档编号:111324432 上传时间:2019-11-02 格式:PPT 页数:165 大小:1.69MB
返回 下载 相关 举报
GIS应用开发教学实务-ArcGIS-应用程序框架_第1页
第1页 / 共165页
GIS应用开发教学实务-ArcGIS-应用程序框架_第2页
第2页 / 共165页
GIS应用开发教学实务-ArcGIS-应用程序框架_第3页
第3页 / 共165页
GIS应用开发教学实务-ArcGIS-应用程序框架_第4页
第4页 / 共165页
GIS应用开发教学实务-ArcGIS-应用程序框架_第5页
第5页 / 共165页
点击查看更多>>
资源描述

《GIS应用开发教学实务-ArcGIS-应用程序框架》由会员分享,可在线阅读,更多相关《GIS应用开发教学实务-ArcGIS-应用程序框架(165页珍藏版)》请在金锄头文库上搜索。

1、Chap. 2 ArcGIS 应用程序框架( 6学时 ),所有的ArcGIS 桌面应用程序(ArcMap、ArcCatlog、ArcGlobe、ArcScene)共享一个相似的应用程序框架结构。 定制或扩展ArcMap 的方法,与定制或扩展其它ArcGIS 桌面应用程序如ArcGlobe或ArcCatalog没有什么不同,尽管它们使用的ArcObjects 组件不一样。,ArcGIS 桌面应用程序框架对象包括: Application and Document Commands and command bars Commands,Subtyped commands Tools, Subtype

2、d Tools,Toolbars Menus,Context menus,MultiItems ToolControls Extensions Standard extensions These are loaded when the application starts. They are often referred to as extensions. Just-in-time extensions These are delay loaded by request to improve startup performance.,Custom windows Dockable window

3、s Property pages Contents views ArcObjects Help for .NET developers Developing with ArcGIS Learning ArcObjects Extending ArcObjects Application framework customizations,2.1 Application对象,Application对象是ArcMap 和ArcCatalog等的核心对象,这个对象代表应用程序本身,通过这个对象可以访问系统中的其它对象。 每一个运行的ArcGIS桌面应用程序都是一个Application的对象实例,Ap

4、plication管理应用程序的启动和关闭、加载扩展模块等。 Application类是在Framework库中定义的,它是应用程序的一个抽象类。 在VBA环境中,Application始终是一个全局变量,在任何地方都可以直接使用。,2.1.1 IApplication接口 (ESRI.ArcGIS.Framework),IApplication定义了ArcGIS所有桌面应用程序的一般功能。这个接口管理应用程序的Document对象、应用程序扩展(extensions)、状态条(StatusBar)、模板(Templates)、当前工具等,这个接口还提供了几个方法,用于打开、保存和打印文档,锁

5、定或解锁应用程序的用户定制,显示应用程序中的对话框,关闭应用程序等。,IApplication的属性、方法,在C#环境下,可用通过以下方法获得Application 对象:,IApplication m_application = hook as IApplication;,Classes that implement IApplication,ApplicationClass (esriArcMap),ArcObjects 10,ArcMap中嵌入Catalog,2.1.2 IMxApplication接口 (ESRI.ArcGIS.ArcMapUI),这是ArcMap程序特有的接口,用于管

6、理SelectionEnvironment、Display、Paper和Printer等对象。,IMxApplication,CopyToClipboard() 方法用于拷贝应用程序当前视图到内存的剪贴板中,然后可以粘贴到其他应用程序如Word中。 SelectionEnvironment属性用于获取要素选择集的相关属性。,ISelectionEnvironment,IMxApplication2,IMxApplication3,Pause display updates. public bool PauseDrawing get; set;,public bool ShowStatusBar

7、 get; set;,ArcCatalog IGxApplication ArcGlobe IGMxApplication ArcSence ISxApplication,2.1.3 IWindowPosition接口 (ESRI.ArcGIS.Framework),任何有可视化窗体的类都实现了IWindowPosition接口,如DockableWindow、CommandBar和各种Application类。 这个接口定义了窗体的尺寸和位置,如width和height确定了窗体的大小,而left和top规定了窗体的左上角距离屏幕的左上角之间的距离。 这个接口还定义了一个属性state,它用

8、于确定程序窗口的形式,如esriWSNormal(正常模式)、esriWSMaximize(最大化模式)、esriWSMinimize(最小化模式)和esriWSFloating(浮动模式)四种。,2.2 Document对象,不同的ArcGIS桌面应用程序,使用的文档对象也不一样: ArcMap:MxDocument (IMxDocument 、 IDocumentEvents) ArcCatalog:GxDocument (IDocument 、 IGxDocumentEvents ) ArcScene:SxDocument (ISxDocument 、 ISxDocumentEvents

9、) ArcGlobe:GMxDocument (IGMxDocument、 IGMxDocumentEvents) 应用程序一次只能有一个文档对象存在。用户可以通过IApplication.Document来获取文档对象。,所有的文档对象都实现了IDocument接口 (ESRI.ArcGIS.Framework),该接口定义了文档相关的以下6个只读属性: Accelerators :文档中定义的加速键表; CommandBars:文档中定义的命令条的集合; ID:文档ID; Parent:打开这个文档的Application对象; Title :文档标题; Type:文档类型; VBProj

10、ect:文档的VB项目。,MxDocument (ESRI.ArcGIS.ArcMapUI),ArcObjects 10,2.2.1 IMxDocument接口(ESRI.ArcGIS.ArcMapUI),IMxDocument是MxDocument的默认接口,也是最主要的接口。该接口定义的方法如下:,Inserts an object into the document. Displays the insert object dialog.,public void UpdateContents ( ); 刷新当前内容表视图,该方法其实是对IContentsView.Refresh方法的快捷访

11、问,可以通过IMxDocument.CurrentContentsView获得当前的内容视图。,IMxDocument定义的属性,IMxDocument. ActivatedView与 ActiveView 属性 在ArcMap的布局视图(layout view)状态下,图形元素可以添加到页面布局(PageLayout)或焦点地图(focus Map)的图形元素容器(graphics container )中;这时, IMxDocument.ActiveView 属性与IMxDocument.ActivatedView 属性不同, ActiveView 属性引用PageLayout 对象, A

12、ctivatedView属性引用焦点地图对象(如果该地图对象处于活动状态) 。 在ArcMap的数据视图(data view)状态下, ActiveView 与ActivatedView属性都引用焦点地图对象。,m_application = hook as IApplication; IDocument document = m_application.Document; IMxDocument mapDocument = document as IMxDocument; 如果通过某种途径先获得了文档对象mapDocument(IMxDocument) 则 IDocument documen

13、t = mapDocument as IDocument; IApplication m_application = document.Parent;,2.2.2 IDocumentDefaultSymbols接口,IDocumentDefaultSymbols接口是文档缺省符号设置接口,用于设置缺省颜色、符号。,2.2.3 IDocumentEvents接口,IDocumentEvents是MxDocument对象的一个外向事件接口,使用这个接口可以监听与地图文档对象有关的事件,如NewDocument事件,CloseDocument事件等。,IDocumentEvents IGxDocum

14、entEvents IGMxDocumentEvents ISxDocumentEvents Method signature at 10.1 void OnContextMenu(int x, int y, out bool handled) Method signature at 10.2 bool OnContextMenu(int x, int y),在C#环境下,可以通过以下步骤来监听文档事件:,1. Getting document object from application. using ESRI.ArcGIS.Framework; IApplication app = ho

15、ok as IApplication; IDocument appDocument = app.Document;,2. Declare an IDocumentEvents_Event variable. using ESRI.ArcGIS.Framework; using ESRI.ArcGIS.ArcMapUI; public class howToClass private IDocumentEvents_Event m_docEvents = null; private void SetUpDocumentEvent( IDocument myDocument) m_docEvent

16、s = myDocument as IDocumentEvents_Event; ,3. Implement the event handler method void OnNewDocument() . 4. Wiring NewDocument event to the handling method (C#). m_docEvents.NewDocument += new IDocumentEvents_NewDocumentEventHandler (OnNewDocument);,using ESRI.ArcGIS.Framework; using ESRI.ArcGIS.ArcMapUI; namespace ArcGISProject public class howToClass /Event member variable. private IDocumentEvents_Event m_docEvents = null; /Wiring. private void SetUpDocum

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

最新文档


当前位置:首页 > 大杂烩/其它

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