* @private * @function WebMapViewModel.prototype._addOverlayToMap * @description 添加基础矢量图层到 MAP * @param {Object} style - mabgl style * @param {String} type - 图层类型
({ type, source, layerID, parentLayerId, beforeId, layerStyle, minzoom, maxzoom, filter })
| 2584 | * @param {String} type - 图层类型 |
| 2585 | */ |
| 2586 | _addOverlayToMap({ type, source, layerID, parentLayerId, beforeId, layerStyle, minzoom, maxzoom, filter }) { |
| 2587 | const mbglTypeMap = { |
| 2588 | POINT: 'circle', |
| 2589 | LINE: 'line', |
| 2590 | POLYGON: 'fill' |
| 2591 | }; |
| 2592 | const mbglType = mbglTypeMap[type]; |
| 2593 | if (mbglType === 'circle' || mbglType === 'line' || mbglType === 'fill') { |
| 2594 | const style = { |
| 2595 | id: layerID, |
| 2596 | type: mbglType, |
| 2597 | source: source, |
| 2598 | paint: layerStyle.style, |
| 2599 | layout: layerStyle.layout || {}, |
| 2600 | minzoom: minzoom || 0, |
| 2601 | maxzoom: maxzoom || this.map.getMaxZoom() + 1 |
| 2602 | }; |
| 2603 | if (filter) { |
| 2604 | style.filter = filter; |
| 2605 | } |
| 2606 | this._addLayer(style, parentLayerId, beforeId); |
| 2607 | } |
| 2608 | } |
| 2609 | |
| 2610 | _addBaselayer({ |
| 2611 | url, |
no test coverage detected