new ImageryLayerCollection
An ordered collection of imagery layers.
Members
-
layerAdded :Event
-
An event that is raised when a layer is added to the collection. Event handlers are passed the layer that was added and the index at which it was added.
- Default Value:
- Event()
-
layerMoved :Event
-
An event that is raised when a layer changes position in the collection. Event handlers are passed the layer that was moved, its new index after the move, and its old index prior to the move.
- Default Value:
- Event()
-
layerRemoved :Event
-
An event that is raised when a layer is removed from the collection. Event handlers are passed the layer that was removed and the index from which it was removed.
- Default Value:
- Event()
-
layerShownOrHidden :Event
-
An event that is raised when a layer is shown or hidden by setting the ImageryLayer#show property. Event handlers are passed a reference to this layer, the index of the layer in the collection, and a flag that is true if the layer is now shown or false if it is now hidden.
- Default Value:
- Event()
-
length :Number
-
Gets the number of layers in this collection.
Methods
-
add
-
Adds a layer to the collection.
Parameters:
Name Type Argument Description layer
ImageryLayer the layer to add. index
Number <optional>
the index to add the layer at. If omitted, the layer will added on top of all existing layers. Throws:
DeveloperError : index, if supplied, must be greater than or equal to zero and less than or equal to the number of the layers. -
addImageryProvider
-
Creates a new layer using the given ImageryProvider and adds it to the collection.
Parameters:
Name Type Argument Description imageryProvider
ImageryProvider the imagery provider to create a new layer for. index
Number <optional>
the index to add the layer at. If omitted, the layer will added on top of all existing layers. Returns:
ImageryLayer The newly created layer. -
contains
-
Checks to see if the collection contains a given layer.
Parameters:
Name Type Description layer
ImageryLayer the layer to check for. Returns:
Boolean true if the collection contains the layer, false otherwise. -
destroy
-
Destroys the WebGL resources held by all layers in this collection. Explicitly destroying this object allows for deterministic release of WebGL resources, instead of relying on the garbage collector.
Once this object is destroyed, it should not be used; calling any function other thanisDestroyed
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.Returns:
Example
layerCollection = layerCollection && layerCollection.destroy();
-
get
-
Gets a layer by index from the collection.
Parameters:
Name Type Description index
Number the index to retrieve. Throws:
DeveloperError : This object was destroyed, i.e., destroy() was called. -
indexOf
-
Determines the index of a given layer in the collection.
Parameters:
Name Type Description layer
ImageryLayer The layer to find the index of. Returns:
Number The index of the layer in the collection, or -1 if the layer does not exist in the collection. -
isDestroyed
-
Returns true if this object was destroyed; otherwise, false.
If this object was destroyed, it should not be used; calling any function other thanisDestroyed
will result in a DeveloperError exception.Returns:
Boolean true if this object was destroyed; otherwise, false. -
lower
-
Lowers a layer down one position in the collection.
Parameters:
Name Type Description layer
ImageryLayer the layer to move. Throws:
-
DeveloperError : layer is not in this collection.
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
-
-
lowerToBottom
-
Lowers a layer to the bottom of the collection.
Parameters:
Name Type Description layer
ImageryLayer the layer to move. Throws:
-
DeveloperError : layer is not in this collection.
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
-
-
raise
-
Raises a layer up one position in the collection.
Parameters:
Name Type Description layer
ImageryLayer the layer to move. Throws:
-
DeveloperError : layer is not in this collection.
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
-
-
raiseToTop
-
Raises a layer to the top of the collection.
Parameters:
Name Type Description layer
ImageryLayer the layer to move. Throws:
-
DeveloperError : layer is not in this collection.
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
-
-
remove
-
Removes a layer from this collection, if present.
Parameters:
Name Type Argument Default Description layer
ImageryLayer The layer to remove. destroy
Boolean <optional>
true whether to destroy the layers in addition to removing them. Returns:
Boolean true if the layer was in the collection and was removed, false if the layer was not in the collection. -
removeAll
-
Removes all layers from this collection.
Parameters:
Name Type Argument Default Description destroy
Boolean <optional>
true whether to destroy the layers in addition to removing them.