MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / onAdd

Method onAdd

src/mapboxgl/overlay/DeckglLayer.js:89–119  ·  view source on GitHub ↗

* @function DeckglLayer.prototype.onAdd * @param {mapboxgl.Map} map - MapBoxGL Map 对象。 * @returns {DeckglLayer}

(map)

Source from the content-addressed store, hash-verified

87 * @returns {DeckglLayer}
88 */
89 onAdd(map) {
90 this.map = map;
91 if (this.canvas) {
92 this.mapContainer = this.map.getCanvasContainer();
93 return this;
94 }
95 //当使用扩展的mapboxgl代码时有效
96 if (this._isEPSG3857()) {
97 this.coordinateSystem = 3;
98 this.isGeographicCoordinateSystem = true;
99 } else {
100 this.coordinateSystem = 1;
101 this.isGeographicCoordinateSystem = false;
102 }
103 //创建图层容器
104 this._initContainer(this.map.getCanvasContainer(), this.map.getCanvas());
105
106 //创建 deckgl 图层
107 this._createLayerByLayerTypeID();
108
109 var mapState = this._getState();
110 let deckOptions = {};
111 for (let key in mapState) {
112 deckOptions[key] = mapState[key];
113 }
114 deckOptions.layers = [this.layer];
115 deckOptions.canvas = this.canvas;
116 this.deckGL = new window.DeckGL.experimental.DeckGLJS(deckOptions);
117 this._draw();
118 return this;
119 }
120
121 /**
122 * @function DeckglLayer.prototype.onRemove

Callers

nothing calls this directly

Calls 7

_isEPSG3857Method · 0.95
_getStateMethod · 0.80
getCanvasContainerMethod · 0.45
_initContainerMethod · 0.45
getCanvasMethod · 0.45
_drawMethod · 0.45

Tested by

no test coverage detected