LayerInfos class
The LayerInfos class enables you to access each operational layer in the web map.
Caution:
The LayerInfos class is deprecated. Use the LayerStructure class instead.
AMD Module Require
require(["jimu/LayerInfos/LayerInfos"], function(LayerInfos) { /* code goes here */ });
Constructor
LayerInfos.getInstance(webmap, webmapItemInfo).then(lang.hitch(this, function(layerInfosObject){})); .then(lang.hitch(this, function(layerInfosObject) { })); Creates a new layerInfos object. Parameters: <Object> webmap—Required. The map. <Object> webmapItemInfo—Required. The itemInfo of the map. Example:
|
Methods
getLayerInfoArray() Gets the layerInfo array corresponding to all of the operational layers. Return type: Object[<LayerInfo> layerInfo, …] |
getLayerInfoById(layerId) Gets the layerInfo by the layer ID. Returns null if the layer ID does not exist. Return type: <LayerInfo> Parameters: <String> layerId—Required. The layer ID. |
getTableInfoArray() Gets the layerInfo array corresponding to all the tables in the map. Return type: Object[<LayerInfo> layerInfo, …] |
moveDownLayer(layerId) Moves the layer down in the map. Return type: <String>. Returns the layer ID that has been changed. Parameters: <String> layerId—Required. The layer ID. |
moveUpLayer(layerId) Moves the layer up in the map. Return type: <String>. Returns the layer ID that has been changed. Parameters: <String> layerId—Required. The layer ID. |
traversal(callback) Traverses all the layers and the sublayers with Depth-First-Search. Return type: <Boolean> Return value:
Parameters: <Function> callback (layerInfo)—Required. Called by each layer and sends layerInfo as a parameter. The layer can be handled in the callback. Callback parameters: <LayerInfo> Callback return type: <Boolean> Callback return value:
Example:
|