* @function DeckglLayer.prototype.onAdd * @param {maplibregl.Map} map - MapLibreGL Map 对象。
(map)
| 85 | * @param {maplibregl.Map} map - MapLibreGL Map 对象。 |
| 86 | */ |
| 87 | onAdd(map) { |
| 88 | this.map = map; |
| 89 | if (this.canvas) { |
| 90 | this.mapContainer = this.map.getCanvasContainer(); |
| 91 | return this; |
| 92 | } |
| 93 | if (this._isEPSG3857()) { |
| 94 | this.coordinateSystem = 3; |
| 95 | this.isGeographicCoordinateSystem = true; |
| 96 | } else { |
| 97 | this.coordinateSystem = 1; |
| 98 | this.isGeographicCoordinateSystem = false; |
| 99 | } |
| 100 | //创建图层容器 |
| 101 | this._initContainer(this.map.getCanvasContainer(), this.map.getCanvas()); |
| 102 | |
| 103 | //创建 deckgl 图层 |
| 104 | this._createLayerByLayerTypeID(); |
| 105 | |
| 106 | var mapState = this._getState(); |
| 107 | let deckOptions = {}; |
| 108 | for (let key in mapState) { |
| 109 | deckOptions[key] = mapState[key]; |
| 110 | } |
| 111 | deckOptions.layers = [this.layer]; |
| 112 | deckOptions.canvas = this.canvas; |
| 113 | this.deckGL = new window.DeckGL.experimental.DeckGLJS(deckOptions); |
| 114 | this._draw(); |
| 115 | } |
| 116 | /** |
| 117 | * @function DeckglLayer.prototype.onRemove |
| 118 | */ |
nothing calls this directly
no test coverage detected