An ordered collection of imagery layers for rendering raster imagery on a
Globe or Cesium3DTileset.
Scene#imageryLayersfor manipulating imagery layers on the globe.Cesium3DTileset#imageryLayersfor manipulating imagery layers on a 3D tileset.
Demo:
See:
Members
layerAdded : Event
当一个图层被添加到收藏中时会上升的事件 。 事件处理器通过层
并添加索引.
-
Default Value:
Event()
layerMoved : Event
当一个图层改变收藏中的位置时会提起的事件 。 事件处理器通过层
移动,移动后它的新索引,移动前它的旧索引.
-
Default Value:
Event()
layerRemoved : Event
当从收藏中移除一层时会提起的事件 。 事件处理器通过层
并删除了该索引.
-
Default Value:
Event()
layerShownOrHidden : Event
通过设置显示或隐藏一层时升起的事件
ImageryLayer#show property. Event handlers are passed a reference to this layer,
收藏中的图层索引,以及如果图层现在为真实的旗帜
如果它现在被隐藏,则显示或虚假.
-
Default Value:
Event()
获得此收藏中的层数 .
Methods
在收藏中添加一层.
| Name | Type | Description |
|---|---|---|
layer |
ImageryLayer | 要添加的图层. |
index |
number | optional 用于添加图层的索引。 如果省略, 层会 添加到所有现有层的顶部. |
Throws:
-
DeveloperError : index, if supplied, must be greater than or equal to zero and less than or equal to the number of the layers.
Examples:
const imageryLayer = Cesium.ImageryLayer.fromWorldImagery();
scene.imageryLayers.add(imageryLayer);
const imageryLayer = Cesium.ImageryLayer.fromProviderAsync(Cesium.IonImageryProvider.fromAssetId(3812));
scene.imageryLayers.add(imageryLayer);
addImageryProvider(imageryProvider, index) → ImageryLayer
使用给定的图像渲染器创建新层,并添加到收藏中.
| Name | Type | Description |
|---|---|---|
imageryProvider |
ImageryProvider | 用于创建新图层的图像提供者. |
index |
number | optional 用于添加图层的索引。 如果省略, 层会 添加到所有现有层的顶部. |
Returns:
新建的层.
Example:
try {
const provider = await Cesium.IonImageryProvider.fromAssetId(3812);
scene.imageryLayers.addImageryProvider(provider);
} catch (error) {
console.log(`There was an error creating the imagery layer. ${error}`)
}
检查收藏是否包含一个给定的图层 .
| Name | Type | Description |
|---|---|---|
layer |
ImageryLayer | 要检查的层. |
Returns:
如果收藏中包含图层,则真实性为真,否则为假.
Destroys the WebGL resources held by all layers in this collection. Explicitly destroying this
对象允许确定释放 NT 0 资源,而不是依赖垃圾
collector.
Once this object is destroyed, it should not be used; calling any function other than
Once this object is destroyed, it should not be used; calling any function other than
isDestroyed will result in a DeveloperError exception. Therefore,
assign the return value (undefined) to the object as done in the example.
Throws:
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
Example:
layerCollection = layerCollection && layerCollection.destroy();
See:
get(index) → ImageryLayer
从收藏中逐层获取索引.
| Name | Type | Description |
|---|---|---|
index |
number | 用于检索的索引. |
Returns:
给定索引的图像层 .
确定收藏中某一层的索引.
| Name | Type | Description |
|---|---|---|
layer |
ImageryLayer | 查找索引的图层 . |
Returns:
收藏中层的索引,或 -1 如果收藏中不存在层的话.
如果此对象被销毁, 返回真实; 否则, 错误 .
If this object was destroyed, it should not be used; calling any function other than
If this object was destroyed, it should not be used; calling any function other than
isDestroyed will result in a DeveloperError exception.
Returns:
如果此对象已被销毁, 则属真; 否则, 属假 .
将收藏中一个位置下一层.
| Name | Type | Description |
|---|---|---|
layer |
ImageryLayer | 要移动的层. |
Throws:
-
DeveloperError : layer is not in this collection.
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
将一个层降低到收藏的底部.
| Name | Type | Description |
|---|---|---|
layer |
ImageryLayer | 要移动的层. |
Throws:
-
DeveloperError : layer is not in this collection.
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
pickImageryLayerFeatures(ray, scene) → Promise.<Array.<ImageryLayerFeatureInfo>>|undefined
同步地决定了被采光所交叉的图像层特征. 相交的图像
layer features are found by invoking
ImageryProvider#pickFeatures for each imagery layer tile intersected
by the pick ray. To compute a pick ray from a location on the screen, use Camera.getPickRay.
| Name | Type | Description |
|---|---|---|
ray |
Ray | 用来测试交叉点的射线. |
scene |
Scene | The scene. |
Returns:
一个能解决 一系列特征的许诺 与采光相交.
如果能够迅速确定没有特征交叉(例如,
因为没有活跃的图像提供者支持
ImageryProvider#pickFeatures
or because the pick ray does not intersect the surface), this function will
return undefined.
Example:
const pickRay = viewer.camera.getPickRay(windowPosition);
const featuresPromise = viewer.imageryLayers.pickImageryLayerFeatures(pickRay, viewer.scene);
if (!Cesium.defined(featuresPromise)) {
console.log('No features picked.');
} else {
Promise.resolve(featuresPromise).then(function(features) {
// This function is called asynchronously when the list if picked features is available.
console.log(`Number of features: ${features.length}`);
if (features.length > 0) {
console.log(`First feature name: ${features[0].name}`);
}
});
}
pickImageryLayers(ray, scene) → Array.<ImageryLayer>|undefined
确定由采光线交叉的图像层。 来计算从一个采光
location on the screen, use
Camera.getPickRay.
| Name | Type | Description |
|---|---|---|
ray |
Ray | 用来测试交叉点的射线. |
scene |
Scene | The scene. |
Returns:
一个包含全部的阵列
由特定的采光线相交的层。 未定义如果
没有选择层次.
将收藏中的一个位置提升一层.
| Name | Type | Description |
|---|---|---|
layer |
ImageryLayer | 要移动的层. |
Throws:
-
DeveloperError : layer is not in this collection.
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
将一层升到收藏的顶端.
| Name | Type | Description |
|---|---|---|
layer |
ImageryLayer | 要移动的层. |
Throws:
-
DeveloperError : layer is not in this collection.
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
如果存在, 从此收藏中删除一层 .
| Name | Type | Default | Description |
|---|---|---|---|
layer |
ImageryLayer | 要删除的图层 . | |
destroy |
boolean |
真
|
optional |
Returns:
如果图层在收藏中被移除,
如果图层不在收藏中,则不真实.
从此收藏中删除所有层.
| Name | Type | Default | Description |
|---|---|---|---|
destroy |
boolean |
真
|
optional |