    import { LayerView } from '@mapgis/webclient-common'
    import MapVLayerUtil from '../view/utils/MapVLayerUtil'

    class MapVLayerView extends LayerView {
      /**
       * 添加图层视图
       * @param {LayerEvent} event 图层事件
       * @return {Promise<LayerView>} 图层视图
       */
      onAdd(event) {
        const layer = this.layer
        const innerView = this.innerView
        this.innerLayer = MapVLayerUtil.addMapVLayer(layer, innerView)
        this.innerLayer.commonLayerId = layer.id
        return Promise.resolve(this)
      }

      /**
       * 移除图层视图
       * @param {LayerEventevent} event 图层事件
       * @return {Promise<LayerView>} 图层视图
       */
      onRemove(event) {
        MapVLayerUtil.removeLayer(this.innerLayer)
        return Promise.resolve(this)
      }

      /**
       * 更新图层视图
       * @param {LayerViewUpdateEvent} event 图层事件
       * @return {Promise<LayerView>} 图层视图
       */
      onUpdate(event) {
        // 确保有updateContent
        if (event.updateContent) {
          for (let i = 0; i < event.updateContent.length; i++) {
            const updateContent = event.updateContent[i]
            // 有updateContent
            if (updateContent) {
              switch (updateContent.name) {
                // 更新主图层可见性
                case 'visible':
                  if (this.layer.visible) {
                    this.innerLayer.show()
                  } else {
                    this.innerLayer.hide()
                  }
                  break
                // 更新透明度
                case 'opacity':
                  this.innerLayer.setOpacity(this.layer.opacity)
                  break
                default:
                  break
              }
            }
          }
        }
        return Promise.resolve(this)
      }
    }
    export default MapVLayerView