An imagery layer that displays tiled image data from a single imagery provider
on a
Globe
.
参数名称 | 类型 | 描述信息 |
---|---|---|
imageryProvider |
ImageryProvider | 可选 The imagery provider to use. |
options |
ImageryLayer.ConstructorOptions | 可选 An object describing initialization options |
使用示例s:
// Add an OpenStreetMaps layer
const imageryLayer = new Cesium.ImageryLayer(new Cesium.OpenStreetMapImageryProvider({
url: "https://tile.openstreetmap.org/"
}));
scene.imageryLayers.add(imageryLayer);
// Add Cesium ion's default world imagery layer
const imageryLayer = Cesium.ImageryLayer.fromWorldImagery();
scene.imageryLayers.add(imageryLayer);
// Add a new transparent layer from Cesium ion
const imageryLayer = Cesium.ImageryLayer.fromProviderAsync(Cesium.IonImageryProvider.fromAssetId(3812));
imageryLayer.alpha = 0.5;
scene.imageryLayers.add(imageryLayer);
参考:
成员(属性)
This value is used as the default threshold for color-to-alpha if one is not provided
during construction or by the imagery provider.
-
默认值:
0.004
This value is used as the default brightness for the imagery layer if one is not provided during construction
or by the imagery provider. This value does not modify the brightness of the imagery.
-
默认值:
1.0
This value is used as the default contrast for the imagery layer if one is not provided during construction
or by the imagery provider. This value does not modify the contrast of the imagery.
-
默认值:
1.0
This value is used as the default gamma for the imagery layer if one is not provided during construction
or by the imagery provider. This value does not modify the gamma of the imagery.
-
默认值:
1.0
This value is used as the default hue for the imagery layer if one is not provided during construction
or by the imagery provider. This value does not modify the hue of the imagery.
-
默认值:
0.0
static Cesium.ImageryLayer.DEFAULT_MAGNIFICATION_FILTER : TextureMagnificationFilter
This value is used as the default texture magnification filter for the imagery layer if one is not provided
during construction or by the imagery provider.
-
默认值:
TextureMagnificationFilter.LINEAR
static Cesium.ImageryLayer.DEFAULT_MINIFICATION_FILTER : TextureMinificationFilter
This value is used as the default texture minification filter for the imagery layer if one is not provided
during construction or by the imagery provider.
-
默认值:
TextureMinificationFilter.LINEAR
This value is used as the default saturation for the imagery layer if one is not provided during construction
or by the imagery provider. This value does not modify the saturation of the imagery.
-
默认值:
1.0
static Cesium.ImageryLayer.DEFAULT_SPLIT : SplitDirection
This value is used as the default split for the imagery layer if one is not provided during construction
or by the imagery provider.
-
默认值:
SplitDirection.NONE
The alpha blending value of this layer, with 0.0 representing fully transparent and
1.0 representing fully opaque.
-
默认值:
1.0
The brightness of this layer. 1.0 uses the unmodified imagery color. Less than 1.0
makes the imagery darker while greater than 1.0 makes it brighter.
colorToAlpha : Color
Color value that should be set to transparent.
Normalized (0-1) threshold for color-to-alpha.
The contrast of this layer. 1.0 uses the unmodified imagery color. Less than 1.0 reduces
the contrast while greater than 1.0 increases it.
cutoutRectangle : Rectangle
Rectangle cutout in this layer of imagery.
The alpha blending value of this layer on the day side of the globe, with 0.0 representing fully transparent and
1.0 representing fully opaque. This only takes effect when
Globe#enableLighting
is true
.
-
默认值:
1.0
The gamma correction to apply to this layer. 1.0 uses the unmodified imagery color.
The hue of this layer in radians. 0.0 uses the unmodified imagery color.
readonly imageryProvider : ImageryProvider
Gets the imagery provider for this layer. This should not be called before
ImageryLayer#ready
returns true.
magnificationFilter : TextureMagnificationFilter
The
TextureMagnificationFilter
to apply to this layer.
Possible values are TextureMagnificationFilter.LINEAR
(the default)
and TextureMagnificationFilter.NEAREST
.
To take effect, this property must be set immediately after adding the imagery layer.
Once a texture is loaded it won't be possible to change the texture filter used.
minificationFilter : TextureMinificationFilter
The
TextureMinificationFilter
to apply to this layer.
Possible values are TextureMinificationFilter.LINEAR
(the default)
and TextureMinificationFilter.NEAREST
.
To take effect, this property must be set immediately after adding the imagery layer.
Once a texture is loaded it won't be possible to change the texture filter used.
The alpha blending value of this layer on the night side of the globe, with 0.0 representing fully transparent and
1.0 representing fully opaque. This only takes effect when
Globe#enableLighting
is true
.
-
默认值:
1.0
Returns true when the terrain provider has been successfully created. Otherwise, returns false.
readonly readyEvent : Event.<ImageryLayer.ReadyEventCallback>
Gets an event that is raised when the imagery provider has been successfully created. Event listeners
are passed the created instance of
ImageryProvider
.
readonly rectangle : Rectangle
Gets the rectangle of this layer. If this rectangle is smaller than the rectangle of the
ImageryProvider
, only a portion of the imagery provider is shown.
The saturation of this layer. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the
saturation while greater than 1.0 increases it.
Determines if this layer is shown.
-
默认值:
true
splitDirection : SplitDirection
The
SplitDirection
to apply to this layer.
方法
static Cesium.ImageryLayer.fromProviderAsync(imageryProviderPromise, options) → ImageryLayer
Create a new imagery layer from an asynchronous imagery provider. The layer will handle any asynchronous loads or errors, and begin rendering the imagery layer once ready.
参数名称 | 类型 | 描述信息 |
---|---|---|
imageryProviderPromise |
Promise.<ImageryProvider> | A promise which resolves to a imagery provider |
options |
ImageryLayer.ConstructorOptions | An object describing initialization options |
返回值:
The created imagery layer.
- ImageryLayer.errorEvent
- ImageryLayer.readyEvent
- ImageryLayer.provider
- ImageryLayer.fromWorldImagery
使用示例s:
// Create a new base layer
const viewer = new Cesium.Viewer("cesiumContainer", {
baseLayer: Cesium.ImageryLayer.fromProviderAsync(Cesium.IonImageryProvider.fromAssetId(3812));
});
// Add a new transparent layer
const imageryLayer = Cesium.ImageryLayer.fromProviderAsync(Cesium.IonImageryProvider.fromAssetId(3812));
imageryLayer.alpha = 0.5;
viewer.imageryLayers.add(imageryLayer);
// Handle loading events
const imageryLayer = Cesium.ImageryLayer.fromProviderAsync(Cesium.IonImageryProvider.fromAssetId(3812));
viewer.imageryLayers.add(imageryLayer);
imageryLayer.readyEvent.addEventListener(provider => {
imageryLayer.provider.errorEvent.addEventListener(error => {
alert(`Encountered an error while loading imagery tiles! ${error}`);
});
});
imageryLayer.errorEvent.addEventListener(error => {
alert(`Encountered an error while creating an imagery layer! ${error}`);
});
参考:
static Cesium.ImageryLayer.fromWorldImagery(options) → ImageryLayer
Create a new imagery layer for ion's default global base imagery layer, currently Bing Maps. The layer will handle any asynchronous loads or errors, and begin rendering the imagery layer once ready.
参数名称 | 类型 | 描述信息 |
---|---|---|
options |
ImageryLayer.WorldImageryConstructorOptions | An object describing initialization options |
返回值:
The created imagery layer.
* @example
// Create a new base layer
const viewer = new Cesium.Viewer("cesiumContainer", {
baseLayer: Cesium.ImageryLayer.fromWorldImagery();
});
- ImageryLayer.errorEvent
- ImageryLayer.readyEvent
- ImageryLayer.provider
使用示例s:
// Add a new transparent layer
const imageryLayer = Cesium.ImageryLayer.fromWorldImagery();
imageryLayer.alpha = 0.5;
viewer.imageryLayers.add(imageryLayer);
// Handle loading events
const imageryLayer = Cesium.ImageryLayer.fromWorldImagery();
viewer.imageryLayers.add(imageryLayer);
imageryLayer.readyEvent.addEventListener(provider => {
imageryLayer.provider.errorEvent.addEventListener(error => {
alert(`Encountered an error while loading imagery tiles! ${error}`);
});
});
imageryLayer.errorEvent.addEventListener(error => {
alert(`Encountered an error while creating an imagery layer! ${error}`);
});
参考:
Destroys the WebGL resources held by this object. Destroying an object allows for deterministic
release of WebGL resources, instead of relying on the garbage collector to destroy this object.
Once an object is destroyed, it should not be used; calling any function other than
Once an 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.
使用示例:
imageryLayer = imageryLayer && imageryLayer.destroy();
参考:
getImageryRectangle() → Rectangle
Computes the intersection of this layer's rectangle with the imagery provider's availability rectangle,
producing the overall bounds of imagery that can be produced by this layer.
返回值:
A rectangle which defines the overall bounds of imagery that can be produced by this layer.
使用示例:
// Zoom to an imagery layer.
const imageryRectangle = imageryLayer.getImageryRectangle();
scene.camera.flyTo({
destination: rectangle
});
Gets a value indicating whether this layer is the base layer in the
ImageryLayerCollection
. The base layer is the one that underlies all
others. It is special in that it is treated as if it has global rectangle, even if
it actually does not, by stretching the texels at the edges over the entire
globe.
返回值:
true if this is the base layer; otherwise, false.
Returns true if this object was destroyed; otherwise, false.
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.
返回值:
True if this object was destroyed; otherwise, false.
定义的类型
Initialization options for the ImageryLayer constructor.
属性:
属性名称 | 类型 | 可选 | 默认值 | 描述信息 |
---|---|---|---|---|
rectangle |
Rectangle |
<可选> |
imageryProvider.rectangle | The rectangle of the layer. This rectangle can limit the visible portion of the imagery provider. |
alpha |
number | function |
<可选> |
1.0 | The alpha blending value of this layer, from 0.0 to 1.0.
This can either be a simple number or a function with the signature
function(frameState, layer, x, y, level) . The function is passed the
current frame state, this layer, and the x, y, and level coordinates of the
imagery tile for which the alpha is required, and it is expected to return
the alpha value to use for the tile. |
nightAlpha |
number | function |
<可选> |
1.0 | The alpha blending value of this layer on the night side of the globe, from 0.0 to 1.0.
This can either be a simple number or a function with the signature
function(frameState, layer, x, y, level) . The function is passed the
current frame state, this layer, and the x, y, and level coordinates of the
imagery tile for which the alpha is required, and it is expected to return
the alpha value to use for the tile. This only takes effect when enableLighting is true . |
dayAlpha |
number | function |
<可选> |
1.0 | The alpha blending value of this layer on the day side of the globe, from 0.0 to 1.0.
This can either be a simple number or a function with the signature
function(frameState, layer, x, y, level) . The function is passed the
current frame state, this layer, and the x, y, and level coordinates of the
imagery tile for which the alpha is required, and it is expected to return
the alpha value to use for the tile. This only takes effect when enableLighting is true . |
brightness |
number | function |
<可选> |
1.0 | The brightness of this layer. 1.0 uses the unmodified imagery
color. Less than 1.0 makes the imagery darker while greater than 1.0 makes it brighter.
This can either be a simple number or a function with the signature
function(frameState, layer, x, y, level) . The function is passed the
current frame state, this layer, and the x, y, and level coordinates of the
imagery tile for which the brightness is required, and it is expected to return
the brightness value to use for the tile. The function is executed for every
frame and for every tile, so it must be fast. |
contrast |
number | function |
<可选> |
1.0 | The contrast of this layer. 1.0 uses the unmodified imagery color.
Less than 1.0 reduces the contrast while greater than 1.0 increases it.
This can either be a simple number or a function with the signature
function(frameState, layer, x, y, level) . The function is passed the
current frame state, this layer, and the x, y, and level coordinates of the
imagery tile for which the contrast is required, and it is expected to return
the contrast value to use for the tile. The function is executed for every
frame and for every tile, so it must be fast. |
hue |
number | function |
<可选> |
0.0 | The hue of this layer. 0.0 uses the unmodified imagery color.
This can either be a simple number or a function with the signature
function(frameState, layer, x, y, level) . The function is passed the
current frame state, this layer, and the x, y, and level coordinates
of the imagery tile for which the hue is required, and it is expected to return
the contrast value to use for the tile. The function is executed for every
frame and for every tile, so it must be fast. |
saturation |
number | function |
<可选> |
1.0 | The saturation of this layer. 1.0 uses the unmodified imagery color.
Less than 1.0 reduces the saturation while greater than 1.0 increases it.
This can either be a simple number or a function with the signature
function(frameState, layer, x, y, level) . The function is passed the
current frame state, this layer, and the x, y, and level coordinates
of the imagery tile for which the saturation is required, and it is expected to return
the contrast value to use for the tile. The function is executed for every
frame and for every tile, so it must be fast. |
gamma |
number | function |
<可选> |
1.0 | The gamma correction to apply to this layer. 1.0 uses the unmodified imagery color.
This can either be a simple number or a function with the signature
function(frameState, layer, x, y, level) . The function is passed the
current frame state, this layer, and the x, y, and level coordinates of the
imagery tile for which the gamma is required, and it is expected to return
the gamma value to use for the tile. The function is executed for every
frame and for every tile, so it must be fast. |
splitDirection |
SplitDirection | function |
<可选> |
SplitDirection.NONE | The SplitDirection split to apply to this layer. |
minificationFilter |
TextureMinificationFilter |
<可选> |
TextureMinificationFilter.LINEAR | The
texture minification filter to apply to this layer. Possible values
are TextureMinificationFilter.LINEAR and
TextureMinificationFilter.NEAREST . |
magnificationFilter |
TextureMagnificationFilter |
<可选> |
TextureMagnificationFilter.LINEAR | The
texture minification filter to apply to this layer. Possible values
are TextureMagnificationFilter.LINEAR and
TextureMagnificationFilter.NEAREST . |
show |
boolean |
<可选> |
true | True if the layer is shown; otherwise, false. |
maximumAnisotropy |
number |
<可选> |
maximum supported | The maximum anisotropy level to use for texture filtering. If this parameter is not specified, the maximum anisotropy supported by the WebGL stack will be used. Larger values make the imagery look better in horizon views. |
minimumTerrainLevel |
number |
<可选> |
The minimum terrain level-of-detail at which to show this imagery layer, or undefined to show it at all levels. Level zero is the least-detailed level. | |
maximumTerrainLevel |
number |
<可选> |
The maximum terrain level-of-detail at which to show this imagery layer, or undefined to show it at all levels. Level zero is the least-detailed level. | |
cutoutRectangle |
Rectangle |
<可选> |
Cartographic rectangle for cutting out a portion of this ImageryLayer. | |
colorToAlpha |
Color |
<可选> |
Color to be used as alpha. | |
colorToAlphaThreshold |
number |
<可选> |
0.004 | Threshold for color-to-alpha. |
A function that is called when an error occurs.
This:
参数名称 | 类型 | 描述信息 |
---|---|---|
err |
Error | An object holding details about the error that occurred. |
A function that is called when the provider has been created
This:
参数名称 | 类型 | 描述信息 |
---|---|---|
provider |
ImageryProvider | The created imagery provider. |
Initialization options for ImageryLayer.fromWorldImagery
属性:
属性名称 | 类型 | 可选 | 默认值 | 描述信息 |
---|---|---|---|---|
options.style |
IonWorldImageryStyle |
<可选> |
IonWorldImageryStyle | The style of base imagery, only AERIAL, AERIAL_WITH_LABELS, and ROAD are currently supported. |