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

Method onAdd

src/mapboxgl/overlay/FGBLayer.js:84–108  ·  view source on GitHub ↗

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

(map)

Source from the content-addressed store, hash-verified

82 * @param {mapboxgl.Map} map - MapBoxGL Map 对象。
83 */
84 onAdd(map) {
85 this.map = map;
86 let extent = [];
87 if (this.strategy === 'bbox') {
88 const bounds = this.map.getBounds().toArray();
89 extent = [
90 bounds[0][0],
91 bounds[0][1],
92 bounds[1][0],
93 bounds[1][1]
94 ];
95 this.map.on('moveend', this._updateFeaturesFn);
96 }
97
98 if (this.extent) {
99 const intersectExtent = getIntersection(this.extent, extent);
100 if (intersectExtent && intersectExtent.length) {
101 extent = intersectExtent;
102 } else {
103 extent = this.extent;
104 }
105 }
106 this.renderer = new FGBLayerRenderer(this.options);
107 this._handleFeatures(extent);
108 }
109 /**
110 * @function FGBLayer.prototype.onRemove
111 */

Callers

nothing calls this directly

Calls 5

_handleFeaturesMethod · 0.95
getIntersectionFunction · 0.90
toArrayMethod · 0.45
getBoundsMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected