* @private * @function WebMap.prototype._removeLayers * @description 移除叠加图层
()
| 173 | * @description 移除叠加图层 |
| 174 | */ |
| 175 | _removeLayers() { |
| 176 | const map = this.map; |
| 177 | this.layers.forEach(({ layerType, layer, labelLayer, pathLayer, dataflowService }) => { |
| 178 | if (!layer) { |
| 179 | return; |
| 180 | } |
| 181 | if (layerType === 'MIGRATION') { |
| 182 | layer.remove(); |
| 183 | return; |
| 184 | } |
| 185 | if (layerType === 'DATAFLOW_POINT_TRACK' || layerType === 'DATAFLOW_HEAT') { |
| 186 | // 移除轨迹图层 |
| 187 | pathLayer && map.removeLayer(pathLayer); |
| 188 | // 取消订阅 |
| 189 | dataflowService && dataflowService.unSubscribe(); |
| 190 | } |
| 191 | // 移除标签图层 |
| 192 | labelLayer && map.removeLayer(labelLayer); |
| 193 | // 移除图层 |
| 194 | map.removeLayer(layer); |
| 195 | }); |
| 196 | this.layers = []; |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * @private |
no test coverage detected