The image layer collection class is used to manage image layers.
Members
-
layerAdded : Event
-
The event is triggered after a layer is added to the layer collection.
-
Default Value:
Event() -
layerMoved : Event
-
The event is triggered afrer a layer in the layer collection has been moved.
-
Default Value:
Event() -
layerRemoved : Event
-
The event is triggered after a layer in the layer collection has been removed.
-
Default Value:
Event() -
layerShownOrHidden : Event
-
The event is triggered when the ImageryLayer#show changes.
-
Default Value:
Event() -
Get the number of layers in the layer collection.
Methods
-
Add a layer to the layer collection.
Name Type Description layerImageryLayer The layer to be added. indexNumber optional The index of the layer to be added. Throws:
-
DeveloperError : The index value should be greater than or equal to 0 and less than the total number of layers.
-
-
addGridProvider(gridProvider, index) → GridLayer
-
Add a Grid tile service provider.
Name Type Description gridProviderString Creat a new layer using the given raster layer provider, and add it to the layer collection. indexNumber optional The index of the layer to be added. If the parameter is ignored, the new layer will be placed on top of all existing layers. Returns:
The newly added layer. -
addImageryProvider(imageryProvider, index) → ImageryLayer
-
Creat a new layer using the given image service provider and add it to the layer collection.
Name Type Description imageryProviderImageryProvider The given image service provider. indexNumber optional The index of the layer to be added. Returns:
The newly added iamge layer.Example:
var imageryLayers = viewer.imageryLayers; var labelImagery = new SuperMap3D.WebMapTileServiceImageryProvider({ url : 'http://[subdomain].tianditu.com/cia_w/wmts', layer : 'cia', style : 'default', format : 'tiles', tileMatrixSetID : 'w', credit : new SuperMap3D.Credit('Tianditu Global Imagery Chinese Annotation Service'), subdomains : ['t0','t1','t2','t3','t4','t5','t6','t7'] }); imageryLayers.addImageryProvider(labelImagery);. -
Determine whether the layer collection contains the specified layer.
Name Type Description layerImageryLayer The layer to be checked. Returns:
Return true if the layer collection layer contains the specified layer, otherwise ruturn false. -
Release all the WebGL resources occupied by the layers in the collection. Once the resources occupied by the object are released, the object will no longer be usable, and calling any command other than isDestroyed will throw a
DeveloperErrorexception. Therefore, as shown in the example, the object is assigned an undefined return value.Returns:
Return undefined。Throws:
-
DeveloperError : The objects have been released.
Example:
layerCollection = layerCollection && layerCollection.destroy();See:
-
-
get(index) → ImageryLayer
-
Get the imagery layer object at the specified index in the layer collection.
Name Type Description indexNumber The index value. Returns:
The imagery layer object. -
getImageryLayerByName(name) → ImageryLayer
-
Get the corresponding image layer in the layer collection based on the layer name.
Name Type Description nameString The imagery layer name. Returns:
-
Get the index value of the specified layer in the layer collection.
Name Type Description layerImageryLayer The specified layer. Returns:
The layer index value, return -1 if it doesn't exist. -
Return true if the object has been released, otherwise return false. Once the resources occupied by the object are released, the object will no longer be usable, and calling any command other than isDestroyed will throw a
DeveloperErrorexception.Returns:
Return true if the object has been released, otherwise return false. -
Move the specified layer in this layer collection down one level.
Name Type Description layerImageryLayer The layer to be moved. Throws:
-
DeveloperError : The layer does not exist in the layer collection.
-
DeveloperError : The object has been released.
-
-
Move the specified layer in this layer collection to the bottom.
Name Type Description layerImageryLayer The layer to be moved. Throws:
-
DeveloperError : The layer does not exist in the layer collection.
-
DeveloperError : The object has been released.
-
-
pickImageryLayerFeatures(ray, scene) → Promise.<Array.<ImageryLayerFeatureInfo>>|undefined
-
Asynchronously select layer features by picking with the cursor.By invoking
ImageryProvider#pickFeatures, pick the cursor intersecting with the layer tiles to discover the intersecting layer features. UseCamera.getPickRayto calculate the pick cursor from the screen position.Name Type Description rayRay The cursor for detecting intersections. sceneScene Scene object. Returns:
Get the promise of a set of features by picking intersecting cursor. If it can quickly determine that there are no intersecting features (e.g., no active layers supportImageryProvider#pickFeatures, or the pick cursor does not intersect with the layer), the function returns undefined.Example:
var pickRay = viewer.camera.getPickRay(windowPosition); var featuresPromise = viewer.imageryLayers.pickImageryLayerFeatures(pickRay, viewer.scene); if (!SuperMap3D.defined(featuresPromise)) { console.log('No features picked.'); } else { SuperMap3D.when(featuresPromise, 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); } }); } -
Move the specified in this layer collection up one level.
Name Type Description layerImageryLayer The layer to be moved. Throws:
-
DeveloperError : The specified layer does not exist in the layer collection.
-
DeveloperError : The object has been released.
-
-
Move the specified layer to this layer collection to the top.
Name Type Description layerImageryLayer The layer to be moved. Throws:
-
DeveloperError : This layer does not exist in the layer collection.
-
DeveloperError : The object has been released.
-
-
Reomove the specified layer in the layer collection.
Name Type Default Description layerImageryLayer The layer to be removed. destroyBoolean trueoptional Whether to release resources upon removal. Returns:
Return true if the removal is successful, otherwise return false. -
Remove all layers in the layer collection.
Name Type Default Description destroyBoolean trueoptional Whether to release resources upon removal. -
Remove the corresponding imagery layer from the layer collection based on the layer ID.
Name Type Default Description idString The image layer ID. destroyBoolean trueoptional Whether the removal was successful, with a return value as a flag. -
Remove the corresponding image layer from the layer collection based on the layer name.
Name Type Default Description nameString The image layer name. destroyBoolean trueoptional Whether the removal was successful, with a return value as a flag.
