* @function FGBLayer.prototype.onAdd * @param {mapboxgl.Map} map - MapBoxGL Map 对象。
(map)
| 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 | */ |
nothing calls this directly
no test coverage detected