* @function VideoMap.prototype.addSource * @description 添加数据源。 * @param {string} id - 数据源 id。 * @param {Object} source - 图层源配置。 * @param {string} source.type - 只支持 geojson * @param {Object} source.data - geojson 数据。
(id, source)
| 155 | * @param {Object} source.data - geojson 数据。 |
| 156 | */ |
| 157 | addSource(id, source) { |
| 158 | if (!this._mapExisted()) { |
| 159 | return; |
| 160 | } |
| 161 | if (this.sourceCache[id]) { |
| 162 | return; |
| 163 | } |
| 164 | const geojsonSource = new GeojsonSource(this); |
| 165 | geojsonSource.add(id, source); |
| 166 | this.sourceCache[id] = geojsonSource; |
| 167 | } |
| 168 | |
| 169 | /** |
| 170 | * @function VideoMap.prototype.removeLayer |
no test coverage detected