* @private * @function WebMap.prototype.getMapInfoSuccess * @description 获取地图的json信息 * @param {Object} mapInfo - webMap对象
(mapInfo)
| 324 | * @param {Object} mapInfo - webMap对象 |
| 325 | */ |
| 326 | async getMapInfoSuccess(mapInfo) { |
| 327 | let that = this; |
| 328 | if (mapInfo.succeed === false) { |
| 329 | that.errorCallback && that.errorCallback(mapInfo.error, 'getMapFaild', that.map); |
| 330 | return; |
| 331 | } |
| 332 | let handleResult = await that.handleCRS(mapInfo.projection, mapInfo.baseLayer.url); |
| 333 | |
| 334 | //存储地图的名称以及描述等信息,返回给用户 |
| 335 | that.mapParams = { |
| 336 | title: mapInfo.title, |
| 337 | description: mapInfo.description |
| 338 | }; |
| 339 | |
| 340 | if (handleResult.action === 'BrowseMap') { |
| 341 | that.createSpecLayer(mapInfo); |
| 342 | } else if (handleResult.action === 'OpenMap') { |
| 343 | that.baseProjection = handleResult.newCrs || mapInfo.projection; |
| 344 | that.webMapVersion = mapInfo.version; |
| 345 | that.baseLayer = mapInfo.baseLayer; |
| 346 | // that.mapParams = { |
| 347 | // title: mapInfo.title, |
| 348 | // description: mapInfo.description |
| 349 | // }; //存储地图的名称以及描述等信息,返回给用户 |
| 350 | that.isHaveGraticule = mapInfo.grid && mapInfo.grid.graticule; |
| 351 | |
| 352 | if (mapInfo.baseLayer && mapInfo.baseLayer.layerType === 'MAPBOXSTYLE') { |
| 353 | // 添加矢量瓦片服务作为底图 |
| 354 | that |
| 355 | .addMVTMapLayer(mapInfo, mapInfo.baseLayer, 0) |
| 356 | .then(async () => { |
| 357 | that.createView(mapInfo); |
| 358 | if (!mapInfo.layers || mapInfo.layers.length === 0) { |
| 359 | that.sendMapToUser(0); |
| 360 | } else { |
| 361 | await that.addLayers(mapInfo); |
| 362 | } |
| 363 | that.addGraticule(mapInfo); |
| 364 | }) |
| 365 | .catch(function (error) { |
| 366 | that.errorCallback && that.errorCallback(error, 'getMapFaild', that.map); |
| 367 | }); |
| 368 | } else { |
| 369 | await that.addBaseMap(mapInfo); |
| 370 | if (!mapInfo.layers || mapInfo.layers.length === 0) { |
| 371 | that.sendMapToUser(0); |
| 372 | } else { |
| 373 | await that.addLayers(mapInfo); |
| 374 | } |
| 375 | that.addGraticule(mapInfo); |
| 376 | } |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | /** |
| 381 | * 处理坐标系(底图) |
no test coverage detected