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

Method onAdd

src/maplibregl/overlay/DeckglLayer.js:87–115  ·  view source on GitHub ↗

* @function DeckglLayer.prototype.onAdd * @param {maplibregl.Map} map - MapLibreGL Map 对象。

(map)

Source from the content-addressed store, hash-verified

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 */

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