* @function VideoMap.prototype.addLayer * @description 添加图层。 * @param {Object} layer - 图层配置。 * @param {string} layer.id - 图层 id * @param {string} layer.type - 图层类型 * @param {string|Object} layer.source - 数据源配置 * @param {Array} [layer.filter] - 过滤配置 * @param {Object} [layer.layou
(layer, beforeId)
| 135 | * @param {string} beforeId - 已经存在的图层 ID。 |
| 136 | */ |
| 137 | addLayer(layer, beforeId) { |
| 138 | if (!this._mapExisted()) { |
| 139 | return; |
| 140 | } |
| 141 | if (this.layerCache[layer.id]) { |
| 142 | return; |
| 143 | } |
| 144 | const currentLayer = new GeojsonLayer(this); |
| 145 | currentLayer.add(layer, beforeId); |
| 146 | this.layerCache[layer.id] = currentLayer; |
| 147 | } |
| 148 | |
| 149 | /** |
| 150 | * @function VideoMap.prototype.addSource |
no test coverage detected