Appearance
KBE3D / KBCore / Cesium / ImageryLayer
类: ImageryLayer
An imagery layer that displays tiled image data from a single imagery provider on a Globe or Cesium3DTileset.
Examples
ts
// Add an OpenStreetMaps layer
const imageryLayer = new Cesium.ImageryLayer(new Cesium.OpenStreetMapImageryProvider({
url: "https://tile.openstreetmap.org/"
}));
scene.imageryLayers.add(imageryLayer);ts
// Add Cesium ion's default world imagery layer
const imageryLayer = Cesium.ImageryLayer.fromWorldImagery();
scene.imageryLayers.add(imageryLayer);ts
// 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);ts
// Drape Bing Maps Aerial imagery over a 3D tileset
const tileset = await Cesium.Cesium3DTileset.fromUrl(
"http://localhost:8002/tilesets/Seattle/tileset.json"
);
scene.primitives.add(tileset);
const imageryProvider = await Cesium.createWorldImageryAsync({
style: Cesium.IonWorldImageryStyle.AERIAL,
});
const imageryLayer = new ImageryLayer(imageryProvider);
tileset.imageryLayers.add(imageryLayer);参数
The imagery provider to use.
参数
An object describing initialization options
属性
DEFAULT_BRIGHTNESS
staticDEFAULT_BRIGHTNESS:number
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.
DEFAULT_CONTRAST
staticDEFAULT_CONTRAST:number
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.
DEFAULT_HUE
staticDEFAULT_HUE:number
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.
DEFAULT_SATURATION
staticDEFAULT_SATURATION:number
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.
DEFAULT_GAMMA
staticDEFAULT_GAMMA:number
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.
DEFAULT_SPLIT
staticDEFAULT_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.
DEFAULT_MINIFICATION_FILTER
staticDEFAULT_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.
DEFAULT_MAGNIFICATION_FILTER
staticDEFAULT_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.
DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD
staticDEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD:number
This value is used as the default threshold for color-to-alpha if one is not provided during construction or by the imagery provider.
alpha
alpha:
number
The alpha blending value of this layer, with 0.0 representing fully transparent and 1.0 representing fully opaque.
nightAlpha
nightAlpha:
number
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 <code>true</code>.
dayAlpha
dayAlpha:
number
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 <code>true</code>.
brightness
brightness:
number
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.
contrast
contrast:
number
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.
hue
hue:
number
The hue of this layer in radians. 0.0 uses the unmodified imagery color.
saturation
saturation:
number
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.
gamma
gamma:
number
The gamma correction to apply to this layer. 1.0 uses the unmodified imagery color.
splitDirection
splitDirection:
SplitDirection
The SplitDirection to apply to this layer.
minificationFilter
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.
magnificationFilter
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.
show
show:
boolean
Determines if this layer is shown.
cutoutRectangle
cutoutRectangle:
Rectangle
Rectangle cutout in this layer of imagery.
colorToAlpha
colorToAlpha:
Color
Color value that should be set to transparent.
colorToAlphaThreshold
colorToAlphaThreshold:
number
Normalized (0-1) threshold for color-to-alpha.
imageryProvider
readonlyimageryProvider:ImageryProvider
Gets the imagery provider for this layer. This should not be called before ImageryLayer#ready returns true.
ready
readonlyready:boolean
Returns true when the terrain provider has been successfully created. Otherwise, returns false.
errorEvent
readonlyerrorEvent:Event<ErrorEventCallback>
Gets an event that is raised when the imagery provider encounters an asynchronous error. By subscribing to the event, you will be notified of the error and can potentially recover from it. Event listeners are passed an instance of the thrown error.
readyEvent
readonlyreadyEvent:Event<ReadyEventCallback>
Gets an event that is raised when the imagery provider has been successfully created. Event listeners are passed the created instance of ImageryProvider.
rectangle
readonlyrectangle: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.
方法
fromProviderAsync()
staticfromProviderAsync(imageryProviderPromise:Promise<ImageryProvider>,options?:ConstructorOptions):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?
An object describing initialization options
返回
ImageryLayer
The created imagery layer.
Examples
ts
// Create a new base layer
const viewer = new Cesium.Viewer("cesiumContainer", {
baseLayer: Cesium.ImageryLayer.fromProviderAsync(Cesium.IonImageryProvider.fromAssetId(3812));
});ts
// Add a new transparent layer
const imageryLayer = Cesium.ImageryLayer.fromProviderAsync(Cesium.IonImageryProvider.fromAssetId(3812));
imageryLayer.alpha = 0.5;
viewer.imageryLayers.add(imageryLayer);ts
// Handle loading events
const imageryLayer = Cesium.ImageryLayer.fromProviderAsync(Cesium.IonImageryProvider.fromAssetId(3812));
viewer.imageryLayers.add(imageryLayer);
imageryLayer.readyEvent.addEventListener(provider => {
imageryLayer.imageryProvider.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}`);
});fromWorldImagery()
staticfromWorldImagery(options:ConstructorOptions):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
An object describing initialization options
返回
ImageryLayer
The created imagery layer.
Examples
ts
// Add a new transparent layer
const imageryLayer = Cesium.ImageryLayer.fromWorldImagery();
imageryLayer.alpha = 0.5;
viewer.imageryLayers.add(imageryLayer);ts
// Handle loading events
const imageryLayer = Cesium.ImageryLayer.fromWorldImagery();
viewer.imageryLayers.add(imageryLayer);
imageryLayer.readyEvent.addEventListener(provider => {
imageryLayer.imageryProvider.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}`);
});ts
// Create a new base layer
const viewer = new Cesium.Viewer("cesiumContainer", {
baseLayer: Cesium.ImageryLayer.fromWorldImagery();
});isBaseLayer()
isBaseLayer():
boolean
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.
返回
boolean
true if this is the base layer; otherwise, false.
isDestroyed()
isDestroyed():
boolean
Returns true if this object was destroyed; otherwise, false. <br /><br /> If this object was destroyed, it should not be used; calling any function other than <code>isDestroyed</code> will result in a DeveloperError exception.
返回
boolean
True if this object was destroyed; otherwise, false.
destroy()
destroy():
void
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. <br /><br /> Once an object is destroyed, it should not be used; calling any function other than <code>isDestroyed</code> will result in a DeveloperError exception. Therefore, assign the return value (<code>undefined</code>) to the object as done in the example.
返回
void
示例
ts
imageryLayer = imageryLayer && imageryLayer.destroy();getImageryRectangle()
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.
示例
ts
// Zoom to an imagery layer.
const imageryRectangle = imageryLayer.getImageryRectangle();
scene.camera.flyTo({
destination: rectangle
});构造函数
构造函数
new ImageryLayer(
imageryProvider?:ImageryProvider,options?:ConstructorOptions):ImageryLayer
参数
imageryProvider?
options?
返回
ImageryLayer
