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

Method _handleFeatures

src/maplibregl/overlay/FGBLayer.js:159–181  ·  view source on GitHub ↗
(bounds)

Source from the content-addressed store, hash-verified

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