{"version":3,"file":"DrawUtils.mjs","sources":["../../../../../../packages/sdk/plugins/Draw/DrawUtils.ts"],"sourcesContent":["import { toRaw, unref } from 'vue'\nimport * as L from 'leaflet'\nimport 'leaflet-semicircle' // 扇形插件的类型定义\nimport 'leaflet-ellipse' // 椭圆形插件的类型定义\nimport LeafletFreeDraw, { freeDraw } from 'leaflet-freedraw'\nimport { CanvasShipUtils } from '@map-sdk/sdk/utils/CanvasShipUtils'\nimport type { MyMap } from '@map-sdk/sdk/ShipxyAPISDK'\n\ninterface beginOptions {\n  shape: string\n  pathOptions: any //L.PathOptions | L.CircleOptions\n  locate: boolean\n}\n\nclass DrawUtil {\n  public _map: MyMap\n  options: {\n    shape: string\n    templineStyle: { color: string }\n    hintlineStyle: { color: string; dashArray: number[] }\n    markerStyle: { draggable: boolean }\n    pathOptions: Record<string, any>\n    draggable: boolean\n    snappable: boolean\n    finishOnDoubleClick: boolean\n  }\n  _callback!: {\n    sectorEditCallback?: (sector: L.Layer) => void\n    sectorMoveCallback?: (sector: L.Layer) => void\n    sectorMoveendCallback?: (sector: L.Layer) => void\n    sectorMovebeginCallback?: (sector: L.Layer) => void\n    sectorMovebeginendCallback?: (sector: L.Layer) => void\n    sectorMovestopCallback?: (sector: L.Layer) => void\n    sectorMovestopendCallback?: (sector: L.Layer) => void\n    ellipseEditCallback?: (ellipse: L.Ellipse) => void\n    ellipseMoveCallback?: (ellipse: L.Ellipse) => void\n    ellipseMoveendCallback?: (ellipse: L.Ellipse) => void\n  }\n  _editIcon: L.Icon<L.IconOptions>\n  _editSectorInstance: any\n  _editEllipseInstance: any\n  constructor(map: MyMap) {\n    this._map = map\n    this.options = {\n      shape: 'Polygon',\n      templineStyle: {\n        color: 'red',\n      },\n      hintlineStyle: {\n        color: 'red',\n        dashArray: [5, 5],\n      },\n      markerStyle: {\n        draggable: true,\n      },\n      pathOptions: {},\n      draggable: true,\n      snappable: false,\n      finishOnDoubleClick: true,\n    }\n    this._editIcon = L.icon({\n      iconUrl: 'https://cdn.xplusship.com/img/images/flag/red_circle.png',\n      iconSize: [10, 10],\n      iconAnchor: [5, 5],\n    })\n  }\n\n  begin(options?: Partial<beginOptions>): L.Layer | null {\n    let layer: any = null\n    if (this._check()) {\n      this._map.shipsService?.setZIndex()\n      this._setOptions(options)\n      switch (this.options.shape) {\n        case 'Sector':\n        case 'Ellipse':\n          layer = new (L.PM as any).Draw.Marker(toRaw(unref(this._map)))\n          break\n        case 'FreeDraw':\n          this._checkType('FreeDraw')\n          layer = freeDraw({\n            mode: LeafletFreeDraw.CREATE,\n            leaveModeAfterCreate: true,\n          })\n          layer.shapeType = 'FreeDraw'\n          layer.getLayer = () => {\n            return null\n          }\n          this._map.addLayer(layer)\n          layer.on('markers', (event: any) => {\n            if (layer.size() > 0) {\n              const latlngs = event.latLngs[0]\n              const polygon = L.polygon(\n                latlngs,\n                this.options.pathOptions\n              ).addTo(this._map)\n              layer.getLayer = () => {\n                return polygon\n              }\n              this._map._container.style.cursor = 'default'\n              this.edit(polygon) // 假设 edit 方法可以接收 polygon\n            }\n            layer.off()\n            layer.clear()\n            const freeDrawSVGs = document.querySelectorAll('svg.free-draw')\n            // 遍历并移除这些元素\n            freeDrawSVGs.forEach((svg) => {\n              // 检查父元素是否存在，若存在，则移除该元素\n              svg.parentNode?.removeChild(svg)\n            })\n          })\n          break\n        default:\n          layer = new (L.PM as any).Draw[this.options.shape](this._map)\n      }\n\n      if (this.options.shape !== 'FreeDraw') {\n        layer.enable(this.options)\n      }\n      this._map._container.style.cursor = 'crosshair'\n    }\n    return layer\n  }\n\n  // 结束绘制操作\n  end(layer: any): void {\n    // 假设layer是L.PM.Layer或其子类实例\n    if ('disable' in layer) {\n      layer.disable() // 禁用编辑功能\n    }\n\n    // 检查是否是自由绘制图层\n    if (layer.shapeType === 'FreeDraw') {\n      const lay = layer.getLayer()\n      if (lay) {\n        // 如果是自由绘制图层，执行特定操作\n        lay.pm.disable() // 禁用图层的PM编辑功能\n        layer.mode(0) // 设置自由绘制模式\n        // $('svg.free-draw').remove() // 移除自由绘制SVG元素\n        const freeDrawSVGs = document.querySelectorAll('svg.free-draw')\n        // 遍历并移除这些元素\n        freeDrawSVGs.forEach((svg) => {\n          // 检查父元素是否存在，若存在，则移除该元素\n          svg.parentNode?.removeChild(svg)\n        })\n      }\n    }\n\n    // 恢复所有船只的Z-index\n    if (this._map.shipsService) {\n      this._map.shipsService.restoreZIndex()\n    }\n\n    // 将地图光标设置回默认状态\n    this._map._container.style.cursor = 'default'\n  }\n\n  // 根据选项显示图层\n  show(\n    latlngs: L.LatLng[],\n    options: { shape: string; [key: string]: any }\n  ): L.Layer {\n    let layer: L.Layer | undefined\n\n    switch (options.shape) {\n      case 'Marker':\n        layer = this._showMark(latlngs, options)\n        break\n      case 'Circle':\n        layer = this._showCircle(latlngs, options)\n        break\n      case 'Line':\n        layer = this._showPolyLine(latlngs, options)\n        break\n      case 'Rectangle':\n        layer = this._showRectangle(latlngs as any, options)\n        break\n      case 'Sector':\n        layer = this._showSector(latlngs, options)\n        break\n      case 'Ellipse':\n        layer = this._showEllipse(latlngs, options)\n        break\n      case 'FreeDraw':\n        layer = this._showFreeDraw(latlngs, options)\n        break\n      case 'Polygon':\n        layer = this._showPolygon(latlngs, options)\n        break\n      default:\n        throw new Error(`Unsupported shape type: ${options.shape}`)\n    }\n\n    this._map._container.style.cursor = 'default'\n    if (\n      this._map.shipsService &&\n      typeof this._map.shipsService.restoreZIndex === 'function'\n    ) {\n      this._map.shipsService.restoreZIndex()\n    }\n\n    return layer! // 使用!断言存在，实际使用时可能需要null检查\n  }\n\n  // 编辑图层\n  edit(layer: L.Layer, editOption?: any, zoomOption?: any): void {\n    this._map.shipsService && this._map.shipsService.setZIndex()\n    const zIndexValue = [null, undefined, true].indexOf(zoomOption)\n    if (zIndexValue > -1) {\n      if ('getBounds' in layer) {\n        this._map.fitBounds((layer as any).getBounds())\n      } else {\n        this._map.setView((layer as any).getLatLng(), this._map.getZoom() || 12)\n      }\n    }\n\n    if ('stopAngle' in layer.options) {\n      this._editSector?.call(this, layer)\n    } else if ('_radiusX' in layer && '_radiusY' in layer) {\n      this._editEllipse?.call(this, layer as any)\n    } else {\n      if ([null, undefined, true].includes(editOption)) {\n        ;(layer as any).pm.disable()\n      }\n      ;(layer as any).pm.enable(this.options)\n    }\n  }\n\n  // 开始编辑扇区\n  _editSector(editSector: L.Layer) {\n    this._editSectorInstance = editSector\n    const sectorInfo = this._getSectorInfo(this._editSectorInstance)\n    const editIcon = this._editIcon\n    if (this._editSectorInstance.options.marker_center) {\n      this._map.removeLayer(this._editSectorInstance.options.marker_center)\n      this._editSectorInstance.options.marker_center = null\n    }\n    this._editSectorInstance.options.marker_center = L.marker(\n      sectorInfo.center_ll,\n      {\n        draggable: true,\n        semiCircle: this._editSectorInstance,\n        icon: editIcon,\n      } as any\n    ).addTo(this._map)\n    this._editSectorInstance.options.marker_center\n      .on('move', (e: any) => {\n        if (\n          !e.target.options.semiCircle.options.draggingObj ||\n          'center' == e.target.options.semiCircle.options.draggingObj\n        ) {\n          e.target.options.semiCircle.options.draggingObj = 'center'\n          e.target.options.semiCircle.setLatLng(e.latlng)\n          const sectorInfo = this._getSectorInfo(e.target.options.semiCircle)\n          e.target.options.semiCircle.options.marker_start.setLatLng(\n            sectorInfo.startll\n          )\n          e.target.options.semiCircle.options.marker_end.setLatLng(\n            sectorInfo.endll\n          )\n          e.target.options.semiCircle.options.draggingObj = ''\n          this._callback?.sectorEditCallback &&\n            this._callback.sectorEditCallback(this._editSectorInstance)\n          this._callback?.sectorMoveCallback &&\n            this._callback.sectorMoveCallback(this._editSectorInstance)\n        }\n      })\n      .on('moveend', () => {\n        this._callback?.sectorMoveendCallback &&\n          this._callback.sectorMoveendCallback(this._editSectorInstance)\n      })\n    if (this._editSectorInstance.options.marker_start) {\n      this._map.removeLayer(this._editSectorInstance.options.marker_start)\n      this._editSectorInstance.options.marker_start = null\n    }\n    this._editSectorInstance.options.marker_start = L.marker(\n      sectorInfo.startll,\n      {\n        draggable: true,\n        semiCircle: this._editSectorInstance,\n        icon: editIcon,\n      } as any\n    ).addTo(this._map)\n    this._editSectorInstance.options.marker_start\n      .on('move', (e: any) => {\n        if (\n          !e.target.options.semiCircle.options.draggingObj ||\n          'start' == e.target.options.semiCircle.options.draggingObj\n        ) {\n          e.target.options.semiCircle.options.draggingObj = 'start'\n          const latLng = this._editSectorInstance\n            .getLatLng()\n            .distanceTo(e.latlng)\n          const latLngToBigCircle = CanvasShipUtils.getAngleByLatLngToBigCircle(\n            e.target.options.semiCircle.getLatLng(),\n            e.latlng\n          )\n          e.target.options.semiCircle.setStartAngle(latLngToBigCircle)\n          e.target.options.semiCircle.setRadius(latLng)\n          const sectorInfo = this._getSectorInfo(e.target.options.semiCircle)\n          e.target.options.semiCircle.options.marker_end.setLatLng(\n            sectorInfo.endll\n          )\n          e.target.options.semiCircle.options.draggingObj = ''\n          this._callback?.sectorEditCallback &&\n            this._callback.sectorEditCallback(this._editSectorInstance)\n          this._callback?.sectorMovebeginCallback &&\n            this._callback.sectorMovebeginCallback(this._editSectorInstance)\n        }\n      })\n      .on('moveend', () => {\n        this._callback?.sectorMovebeginendCallback &&\n          this._callback.sectorMovebeginendCallback(this._editSectorInstance)\n      })\n    this._editSectorInstance.options.marker_end &&\n      (this._map.removeLayer(this._editSectorInstance.options.marker_end),\n      (this._editSectorInstance.options.marker_end = null))\n    this._editSectorInstance.options.marker_end = L.marker(sectorInfo.endll, {\n      draggable: true,\n      semiCircle: this._editSectorInstance,\n      icon: editIcon,\n    } as any).addTo(this._map)\n    this._editSectorInstance.options.marker_end\n      .on('move', (e: any) => {\n        if (\n          !e.target.options.semiCircle.options.draggingObj ||\n          'end' === e.target.options.semiCircle.options.draggingObj\n        ) {\n          e.target.options.semiCircle.options.draggingObj = 'end'\n          let sectorInfo = this._getSectorInfo(e.target.options.semiCircle)\n          e.target.options.semiCircle.options.marker_start.setLatLng(\n            sectorInfo.startll\n          )\n          const distanceToBigCircle = this._editSectorInstance\n            .getLatLng()\n            .distanceTo(e.latlng)\n          const angleToBigCircle = CanvasShipUtils.getAngleByLatLngToBigCircle(\n            e.target.options.semiCircle.getLatLng(),\n            e.latlng\n          )\n          Math.abs(\n            angleToBigCircle - e.target.options.semiCircle.startAngle()\n          ) > 50\n            ? e.target.options.semiCircle.setStopAngle(angleToBigCircle)\n            : ((sectorInfo = this._getSectorInfo(e.target.options.semiCircle)),\n              e.target.setLatLng(sectorInfo.endll))\n          e.target.options.semiCircle.setRadius(distanceToBigCircle)\n          e.target.options.semiCircle.options.draggingObj = ''\n          this._callback?.sectorEditCallback &&\n            this._callback.sectorEditCallback(this._editSectorInstance)\n          this._callback?.sectorMovestopCallback &&\n            this._callback.sectorMovestopCallback(this._editSectorInstance)\n        }\n      })\n      .on('moveend', () => {\n        this._callback?.sectorMovestopendCallback &&\n          this._callback.sectorMovestopendCallback(this._editSectorInstance)\n      })\n  }\n\n  // 开始编辑椭圆\n  _editEllipse(ellipse: L.Ellipse): void {\n    this._editEllipseInstance = ellipse\n\n    if (this._editEllipseInstance.options.marker_center) {\n      this._map.removeLayer(this._editEllipseInstance.options.marker_center)\n      this._editEllipseInstance.options.marker_center = null\n    }\n\n    const centerLatLng = ellipse.getLatLng()\n    const centerIcon = this._editIcon\n    const getInfo = this._getEllipseVertices(ellipse)\n    this._editEllipseInstance.options.marker_center = L.marker(centerLatLng, {\n      draggable: true,\n      ellipse: this._editEllipseInstance,\n      icon: centerIcon,\n    } as any).addTo(this._map)\n\n    console.log(getInfo, 'getInfo')\n    getInfo.forEach((item) => {\n      L.marker(item, {\n        draggable: true,\n        ellipse: this._editEllipseInstance,\n        icon: centerIcon,\n      } as any).addTo(this._map)\n    })\n    this._editEllipseInstance.options.marker_center\n      .on('move', (e: any) => {\n        ;((e.target as L.Marker).options as any).ellipse.setLatLng(e.latlng)\n        if (this._callback?.ellipseEditCallback) {\n          this._callback.ellipseEditCallback(this._editEllipseInstance)\n        }\n        if (this._callback?.ellipseMoveCallback) {\n          this._callback.ellipseMoveCallback(this._editEllipseInstance)\n        }\n      })\n      .on('moveend', () => {\n        if (this._callback?.ellipseMoveendCallback) {\n          this._callback.ellipseMoveendCallback(this._editEllipseInstance)\n        }\n      })\n  }\n  // 获取扇区信息\n  _getSectorInfo(sector: {\n    getLatLng: () => L.LatLngExpression\n    startAngle: () => any\n    _radius: any\n    stopAngle: () => any\n  }): { center_ll: L.LatLngExpression; startll: L.LatLng; endll: L.LatLng } {\n    const point = this._map.latLngToLayerPoint(sector.getLatLng()) as any\n    const rotatedStart = point.rotated(sector.startAngle(), sector._radius)\n    const rotatedEnd = point.rotated(sector.stopAngle(), sector._radius)\n    const startll = this._map.layerPointToLatLng(rotatedStart)\n    const endll = this._map.layerPointToLatLng(rotatedEnd)\n    return {\n      center_ll: sector.getLatLng(),\n      startll,\n      endll,\n    }\n  }\n\n  // 获取椭圆区域四个定点\n  _getEllipseVertices(ellipse: any) {\n    // 椭圆的中心点\n    const center = ellipse.getLatLng()\n\n    // 椭圆的长轴和短轴长度\n    const radiusX = ellipse.options.radiusKm[0] // 长轴长度\n    const radiusY = ellipse.options.radiusKm[1] // 短轴长度\n\n    // 椭圆的旋转角度（如果适用）\n    const angle = ellipse.options.radiusKm[2]\n\n    // Leaflet 提供的计算目的地点的方法\n    const latLngToPoint = (\n      latlng: { lat: number; lng: number },\n      distance: number,\n      angle: number\n    ) => {\n      const lat = (latlng.lat * Math.PI) / 180,\n        lng = (latlng.lng * Math.PI) / 180,\n        R = 6378137, // 地球半径，单位为米\n        delta = distance / R,\n        angleRad = (angle * Math.PI) / 180\n      const lat2 = Math.asin(\n        Math.sin(lat) * Math.cos(delta) +\n          Math.cos(lat) * Math.sin(delta) * Math.cos(angleRad)\n      )\n      const lng2 =\n        lng +\n        Math.atan2(\n          Math.sin(angleRad) * Math.sin(delta) * Math.cos(lat),\n          Math.cos(delta) - Math.sin(lat) * Math.sin(lat2)\n        )\n      return L.latLng([(lat2 * 180) / Math.PI, (lng2 * 180) / Math.PI])\n    }\n\n    // 计算长轴顶点\n    const majorAxisVertex1 = latLngToPoint(center, radiusX, angle + 90)\n    const majorAxisVertex2 = latLngToPoint(center, radiusX, angle - 90)\n\n    // 计算短轴顶点\n    // 这里我们假设短轴与长轴垂直，因此角度为长轴角度加上90度\n    const minorAxisVertex1 = latLngToPoint(center, radiusY, angle)\n    const minorAxisVertex2 = latLngToPoint(center, radiusY, angle + 180)\n\n    // 打印长轴和短轴顶点\n    console.log('长轴顶点:', majorAxisVertex1, majorAxisVertex2)\n    console.log('短轴顶点:', minorAxisVertex1, minorAxisVertex2)\n    return [\n      majorAxisVertex1,\n      majorAxisVertex2,\n      minorAxisVertex1,\n      minorAxisVertex2,\n    ]\n  }\n\n  // 设置回调函数\n  setCallback(cb: any): void {\n    this._callback = Object.assign(this._callback || {}, cb)\n  }\n\n  // 取消编辑\n  cancelEdit(layer: any): void {\n    // layer 参数类型根据实际情况确定\n    if ('_radius' in layer && '_radiusY' in layer) {\n      if (this._editSectorInstance) {\n        ;['marker_center', 'marker_start', 'marker_end'].forEach(\n          (markerKey) => {\n            const marker = this._editSectorInstance.options[markerKey]\n            if (marker) {\n              this._map.removeLayer(marker)\n              this._editSectorInstance.options[markerKey] = null\n            }\n          }\n        )\n        this._editSectorInstance = null\n      }\n      if (layer.pm && layer.pm.enable && layer.pm.disable) {\n        layer.pm.enable(this.options)\n        layer.pm.disable()\n      }\n    } else if ('_radiusX' in layer && '_radiusY' in layer) {\n      if (this._editEllipseInstance) {\n        this._map.removeLayer(this._editEllipseInstance.options.marker_center)\n        this._editEllipseInstance.options.marker_center = null\n        this._editEllipseInstance = null\n      }\n    } else {\n      layer.pm.enable(this.options)\n      layer.pm.disable()\n    }\n    if (this._map.shipsService && this._map.shipsService.restoreZIndex) {\n      this._map.shipsService.restoreZIndex()\n    }\n  }\n\n  // 移除图层\n  remove(layerId: any): void {\n    // layerId 参数类型根据实际情况确定\n    let layerToRemove\n    if (layerId.shapeType === 'FreeDraw') {\n      layerToRemove = layerId.getLayer && layerId.getLayer()\n    } else if (this._map.hasLayer(layerId)) {\n      layerToRemove = layerId\n    } else {\n      layerToRemove = this.getLayer(layerId) // 假设 getLayer 方法已定义并返回 L.Layer 或 null\n    }\n\n    if (layerToRemove) {\n      this._map.removeLayer(layerToRemove)\n    }\n  }\n\n  // 根据 layerId 获取图层\n  getLayer(layerId: any): L.Layer | null {\n    if (!layerId) return null\n\n    // 如果直接是一个图层实例，直接返回\n    if (this._map.hasLayer(layerId)) {\n      return layerId\n    }\n\n    // 如果 layerId 是一个包含 _layer 属性的对象\n    if (layerId._layer) {\n      layerId._layer._map = this._map\n      const layers: L.Layer[] = []\n\n      this._map.eachLayer((layer: L.Layer) => {\n        if (\n          layer instanceof L.Polyline ||\n          layer instanceof L.Marker ||\n          layer instanceof L.Circle ||\n          layer instanceof L.Rectangle\n        ) {\n          layers.push(layer)\n        }\n      })\n\n      layers.filter((layer: L.Layer) => {\n        return !!(layer as any).pm\n      })\n\n      if (layerId._shape === 'Marker') {\n        return layers.find((layer: any) =>\n          layerId._layer.getLatLng().equals(layer.getLatLng())\n        ) as any\n      } else {\n        return layers.find((layer: any) =>\n          layerId._layer.getBounds().equals(layer.getBounds())\n        ) as any\n      }\n    }\n\n    console.error('参数错误。layer 不存在，或者不是 Layer 或 Shape')\n    return null\n  }\n  // 显示矩形\n  _showRectangle(\n    latlngs: L.LatLngBounds,\n    options?: Partial<beginOptions>\n  ): L.Rectangle {\n    const layer = this.begin(options) as any\n    const rectangle = L.rectangle(latlngs, this.options.pathOptions).addTo(\n      this._map\n    )\n    layer.disable()\n    if (options?.locate) {\n      this._map.fitBounds(latlngs)\n    }\n    return rectangle\n  }\n  // 显示多边形\n  _showPolygon(\n    latlngs: L.LatLng[],\n    options?: Partial<beginOptions>\n  ): L.Polygon {\n    const layer = this.begin(options) as any\n    let lastLatLng: L.LatLng | undefined\n\n    latlngs.forEach((latlng) => {\n      if (!layer._hintMarker._snapped) {\n        layer._hintMarker.setLatLng(latlng)\n      }\n      lastLatLng = layer._hintMarker.getLatLng()\n      layer._layer.addLatLng(lastLatLng!)\n      layer._createMarker(lastLatLng!)\n      layer._hintline.setLatLngs([lastLatLng!, lastLatLng!])\n    })\n\n    const polygonLatLngs = layer._layer.getLatLngs() as L.LatLng[]\n    const polygon = L.polygon(polygonLatLngs, this.options.pathOptions).addTo(\n      this._map\n    )\n    layer.disable()\n    if (options?.locate) {\n      this._map.fitBounds(layer._layer.getBounds())\n    }\n    return polygon\n  }\n\n  _showPolyLine(\n    latlngs: L.LatLng[],\n    options?: Partial<beginOptions>\n  ): L.Polyline {\n    const layer = this.begin(options) as any\n\n    layer._hintMarker._snapped || layer._hintMarker.setLatLng(latlngs[0])\n\n    let lastLatLng: L.LatLng | undefined\n    latlngs.forEach((latlng) => {\n      if (!layer._hintMarker?._snapped) {\n        layer._hintMarker.setLatLng(latlng) // 更新提示标记位置\n      }\n      lastLatLng = layer._hintMarker.getLatLng()\n      layer._layer.addLatLng(lastLatLng!)\n      layer._createMarker(lastLatLng!)\n      layer._hintline.setLatLngs([lastLatLng!, lastLatLng!])\n    })\n\n    const polylineLatLngs = layer._layer.getLatLngs() as L.LatLng[]\n    const polyline = L.polyline(\n      polylineLatLngs,\n      this.options.pathOptions\n    ).addTo(this._map)\n    layer.disable()\n\n    if (options?.locate) {\n      this._map.fitBounds(polyline.getBounds())\n    }\n\n    return polyline\n  }\n\n  _showMark(latlngs: L.LatLng[], options?: Partial<beginOptions>): L.Marker {\n    const layer = this.begin(options) as any\n    const firstLatLng = latlngs[0]\n\n    if (!layer._hintMarker._snapped) {\n      layer._hintMarker.setLatLng(firstLatLng)\n    }\n\n    const markerLatLng = layer._hintMarker.getLatLng()\n    const marker = new L.Marker(markerLatLng, this.options.markerStyle).addTo(\n      this._map\n    )\n    layer.disable()\n\n    const zoom = this._map.getZoom() || 12\n    if (options?.locate) {\n      const lastLatLng = latlngs[latlngs.length - 1]\n      this._map.setView(lastLatLng, zoom)\n    }\n\n    return marker\n  }\n\n  _showCircle(center: L.LatLng[], options: Partial<beginOptions>): L.Circle {\n    const layer = this.begin(options) as any\n    const hintMarker = layer._hintMarker\n    const centerLatLng = center[0]\n\n    if (!hintMarker._snapped) {\n      hintMarker.setLatLng(centerLatLng)\n    }\n\n    const latLng = hintMarker.getLatLng()\n    const circle = L.circle(\n      latLng,\n      options.pathOptions as L.CircleMarkerOptions\n    ).addTo(this._map)\n\n    layer.disable()\n    if (options.locate) {\n      this._map.fitBounds(circle.getBounds())\n    }\n\n    return circle\n  }\n\n  _showSector(center: L.LatLng[], options: Partial<beginOptions>) {\n    const layer = this.begin(options) as any\n    const hintMarker = layer._hintMarker\n    const centerLatLng = center[0]\n\n    if (!hintMarker._snapped) {\n      hintMarker.setLatLng(centerLatLng)\n    }\n\n    this._checkType('sector')\n\n    const radius: number = options.pathOptions?.radius || 10000 // 假设默认半径\n    const startAngle = 45 // 假设默认起始角度\n    const stopAngle = 135 // 假设默认结束角度\n\n    delete options.pathOptions?.radius\n\n    const sectorOptions: L.PathOptions = {\n      radius,\n      startAngle,\n      stopAngle,\n      draggingObj: '',\n      fillOpacity: 1,\n      ...options.pathOptions,\n    }\n\n    const sector = L.semiCircle(centerLatLng, sectorOptions).addTo(this._map)\n\n    layer.disable()\n    if (options.locate) {\n      this._map.fitBounds(sector.getBounds())\n    }\n\n    return sector\n  }\n\n  _showEllipse(center: L.LatLng[], options: Partial<beginOptions>): L.Ellipse {\n    const layer = this.begin(options) as any\n    const hintMarker = layer._hintMarker\n    const centerLatLng = center[0]\n\n    if (!hintMarker._snapped) {\n      hintMarker.setLatLng(centerLatLng)\n    }\n\n    this._checkType('ellipse')\n\n    const radii: [number, number, number] = options.pathOptions?.radius || [\n      10000, 6000, 0,\n    ] // 假设默认半径\n    delete options.pathOptions?.radius\n\n    const ellipseOptions: L.EllipseOptions = {\n      fillOpacity: 0.1,\n      radiusKm: radii,\n      ...options.pathOptions,\n    }\n\n    const ellipse = L.ellipse(\n      centerLatLng,\n      [radii[0], radii[1]],\n      radii[2],\n      ellipseOptions\n    ).addTo(this._map)\n\n    layer.disable()\n    if (options.locate) {\n      this._map.fitBounds(ellipse.getBounds())\n    }\n\n    return ellipse\n  }\n\n  _showFreeDraw(\n    latlng: L.LatLng[],\n    options?: Partial<beginOptions>\n  ): L.Polygon {\n    this._setOptions(options)\n    const polygon = L.polygon(latlng, this.options.pathOptions).addTo(this._map)\n    options?.locate && this._map.fitBounds(polygon.getBounds())\n    return polygon\n  }\n\n  _setOptions(options?: any): void {\n    L.Util.setOptions(this, options)\n    L.Util.extend((this._map.pm.Draw as any).options, this.options)\n  }\n\n  _check() {\n    const map = this._map\n    if (this._isEmptyObject(map) || null == map)\n      throw new Error('The instance of map is null.')\n    return true\n  }\n\n  _checkType(layer: string): boolean {\n    let isHave = true\n    switch (layer.toLowerCase()) {\n      case 'sector':\n        ;(L && L.semiCircle) ||\n          (console.error('请先引入绘制扇形插件'), (isHave = false))\n        break\n      case 'ellipse':\n        ;(L && L.ellipse) ||\n          (console.error('请先引入绘制椭圆形插件'), (isHave = false))\n        break\n      case 'freedraw':\n        LeafletFreeDraw ||\n          (console.error('请先引入自由绘制插件'), (isHave = false))\n    }\n    return isHave\n  }\n\n  _isEmptyObject(object: any): boolean {\n    for (const key in object) {\n      return false\n    }\n    return true\n  }\n}\n\nconst drawUtil = (map: MyMap) => {\n  if (!map.drawEdit) {\n    map.drawEdit = new DrawUtil(map)\n  }\n  return map.drawEdit\n}\nexport { DrawUtil, drawUtil }\n"],"names":["f","constructor","e","this","_map","options","shape","templineStyle","color","hintlineStyle","dashArray","markerStyle","draggable","pathOptions","snappable","finishOnDoubleClick","_editIcon","o","icon","iconUrl","iconSize","iconAnchor","begin","s","t","_check","shipsService","setZIndex","_setOptions","PM","Draw","Marker","I","v","_checkType","E","mode","k","CREATE","leaveModeAfterCreate","shapeType","getLayer","addLayer","on","a","size","n","latLngs","r","polygon","addTo","_container","style","cursor","edit","off","clear","document","querySelectorAll","forEach","parentNode","removeChild","enable","end","disable","pm","i","restoreZIndex","show","_showMark","_showCircle","_showPolyLine","_showRectangle","_showSector","_showEllipse","_showFreeDraw","_showPolygon","Error","indexOf","fitBounds","getBounds","setView","getLatLng","getZoom","_editSector","call","_editEllipse","includes","_editSectorInstance","_getSectorInfo","marker_center","removeLayer","marker","center_ll","semiCircle","target","draggingObj","setLatLng","latlng","marker_start","startll","marker_end","endll","_callback","sectorEditCallback","sectorMoveCallback","sectorMoveendCallback","distanceTo","l","u","getAngleByLatLngToBigCircle","setStartAngle","setRadius","c","sectorMovebeginCallback","sectorMovebeginendCallback","Math","abs","startAngle","setStopAngle","sectorMovestopCallback","sectorMovestopendCallback","_editEllipseInstance","_getEllipseVertices","ellipse","ellipseEditCallback","ellipseMoveCallback","ellipseMoveendCallback","latLngToLayerPoint","rotated","_radius","stopAngle","layerPointToLatLng","radiusKm","d","g","y","_","lat","PI","C","lng","L","m","b","asin","sin","cos","S","atan2","latLng","setCallback","Object","assign","cancelEdit","remove","hasLayer","_layer","eachLayer","Polyline","Circle","Rectangle","push","filter","_shape","find","equals","rectangle","locate","_hintMarker","_snapped","addLatLng","_createMarker","_hintline","setLatLngs","getLatLngs","polyline","length","circle","radius","fillOpacity","p","Util","setOptions","extend","_isEmptyObject","toLowerCase","w","h","drawEdit"],"mappings":"qOAAwO,MAAMA,EAAE,WAAAC,CAAYC,GAAGC,KAAKC,KAAKF,EAAEC,KAAKE,QAAQ,CAACC,MAAM,UAAUC,cAAc,CAACC,MAAM,OAAOC,cAAc,CAACD,MAAM,MAAME,UAAU,CAAC,EAAE,IAAIC,YAAY,CAACC,WAAU,GAAIC,YAAY,CAAE,EAACD,WAAU,EAAGE,WAAU,EAAGC,qBAAoB,GAAIZ,KAAKa,UAAUC,EAAEC,KAAK,CAACC,QAAQ,2DAA2DC,SAAS,CAAC,GAAG,IAAIC,WAAW,CAAC,EAAE,IAAI,CAAC,KAAAC,CAAMpB,GAAG,IAAIqB,EAAE,IAAIC,EAAE,KAAK,GAAGrB,K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