* @private * @function WebMapV3.prototype._initLayers * @description emit 图层加载成功事件。
()
| 395 | * @description emit 图层加载成功事件。 |
| 396 | */ |
| 397 | async _initLayers() { |
| 398 | await this._getSpriteDatas(); |
| 399 | if (Object.prototype.toString.call(this.mapId) === '[object Object]') { |
| 400 | this.mapParams = { |
| 401 | title: this._mapInfo.name, |
| 402 | description: this._relatedInfo.description |
| 403 | }; |
| 404 | if (this._relatedInfo.projectInfo) { |
| 405 | this._mapResourceInfo = JSON.parse(this._relatedInfo.projectInfo); |
| 406 | this._changeMapInfoFilter(); |
| 407 | } |
| 408 | this._createMapRelatedInfo(); |
| 409 | this._addLayersToMap(); |
| 410 | return; |
| 411 | } |
| 412 | this._getMapRelatedInfo() |
| 413 | .then((relatedInfo) => { |
| 414 | this.mapParams = { |
| 415 | title: this._mapInfo.name, |
| 416 | description: relatedInfo.description |
| 417 | }; |
| 418 | this._mapResourceInfo = JSON.parse(relatedInfo.projectInfo); |
| 419 | this._changeMapInfoFilter(); |
| 420 | this._createMapRelatedInfo(); |
| 421 | this._addLayersToMap(); |
| 422 | }) |
| 423 | .catch((error) => { |
| 424 | this.fire('mapcreatefailed', { error: error }); |
| 425 | console.error(error); |
| 426 | }); |
| 427 | } |
| 428 | /** |
| 429 | * @private |
| 430 | * @function WebMapV3.prototype._changeMapInfoFilter |
no test coverage detected