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

Method _handleFeatures

src/mapboxgl/overlay/FGBLayer.js:157–179  ·  view source on GitHub ↗
(bounds)

Source from the content-addressed store, hash-verified

155 }
156
157 async _handleFeatures(bounds) {
158 let iter = await this.renderer._loadData(bounds);
159 const features = await this.renderer.iterateFeatures(iter);
160 if (!this.map.getSource(this._sourceId)) {
161 this.map.addSource(this._sourceId, {
162 type: 'geojson',
163 data: features
164 });
165 } else {
166 this.map.getSource(this._sourceId).setData(features);
167 }
168 if (!this.map.getLayer(this.layerId)) {
169 this.layerType = this.renderer.layerType;
170 const layer = Object.assign({
171 id: this.layerId,
172 type: this.layerType,
173 source: this._sourceId,
174 paint: Object.assign(PAINT_MAP[this.layerType], this.options.paint) || {},
175 layout: this.options.layout || {}
176 });
177 this.map.addLayer(layer);
178 }
179 }
180
181 async _updateFeatures() {
182 const bounds = this.map.getBounds().toArray();

Callers 1

onAddMethod · 0.95

Calls 7

_loadDataMethod · 0.80
iterateFeaturesMethod · 0.80
addSourceMethod · 0.80
getSourceMethod · 0.45
setDataMethod · 0.45
getLayerMethod · 0.45
addLayerMethod · 0.45

Tested by

no test coverage detected