150 likes | 745 Views
ArcGIS 软件体系. ArcGIS Desktop :一个专业 GIS 应用的完整套件 ArcGIS Engine :开发 GIS 应用的嵌入式开发组件 服务器 GIS : ArcSDE , ArcIMS 和 ArcGIS Server 移动 GIS : ArcPad. 桌面 GIS ( ArcGIS Desktop ),嵌入式 GIS ( ArcGIS Engine )以及服务器 GIS ( ArcGIS Server )都是基于 一套共同的 GIS 组件实现的 ,这些组件被称为 ArcObjects 。. Introducing COM.
E N D
ArcGIS 软件体系 • ArcGIS Desktop:一个专业GIS 应用的完整套件 • ArcGIS Engine:开发GIS 应用的嵌入式开发组件 • 服务器GIS:ArcSDE,ArcIMS和ArcGIS Server • 移动GIS:ArcPad 桌面GIS(ArcGIS Desktop),嵌入式GIS(ArcGIS Engine)以及服务器GIS (ArcGIS Server)都是基于一套共同的GIS 组件实现的,这些组件被称为ArcObjects。
Introducing COM • COM: 组件对象模型Component Object Model • 使用COM类Working with COM classes • 接口Interfaces • COM is a standard for creating classes • Classes can be reused between applications • Independent of programming language • All ArcObjects are COM classes
垃圾车 RaceCar 燃料 IDrive Fuel IDrive 加速 Accelerate 刹车 Brake IGarbage 倾倒 IRace 圈速度 拾起 停靠站 COM classes have interfaces • 对象拥有一个或多个接口 • 接口是定义了一组方法和属性的逻辑关系 • 与对象的通信是通过接口来进行的
GarbageTruck Fuel IDrive Accelerate Brake IGarbage Dump PickUp Working with ArcObjects COM classes • Instantiate COM classes with an interface • Dim <variable> As <some interface> • Interfaces group properties and methods Dim pGarbage As IDrive Set pGarbage = New GarbageTruck pGarbage.Fuel = "Full" pGarbage.Accelerate
IRadio ITape ICD More on interfaces … • 一个组合音响的例子 • 一个对象可以播放收音机、磁带、CD • 必须使用适当的接口 • 如果选择了播放磁带的接口,则不能收听收音机 Dim pBBox As ITape Set pBBox = New BoomBox pBBox.FM = True
Relationship symbols • 继承 • 组成 • 用来创建 • 对应关系 1:N • 联合 鸟 巢 CoClass Abstract * 羽毛 小鸡 _____ * CoClass Class 2 蛋 Class 翅膀 Class
ArcMap objects • 类和他们相应的对象 Application MxDocument * Map * Layer FeatureLayer
Property Set (write) Property Get (read) Property and method symbols • Property • 哑铃形状的图标 • Method
Setting properties • Property Put: Most ArcObjects properties • Property holds a value or a copy of an object • Do not use Set keyword • Property Put by Reference: Some ArcObjects properties • Property holds a reference to an object • Must use the Set keyword • 如果引用对象发生了变化,对象的属性将同步受到影响 pLayer.Name = "Port Moresby" 'No Set keyword Set pLayer.FeatureClass = pMoresbyData'Must use Set!
Getting properties • Return a value • Name: String • Return an object reference • Document: IDocument • StatusBar: IStatusBar 返回一个值 Dim strName As String Dim pDoc As IDocument Dim pBar As IStatusBar strName = Application.Name MsgBox strName 返回一个引用 Set pDoc = Application.Document Set pBar = Application.StatusBar pBar.Message(0) pDoc.Title
Example: MxDocument > Map > layer • Get the FocusMap (active data frame) from MxDocument • MxDocument may have several Maps ( * ) • Get a layer from the the Map • Many types of layers ( ) MxDocument * Map Dim pMxDoc As IMxDocument Set pMxDoc = ThisDocument Dim pMap As IMap Set pMap = pMxDoc.FocusMap Dim pLayer As ILayer Set pLayer = pMap.Layer(1) 'Is pLayer a FeatureLayer? IfTypeOf pLayer Is IFeatureLayer Then MsgBox "Yes!, it’s a feature layer" End If * Layer FeatureLayer Others A
访问.shp文件的点要素属性 • IPointCollection 接口提供访问点属性的途径 • 可以通过“Polyline”类实例化,通过访问可以得到点的数量 • IPointCollection接口具有添加、移出、替换制定点的方法 • 访问点要素直接使用IPointCollection接口的point属性,point具有xy坐标值 • IPointCollection接口的ReplacePoints方法