(type, mapInfo)
| 653 | } |
| 654 | |
| 655 | _createMap(type, mapInfo) { |
| 656 | const commonOptions = { |
| 657 | ...this.options, |
| 658 | iportalServiceProxyUrlPrefix: this.webMapService.iportalServiceProxyUrl |
| 659 | }; |
| 660 | const commonEvents = { |
| 661 | ...this.eventTypes.reduce((events, name) => { |
| 662 | events[name] = (params) => { |
| 663 | this._fire(name, params); |
| 664 | }; |
| 665 | return events; |
| 666 | }, {}), |
| 667 | mapinitialized: this._mapInitializedHandler, |
| 668 | mapcreatesucceeded: this._mapCreateSucceededHandler, |
| 669 | layeraddchanged: this._addLayerChangedHandler |
| 670 | }; |
| 671 | const mapOptions = cloneDeep(this.mapOptions); |
| 672 | /** |
| 673 | * @constructor |
| 674 | * @private |
| 675 | */ |
| 676 | const WebMapFactory = this._createWebMapFactory(type); |
| 677 | const mapId = this.mapId || this.webMapInfo; |
| 678 | this._handler = new WebMapFactory(mapId, commonOptions, mapOptions); |
| 679 | for (const type in commonEvents) { |
| 680 | this._handler.on(type, commonEvents[type]); |
| 681 | } |
| 682 | let _mapInfo = {}; |
| 683 | const layerFilter = this.options.layerFilter; |
| 684 | if (mapInfo) { |
| 685 | _mapInfo = { |
| 686 | ...mapInfo, |
| 687 | layers: typeof layerFilter === 'function' ? mapInfo.layers.filter(layerFilter) : mapInfo.layers |
| 688 | }; |
| 689 | } |
| 690 | this.type = type; |
| 691 | // initializeMap 完成3个步骤:1. 注册投影 2. 判断投影与存在的map是否一致 3. 创建地图 |
| 692 | this._handler.initializeMap(_mapInfo, this.map); |
| 693 | } |
| 694 | |
| 695 | _updateRasterSource(sourceId, options) { |
| 696 | if (!sourceId) { |
no test coverage detected