How to set globe layer cache properties(如何设置globe图层的缓存属性)
原文:Disk caching creates a temporary file or cache for each layer in ArcGlobe, which helps you display and navigate your data efficiently. This topic shows how to set layer cache properties programmatically.
译文:磁盘缓存为ArcGlobe里的每一个图层创建一个临时文件或缓存文件,这些缓存将有利于有效的显示和漫游你的数据。这个topic教你如何通过编程来设置图层的缓存属性。
原文:
Setting globe layer cache properties
- Properly initialize the following variables:
- ESRI.ArcGIS.GlobeCore.IGlobeDisplay pGlobeDisplay
- ESRI.ArcGIS.Carto.ILayer pLayer—The layer for which the cache properties have to be set
- To set the layer cache properties, you need a handle to ESRI.ArcGIS.GlobeCore.IGlobeLayerProperties2 for the layer. See the following code example:
- The ESRI.ArcGIS.GlobeCore.IGlobeLayerProperties2 interface exposes all the methods and properties that can be used to get and set the globe layer's cache properties. The following code example shows how to set the lossy compression
option (Joint Photographics Experts Group [JPEG] or DirectX Texture Compression [DXT]) for raster layers:
- Set the option to reduce the number of bits used to display colors for an image. See the following code example:
- Set the minimum cell size (in meters) for raster layers. See the following code example:
- Set the cache removal options. See the following code example:
- Once the layer properties have been set, refresh the layer. See the following code example:
译文:1、首先初始化IGlobeDisplay和ILayer对象。
2、设置图层的缓存属性,需要操作IGlobeLayerProperties2接口
3、IGlobeLayerProperties2
接口提供了所有可以用来获取和设置globe图层的缓存属性的方法和属性。下面的代码展示了如何设置栅格图层的有损压缩选项(JPEG或者DXT)
4、设置选项以减少一幅图像颜色显示的位数。
5、设置栅格图层的最小分辨率
6、设置缓存的移除选项
7、一旦图层属性设置完成,刷新图层。
IGlobeDisplayLayers globeDisplayLayers = pGlobeDisplay as IGlobeDisplayLayers; //获取IGlobeLayerProperties.(第二步) IGlobeLayerProperties globeLayerProperties = globeDisplayLayers.FindGlobeProperties (pLayer); IGlobeLayerProperties2 globeLayerProperties2 = globeLayerProperties as IGlobeLayerProperties2; //(第三步)Set the lossy compression option (JPEG or DXT) for raster layers. globeLayerProperties2.CacheCompressionType = esriTextureFormatType.esriTextureJPEG; globeLayerProperties2.PutLossyCompressionOption(true, 50); //(第四步)Set the option to reduce the number of bits used to display colors for an image. globeLayerProperties2.Use16ColorBits = true; //第五步 Set the minimum cell size (in meters) for raster layers.(设置栅格图层的最小分辨率,以米为单位) globeLayerProperties2.MinimumCellSize = 1; //(第六步)Set the cache removal options. globeLayerProperties2.CacheRemovalOption = esriGlobeLayerCacheRemovalOption.esriGlobeLayerExitRemoval; //Refresh the layer. globeDisplayLayers.RefreshLayer(pLayer);