export default class TslMapClassClient {
  /**
   * [线型]
   * {[String]} solid 实线
   *           dashed 虚线
   */
  static MapLineType = {
    Solid: "SOLID",
    Dashed: "DASHED",
  };
  /**
   * 地图类型
   * {[String]} Gaode 高德 API
   *            Esri  Esri API
   *            GA    IMap API 徐汇公安地图
   *            Tianditu 天地图API
   *            Baidu 百度地图
   */
  static MapType = {
    Gaode: "GD",
    Esri: "ESRI",
    GA: "GA",
    Tianditu: "TD",
    Baidu: "BD",
  };
  static CoorSystem = {
    wgs84: "wgs84",
    sh_54: "sh_54",
  };

  /**
   * [点]
   * {[Number]} x   [x坐标]
   * {[Number]} y   [y坐标]
   * {[Number]} id   [id]
   * {[MapPointStyle]} style [样式]
   */
  static MapPoint(x, y, id, style) {
    let entity = {};
    entity.id = id;
    entity.x = x;
    entity.y = y;
    entity.style = style;
    return entity;
  }
  /**
   * [线]
   * {[Array]} path  [组成线的点集]
   * {[Number]} id   [id]
   * {[MapLineStyle]} style [样式]
   */
  static MapPolyline(path, id, style) {
    let entity = {};
    entity.id = id;
    entity.path = path;
    entity.style = style;
    return entity;
  }
  /**
   * [面]
   * {[Array]} path     [组成面的点集]
   * {[Number]} id      [id]
   * {[MapPolygonStyle]} style [样式]
   */
  static MapPolygon(path, id, style) {
    let entity = {};
    entity.id = id;
    entity.path = path;
    entity.style = style;
    return entity;
  }
  /**
   * [点样式]
   * {[Number]} width   [点宽]
   * {[Number]} height   [点高]
   * {[Number]} baseUrl   [图片url] Esri使用require到的图片地址或url，高德或天地图不需要
   * {[Number]} xOffset [x偏移]
   * {[Number]} yOffset [y偏移]
   * {[Number]} angle   [角度]
   * {[String]} icon   高德或天地图需要 icon对应的类名
   */
  static MapPointStyle(width, height, baseUrl, xOffset, yOffset, angle, icon) {
    let entity = {};
    entity.width = width;
    entity.height = height;
    entity.baseUrl = baseUrl;
    entity.xOffset = xOffset;
    entity.yOffset = yOffset;
    entity.angle = angle;
    entity.icon = icon;
    return entity;
  }
  /**
   * [线样式]
   * {[String]} color         [颜色]
   * {[Number]} width         [宽度]
   * {[Number]} opacity      [透明度]
   * {[MapLineType]} lineType [线类型]
   */
  static MapLineStyle(color, width, opacity, lineType) {
    let entity = {};
    entity.color = color;
    entity.width = width;
    entity.opacity = opacity;
    entity.lineType = lineType;
    return entity;
  }
  /**
   * [面样式]
   * {[String]} fillcolor       [填充颜色]
   * {[String]} strokeColor     [边线颜色]
   * {[Number]} strokeWeight    [边线宽]
   * {[Number]} strokeOpacity   [边线透明度]
   * {[Number]} fillOpacity     [填充透明度]
   * {[MapLineType]} strokeType [边线样式（Solid/Dashed）]
   */
  static MapPolygonStyle(
    fillColor,
    strokeColor,
    strokeWeight,
    strokeOpacity,
    fillOpacity,
    strokeType
  ) {
    let entity = {};
    entity.fillColor = fillColor;
    entity.strokeColor = strokeColor;
    entity.strokeWeight = strokeWeight;
    entity.strokeOpacity = strokeOpacity;
    entity.fillOpacity = fillOpacity;
    entity.strokeType = strokeType;
    return entity;
  }

  /**
   * [覆盖物图层]
   * {[String]} name [图层名称]
   * {[]}  layer  [几何要素集合]
   * {[Boolean]}  visible [是否可见]
   */
  static MapOverLayer(name, layer, visible) {
    let entity = {};
    entity.name = name;
    entity.layer = layer;
    entity.visible = visible;
    return entity;
  }
  /**
   * [地图范围]
   * {[Number]} xmin [x坐标最小值]
   * {[Number]} ymin  [y坐标最小值]
   * {[Number]} xmax [x坐标最大值]
   * {[Number]} ymax [y坐标最大值]
   */
  static MapExtent(xmin, ymin, xmax, ymax) {
    let entity = {};
    entity.xmin = xmin;
    entity.ymin = ymin;
    entity.xmax = xmax;
    entity.ymax = ymax;
    return entity;
  }
  /**
   * [地图初始化类]
   *  {[String]} container  [地图容器]
   *  {[String]} basemapurl [ESRI不可省略]
   *  {[MapExtent]} extent    [地图显示范围 required]
   *  {[Number]} minzoom    [地图最小缩放范围]
   *  {[Number]} maxzoom    [地图最大缩放范围]
   *  属性：map [地图]   layers [所有覆盖物图层] mapoverlayer
   *  layerDatas [{layername: 'parking', data: geoObj}]
   */
  static Map(container, basemapurl, extent, minzoom, maxzoom) {
    let entity = {};
    entity.mapContainer = container;
    entity.baseMapURL = basemapurl;
    entity.mapExtent = extent;
    entity.minZoom = minzoom;
    entity.maxZoom = maxzoom;
    entity.map = null;
    entity.layers = [];
    entity.layerDatas = [];
    return entity;
  }
}
