import { FeatureRender } from '@mapgis/webclient-common'

class CesiumFeatureRender extends FeatureRender {
  /**
   * @description: 绘制要素
   * @param {*} innerLayer
   * @param {*} features
   * @return {*}
   */
  drawFeature(innerLayer, features) {
    for (let i = 0; i < features.length; i++) {
      innerLayer.add(features[i])
    }
  }

  /**
   * @description: 更新样式
   * @param {Object} innerLayer
   * @param {Array<Feature>} features
   * @param {Array<Object>} updateDetail 要素更新细节
   * @return {*}
   */
  updateFeature(innerLayer, features, updateDetail) {
    for (let i = 0; i < features.length; i++) {
      innerLayer.update(features[i])
    }
  }

  /**
   * @description: 清除要素
   * @param {*} innerLayer
   * @param {*} features
   * @return {*}
   */
  clearFeature(innerLayer, features) {
    for (let i = 0; i < features.length; i++) {
      innerLayer.remove(features[i])
    }
  }

  /**
   * @description: 清空上下文图层
   * @param {*} innerLayer
   * @return {*}
   */
  clear(innerLayer) {
    innerLayer.removeAll()
  }
}
export default CesiumFeatureRender
