(SuperClass, { MapManager, mapRepo, crsManager, l7LayerUtil })
| 161 | STYLE: 'style' |
| 162 | }; |
| 163 | export function createWebMapV3Extending(SuperClass, { MapManager, mapRepo, crsManager, l7LayerUtil }) { |
| 164 | return class WebMapV3 extends SuperClass { |
| 165 | constructor(mapId, options, mapOptions = {}) { |
| 166 | super(); |
| 167 | this.mapId = mapId; |
| 168 | this.options = options; |
| 169 | this.mapOptions = mapOptions; |
| 170 | this._mapResourceInfo = {}; |
| 171 | this._relatedInfo = options.relatedInfo || {}; |
| 172 | this._sprite = ''; |
| 173 | this._spriteDatas = {}; |
| 174 | this._appendLayers = false; |
| 175 | this._baseProjection = ''; |
| 176 | } |
| 177 | |
| 178 | initializeMap(mapInfo, map) { |
| 179 | this._mapInfo = mapInfo; |
| 180 | this._baseProjection = this._registerMapCRS(mapInfo); |
| 181 | if (map) { |
| 182 | this.map = map; |
| 183 | if (!crsManager.isSameProjection(this.map, this._baseProjection)) { |
| 184 | this.fire('projectionnotmatch'); |
| 185 | return; |
| 186 | } |
| 187 | this._appendLayers = true; |
| 188 | // 处理图层管理添加 sprite |
| 189 | const sprite = this._mapInfo.sprite; |
| 190 | if (sprite) { |
| 191 | this._sprite = sprite; |
| 192 | this.map.addStyle({ |
| 193 | sprite |
| 194 | }); |
| 195 | } |
| 196 | this._initLayers(); |
| 197 | return; |
| 198 | } |
| 199 | this._createMap(); |
| 200 | } |
| 201 | |
| 202 | cleanLayers(layers) { |
| 203 | super.cleanLayers(layers); |
| 204 | const l7MarkerLayers = l7LayerUtil.getL7MarkerLayers(); |
| 205 | for (const layerId in l7MarkerLayers) { |
| 206 | l7LayerUtil.removeL7MarkerLayer(layerId, this.map.$l7scene); |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | clean(removeMap = true) { |
| 211 | if (this.map) { |
| 212 | if (this._sourceListModel) { |
| 213 | this._sourceListModel.destroy(); |
| 214 | this._sourceListModel = null; |
| 215 | } |
| 216 | if (removeMap) { |
| 217 | const scene = this.map.$l7scene; |
| 218 | scene && scene.removeAllLayer(); |
| 219 | this.map.remove(); |
| 220 | } |
no outgoing calls
no test coverage detected