基于COM接编程基础(I)
基于COM接口编程基础(I) Lesson overview COM: 组件对象模型Component Object Model 使用COM类Working with COM classes 接口Interfaces 多态Polymorphism 接口查询QueryInterface 测试一个对象的引用Testing an object reference Is it nothing? What type of object is it? Introducing COM COM is a standard for creating classes Classes can be reused between applications Independent of programming language All ArcObjects are COM classes Technologies based on COM Object Linking and Embedding (OLE) OLE DB ActiveX is any technology built on COM DCOM and COM+ COM classes have interfaces 对象拥有一个或多个接口 接口是定义了一组方法和属性的逻辑关系 与对象的通信是通过接口来进行的 Working with ArcObjects COM classes Instantiate COM classes with an interface Dim variable As some interface Interfaces group properties and methods More on interfaces … 一个组合音响的例子 一个对象可以播放收音机、磁带、CD 必须使用适当的接口 如果选择了播放磁带的接口,则不能收听收音机 多态 许多不同的类可以支持相同的接口 拥有相同的所有的方法和属性 可以有不同的执行方式和拥有不同的属性值 ArcObjects 多态 许多ArcGIS的类都表现出多态的特性 General interfaces for all subtypes ILayer: All layer types (raster, tin, feature, etc.) IGxFile: All ArcCatalog file types (shapefile, map, table, etc.) IActiveView: Map (data view) and PageLayout (layout view) Several others … Using methods and properties Dim the variable pointing to an interface Instantiate the object (Set) Call methods, set properties Only use methods and properties for the declared interface Getting other interfaces QueryInterface (QI) Access other methods and properties Testing an object reference Is an object Nothing? COM class code Interface module 定义方法和属性 Class module 实现方法和属性 Client module 实例化类 使用方法和属性 Using library names Many libraries may share interface or class names 可以明白地引用对象库 Create a new point and line from the esriCore library Dim pPoint As esriCore.IPoint Dim pLine As esriCore.ILine Set pPoint = New Point Set pLine = New Line Using the ESRI Object Browser Lists classes, interfaces, properties, and methods C:\ArcGIS\arcexe83\ArcObjects Developer Kit\Utilities Exercise 6 overview Design an interface Create a COM cl
您可能关注的文档
最近下载
- 2016-2023年广安职业技术学院高职单招(英语/数学/语文)笔试历年考点试题库含答案解析.docx VIP
- 支部书记2025年度组织生活会个人对照检查(五个对照).docx VIP
- (完整版)济南大学大学物理2期末考试试题.pdf VIP
- 2016-2023年广州珠江职业技术学院高职单招(英语/数学/语文)笔试历年考点试题库含答案解析.docx VIP
- YST264-2024 高纯铟-报批稿.pdf VIP
- (完整word版)成人学位英语考试大纲词汇表.pdf VIP
- 数据科学导论.pdf VIP
- 2024盐城工业职业技术学院招聘笔试真题及参考答案详解一套.docx VIP
- 2025至2030中国儿童保健品行业细分市场及应用领域与趋势展望研究报告.docx VIP
- 体表静脉留置针静脉输液操作考核评分标准.docx VIP
原创力文档

文档评论(0)