function F() {
  function o() {
    return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
  }
  return o() + o() + "-" + o() + "-" + o() + "-" + o() + "-" + o() + o() + o();
}
function y(o, e) {
  return o.camera.pickEllipsoid(e);
}
function L(o) {
  const e = Cesium.Cartographic.fromCartesian(o), t = Cesium.Math.toDegrees(e.longitude), i = Cesium.Math.toDegrees(e.latitude);
  return [t, i, e.height];
}
function c(o, e) {
  const t = {
    lonlat: void 0,
    cartesian3: void 0,
    position: e
  };
  return t.cartesian3 = y(o, e), t.cartesian3 && (t.lonlat = L(t.cartesian3)), t;
}
function b(o, e) {
  const t = o.scene.pick(e);
  if (!t)
    return;
  const { id: i } = t;
  return i._id;
}
class H {
  /**
   * 屏幕事件管理器
   */
  screenEventHandler;
  mode;
  viewer;
  featureCollection;
  constructor(e) {
    const { viewer: t, mode: i, featureCollection: s } = e;
    if (!(t instanceof Cesium.Viewer))
      throw new Error("viewer对象不正确：" + t);
    this.mode = i, this.viewer = t, this.featureCollection = s, this.screenEventHandler = new Cesium.ScreenSpaceEventHandler(t.scene.canvas), this.addEventListeners();
  }
  changeMode(e, t) {
    return this.mode && this.mode.stop(), typeof e == "string" ? this.mode = new this.featureCollection[e](t) : this.mode = new e(t), this.mode.start(), this.mode;
  }
  click(e) {
    const t = c(this.viewer, e.position);
    this.mode?.onClick?.(t);
  }
  leftDown(e) {
    const t = c(this.viewer, e.position);
    this.mode?.onLeftDown?.(t);
  }
  leftUp(e) {
    const t = c(this.viewer, e.position);
    this.mode?.onLeftUp?.(t);
  }
  dbClick(e) {
    const t = c(this.viewer, e.position);
    this.mode?.onDbClick?.(t);
  }
  mouseMove(e) {
    const t = c(this.viewer, e.endPosition);
    this.mode?.onMouseMove?.(t);
  }
  rightClick(e) {
    const t = c(this.viewer, e.position);
    this.mode?.onRightClick?.(t);
  }
  mouseDown(e) {
    const t = c(this.viewer, e.position);
    this.mode?.onMouseDown?.(t);
  }
  mouseUp(e) {
    const t = c(this.viewer, e.position);
    this.mode?.onMouseUp?.(t);
  }
  wheel(e) {
    this?.mode?.onWheel(e);
  }
  addEventListeners() {
    this.screenEventHandler.setInputAction(
      this.click.bind(this),
      Cesium.ScreenSpaceEventType.LEFT_CLICK
    ), this.screenEventHandler.setInputAction(
      this.dbClick.bind(this),
      Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK
    ), this.screenEventHandler.setInputAction(
      this.mouseMove.bind(this),
      Cesium.ScreenSpaceEventType.MOUSE_MOVE
    ), this.screenEventHandler.setInputAction(
      this.rightClick.bind(this),
      Cesium.ScreenSpaceEventType.RIGHT_CLICK
    ), this.screenEventHandler.setInputAction(
      this.leftDown.bind(this),
      Cesium.ScreenSpaceEventType.LEFT_DOWN
    ), this.screenEventHandler.setInputAction(
      this.leftUp.bind(this),
      Cesium.ScreenSpaceEventType.LEFT_UP
    ), this.screenEventHandler.setInputAction(this.wheel.bind(this), Cesium.ScreenSpaceEventType.WHEEL);
  }
  removeEventListeners() {
    this.screenEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK), this.screenEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK), this.screenEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE), this.screenEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.RIGHT_CLICK), this.screenEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOWN), this.screenEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_UP), this.screenEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.WHEEL);
  }
}
class J {
  /**
   * 事件列表
   */
  eventMap;
  constructor() {
    this.eventMap = /* @__PURE__ */ new Map([]);
  }
  // 发布
  emit(e, t) {
    this.eventMap.has(e) && this.eventMap.get(e)?.forEach((i) => {
      i(t);
    });
  }
  // 订阅
  on(e, t) {
    if (!this.eventMap.has(e))
      return this.eventMap.set(e, [t]);
    this.eventMap.get(e)?.push(t);
  }
  // 取消订阅
  un(e) {
    this.eventMap.has(e) && this.eventMap.delete(e);
  }
}
class A {
  viewer;
  features;
  constructor(e) {
    const { viewer: t, features: i } = e;
    this.viewer = t, this.features = i || /* @__PURE__ */ new Map([]);
  }
  addFeature(e) {
    this.features.set(e.id, e);
  }
  getFeature(e) {
    return this.features.get(e);
  }
  deleteFeature(e) {
    this.features.delete(e);
  }
  deleteFeatures(e) {
    e.forEach((t) => {
      this.features.delete(t);
    });
  }
  deleteFeatureAll() {
    this.features.forEach((e) => {
      e.remove();
    }), this.features.clear();
  }
  toGeoJSON() {
    const e = {
      type: "FeatureCollection",
      features: []
    };
    return this.features.forEach((t) => {
      t.isValidGeoJSON() && e.features.push(t.toGeoJSON());
    }), e;
  }
}
class O {
  prompt;
  rightMenu;
  menuMap;
  callbackMap;
  fn;
  constructor() {
    this.rightMenu = this.createRightMenu(), this.prompt = this.createPrompt(), this.fn = () => {
    }, this.menuMap = /* @__PURE__ */ new Map([["delete", this.createDeleteEl.bind(this)]]), this.callbackMap = /* @__PURE__ */ new Map([["delete", () => {
    }]]);
  }
  /**
   * 创建提示词元素
   * @returns
   */
  createPrompt() {
    const e = this.createElement("div", {
      className: "__lsgfish_prompt",
      style: { display: "none" }
    });
    return e.innerHTML = "我是提示框", document.body.appendChild(e), e;
  }
  close() {
    this.closePrompt(), this.closeRightMenu();
  }
  setText(e) {
    this.prompt.innerText = e;
  }
  showPrompt() {
    this.prompt.style.display !== "block" && this.prompt?.style.setProperty("display", "block");
  }
  closePrompt() {
    this.prompt.style.setProperty("display", "none");
  }
  movePrompt(e) {
    let { x: t, y: i } = e;
    t += 3, i += 30;
    const { width: s, height: r } = this.prompt.getBoundingClientRect();
    t += s / 5, i -= r / 2, this.prompt?.style.setProperty("left", t + "px"), this.prompt?.style.setProperty("top", i + "px");
  }
  showRightMenu(e) {
    for (this.rightMenu.style.setProperty("display", "block"); this.rightMenu.lastElementChild; )
      this.rightMenu.lastElementChild.remove();
    e.forEach((t) => {
      if (this.menuMap.has(t[0])) {
        if (this.callbackMap.has(t[0])) {
          const s = this.callbackMap.get(t[0]);
          removeEventListener("click", s);
        }
        this.callbackMap.set(t[0], t[1]);
        const i = this.menuMap.get(t[0])?.();
        this.rightMenu.appendChild(i);
      }
    });
  }
  closeRightMenu() {
    this.rightMenu.style.setProperty("display", "none");
  }
  moveRightMenu(e) {
    let { x: t, y: i } = e;
    t += 6, i += 40, this.rightMenu?.style.setProperty("left", t + "px"), this.rightMenu?.style.setProperty("top", i + "px");
  }
  /**
   * 创建右键菜单元素
   */
  createRightMenu() {
    const e = this.createElement("div", {
      className: "__lsgfish_menu",
      style: { display: "none" }
    });
    return document.body.appendChild(e), e;
  }
  /**
   * 创建删除元素
   */
  createDeleteEl() {
    const e = this.createElement("div", { className: "delete" });
    return e.innerHTML = `
    <svg t="1707287068207" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
        p-id="4256" width="30" height="30">
        <path
            d="M733.696 791.552c0 26.624-21.504 48.128-48.128 48.128H338.432c-26.624 0-48.128-21.504-48.128-48.128V280.064h443.904v511.488zM386.56 193.536c0-5.632 4.096-9.728 9.728-9.728h231.936c5.632 0 9.728 4.096 9.728 9.728v29.184H386.56v-29.184z m492.032 29.184h-182.784v-29.184c0-36.864-30.208-67.584-67.584-67.584H396.288c-36.864 0-67.584 30.208-67.584 67.584v29.184H145.408c-15.872 0-29.184 12.8-29.184 29.184 0 15.872 12.8 29.184 29.184 29.184h86.528v510.976c0 58.88 47.616 106.496 106.496 106.496h347.136c58.88 0 106.496-47.616 106.496-106.496v-512h86.528c15.872 0 29.184-12.8 29.184-29.184s-13.312-28.16-29.184-28.16zM512 752.64c15.872 0 29.184-12.8 29.184-29.184V414.72c0-15.872-12.8-29.184-29.184-29.184s-29.184 12.8-29.184 29.184v308.736c0 16.384 13.312 29.184 29.184 29.184m-135.168 0c15.872 0 29.184-12.8 29.184-29.184V414.72c0-15.872-12.8-29.184-29.184-29.184-15.872 0-29.184 12.8-29.184 29.184v308.736c0.512 16.384 13.312 29.184 29.184 29.184m270.336 0c15.872 0 29.184-12.8 29.184-29.184V414.72c0-15.872-12.8-29.184-29.184-29.184s-29.184 12.8-29.184 29.184v308.736c0.512 16.384 13.312 29.184 29.184 29.184"
            p-id="4257"></path>
    </svg>
    `, this.callbackMap.has("delete") && (e.onclick = this.callbackMap.get("delete")), e;
  }
  /**
   * 创建dom元素
   * @param selector
   * @param config
   * @returns
   */
  createElement(e, t) {
    const i = document.createElement(e);
    i.classList.add(t.className || ""), i.id = t.id;
    for (const s in t.style)
      i.style.setProperty(s, t.style[s]);
    return i;
  }
}
class C {
  /**
   * 实例id
   */
  id;
  /**
   * 当前entity
   */
  entity;
  /**
   * cesium中的viewer实例
   */
  viewer;
  /**
   * 事件订阅发布
   */
  listener;
  /**
   * 几何类型，导出geojson时使用，在构造函数中赋值即可
   */
  geometryType;
  /**
   * 用户选中的点集合，经纬度、高度
   */
  vertexs;
  /**
   * 渲染的经纬度（在每次vertexs更新后，都需要重新计算一下插值）
   */
  coordinates;
  /**
   * 当前控制点集合的下标，this.vertex.length - 1
   */
  currentVertexIdx;
  /**
   * 属性
   */
  properties;
  /**
   * 事件管理实例
   */
  events;
  /**
   * 数据仓实例
   */
  stores;
  /**
   * 信息提示框
   */
  prompt;
  /**
   * 屏幕时间管理器
   */
  screenEventHandler;
  /**
   * 当前对象的点位控制对象集合
   */
  pointFeatures;
  /**
   * 当前时间戳，主要用来给双击事件时，对单击事件做节流优化使用
   */
  currentTimeStamp;
  /**
   * 当前动作结束后的绘制模式
   * @date 2/21/2024 - 4:16:10 PM
   * @author 走我们钓鱼去
   *
   * @type {*}
   */
  mode;
  constructor(e) {
    const { viewer: t, listener: i, events: s, stores: r, prompt: n, isContinue: h } = e;
    this.viewer = t, this.listener = i, this.events = s, this.stores = r, this.properties = {}, this.currentVertexIdx = 0, this.coordinates = [], this.vertexs = [], this.id = F(), this.prompt = n, this.entity = new Cesium.Entity(), this.screenEventHandler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas), this.pointFeatures = /* @__PURE__ */ new Map([]), this.currentTimeStamp = (/* @__PURE__ */ new Date()).getTime(), this.mode = h ? this.constructor.name : "Select";
  }
  /**
   * 模式启用时会调用
   */
  start() {
    this.stores.addFeature(this), this.currentVertexIdx = 0, this.viewer.container.style.cursor = "crosshair";
  }
  /**
   * 当前模式调用结束前调用
   */
  stop() {
    this.currentVertexIdx = 0, this.viewer.container.style.cursor = "default";
  }
  /**
   * 当前操作结束的调用hans
   */
  finish() {
    this.events.changeMode(this.mode, this);
  }
  /**
   * 鼠标左键弹起
   */
  mouseLeftBounceUp() {
  }
  /**
   * 移动当前的元素回调
   * @param cartesian
   */
  move(e, t) {
  }
  /**
   * 选中当前元素的回调
   */
  selected(e) {
  }
  /**
   * 取消选中回调
   */
  unSelected(e) {
  }
  /**
   * 创建图元、entity
   * @param params
   */
  createPrimitve(e) {
  }
  remove(e) {
    this.viewer.entities.removeById(this.id), this.pointFeatures.forEach((t) => {
      this.viewer.entities.removeById(t[1].id);
    });
  }
  /**
   * 校验当前feature的json数据是否合格，合格返回true，不合格返回false，各种类型需要自己实现具体逻辑
   * @returns
   */
  isValidGeoJSON() {
    return this.vertexs.length > 0;
  }
  /**
   * 添加控制点，根据下标添加控制点
   * @param idx
   * @param vertex
   * @returns
   */
  addVertex(e) {
    this.vertexs.push(e), this.currentVertexIdx = this.vertexs.length - 1, this.addCoordinates(e);
  }
  /**
   * 插入经纬度
   * @param idx
   * @param vertex
   */
  insertVertex(e, t) {
    this.vertexs.splice(e, 0, t), this.insertCoordinates(e, t);
  }
  /**
   * 更新控制点
   * @param idx
   * @param vertex
   */
  updateVertex(e, t) {
    this.vertexs.splice(e, 1, t), this.updateCoordinates(e, t);
  }
  /**
   * 移出控制点
   * @param idx
   * @returns
   */
  removeVertex(e) {
    e < 0 || e >= this.vertexs.length || (this.vertexs.splice(e, 1), this.currentVertexIdx = this.vertexs.length - 1, this.removeCoordinates(e));
  }
  /**
   * 设置控制点，一次性更新所有的vertex
   * @param vertexs
   */
  setVertexs(e) {
    this.vertexs = e, this.currentVertexIdx = this.vertexs.length - 1, this.setCoordinates(e);
  }
  /**
   * 获取控制点
   * @returns
   */
  getVertexs() {
    return this.vertexs;
  }
  /**
   * 获取计算的控制点位数据
   * @returns
   */
  getCoordinates() {
    return this.coordinates;
  }
  /**
   * 插入渲染经纬度
   * @param idx
   * @param vertex
   */
  insertCoordinates(e, t) {
    this.coordinates.splice(e, 0, Cesium.Cartesian3.fromDegrees(...t));
  }
  /**
   * 添加渲染经纬度
   * @param vertex
   */
  addCoordinates(e) {
    this.coordinates.push(Cesium.Cartesian3.fromDegrees(...e));
  }
  /**
   * 计算控制点插值数据
   * @param coordinates
   */
  setCoordinates(e) {
    this.coordinates = Cesium.Cartesian3.fromDegreesArrayHeights(e.flat());
  }
  /**
   * 删除渲染经纬度
   * @param idx
   * @param vertex
   */
  removeCoordinates(e) {
    this.coordinates.splice(e, 1);
  }
  /**
   * 更新渲染经纬度
   * @param idx
   * @param vertex
   */
  updateCoordinates(e, t) {
    this.coordinates.splice(e, 1, Cesium.Cartesian3.fromDegrees(...t));
  }
  /**
   * 获取样式
   */
  getStyle() {
    return {};
  }
  /**
   * 设置样式
   * @param params
   */
  setStyle(e) {
  }
  /**
   * 设置属性
   * @param key
   * @param value
   */
  setProperty(e, t) {
    this.properties[e] = t;
  }
  /**
   * 获取属性
   * @param key
   * @returns
   */
  getProperty(e) {
    return this.properties[e];
  }
  onClick(e) {
  }
  onLeftDown(e) {
  }
  onLeftUp(e) {
  }
  onDbClick(e) {
  }
  onMouseMove(e) {
    const { lonlat: t, position: i } = e;
    if (!t)
      return this.prompt.closePrompt();
    this.prompt.showPrompt(), this.prompt.movePrompt(i);
  }
  onRightClick(e) {
  }
  onMouseDown(e) {
  }
  onMouseUp(e) {
  }
  onWheel(e) {
  }
  /**
   * 通过json数据格式进行创建
   * @param json
   */
  createFromGeoJSON(e) {
    const { geometry: t, properties: i, id: s } = e;
    this.id = s, this.setVertexs(t.coordinates), this.createPrimitve(), this.stores.addFeature(this), this.properties = i;
  }
  /**
   * 导出geojson数据
   * @returns
   */
  toGeoJSON() {
    return {
      id: this.id,
      featureConstructorName: this.constructor.name,
      type: "Feature",
      properties: { style: { ...this.getStyle() }, ...this.properties },
      geometry: {
        coordinates: this.getVertexs(),
        type: this.geometryType
      }
    };
  }
}
class k extends C {
  screenEventHandler;
  feature;
  selectIdx;
  constructor(e) {
    super(e), this.screenEventHandler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas), this.feature = void 0, this.id = "";
  }
  start() {
    this.currentVertexIdx = 0, this.viewer.container.style.cursor = "default";
  }
  stop() {
    this.feature?.unSelected();
  }
  onClick(e) {
    const { position: t, lonlat: i } = e;
    if (!i) {
      this.unSelected();
      return;
    }
    const s = b(this.viewer, t);
    if (!s) {
      this.unSelected();
      return;
    }
    this.feature?.id !== s && this.feature?.unSelected(), this.feature = this.stores.getFeature(s), this.feature?.selected(i);
  }
  unSelected(e) {
    this.prompt.close(), this.feature?.unSelected(), this.feature = void 0;
  }
  onRightClick(e) {
    if (!this.feature)
      return;
    const { position: t } = e;
    this.prompt.moveRightMenu(t), this.prompt.showRightMenu([["delete", this.deleteCallback.bind(this)]]);
  }
  onLeftDown(e) {
    const { lonlat: t, position: i } = e;
    !t || !this.entity || (this.id = b(this.viewer, i), this.id && (this.feature?.pointFeatures.has(this.id) || this.feature && this.feature.id === this.id) && this.screenEventHandler.setInputAction(
      this.mouseMoveCallback.bind(this),
      Cesium.ScreenSpaceEventType.MOUSE_MOVE
    ));
  }
  onLeftUp(e) {
    this.viewer.scene.screenSpaceCameraController.enableRotate = !0, this.screenEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE), this.feature?.mouseLeftBounceUp();
  }
  onMouseMove(e) {
    const { lonlat: t, position: i } = e;
    if (!t)
      return;
    const s = this.viewer.scene.pick(i);
    this.viewer.container.style.cursor = s ? "pointer" : "default";
  }
  /**
   * 鼠标移动回调函数
   * @param mouseEvent
   * @returns
   */
  mouseMoveCallback(e) {
    const t = y(this.viewer, e.endPosition);
    this.feature && (this.viewer.scene.screenSpaceCameraController.enableRotate = !1, t && this.feature?.move(e.endPosition, this.id));
  }
  /**
   * 删除回调函数
   */
  deleteCallback() {
    this.prompt.close(), this.feature?.remove(), this.stores.deleteFeature(this.feature?.id || ""), this.feature = void 0;
  }
}
var f = /* @__PURE__ */ ((o) => (o.CREATED = "created", o))(f || {});
class D extends C {
  /**
   * 上一个控制点的坐标位置
   */
  preControlPointPosition;
  constructor(e) {
    super(e), this.geometryType = "LineString", this.prompt.setText("单击确定线段起点位置");
  }
  getStyle() {
    const e = {};
    return e.material = this.entity?.polyline?.material?.getValue(new Cesium.JulianDate()), e.color = e.material?.color, e.width = this.entity?.polyline?.width?.getValue(new Cesium.JulianDate()), e.clampToGround = this.entity?.polyline?.clampToGround?.getValue(new Cesium.JulianDate()), e;
  }
  setStyle(e) {
    if (this.entity) {
      for (const t in e)
        /color|material/gi.test(t) || (this.entity.polyline[t] = e[t]);
      this.entity.polyline.material = e.color && Cesium.Color.fromCssColorString(e.color);
    }
  }
  /**
   * 创建图元的控制点
   * @param idx
   * @param position
   * @returns
   */
  createControlPointPrimitive(e, t) {
    if (!t)
      return;
    const i = new w(this);
    i.createPrimitve(), i.setVertexs(t), this.pointFeatures.set(i.id, [e, i]);
  }
  selected(e) {
    this.listener.emit(f.CREATED, { geojson: this.toGeoJSON() }), !this.pointFeatures.size && this.vertexs.forEach((t, i) => {
      this.createControlPointPrimitive(i, t);
    });
  }
  unSelected() {
    this.pointFeatures.forEach((e) => {
      e[1].remove();
    }), this.pointFeatures.clear();
  }
  /**
   * 鼠标左键弹起
   */
  mouseLeftBounceUp() {
    this.preControlPointPosition = void 0;
  }
  move(e, t) {
    const { lonlat: i } = c(this.viewer, e);
    if (typeof t < "u" && this.id !== t && i) {
      this.preControlPointPosition = void 0;
      const s = this.pointFeatures.get(t);
      if (!s)
        return;
      this.updateVertex(s[0], i), s[1]?.setVertexs(i);
      return;
    }
    if (this.preControlPointPosition || (this.preControlPointPosition = i), this.preControlPointPosition && this.preControlPointPosition.length && i) {
      const s = i[0] - this.preControlPointPosition[0], r = i[1] - this.preControlPointPosition[1];
      this.vertexs.forEach((n) => {
        n[0] += s, n[1] += r;
      }), this.setCoordinates(this.vertexs);
    }
    i && (this.preControlPointPosition = i);
  }
  removeVertex(e) {
    if (!(e < 0 || e >= this.vertexs.length)) {
      if (e === 0) {
        this.remove(), this.vertexs = [], this.finish();
        return;
      }
      this.vertexs.splice(e, 1), this.currentVertexIdx = this.vertexs.length - 1, this.removeCoordinates(e);
    }
  }
  isValidGeoJSON() {
    if (!this.vertexs.length)
      return !1;
    if (this.vertexs.length === 2) {
      const e = Cesium.Cartesian3.fromDegrees(...this.vertexs[0]), t = Cesium.Cartesian3.fromDegrees(...this.vertexs[1]);
      if (!Cesium.Cartesian3.distance(e, t))
        return !1;
    }
    return !0;
  }
  toGeoJSON() {
    return {
      id: this.id,
      featureConstructorName: this.constructor.name,
      type: "Feature",
      properties: { style: { ...this.getStyle() }, ...this.properties },
      geometry: {
        coordinates: this.vertexs,
        type: this.geometryType
      }
    };
  }
  createFromGeoJSON(e) {
    const { geometry: t, properties: i, id: s } = e;
    this.id = s, this.setVertexs(t.coordinates), this.createPrimitve(), this.stores.addFeature(this), this.properties = i;
  }
}
class x extends D {
  constructor(e) {
    super(e), this.prompt.setText("鼠标左键按下移动鼠标开始画笔，鼠标左键弹起则画笔结束");
  }
  onLeftDown(e) {
    const { lonlat: t } = e;
    t && (this.viewer.scene.screenSpaceCameraController.enableRotate = !1, this.addVertex(t), this.createPrimitve(), this.screenEventHandler.setInputAction(
      this.moveCallback.bind(this),
      Cesium.ScreenSpaceEventType.MOUSE_MOVE
    ));
  }
  onLeftUp(e) {
    this.screenEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE), this.viewer.scene.screenSpaceCameraController.enableRotate = !0, this.events.changeMode(x, this);
  }
  moveCallback(e) {
    const { lonlat: t } = c(this.viewer, e.endPosition);
    t && this.vertexs.length && this.addVertex(t);
  }
  createPrimitve(e) {
    this.entity = this.viewer.entities.add({
      id: this.id,
      polyline: {
        positions: new Cesium.CallbackProperty(() => this.coordinates, !1),
        material: Cesium.Color.RED,
        width: 4
      }
    });
  }
}
class I extends C {
  constructor(e) {
    super(e), this.geometryType = "Point", this.prompt.setText("单击确定点位置");
  }
  selected() {
    this.listener.emit(f.CREATED, { geojson: this.toGeoJSON() });
  }
  getStyle() {
    const e = {};
    return e.color = this.entity?.point?.color?.getValue(new Cesium.JulianDate()), e.pixelSize = this.entity?.point?.pixelSize?.getValue(new Cesium.JulianDate()), e.heightReference = this.entity?.point?.heightReference?.getValue(new Cesium.JulianDate()), e.outlineColor = this.entity?.point?.outlineColor?.getValue(new Cesium.JulianDate()), e.outlineWidth = this.entity?.point?.outlineWidth?.getValue(new Cesium.JulianDate()), e;
  }
  setStyle(e) {
    if (this.entity) {
      for (const t in e)
        /color/gi.test(t) || (this.entity.point[t] = e[t]);
      this.entity.point.color = e.color && Cesium.Color.fromCssColorString(e.color), this.entity.point.outlineColor = e.outlineColor && Cesium.Color.fromCssColorString(e.outlineColor);
    }
  }
  move(e) {
    const t = y(this.viewer, e);
    t && this.entity && (this.entity.position = t);
  }
}
class w extends I {
  constructor(e) {
    super(e);
  }
  setCoordinates(e) {
    this.coordinates = e;
  }
  onClick(e) {
    e.lonlat && (this.setVertexs(e.lonlat), this.createPrimitve(), this.finish());
  }
  createPrimitve() {
    this.entity = this.viewer.entities.add({
      id: this.id,
      position: new Cesium.CallbackProperty(() => {
        const [e, t, i] = this.getCoordinates();
        return Cesium.Cartesian3.fromDegrees(e, t, i);
      }, !1),
      point: {
        // color: Cesium.Color.RED,
        pixelSize: 12,
        // outlineColor: Cesium.Color.GREEN,
        outlineWidth: 2
      }
    });
  }
}
class P extends C {
  /**
   * 上一个控制点的坐标位置
   */
  preControlPointPosition;
  constructor(e) {
    super(e), this.geometryType = "Polygon", this.prompt.setText("单击确定起点位置");
  }
  getStyle() {
    const e = {};
    return e.fill = this.entity?.polygon?.fill?.getValue(new Cesium.JulianDate()), e.material = this.entity?.polygon?.material?.getValue(new Cesium.JulianDate()), e.color = e.material?.color, e.height = this.entity?.polygon?.height?.getValue(new Cesium.JulianDate()), e.heightReference = this.entity?.polygon?.heightReference?.getValue(new Cesium.JulianDate()), e.outline = this.entity?.polygon?.outline?.getValue(new Cesium.JulianDate()), e.outlineColor = this.entity?.polygon?.outlineColor?.getValue(new Cesium.JulianDate()), e.outlineWidth = this.entity?.polygon?.outlineWidth?.getValue(new Cesium.JulianDate()), e;
  }
  setStyle(e) {
    if (this.entity) {
      for (const t in e)
        /color|material/gi.test(t) || (this.entity.polygon[t] = e[t]);
      this.entity.polygon.material = e.color && Cesium.Color.fromCssColorString(e.color), this.entity.polygon.outlineColor = e.outlineColor && Cesium.Color.fromCssColorString(e.outlineColor);
    }
  }
  /**
   * 创建图元的控制点
   * @param idx
   * @param position
   * @returns
   */
  createControlPointPrimitive(e, t) {
    if (!t)
      return;
    const i = new w(this);
    i.createPrimitve(), i.setVertexs(t), this.pointFeatures.set(i.id, [e, i]);
  }
  mouseLeftBounceUp() {
    this.preControlPointPosition = void 0;
  }
  unSelected(e) {
    this.pointFeatures.forEach((t) => {
      t[1].remove();
    }), this.pointFeatures.clear();
  }
  selected(e) {
    this.listener.emit(f.CREATED, { geojson: this.toGeoJSON() }), !this.pointFeatures.size && this.vertexs.forEach((t, i) => {
      this.createControlPointPrimitive(i, t);
    });
  }
  onRightClick(e) {
    this.removeVertex(this.vertexs.length - 2), this.vertexs.length === 2 ? this.prompt.setText("单击选中下一个点位置，右击回撤一步") : this.vertexs.length >= 3 && this.prompt.setText("单击选中下一个点位置，双击完成绘制，右击回撤一步");
  }
  removeVertex(e) {
    if (!(e < 0 || e >= this.vertexs.length)) {
      if (e <= 0) {
        this.remove(), this.vertexs = [], this.finish();
        return;
      }
      this.vertexs.splice(e, 1), this.currentVertexIdx = this.vertexs.length - 1, this.removeCoordinates(e), this.entity && (this.entity.polyline.show = this.vertexs.length === 2);
    }
  }
  move(e, t) {
    const { lonlat: i } = c(this.viewer, e);
    if (typeof t < "u" && this.id !== t && i) {
      this.preControlPointPosition = void 0;
      const s = this.pointFeatures.get(t);
      if (!s)
        return;
      this.updateVertex(s[0], i), s[1]?.setVertexs(i);
      return;
    }
    if (this.preControlPointPosition || (this.preControlPointPosition = i), this.preControlPointPosition && this.preControlPointPosition.length && i) {
      const s = i[0] - this.preControlPointPosition[0], r = i[1] - this.preControlPointPosition[1];
      this.vertexs.forEach((n) => {
        n[0] += s, n[1] += r;
      }), this.setVertexs(this.vertexs);
    }
    i && (this.preControlPointPosition = i);
  }
  isValidGeoJSON() {
    if (this.vertexs.length < 3)
      return !1;
    if (this.vertexs.length === 2) {
      const e = Cesium.Cartesian3.fromDegrees(...this.vertexs[0]), t = Cesium.Cartesian3.fromDegrees(...this.vertexs[1]), i = Cesium.Cartesian3.fromDegrees(...this.vertexs[2]);
      let s = Cesium.Cartesian3.distance(e, t);
      return !(!s || (s = Cesium.Cartesian3.distance(i, t), !s) || (s = Cesium.Cartesian3.distance(i, e), !s));
    }
    return !0;
  }
  createFromGeoJSON(e) {
    const { geometry: t, properties: i, id: s } = e;
    this.id = s, this.setVertexs(t.coordinates.flat()), this.createPrimitve(), this.stores.addFeature(this), this.properties = i;
  }
  toGeoJSON() {
    return {
      id: this.id,
      featureConstructorName: this.constructor.name,
      type: "Feature",
      properties: { style: { ...this.getStyle() }, ...this.properties },
      geometry: {
        coordinates: [[...this.vertexs, this.vertexs[0]]],
        type: this.geometryType
      }
    };
  }
}
class R extends P {
  constructor(e) {
    super(e);
  }
  onClick(e) {
    const t = (/* @__PURE__ */ new Date()).getTime();
    if (t - this.currentTimeStamp < 300)
      return;
    this.currentTimeStamp = t;
    const { lonlat: i, position: s } = e;
    if (!i)
      return this.prompt.close();
    if (this.addVertex(i), this.vertexs.length === 2 ? this.prompt.setText("单击选中下一个点位置，右击回撤一步") : this.vertexs.length >= 3 && this.prompt.setText("单击选中下一个点位置，双击完成绘制，右击回撤一步"), this.vertexs.length <= 2)
      this.createPrimitve();
    else if (this.vertexs.length > 2) {
      if (!this.entity)
        return;
      this.entity.polyline.show = !1;
    }
  }
  onDbClick(e) {
    this.removeVertex(this.currentVertexIdx), this.finish();
  }
  onMouseMove(e) {
    const { lonlat: t, position: i } = e;
    if (!t)
      return this.prompt.closePrompt();
    this.prompt.showPrompt(), this.prompt.movePrompt(i), this.updateVertex(this.currentVertexIdx, t);
  }
  setCoordinates(e) {
    this.coordinates = Cesium.Cartesian3.fromDegreesArrayHeights(e.flat());
  }
  getPolylineCoordinates() {
    return this.vertexs.length < 2 ? [new Cesium.Cartesian3(), new Cesium.Cartesian3()] : Cesium.Cartesian3.fromDegreesArrayHeights([...this.vertexs[0], ...this.vertexs[1]]);
  }
  createPrimitve(e) {
    const t = this.vertexs.length <= 2;
    this.entity = this.viewer.entities.add({
      id: this.id,
      polyline: {
        show: t,
        positions: new Cesium.CallbackProperty(() => this.getPolylineCoordinates(), !1),
        width: 2
        // material: Cesium.Color.fromCssColorString('#f1c40f').withAlpha(0.4)
      },
      polygon: {
        hierarchy: new Cesium.CallbackProperty(() => new Cesium.PolygonHierarchy(this.coordinates), !1),
        fill: !0,
        height: 0,
        // material: Cesium.Color.fromCssColorString('#f1c40f').withAlpha(0.4),
        outlineWidth: 12
        // outlineColor: Cesium.Color.fromCssColorString('#f1c40f').withAlpha(0.4)
      }
    });
  }
}
class S extends P {
  clickTimes;
  constructor(e) {
    super(e), this.clickTimes = 0, this.prompt.setText("单击选择箭头开始位置");
  }
  onClick(e) {
    const t = (/* @__PURE__ */ new Date()).getTime();
    if (t - this.currentTimeStamp < 300)
      return;
    this.currentTimeStamp = t;
    const { lonlat: i, position: s } = e;
    if (i)
      if (this.clickTimes === 0)
        this.clickTimes++, this.addVertex(i), this.prompt.setText("移动鼠标，然后单击选择箭头结束位置，右击回撤"), this.createPrimitve();
      else {
        if (this.finish(), !this.entity?.polyline)
          return;
        this.entity.polyline.show = !1;
      }
  }
  /**
   * 计算箭头需要的渲染坐标
   */
  computedArrowPoints() {
    const e = Cesium.Cartesian3.fromDegrees(...this.vertexs[0]), t = Cesium.Cartesian3.fromDegrees(...this.vertexs[1]), i = this.computedThirdPoint2(4, Math.PI / 7), s = this.computedThirdPoint2(3, Math.PI / 10), r = this.computedThirdPoint2(4, Math.PI / 7, !1), n = this.computedThirdPoint2(3, Math.PI / 10, !1), h = [
      i,
      s,
      e,
      n,
      r,
      t
    ];
    this.setCoordinates(h);
  }
  /**
   *计算箭头的第三个位置的点cartesian3坐标（使用了Cesium.Cartesian3的计算函数）
   * @param start 坐标起点
   * @param end 坐标终点
   * @param length 距离坐标终点的长度
   * @param width 距离线段的垂直距离
   */
  computedThirdPoint(e, t, i, s) {
    var r = Cesium.Cartesian3.subtract(t, e, new Cesium.Cartesian3());
    const n = i / Cesium.Cartesian3.magnitude(r);
    let h = Cesium.Cartesian3.multiplyByScalar(
      r,
      n,
      new Cesium.Cartesian3()
    );
    h = Cesium.Cartesian3.add(t, h, h);
    var u = Cesium.Cartesian3.UNIT_X, l = Cesium.Cartesian3.normalize(
      Cesium.Cartesian3.cross(u, r, new Cesium.Cartesian3()),
      new Cesium.Cartesian3()
    ), a = Cesium.Cartesian3.multiplyByScalar(
      l,
      s,
      new Cesium.Cartesian3()
    );
    return Cesium.Cartesian3.add(h, a, new Cesium.Cartesian3());
  }
  /**
   * 计算相对于起始点的第三个坐标点位置（使用了三角函数计算公式）
   * @param length 相对于终点到起点的距离长度
   * @param radian 相对起始点的弧度
   * @param isLeft 是否在线的左边
   * @returns
   */
  computedThirdPoint2(e, t, i = !0) {
    const s = this.vertexs[0], r = this.vertexs[1], n = this.getBaseLength(s, r);
    let h = Math.abs(r[1] - s[1]) / n, u = Math.asin(h);
    t = i ? t : -t, r[1] >= s[1] && r[0] >= s[0] ? t += u + Math.PI : r[1] >= s[1] && r[0] < s[0] ? t += Math.PI * 2 - u : r[1] < s[1] && r[0] < s[0] ? t += u : r[1] < s[1] && r[0] >= s[0] && (t += Math.PI - u);
    const l = Math.cos(t) * e, a = Math.sin(t) * e, v = r[0] + l, m = r[1] + a;
    return Cesium.Cartesian3.fromDegrees(v, m, 0);
  }
  /**
   * 获取起始线段长度
   * @param startPoint
   * @param endPoint
   * @returns
   */
  getBaseLength(e, t) {
    return Math.sqrt(
      Math.pow(t[0] - e[0], 2) + Math.pow(t[1] - e[1], 2)
    );
  }
  move(e, t) {
    const { lonlat: i } = c(this.viewer, e);
    if (typeof t < "u" && this.id !== t && i) {
      this.preControlPointPosition = void 0;
      const s = this.pointFeatures.get(t);
      if (!s)
        return;
      this.updateVertex(s[0], i), s[1]?.setVertexs(i), this.computedArrowPoints();
      return;
    }
    if (this.preControlPointPosition || (this.preControlPointPosition = i), this.preControlPointPosition && this.preControlPointPosition.length && i) {
      const s = i[0] - this.preControlPointPosition[0], r = i[1] - this.preControlPointPosition[1];
      this.vertexs.forEach((n) => {
        n[0] += s, n[1] += r;
      }), this.computedArrowPoints();
    }
    i && (this.preControlPointPosition = i);
  }
  onMouseMove(e) {
    const { lonlat: t, position: i } = e;
    if (!t)
      return this.prompt.closePrompt();
    this.prompt.showPrompt(), this.prompt.movePrompt(i), this.updateVertex(this.currentVertexIdx, t), this.vertexs.length >= 2 && this.computedArrowPoints();
  }
  setCoordinates(e) {
    this.coordinates = e;
  }
  getPolylineCoordinates() {
    return this.vertexs.length < 2 ? [new Cesium.Cartesian3(), new Cesium.Cartesian3()] : Cesium.Cartesian3.fromDegreesArrayHeights([...this.vertexs[0], ...this.vertexs[1]]);
  }
  finish() {
    this.clickTimes = 0, this.events.changeMode(S, this);
  }
  createPrimitve(e) {
    this.entity = this.viewer.entities.add({
      id: this.id,
      polygon: {
        hierarchy: new Cesium.CallbackProperty(() => new Cesium.PolygonHierarchy(this.coordinates), !1),
        fill: !0,
        height: 0,
        // material: Cesium.Color.fromCssColorString('#f1c40f').withAlpha(0.4),
        outlineWidth: 12
        // outlineColor: Cesium.Color.fromCssColorString('#f1c40f').withAlpha(0.4)
      }
    });
  }
}
class N extends D {
  constructor(e) {
    super(e);
  }
  onClick(e) {
    const t = (/* @__PURE__ */ new Date()).getTime();
    if (t - this.currentTimeStamp < 300)
      return;
    this.currentTimeStamp = t;
    const { lonlat: i } = e;
    if (!i)
      return this.prompt.closePrompt();
    this.prompt.showPrompt(), this.prompt.setText("单击选中下一个点位置，双击完成绘制，右击回撤一步"), this.addVertex(i), this.getVertexs().length === 1 && (this.addVertex(i), this.createPrimitve());
  }
  onDbClick(e) {
    this.vertexs.pop(), this.finish();
  }
  onMouseMove(e) {
    const { lonlat: t, position: i } = e;
    if (!t)
      return this.prompt.closePrompt();
    this.prompt.showPrompt(), this.prompt.movePrompt(i), !(this.vertexs.length < 1) && this.updateVertex(this.currentVertexIdx, t);
  }
  onRightClick(e) {
    this.removeVertex(this.vertexs.length - 2);
  }
  createPrimitve(e) {
    this.entity = this.viewer.entities.add({
      id: this.id,
      polyline: {
        positions: new Cesium.CallbackProperty(() => this.coordinates, !1),
        // material: Cesium.Color.RED,
        width: 4
      }
    });
  }
}
class U extends I {
  constructor(e) {
    super(e), this.prompt.setText("单击确定文字位置");
  }
  getStyle() {
    const e = {};
    return e.text = this.entity?.label?.text?.getValue(new Cesium.JulianDate()), e.showBackground = this.entity?.label?.showBackground?.getValue(new Cesium.JulianDate()), e.scale = this.entity?.label?.scale?.getValue(new Cesium.JulianDate()) || 1, e.heightReference = this.entity?.label?.heightReference?.getValue(new Cesium.JulianDate()), e.showBackground = this.entity?.label?.showBackground?.getValue(new Cesium.JulianDate()), e.backgroundColor = this.entity?.label?.backgroundColor?.getValue(new Cesium.JulianDate()), e.backgroundPadding = this.entity?.label?.backgroundPadding?.getValue(
      new Cesium.JulianDate()
    ), e.fillColor = this.entity?.label?.fillColor?.getValue(new Cesium.JulianDate()), e.outlineColor = this.entity?.label?.outlineColor?.getValue(new Cesium.JulianDate()), e.outlineWidth = this.entity?.label?.outlineWidth?.getValue(new Cesium.JulianDate()), e;
  }
  setStyle(e) {
    if (this.entity) {
      for (const t in e)
        /color/gi.test(t) || (this.entity.label[t] = e[t]);
      this.entity.label.fillColor = e.fillColor && Cesium.Color.fromCssColorString(e.fillColor), this.entity.label.outlineColor = e.outlineColor && Cesium.Color.fromCssColorString(e.outlineColor), this.entity.label.backgroundColor = e.backgroundColor && Cesium.Color.fromCssColorString(e.backgroundColor);
    }
  }
  onClick(e) {
    const t = (/* @__PURE__ */ new Date()).getTime();
    t - this.currentTimeStamp < 300 || (this.currentTimeStamp = t, e.lonlat && (this.setVertexs(e.lonlat), this.createPrimitve(), this.events.changeMode("Label", this)));
  }
  createPrimitve(e) {
    this.entity = this.viewer.entities.add({
      id: this.id,
      position: new Cesium.CallbackProperty(() => this.getCoordinates()[0], !1),
      label: {
        text: "你好",
        font: "24px sans-serif"
      }
    });
  }
}
class _ extends P {
  /**
   * 图片材质
   */
  imgMaterial;
  constructor(e) {
    super(e), this.properties = {
      style: {
        text: "贴地文字",
        fillStyle: "#ffffff",
        fontSize: 30,
        fontFamily: "Arial",
        outline: !1,
        outlineWidth: 1,
        outlineColor: "#000000"
      }
    }, this.prompt.setText("单击确定文字起点位置");
  }
  onClick(e) {
    const { lonlat: t } = e;
    t && (this.vertexs.length === 0 ? (this.addVertex(t), this.prompt.setText("移动鼠标然后选中文字的结束点位置"), this.createImageMaterial(this.properties.style), this.createPrimitve()) : this.vertexs.length >= 2 && (this.updateVertex(this.currentVertexIdx + 1, t), this.events.changeMode("LabelClamp", this)));
  }
  onMouseMove(e) {
    const { lonlat: t, position: i } = e;
    if (!t)
      return this.prompt.closePrompt();
    this.prompt.showPrompt(), this.prompt.movePrompt(i), this.vertexs.length !== 0 && this.updateVertex(this.currentVertexIdx + 1, t);
  }
  updateCoordinates(e, t) {
    this.vertexs.length === 2 && this.setCoordinates(this.computedRect(this.vertexs[0], this.vertexs[1]));
  }
  setCoordinates(e) {
    Array.isArray(e) && e.length === 2 ? this.setCoordinates(this.computedRect(e[0], e[1])) : this.coordinates = Cesium.Cartesian3.fromDegreesArrayHeights(e.flat());
  }
  /**
   * 根据对角两点计算矩阵四个点位
   * @param startPoint
   * @param endPoint
   * @returns
   */
  computedRect(e, t) {
    const i = e, s = [t[0], e[1], 0], r = t, n = [e[0], t[1], 0];
    return [i, s, r, n];
  }
  getStyle() {
    return this.properties.style;
  }
  setStyle(e) {
    this.entity && (this.properties.style = Object.assign(this.properties.style, e), this.createImageMaterial(this.properties.style), this.entity.polygon.material = new Cesium.ImageMaterialProperty({
      image: Cesium.buildModuleUrl(this.imgMaterial || ""),
      transparent: !0
    }));
  }
  createPrimitve(e) {
    this.entity = this.viewer.entities.add({
      id: this.id,
      polygon: {
        hierarchy: new Cesium.CallbackProperty(() => new Cesium.PolygonHierarchy(this.getCoordinates()), !1),
        material: new Cesium.ImageMaterialProperty({
          image: Cesium.buildModuleUrl(this.imgMaterial || ""),
          transparent: !0
        })
      }
    });
  }
  /**
   * 创建图片材质
   * @param style
   * @returns
   */
  createImageMaterial(e) {
    const {
      fillStyle: t = "#ffffff",
      fontSize: i = 30,
      fontFamily: s = "Arial",
      text: r = "贴地文字",
      outlineColor: n,
      outline: h,
      outlineWidth: u
    } = e, l = document.createElement("canvas"), a = l.getContext("2d");
    if (!a)
      return;
    l.width = 200, l.height = 70, v();
    function v() {
      if (!a)
        return;
      a.font = i + "px " + s, a.textAlign = "center", a.textBaseline = "middle", a.fillStyle = t;
      var m = l.width / 2, M = l.height / 2;
      if (a.measureText(r).width < l.width)
        h && (a.stroke(), a.lineWidth = u, a.strokeStyle = n, a.strokeText(r, m, M)), a.fillText(r, m, M);
      else {
        const g = r.split(""), E = i;
        let V = 1, p = "";
        for (let d = 0; d < g.length; d++) {
          const T = p + g[d];
          a.measureText(T).width >= l.width ? (a.fillText(p, m, E * V++), p = g[d]) : p = T;
        }
        p && a.fillText(p, 0, E * V);
      }
    }
    this.imgMaterial = l.toDataURL("image/png");
  }
  createFromGeoJSON(e) {
    const { geometry: t, properties: i, id: s } = e;
    this.id = s, this.setVertexs(t.coordinates.flat()), this.createImageMaterial(i.style), this.createPrimitve(), this.stores.addFeature(this), this.properties = i;
  }
  isValidGeoJSON() {
    if (this.vertexs.length < 2)
      return !1;
    if (this.vertexs.length === 2) {
      const e = Cesium.Cartesian3.fromDegrees(...this.vertexs[0]), t = Cesium.Cartesian3.fromDegrees(...this.vertexs[1]);
      return !!Cesium.Cartesian3.distance(e, t);
    }
    return !0;
  }
  toGeoJSON() {
    return {
      id: this.id,
      featureConstructorName: this.constructor.name,
      type: "Feature",
      properties: { style: { ...this.getStyle() }, ...this.properties },
      geometry: {
        coordinates: [this.vertexs],
        type: this.geometryType
      }
    };
  }
}
const G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  Label: U,
  LabelClamp: _,
  Pencil: x,
  Point: w,
  Polygon: R,
  PolygonArrow: S,
  Polyline: N,
  Select: k
}, Symbol.toStringTag, { value: "Module" }));
class z {
  /**
   * cesium中的viewer实例
   */
  viewer;
  /**
   * 事件管理实例
   */
  events;
  /**
   * 事件订阅发布
   */
  listener;
  /**
   * 数据仓实例
   */
  stores;
  featureCollection;
  mode;
  prompt;
  constructor(e) {
    const { viewer: t } = e;
    this.viewer = t, this.featureCollection = G, this.mode = null, this.prompt = new O(), this.listener = new J(), this.stores = new A(e), this.events = new H({
      viewer: t,
      mode: null,
      featureCollection: this.featureCollection
    });
  }
  /**
   * 改变绘制模式
   * @date 2/21/2024 - 4:14:23 PM
   * @author 走我们钓鱼去
   *
   * @param {?*} [mode]
   * @param {boolean} [isContinue=true] 默认为true，连续绘制，设置为false则为单次绘制
   */
  changeMode(e, t = !0) {
    this.events.changeMode(e || k, Object.assign(this, { isContinue: t }));
  }
  /**
   * 事件监听
   * @param name
   * @param cb
   */
  on(e, t) {
    this.listener.on(e, t);
  }
  /**
   * 事件卸载
   * @param name
   */
  un(e) {
    this.listener.un(e);
  }
  /**
   * 数据导出
   * @returns
   */
  export() {
    return this.stores.toGeoJSON();
  }
  /**
   * 导入数据
   */
  load(e) {
    const { type: t, features: i } = e;
    if (t !== "FeatureCollection" || !Array.isArray(i))
      throw new Error("导入数据格式不正确");
    i.forEach((s) => {
      const r = this.featureCollection[s.featureConstructorName];
      new r(this).createFromGeoJSON(s);
    });
  }
  removeAll() {
    this.stores.deleteFeatureAll();
  }
  updateEntityStyle(e, t) {
    const i = this.stores.getFeature(e);
    i && i.setStyle(t);
  }
}
export {
  z as Plot
};
