1 ArcGIS 软件体系 ArcGIS Desktop :一个专业 GIS 应用的完整套件 ArcGIS Engine...

14
1 ArcGIS 软软 ArcGIS Desktop ArcGIS Desktop 软软软 :一 软软软 :一 GIS GIS 软软软软软软软 软软软软软软软 ArcGIS Engine ArcGIS Engine 软软 软软 GIS GIS 软软软软软软软软软软 软软软软软软软软软软 软软软 软软软 GIS GIS ArcSDE ArcSDE ArcIMS ArcIMS ArcGIS ArcGIS Server Server 软软 软软 GIS GIS ArcPad ArcPad 软软 软软 GIS GIS ArcGIS Desktop ArcGIS Desktop 软软软 ), 软软软 ), GIS GIS ArcGIS Engine ArcGIS Engine 软软软软软 软软软软软 GIS GIS ArcGIS Server ArcGIS Server 软软软软 软软软软 软软软软 软软软软 GIS GIS 软软软软软 软软软软软 软软软软软软软 软软软软软软软 ArcObjects ArcObjects
  • date post

    20-Dec-2015
  • Category

    Documents

  • view

    330
  • download

    5

Transcript of 1 ArcGIS 软件体系 ArcGIS Desktop :一个专业 GIS 应用的完整套件 ArcGIS Engine...

Page 1: 1 ArcGIS 软件体系 ArcGIS Desktop :一个专业 GIS 应用的完整套件 ArcGIS Engine :开发 GIS 应用的嵌入式开发组件 服务器 GIS : ArcSDE , ArcIMS 和 ArcGIS

1

ArcGIS 软件体系ArcGIS DesktopArcGIS Desktop :一个专业:一个专业 GIS GIS 应用的完整套应用的完整套件件ArcGIS EngineArcGIS Engine :开发:开发 GIS GIS 应用的嵌入式开发组应用的嵌入式开发组件件服务器服务器 GISGIS :: ArcSDEArcSDE ,, ArcIMSArcIMS 和和 ArcGIS ArcGIS ServerServer

移动移动 GISGIS :: ArcPadArcPad桌面桌面 GISGIS (( ArcGIS DesktopArcGIS Desktop ),嵌入式),嵌入式 GISGIS(( ArcGIS EngineArcGIS Engine )以及服务器)以及服务器 GIS GIS (( ArcGIS ServerArcGIS Server )都是基于)都是基于一套共同的一套共同的 GIS GIS 组件实现的组件实现的,这些组件被称为,这些组件被称为 ArcObjectsArcObjects 。

Page 2: 1 ArcGIS 软件体系 ArcGIS Desktop :一个专业 GIS 应用的完整套件 ArcGIS Engine :开发 GIS 应用的嵌入式开发组件 服务器 GIS : ArcSDE , ArcIMS 和 ArcGIS

2

Page 3: 1 ArcGIS 软件体系 ArcGIS Desktop :一个专业 GIS 应用的完整套件 ArcGIS Engine :开发 GIS 应用的嵌入式开发组件 服务器 GIS : ArcSDE , ArcIMS 和 ArcGIS

Introduction to Programming ArcObjects with VBA

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

Page 4: 1 ArcGIS 软件体系 ArcGIS Desktop :一个专业 GIS 应用的完整套件 ArcGIS Engine :开发 GIS 应用的嵌入式开发组件 服务器 GIS : ArcSDE , ArcIMS 和 ArcGIS

Introduction to Programming ArcObjects with VBA

COM classes have interfaces

对象拥有一个或多个接口

接口是定义了一组方法和属性的逻辑关系 与对象的通信是通过接口来进行的

RaceCar

AccelerateBrake

Fuel

停靠站圈速度IRace

IDrive

垃圾车

加速刹车

燃料

拾起倾倒IGarbage

IDrive

Page 5: 1 ArcGIS 软件体系 ArcGIS Desktop :一个专业 GIS 应用的完整套件 ArcGIS Engine :开发 GIS 应用的嵌入式开发组件 服务器 GIS : ArcSDE , ArcIMS 和 ArcGIS

Introduction to Programming ArcObjects with VBA

Instantiate COM classes with an interface Dim <variable> As <some interface>

Interfaces group properties and methods

Dim pGarbage As IDriveSet pGarbage = New GarbageTruck

pGarbage.Fuel = "Full"pGarbage.Accelerate

Working with ArcObjects COM classes

GarbageTruck

AccelerateBrake

Fuel

PickUp

DumpIGarbage

IDrive

Page 6: 1 ArcGIS 软件体系 ArcGIS Desktop :一个专业 GIS 应用的完整套件 ArcGIS Engine :开发 GIS 应用的嵌入式开发组件 服务器 GIS : ArcSDE , ArcIMS 和 ArcGIS

Introduction to Programming ArcObjects with VBA

More on interfaces …

一个组合音响的例子 一个对象可以播放收音机、磁带、 CD

必须使用适当的接口 如果选择了播放磁带的接口,则不能收听收音机

IRadio

ITape

ICD

Dim pBBox As ITapeSet pBBox = New BoomBoxpBBox.FM = True

Page 7: 1 ArcGIS 软件体系 ArcGIS Desktop :一个专业 GIS 应用的完整套件 ArcGIS Engine :开发 GIS 应用的嵌入式开发组件 服务器 GIS : ArcSDE , ArcIMS 和 ArcGIS

Introduction to Programming ArcObjects with VBA

Relationship symbols

继承 组成 用来创建 对应关系 1 : N

联合

*_____

翅膀

羽毛

2

Abstract

Class

Class

Class

小鸡CoClass

巢CoClass

*

Page 8: 1 ArcGIS 软件体系 ArcGIS Desktop :一个专业 GIS 应用的完整套件 ArcGIS Engine :开发 GIS 应用的嵌入式开发组件 服务器 GIS : ArcSDE , ArcIMS 和 ArcGIS

Introduction to Programming ArcObjects with VBA

类和他们相应的对象

ArcMap objects

MxDocument

Map

Layer

*

*

FeatureLayer

Application

Page 9: 1 ArcGIS 软件体系 ArcGIS Desktop :一个专业 GIS 应用的完整套件 ArcGIS Engine :开发 GIS 应用的嵌入式开发组件 服务器 GIS : ArcSDE , ArcIMS 和 ArcGIS

Introduction to Programming ArcObjects with VBA

Property and method symbols

Property 哑铃形状的图标

Method

Property Get(read)

Property Get(read)

Property Set(write)

Property Set(write)

Page 10: 1 ArcGIS 软件体系 ArcGIS Desktop :一个专业 GIS 应用的完整套件 ArcGIS Engine :开发 GIS 应用的嵌入式开发组件 服务器 GIS : ArcSDE , ArcIMS 和 ArcGIS

Introduction to Programming ArcObjects with VBA

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

如果引用对象发生了变化,对象的属性将同步受到影响

Setting properties

pLayer.Name = "Port Moresby" 'No Set keyword

Set pLayer.FeatureClass = pMoresbyData 'Must use Set!

Page 11: 1 ArcGIS 软件体系 ArcGIS Desktop :一个专业 GIS 应用的完整套件 ArcGIS Engine :开发 GIS 应用的嵌入式开发组件 服务器 GIS : ArcSDE , ArcIMS 和 ArcGIS

Introduction to Programming ArcObjects with VBA

Return a value Name: String

Return an object reference Document: IDocument

StatusBar: IStatusBar

Getting properties

返回一个值Dim strName As String Dim pDoc As IDocumentDim pBar As IStatusBarstrName = Application.NameMsgBox strName

返回一个引用Set pDoc = Application.DocumentSet pBar = Application.StatusBar pBar.Message(0) pDoc.Title

Page 12: 1 ArcGIS 软件体系 ArcGIS Desktop :一个专业 GIS 应用的完整套件 ArcGIS Engine :开发 GIS 应用的嵌入式开发组件 服务器 GIS : ArcSDE , ArcIMS 和 ArcGIS

Introduction to Programming ArcObjects with VBA

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 ( )

Dim pMxDoc As IMxDocumentSet pMxDoc = ThisDocumentDim pMap As IMapSet pMap = pMxDoc.FocusMapDim pLayer As ILayerSet pLayer = pMap.Layer(1)

'Is pLayer a FeatureLayer?If TypeOf pLayer Is IFeatureLayer Then

MsgBox "Yes!, it’s a feature layer"End If

MxDocument

Map

FeatureLayer

Layer*

*

Others

A

Page 13: 1 ArcGIS 软件体系 ArcGIS Desktop :一个专业 GIS 应用的完整套件 ArcGIS Engine :开发 GIS 应用的嵌入式开发组件 服务器 GIS : ArcSDE , ArcIMS 和 ArcGIS

Introduction to Programming ArcObjects with VBA

访问 .shp 文件的点要素属性 IPointCollection 接口提供访问点属性的途径 可以通过“ Polyline” 类实例化,通过访问可以得到点的数量 IPointCollection 接口具有添加、移出、替换制定点的方法 访问点要素直接使用 IPointCollection 接口的 point 属

性, point 具有 xy 坐标值 IPointCollection 接口的 ReplacePoints 方法

Page 14: 1 ArcGIS 软件体系 ArcGIS Desktop :一个专业 GIS 应用的完整套件 ArcGIS Engine :开发 GIS 应用的嵌入式开发组件 服务器 GIS : ArcSDE , ArcIMS 和 ArcGIS

Introduction to Programming ArcObjects with VBA