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