IStyleGallery 和IstyleGalleryItem以及IStyleGalleryStorage接口的详解
来源:互联网 发布:node sass dose not 编辑:程序博客网 时间:2024/06/05 04:45
IStyleGalleryStorage
Provides access to members that manage the files used in the Style Gallery.
Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.
Description
IStyleGalleryStorage 用来管理可以使用IStyleGallery编辑的Styles文件,我们可以将IStyleGalleryStorage看做一个存放Style文件的一个大的容器,每一个style文件由IStyleGalleryItems组成,通过IStyleGalleryStorage 我们可以添加、删除、更新对应的style文件。ESRI为我们提供了很多的默认的style文件,这些style文件的默认的存放路径C:\Program Files\ArcGIS\Styles下。 该路径下有两种类型的文件,一种是文件扩展名称为.ServerStyle的文件,一种是文件扩展名称为style的文件。ServerStyle文件用于AE的开发,Style文件是ArcMap可以使用的样式文件。ESRI自带的工具里面有一种工具可以将style类型的文件转换为ServerStyle类型的文件,然后提供给ArcGIS Engine使用。
下面主要说明一下IStyleGalleryStorage对象的几个主要成员
AddFile;
语法: Public void AddFile(string path);
Path : 表示文本在本地的存放位置,比如C:\Program Files\ArcGIS\Styles\ Business.style或者C:\Program Files\ArcGIS\Styles\ Business.ServerStyle文件
该函数的意思是将一个指定位置的style文件添加到这个指定的容器里面,然后就可以通过IStyleGallery来对这些容器中的IStyleGalleryItem对象进行调用、处理等基本操作。
2)DefaultStylePath: 是一个只读类型的属性,她返回的是ESRI中style文件默认的存放路径,这个跟ArcGIS软件的安装路径有关。返回值是一个String类型的变量,她的默认值可以是C:\Program Files\ArcGIS\Styles 这个是我本地计算机的DefualtStylePath的返回,因为我的ArcGIS软件安装在C盘。
3)File属性
4)FileCount :The number of files in the Style Gallery
5)RemoveFile(string path) 返回指定路径的style文件。
6)TargetFile
一个是C:\Users\Administrator\AppData\Roaming\ESRI\ArcMap\Administrator.style文件,
一个是C:\Program Files\ArcGIS\Styles\ESRI.style文件
每一个文件都是由IStyleGalleryItem项组成的。并且每一个.style文件或.ServerStyle文件中的IStyleGalleryItem中的Item属性都有一个Class类型,然后根据不同的Class类型,添加后划分到对应的Class类型中,如下图所示:(关于Class类后面还有介绍)
如上图所示的ESRI.style文件中,有很多类型的IstyleGalleryItem项,比如:Reference Systems/Maplex Labels/Shadows/Area Patches/Line Patches等等。每一个类都有若干数量的IStyleGalleryItem组成,比如上图中的Color Ramps项就是由右边的IStyleGalleryItem项组成的。
2:IStyleGallery
>Provides access to members modify the Style Gallery. 提供重新定义StyleGallery的方法的访问权限。
>Product Availability
Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.
Description
IStyleGallery is used to access styles, add new items with AddItem, remove items with RemoveItem, make updates with UpdateItem and save your changes with SaveStyle. Styles provide storage for your colors, map elements, symbols, and properties of symbols.
我的理解:
IStyleGallery可以看成是ISyleGalleryItem的容器,我们在上一节中已经提到我们可以把IStyelGalleryStorage看做一个.style和.ServerStyle文件的容器,并管理这些style文件,而这些style文件内是由ISyleGalleryItem项组成的。但是IStyleGaleryStorage却没有提供管理这些Style文件内的IStyleGalleryItem的借口,所以不能管理这些IstyleGalleryItem,这个时候就出现了IStyleGallery借口,由他来管理IStyleGalleryStorage容器内所有的IstyleGalleryItem项,比如,添加、删除、更新等操作。
下面接下来讲解一下他的几个属性以及他的方法:
ClassCount
每一个类都包含有若干个IStyleGaleryItem,如下图所示
上图中,ESRI.Style文件包含22个类,当前我们选中North Arrows指北针类,然后右边就显示出来North Arrow类中所包含的IStyleGalleryItem项,可以看出有很多个这样的Item。
ClassCount属性也就是返回当前的StyleGallery中所包含的类的数目。在IStyleGallery中,不管我们包含多少个IStyle文件,IStyleGallery中包含的类的种类的数量都是一定的,即22个。也就是说,每一个Style文件中包含的类的数量以及类的名称都是一样的,我们也可以这样理解,当我们创建一个.style文件的时候,系统就自动在style文件中创建22个类,尽管这个时候,每个类中的IStyleGalleryItem都为空。
Class属性, 通过调用.get_Class(int index) 来返回指定索引值的IStyleGaleryClass对象,请看下面一段代码
int StyleGalleryClassCouont = styleGellery.ClassCount;
关于IStyleGalleryClass 我们可以在以后讲解,这里只需要知道通过这个属性可以返回一个IStyleGaleryItem类的一个示例。
AddItem 语法如下所示:
Public void AddItem(IstyleGalleryItem item);
描述:Adds an item to the target style file.
CateGories属性
描述:The categories within the given class. 返回指定名称的Class中所包含的IStyleGallery所属的类别。
每一个IStyleGalleryClass类都包含有多个IstyleGalleryItem项,为了大体上区别这些IstyleGalleryItem项,我们又给这些IstyleGalleryItem项归类,也就是说,每一个IstyleGalleryItem都有这个Cagegories(种类、类别)这个属性。如下图所示:
5)Clear
语法:
Discription:Removes all styles from the Style Gallery.
Items
Discription: The style items from the specified style file, in the specified class and category. The style set and category may be blank to return all items.
语法:IEnumStyleGalleryItem
className:表示,IStyleGalleryItem所属的类
StyleSet:表示IstyleGalleryItem所存在的style文件
Category:IstyleGalleryItem 所属的类别。
参考代码:
RemoveItem
Discription: Removes an item from the target style file.
这个方法挺简单,直接调用就可以了。
SaveStyle
Discription: Saves the specified style to a file. If class is specified, only items in that class will be saved.
这里面的有一个参数:FileName不是很理解
UpdateItem
Discription: Updates an existing item in target style file.(可以看出,这里需要指定IStyleGalery的TargetFile属性,用来更新的操作也是更新这个属性指定的文件中的Item成员)
下面讲解下:IstyleGalleryItem
Defination: Provides access to members that define items in the Style Gallery.
Product Availability:Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.
Description:Symbols and map elements are stored in the Style Gallery. Each symbol or map element has a unique ID that can be read from the item within the style gallery. A Name and Category are also properties of the items within the style gallery. These two fields, along with the Item itself, can be updated and changed as necessary.
主要方法:
Category
ID: Id for the item in the Style Gallery.
Item: The symbol or map element to be stored in the Style Gallery item.
Name :The name of the item in the Style Gallery.
理解:IStyleGalleryItem项是IStyleGallery中最小的组成单元,即使是最小的单元,但是他也有她自己的属性,比如:Category、ID、Name等属性。我们也需要将IStyleGalleyItem理解成一个小的容器,因为每一个IStyleGalleryItem中都包含着一个属性Item属性,symbol或者地图都包含在这样一个IStyleGalleryItem项中。
参考代码:
IStyleGallery styleGallery = new StyleGallery();
IEnumStyleGalleryItem styleGalleryItem = (IEnumStyleGalleryItem)styleGallery;//从这一行可以看出一个IStyleGallery实例可以直接的转换为一个IEnumStyleGaleryItem对象
styleGalleryItem.Reset();
string itemName = styleGalleryItem.Next().Name;
MessageBox.Show(itemName);
- IStyleGallery 和IstyleGalleryItem以及IStyleGalleryStorage接口的详解
- 如何生成IStyleGalleryItem和ISymbol对象的预览图
- IStyleGallery
- Java多线程Thread类和Runable接口的区别以及线程类详解
- 类和接口以及之间的关系
- socket原理详解以及使用的链接接口
- Filter接口和HttpServlet类的详解
- 抽象类和接口的区别详解
- 详解接口和抽象类的区别
- 抽象类和接口的详解
- Java的接口和抽象类详解
- Java的接口和抽象类详解
- Java的接口和抽象类详解
- Java的接口和抽象类详解
- PHP的数据库接口和技术详解
- JDBC常用的类和接口详解
- Java的接口和抽象类详解
- Java的接口和抽象类详解
- 新APP上线
- bat命令大全
- HDU 2476 String painter(区间DP)
- 图解TCP/IP 笔记
- Bat基本语法
- IStyleGallery 和IstyleGalleryItem以及IStyleGalleryStorage接口的详解
- java基础:反射字段
- 返回 list<> 集合异常
- 链表中倒数第k个结点
- ubuntu tftp服务器
- Log4J入门教程(一) 入门例程
- 【SDOI2012】【BZOJ2705】Longge的问题
- iOS扫码Zbar静态库支持arm64和arms7s的静态库
- poj2763 Housewife Wind 树链剖分