import SvgUtils from "../utils/SvgUtils";
import Pulser from "../widget/Pulser";

/**
 * 定义地图图标提供类
 */
export default class IconProvider {
  constructor() { }

  /** 私有方法 **/
  /**
   * 加载图标到地图
   * @param {Object} map -地图对象
   * @param {String} id  -图标Id
   * @param {String} src -图像源
   * @param {Number} w -宽
   * @param {Number} h -高
   */
  static _loadIcon(map, id, src, w, h) {
    if (map.hasImage(id)) return;

    let icon = new Image(w, h);
    icon.src = src;
    icon.onload = function () {
      map.addImage(id, icon);
    };
  }

  /**
   * 加载环绕图片
   * @param {Object} map -地图对象
   * @param {String} id  -图标Id
   * @param {String} base64 -Base64字符串
   */
  static _loadRoundedImage(map, id, base64) {
    map.loadImage(base64, function (error, image) {
      if (error) throw error;

      if (!map.hasImage(id)) {
        map.addImage(id, image, {
          content: [5, 3, 10, 13],
          stretchX: [[7, 9]],
          stretchY: [[7, 9]]
        });
      }
    });
  }

  /**
   * 加载文字环绕图标
   * @param {Object} map -地图对象
   * @param {String} id  -图标Id
   */
  static _loadRoundedIcon(map, id) {
    const base64Str = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA4NpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ4IDc5LjE2NDAzNiwgMjAxOS8wOC8xMy0wMTowNjo1NyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbn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ksRsa2gwAYZoFGuqXeHVANqdAxBgakOMoAdFtqkAENB4d9Aio2JgUIAMuAnKJ5J1bj28QNuIPUFZMANUCIh1YClD+7IAal7IAM2nXzzypNUA4Cu9gJSW0EGTHnx43sKKIURqxmkFqQHyJwAMuAVKG2Dkqf17s3WxGiGJmVQfnjFiJQbQ0DJE5Qq7cQkNtfpGN7R5hf8A5LY9PQR15y7N5VOv33tCcxMyUChRPTMhJ6dfUGJBIhZoeJfgfgWyM9APBE5OwMEGAACC4FjcDeZ8gAAAABJRU5ErkJggg==';
    // 加载环绕图片
    this._loadRoundedImage(map, id, base64Str);
  }
  /**
   * 加载选中的文字环绕图标
   * @param {Object} map -地图对象
   * @param {String} id  -图标Id
   */
  static _loadRoundedSelIcon(map, id) {
    const base64Str = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyVpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ4IDc5LjE2NDAzNiwgMjAxOS8wOC8xMy0wMTowNjo1NyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZ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    this._loadRoundedImage(map, id, base64Str);
  }

  /**
   * 加载流向图标
   */
  static _loadFlowIcon(map, id) {
    let base64Str = SvgUtils.flowIconToBase64();
    if (!base64Str) return;

    this._loadIcon(map, id, base64Str, 16, 16);
  }

  /**
   * 加载方向图标
   */
  static _loadDirectionIcon(map, id) {
    let base64Str = SvgUtils.directionIconToBase64();
    if (!base64Str) return;

    this._loadIcon(map, id, base64Str, 10, 10);
  }
  /**
   * 加载红色方向图标
   * @param {Object} map -地图对象
   * @param {String} id  -图标Id
   */
  static _loadDirectionRedIcon(map, id) {
    let base64Str = SvgUtils.directionRedIconToBase64();
    if (!base64Str) return;

    this._loadIcon(map, id, base64Str, 10, 10);
  }

  /**
   * 加载右箭头图标
   * @param {Object} map -地图对象
   * @param {String} id  -图标Id
   */
  static _loadArrowIcon(map, id) {
    let base64Str = SvgUtils.arrowIconToBase64();
    if (!base64Str) return;

    this._loadIcon(map, id, base64Str, 14, 14);
  }

  /**
   * 加载工单图标
   * @param {Object} map -地图对象
   * @param {String} id  -图标Id
   */
  static _loadOrderIcon(map, id) {
    let base64Str = SvgUtils.orderIconToBase64();
    if (!base64Str) return;

    this._loadIcon(map, id, base64Str, 78, 42);
  }

  /** 公有方法 **/
  /**
   * 移除图标
   * @param {Object} map -地图对象
   * @param {String} id  -图标Id
   */
   static removeIcon(map, id) {
    if (!map) return;

    if (map.hasImage(id)) {
      map.removeImage(id);
    }
  }

  /**
   * 图标是否存在
   * @param {Object} map -地图对象
   * @param {String} id  -图标Id
   */
  static hasIcon(map, id) {
    return map.hasImage(id);
  }

  /**
   * 加载图标列表
   * @param {Object} map -地图对象
   * @param {Array} icons -图标列表
   *
   * @summery <icons参数：
   * [{type: type, name: name, id: id},...]>
   */
  static loadIcons(map, icons) {
    for (let i = 0; i < icons.length; i++) {
      const icon = icons[i];
      switch (icon.name) {
        case 'rounded': { // 文字环绕
          this._loadRoundedIcon(map, icon.id);
          break;
        }
        case 'roundedsel': { // 选中文字环绕
          this._loadRoundedSelIcon(map, icon.id);
          break;
        }
        case 'flow': { // 流向
          this._loadFlowIcon(map, icon.id);
          break;
        }
        case 'direction': { // 方向
          this._loadDirectionIcon(map, icon.id);
          break;
        }
        case 'directionred': { // 方向(红色)
          this._loadDirectionRedIcon(map, icon.id);
          break;
        }
        case 'arrow': { // 箭头
          this._loadArrowIcon(map, icon.id);
          break;
        }
        case 'order': { // 工单
          this._loadOrderIcon(map, icon.id);
          break;
        }
        default:
          break;
      }
    }
  }

  /**
   * 移除图标列表
   * @param {Object} map -地图对象
   * @param {Array} icons -图标列表
   *
   * @summery <icons参数：
   * [{type: type, name: name, id: id},...]>
   */
  static removeIcons(map, icons) {
    for (let i = 0; i < icons.length; i++) {
      const icon = icons[i];
      // 移除图标
      this.removeIcon(map, icon.id);
    }
  }

  /**
   * 加载脉冲图标
   * @param {Object} map -地图对象
   * @param {String} id -图标ID
   * @param {Number} radius -半径
   * @param {Array} innerColor -内圆颜色
   * @param {Array} outerColor -外圆颜色
   */
  static loadPulserIcon(map, id, radius, innerColor, outerColor) {
    if (!map.hasImage(id)) {
      let pulsing = new Pulser({
        map: map,
        size: radius * 2.0,
        innerColor: {
          r: innerColor[0],
          g: innerColor[1],
          b: innerColor[2]
        },
        outerColor: {
          r: outerColor[0],
          g: outerColor[1],
          b: outerColor[2]
        }
      });

      map.addImage(id, pulsing, {
        pixelRatio: 1
      });
    }
  }

  /**
   * 获取排水户图标表达式
   * @param {String} category -类型
   * @param {Boolean} isLayerField -是否图层字段
   *
   * @returns {String}
   */
  static getDrainerIconExpression(category, isLayerField = false) {
    /**
     * 获取属性名称
     * @param {String} category -类型
     * @param {Boolean} isLayerField -是否按照图层字段的命名规则
     *
     * @returns {String}
     */
    function getPropertyName(category, isLayerField = true) {
      switch (category) {
        case 'defect': { // 缺陷
          return isLayerField ? 'defect_catalog' : 'defectCatalog'
        }
        case 'grade': {  // 分级
          return isLayerField ? 'grade_catalog' : 'gradeCatalog';
        }
        case 'catalog': { // 分类
          return isLayerField ? 'catalog_status' : 'catalogStatus';
        }
        case 'connect': { // 分流情况
          return isLayerField ? 'catalog_connect' : 'catalogConnect';
        }
        case 'sumlevel': { // 用水量等级
          return isLayerField ? 'sumlevel' : 'waterUseLevel';
        }
        default:
          return 'catalog_status';
      }
    }

    // 获取属性字段名称
    let propName = getPropertyName(category, isLayerField);

    switch (category) {
      case 'defect': { // 缺陷(WRONG_CONNECTION-错接, HYBRID_CONNECTION-混接, PRIVATE_CONNECTION-私接, STRUCTURAL_DEFECT-结构性缺陷, FUNCTIONAL_DEFECT-功能性缺陷)
        return {
          property: propName,
          type: "categorical",
          stops: [
            // 结构性缺陷
            ["STRUCTURAL_DEFECT_1", "drain_hos-red"], // 医院
            ["STRUCTURAL_DEFECT_2", "drain_mar-red"], // 农贸市场
            ["STRUCTURAL_DEFECT_3", "drain_res-red"], // 餐饮
            ["STRUCTURAL_DEFECT_4", "drain_bui-red"], // 建筑
            ["STRUCTURAL_DEFECT_5", "drain_est-red"], // 楼盘
            ["STRUCTURAL_DEFECT_6", "drain_sch-red"], // 学校
            ["STRUCTURAL_DEFECT_7", "drain_ind-red"], // 工业企业
            ["STRUCTURAL_DEFECT_9", "drain_oth-red"], // 其他
            // 错接
            ["WRONG_CONNECTION_1", "drain_hos-orange"],
            ["WRONG_CONNECTION_2", "drain_mar-orange"],
            ["WRONG_CONNECTION_3", "drain_res-orange"],
            ["WRONG_CONNECTION_4", "drain_bui-orange"],
            ["WRONG_CONNECTION_5", "drain_est-orange"],
            ["WRONG_CONNECTION_6", "drain_sch-orange"],
            ["WRONG_CONNECTION_7", "drain_ind-orange"],
            ["WRONG_CONNECTION_9", "drain_oth-orange"],
            // 混接
            ["HYBRID_CONNECTION_1", "drain_hos-yellow"],
            ["HYBRID_CONNECTION_2", "drain_mar-yellow"],
            ["HYBRID_CONNECTION_3", "drain_res-yellow"],
            ["HYBRID_CONNECTION_4", "drain_bui-yellow"],
            ["HYBRID_CONNECTION_5", "drain_est-yellow"],
            ["HYBRID_CONNECTION_6", "drain_sch-yellow"],
            ["HYBRID_CONNECTION_7", "drain_ind-yellow"],
            ["HYBRID_CONNECTION_9", "drain_oth-yellow"],
            // 	私接
            ["PRIVATE_CONNECTION_1", "drain_hos-grey"],
            ["PRIVATE_CONNECTION_2", "drain_mar-grey"],
            ["PRIVATE_CONNECTION_3", "drain_res-grey"],
            ["PRIVATE_CONNECTION_4", "drain_bui-grey"],
            ["PRIVATE_CONNECTION_5", "drain_est-grey"],
            ["PRIVATE_CONNECTION_6", "drain_sch-grey"],
            ["PRIVATE_CONNECTION_7", "drain_ind-grey"],
            ["PRIVATE_CONNECTION_9", "drain_oth-grey"],
            // 功能性缺陷
            ["FUNCTIONAL_DEFECT_1", "drain_hos-green"],
            ["FUNCTIONAL_DEFECT_2", "drain_mar-green"],
            ["FUNCTIONAL_DEFECT_3", "drain_res-green"],
            ["FUNCTIONAL_DEFECT_4", "drain_bui-green"],
            ["FUNCTIONAL_DEFECT_5", "drain_est-green"],
            ["FUNCTIONAL_DEFECT_6", "drain_sch-green"],
            ["FUNCTIONAL_DEFECT_7", "drain_ind-green"],
            ["FUNCTIONAL_DEFECT_9", "drain_oth-green"]
          ],
          default: "drain_all"
        };
      }
      case 'grade': {  // 分级(IMPORTANT_FIRST-重点一类, IMPORTANT_SECOND-重点二类, NORMAL-一般, OTHER-其他)
        return {
          property: propName,
          type: "categorical",
          stops: [
            // 重点一类
            ["IMPORTANT_FIRST_1", "drain_hos-red"], // 医院
            ["IMPORTANT_FIRST_2", "drain_mar-red"], // 农贸市场
            ["IMPORTANT_FIRST_3", "drain_res-red"], // 餐饮
            ["IMPORTANT_FIRST_4", "drain_bui-red"], // 建筑
            ["IMPORTANT_FIRST_5", "drain_est-red"], // 楼盘
            ["IMPORTANT_FIRST_6", "drain_sch-red"], // 学校
            ["IMPORTANT_FIRST_7", "drain_ind-red"], // 工业企业
            ["IMPORTANT_FIRST_9", "drain_oth-red"], // 其他
            // 重点二类
            ["IMPORTANT_SECOND_1", "drain_hos-yellow"],
            ["IMPORTANT_SECOND_2", "drain_mar-yellow"],
            ["IMPORTANT_SECOND_3", "drain_res-yellow"],
            ["IMPORTANT_SECOND_4", "drain_bui-yellow"],
            ["IMPORTANT_SECOND_5", "drain_est-yellow"],
            ["IMPORTANT_SECOND_6", "drain_sch-yellow"],
            ["IMPORTANT_SECOND_7", "drain_ind-yellow"],
            ["IMPORTANT_SECOND_9", "drain_oth-yellow"],
            // 一般
            ["NORMAL_1", "drain_hos-green"],
            ["NORMAL_2", "drain_mar-green"],
            ["NORMAL_3", "drain_res-green"],
            ["NORMAL_4", "drain_bui-green"],
            ["NORMAL_5", "drain_est-green"],
            ["NORMAL_6", "drain_sch-green"],
            ["NORMAL_7", "drain_ind-green"],
            ["NORMAL_9", "drain_oth-green"],
            // 其他
            ["OTHER_1", "drain_hos-grey"],
            ["OTHER_2", "drain_mar-grey"],
            ["OTHER_3", "drain_res-grey"],
            ["OTHER_4", "drain_bui-grey"],
            ["OTHER_5", "drain_est-grey"],
            ["OTHER_6", "drain_sch-grey"],
            ["OTHER_7", "drain_ind-grey"],
            ["OTHER_9", "drain_oth-grey"]
          ],
          default: "drain_all"
        };
      }
      case 'catalog': { // 分类(1-医疗,2-农贸市场,3-餐饮,4-建筑,5-楼盘,6-学校,7-工业企业,9-其他)
        return {
          property: propName,
          type: "categorical",
          stops: [
            ["1_1", "drain_hos-green"], // 医院
            ["1_2", "drain_hos-yellow"],
            ["1_3", "drain_hos-red"],
            ["1_4", "drain_hos-grey"],
            ["1_5", "drain_hos-dark"],
            ["2_1", "drain_mar-green"], // 农贸市场
            ["2_2", "drain_mar-yellow"],
            ["2_3", "drain_mar-red"],
            ["2_4", "drain_mar-grey"],
            ["2_5", "drain_hos-dark"],
            ["3_1", "drain_res-green"], // 餐饮
            ["3_2", "drain_res-yellow"],
            ["3_3", "drain_res-red"],
            ["3_4", "drain_res-grey"],
            ["3_5", "drain_hos-dark"],
            ["4_1", "drain_bui-green"], // 建筑
            ["4_2", "drain_bui-yellow"],
            ["4_3", "drain_bui-red"],
            ["4_4", "drain_bui-grey"],
            ["4_5", "drain_hos-dark"],
            ["5_1", "drain_est-green"], // 楼盘
            ["5_2", "drain_est-yellow"],
            ["5_3", "drain_est-red"],
            ["5_4", "drain_est-grey"],
            ["5_5", "drain_hos-dark"],
            ["6_1", "drain_sch-green"], // 学校
            ["6_2", "drain_sch-yellow"],
            ["6_3", "drain_sch-red"],
            ["6_4", "drain_sch-grey"],
            ["6_5", "drain_hos-dark"],
            ["7_1", "drain_ind-green"], // 工业企业
            ["7_2", "drain_ind-yellow"],
            ["7_3", "drain_ind-red"],
            ["7_4", "drain_ind-grey"],
            ["7_5", "drain_hos-dark"],
            ["9_1", "drain_oth-green"], // 其他
            ["9_2", "drain_oth-yellow"],
            ["9_3", "drain_oth-red"],
            ["9_4", "drain_oth-grey"],
            ["9_5", "drain_hos-dark"]
          ],
          default: "drain_all"
        };
      }
      case 'connect': { // 分流情况(1-雨水排入污水, 2-雨污分流, 3-污水排入雨水)
        return {
          property: propName,
          type: "categorical",
          stops: [
            ["1_2", "drain_hos-green"], // 医院
            ["1_1", "drain_hos-yellow"],
            ["1_3", "drain_hos-red"],
            ["2_2", "drain_mar-green"], // 农贸市场
            ["2_1", "drain_mar-yellow"],
            ["2_3", "drain_mar-red"],
            ["3_2", "drain_res-green"], // 餐饮
            ["3_1", "drain_res-yellow"],
            ["3_3", "drain_res-red"],
            ["4_2", "drain_bui-green"], // 建筑
            ["4_1", "drain_bui-yellow"],
            ["4_3", "drain_bui-red"],
            ["5_2", "drain_est-green"], // 楼盘
            ["5_1", "drain_est-yellow"],
            ["5_3", "drain_est-red"],
            ["6_2", "drain_sch-green"], // 学校
            ["6_1", "drain_sch-yellow"],
            ["6_3", "drain_sch-red"],
            ["7_2", "drain_ind-green"], // 工业企业
            ["7_1", "drain_ind-yellow"],
            ["7_3", "drain_ind-red"],
            ["9_2", "drain_oth-green"], // 其他
            ["9_1", "drain_oth-yellow"],
            ["9_3", "drain_oth-red"]
          ],
          default: "drain_all"
        }
      }
      case 'sumlevel': { // 用水量等级
        return {
          property: propName,
          type: "categorical",
          stops: [
            [1, "drain_all-green"],
            [2, "drain_all-yellow"],
            [3, "drain_all-orange"],
            [4, "drain_all-red"],
          ],
          default: "drain_all"
        };
      }
      default:
        return "drain_all";
    }
  }
  /** **/
}
