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

Method onAdd

src/maplibregl/overlay/GraticuleLayer.js:108–124  ·  view source on GitHub ↗

* @function GraticuleLayer.prototype.onAdd * @description 添加该图层。 * @param {maplibregl.Map} map - MapLibreGL Map 对象。

(map)

Source from the content-addressed store, hash-verified

106 * @param {maplibregl.Map} map - MapLibreGL Map 对象。
107 */
108 onAdd(map) {
109 this.map = map;
110 this.renderer = new GraticuleLayerRenderer(this.map, this.options, {
111 getMapStateByKey: this.getMapStateByKey,
112 getDefaultExtent: this.getDefaultExtent,
113 updateGraticuleLayer: this.updateGraticuleLayer.bind(this),
114 setVisibility: this.setVisibility.bind(this)
115 }, {
116 mapElement: this.map.getCanvas(),
117 targetElement: this.map.getCanvasContainer(),
118 id: this.id
119 });
120 this.addGraticuleLayer();
121 this.resizeEvent = this.renderer._resizeCallback.bind(this.renderer);
122 this.zoomendEvent = this.setVisibility.bind(this);
123 this._bindEvent()
124 }
125
126 render() {
127 this.renderer.draw();

Callers

nothing calls this directly

Calls 5

addGraticuleLayerMethod · 0.95
_bindEventMethod · 0.95
bindMethod · 0.80
getCanvasMethod · 0.45
getCanvasContainerMethod · 0.45

Tested by

no test coverage detected