| | |
| | | activate() { |
| | | //监听事件,联动勾选状态 |
| | | this.map.on(mars3d.EventType.addLayer, this._onAddLayerHandler, this); |
| | | this.map.on(mars3d.EventType.removeLayer, this._onRemoveLayerHandler, this); |
| | | // this.map.on(mars3d.EventType.removeLayer, this._onRemoveLayerHandler, this); |
| | | } |
| | | //关闭释放 |
| | | disable() { |
| | | this.viewWindow = null; |
| | | |
| | | this.map.off(mars3d.EventType.addLayer, this._onAddLayerHandler, this); |
| | | this.map.off(mars3d.EventType.removeLayer, this._onRemoveLayerHandler, this); |
| | | // this.map.off(mars3d.EventType.removeLayer, this._onRemoveLayerHandler, this); |
| | | } |
| | | _onAddLayerHandler(e) { |
| | | if (!this.isActivate || !this.viewWindow) { |
| | |
| | | this.map.on(mars3d.EventType.addLayer, this._onAddLayerHandler, this); |
| | | } |
| | | } else { |
| | | // if (layer.isAdded) { |
| | | // this.map.removeLayer(layer) |
| | | // } |
| | | if (layer.isAdded) { |
| | | this.map.removeLayer(layer) |
| | | } |
| | | } |
| | | } |
| | | } |