{"version":3,"file":"ShipxyAPISDK.mjs","sources":["../../../../packages/sdk/ShipxyAPISDK.ts"],"sourcesContent":["import * as L from 'leaflet'\n\nimport { CanvasShipUtils } from '@map-sdk/sdk/utils/CanvasShipUtils'\nimport { CommUtils } from '@map-sdk/sdk/utils/CommUtils'\n\nimport { PolylineMeasureExtend } from '@map-sdk/sdk/plugins/PolylineMeasureExtend'\nimport { CanvasShipService } from '@map-sdk/sdk/CanvasShipService'\nimport { canvasShip } from '@map-sdk/sdk/CanvasShipSJService'\nimport { ShipxyOptions } from '@map-sdk/sdk/config'\nimport { areaViewSymbol } from '@map-sdk/sdk/plugins/AreaView/AreaViewSymbol'\nimport attributionElane from '@map-sdk/sdk/plugins/AttributionElane'\nimport { latlngGraticuleServer } from '@map-sdk/sdk/plugins/LatLngGraticuleServer'\nimport ScaleElane from '@map-sdk/sdk/plugins/ScaleElane'\nimport { WeatherServiceImpl } from '@map-sdk/sdk/plugins/weather/WeatherServiceImpl'\nimport { NavigationServiceImpl } from '@map-sdk/sdk/plugins/NavigationServiceImpl'\nimport { PortCanvas } from '@map-sdk/sdk/plugins/Port/PortCanvas'\nimport { TrackServiceImpl } from '@map-sdk/sdk/plugins/Trackplayer/TrackServiceImpl'\nimport { mousePosition } from '@map-sdk/sdk/plugins/utils/mousePositong'\nimport { TrackForecast } from '@map-sdk/sdk/plugins/Trackplayer/TrackForecast'\nimport { NavigationalWarningService } from '@map-sdk/sdk/plugins/NavigationalWarning/NavigationalWarningService'\nimport {\n  type TrackDrawServiceImpl,\n  trackDrawServiceImpl,\n} from '@map-sdk/sdk/plugins/TrackDraw/TrackDrawServiceImpl'\nimport { DrawUtil } from '@map-sdk/sdk/plugins/Draw/DrawUtils'\nimport { OverLayers } from '@map-sdk/sdk/plugins/Draw/OverLayers'\nimport {\n  type AisManageOptions,\n  AisManager,\n} from '@map-sdk/sdk/plugins/Ais/AisManager'\nimport { terminatorSymbol } from '@map-sdk/sdk/plugins/AreaView/layer/TerminatorSymbol'\nimport type { CanvasShipServiceOptions } from '@map-sdk/sdk/CanvasShipService'\nimport type {\n  LatLngGraticuleServer,\n  OptionsLatLngGraticule,\n} from '@map-sdk/sdk/plugins/LatLngGraticuleServer'\nimport type {\n  AreaViewSymbol,\n  AreaViewSymbolOptions,\n} from '@map-sdk/sdk/plugins/AreaView/AreaViewSymbol'\n\ntype TileSource = 'sea' | 'google' | 'satellite'\ntype PartialTileSource = {\n  [K in TileSource]?: TileUrlRecord\n}\n\ntype TileUrlRecord = Record<\n  'url' | 'errorTileUrl',\n  string | Record<number, { url: string }>\n>\n\n/**\n * 地图接口参数\n */\nexport interface ShipxyAPIOptions extends L.MapOptions {\n  attribution?: { isShow: boolean; emptyString: string }\n  mapTypes?: string[]\n  ak?: string\n  defaultMapType?: string\n  gratings?: { isShow: boolean; maxZoom: number; type: string }\n  centerPoint?: [number, number]\n  measureCtrl?: { isShow: boolean; position: string }\n  mousePostionCtrl?: { isShow: boolean; position: string }\n  zoomControlElane?: { isShow: boolean; position: string }\n  zoomviewControl?: { isShow: boolean; position: string }\n  basemapsControl?: { isShow: boolean; position: string }\n  mapReadyCallBack?: (map: L.Map) => void\n  scaleCtrl?: { isShow: boolean; position: string }\n  addTileLayer?: L.TileLayer[]\n  cjhdTileLayer?: { isShow: boolean }\n  miniMapControl?: { isShow: boolean; options?: any }\n  tileLayer?: L.TileLayerOptions & PartialTileSource\n}\ninterface MyMapInterface {\n  getMapType: () => string\n}\nexport type MyMapType = MyMap\nexport class MyMap extends L.Map implements MyMapInterface {\n  [x: string]: any\n  public static service = []\n  public _options?: ShipxyAPIOptions\n  public _hoverShipId: any\n  public offsetC = true\n  public _selShipId!: Record<string, any>\n  public _size?: L.Point\n  public _unselectedShipListener?: (params?: any) => void\n  public mapType?: string\n  public shipxy_tooltip?: L.Tooltip\n  public shipxy_tooltip_timer?: ReturnType<typeof setTimeout>\n  weatherService!: WeatherServiceImpl\n  shipsService!: CanvasShipService\n  latlngGraticuleServer!: LatLngGraticuleServer\n  areaViewSymbol!: AreaViewSymbol\n  navigationService!: NavigationServiceImpl\n  portCanvasService!: PortCanvas\n  trackService!: TrackServiceImpl\n  trackForecast!: TrackForecast\n  public static readonly defaultOptions = {\n    // 公司版权信息( 支持html )，默认Elane Inc.\n    attribution: {\n      isShow: true,\n      emptyString: '&copy;2024 <a class=\"\">LandSea</a><a></a>',\n    },\n    attributionControl: false,\n    // 显示地图类型，'MT_SEA'，MT_GOOGLE,MT_SATELLITE,\n    mapTypes: ['MT_SEA', 'MT_GOOGLE', 'MT_SATELLITE'],\n    // 授权码\n    ak: '',\n    // 默认展示地图类型\n    defaultMapType: 'MT_GOOGLE',\n    // 光栅图,是否显示，最大显示级别,默认:false\n    gratings: {\n      isShow: false,\n      maxZoom: 9,\n      type: 'RASTER_WORLD',\n    },\n    // 初始中心点坐标\n    centerPoint: [32.1, 122.11],\n\n    // 初始缩放级别\n    zoom: 4,\n    // 最小缩放级别\n    minZoom: 2,\n    // 最大缩放级别\n    maxZoom: 18,\n    // 测量控件的显示隐藏\n    measureCtrl: {\n      isShow: true,\n      position: 'topleft',\n    },\n\n    // 鼠标移动悬浮经纬度控件\n    mousePostionCtrl: {\n      isShow: true,\n      position: 'bottomright',\n    },\n    // 缩放控件的显示隐藏\n    zoomControlElane: {\n      isShow: true,\n      position: 'topright',\n    },\n    // 缩放级别显示控件\n    zoomviewControl: {\n      isShow: true,\n      position: 'topleft',\n    },\n    // 地图切换控件的位置\n    basemapsControl: {\n      isShow: true,\n      position: 'topright',\n    },\n\n    // 比例尺，控件\n    scaleCtrl: {\n      isShow: true,\n      position: 'bottomleft',\n    },\n    // 自定义图源\n    addTileLayer: [],\n    // 是否显示长江航道，默认：false,\n    cjhdTileLayer: {\n      isShow: false,\n    },\n    // 鹰眼控件\n    miniMapControl: {\n      isShow: false,\n      options: {},\n    },\n    // 默认图源设置（url，errorTileUrl），默认图源类型有：sea、google、satellite\n    tileLayer: null,\n    zoomControl: false,\n    worldCopyJump: true,\n    preferCanvas: false,\n    wheelPxPerZoomLevel: 800,\n    zoomAnimation: false,\n    markerZoomAnimation: false,\n    zoomSnap: 1,\n    zoomDelta: 1,\n    fadeAnimation: true,\n    wheelDebounceTime: 40,\n  }\n  constructor(id: string | HTMLElement, options?: ShipxyAPIOptions) {\n    super(id, options)\n    this._options = options\n  }\n  getMapType() {\n    const id = this.getContainer().id\n    let type = CommUtils.getCookie(`_sdk_maptype_${id}`)\n    if (CommUtils.isEmpty(type)) {\n      type = this._options?.defaultMapType\n      CommUtils.setCookie(`_sdk_maptype_${id}`, type)\n    }\n    return type\n  }\n}\n\n/**\n * 公共接口\n */\nexport class ShipxyAPI {\n  public static Map = MyMap\n  public static Control = {}\n\n  constructor() {\n    // 假设这里进行了ShipxyAPI.Map相关的初始化工作\n  }\n\n  static version = `${ShipxyOptions.versionType}-3.5.202308251430`\n  static GeoJSON = L.GeoJSON\n  static geoJSON = L.geoJSON\n  static geoJson = L.geoJson\n  static Layer = L.Layer\n  static LayerGroup = L.LayerGroup\n  static layerGroup = L.layerGroup\n  static FeatureGroup = L.FeatureGroup\n  static featureGroup = L.featureGroup\n  static LatLng = L.LatLng\n  static latLng = L.latLng\n  static Marker = L.Marker\n  static marker = L.marker\n  static Circle = L.Circle\n  static circle = L.circle\n  static circleMarker = L.circleMarker\n  static Polyline = L.Polyline\n  static polyline = L.polyline\n  static Polygon = L.Polygon\n  static polygon = L.polygon\n  static Rectangle = L.Rectangle\n  static rectangle = L.rectangle\n  static DivIcon = L.DivIcon\n  static divIcon = L.divIcon\n  static extend = L.extend\n  static DomUtil = L.DomUtil\n  static Util = L.Util\n  static Browser = L.Browser\n  static console = () => {\n    const consoleListFunction = {} as {\n      log: (...params: any) => object\n      debug: (...params: any) => object\n      info: (...params: any) => object\n      warn: (...params: any) => object\n      error: (...params: any) => object\n      assert: (...params: any) => object\n      dir: (...params: any) => object\n      dirxml: (...params: any) => object\n      group: (...params: any) => object\n      groupEnd: (...params: any) => object\n      time: (...params: any) => object\n      timeEnd: (...params: any) => object\n      count: (...params: any) => object\n      trace: (...params: any) => object\n      profile: (...params: any) => object\n      profileEnd: (...params: any) => object\n      memory: (...params: any) => object\n    }\n    const consoleList = [\n      'log',\n      'debug',\n      'info',\n      'warn',\n      'error',\n      'assert',\n      'dir',\n      'dirxml',\n      'group',\n      'groupEnd',\n      'time',\n      'timeEnd',\n      'count',\n      'trace',\n      'profile',\n      'profileEnd',\n      'memory',\n    ]\n    for (const element of consoleList) {\n      // eslint-disable-next-line @typescript-eslint/no-empty-function\n      ;(consoleListFunction as any)[element] = function () {}\n    }\n    if (ShipxyOptions.log && window.console) {\n      for (let i = 0; i < ShipxyOptions.log.length; i++) {\n        const log = ShipxyOptions.log[i]\n        // eslint-disable-next-line @typescript-eslint/no-empty-function\n        log && log.length > 0 && ((consoleListFunction as any)[log] = () => {}) //window.console[log]\n      }\n    }\n    return consoleListFunction\n  }\n\n  static _onAddController(map: any, _this: any): void {\n    const setOrder = (order: number | undefined): void => {\n      if (order !== undefined && _this._container) {\n        _this._container.style.order = order.toString()\n      }\n    }\n\n    if ('_zoomInButton' in _this) {\n      if (map.options.zoomControlElane && map.options.zoomControlElane.order) {\n        setOrder(map.options.zoomControlElane.order)\n      }\n    } else if (_this._container.classList.contains('leaflet-control-minimap')) {\n      if (map.options.miniMapControl && map.options.miniMapControl.order) {\n        setOrder(map.options.miniMapControl.order)\n      }\n    } else if (_this.options && _this.options.order) {\n      setOrder(_this.options.order)\n    }\n  }\n\n  static addDefaultHooks() {\n    ShipxyAPI.Map.include({\n      mapType: '',\n      _mapLayers: {},\n      getMapType() {\n        const id = this.getContainer().id\n        let type = CommUtils.getCookie(`_sdk_maptype_${id}`)\n        if (CommUtils.isEmpty(type)) {\n          type = this.options.defaultMapType\n          CommUtils.setCookie(`_sdk_maptype_${id}`, type)\n        }\n        return type\n      },\n    })\n\n    ShipxyAPI.Map.mergeOptions(MyMap.defaultOptions)\n\n    /**\n     * 初始化地图控件\n     */\n    ShipxyAPI.Map.addInitHook(function () {\n      ShipxyOptions.providerTiles.RASTER_WORLD =\n        ShipxyOptions.providerTiles.RASTER_WORLD.replace('{k}', this.options.ak)\n      ShipxyOptions.providerTiles.RASTER_WORLD_GOOGLE =\n        ShipxyOptions.providerTiles.RASTER_WORLD_GOOGLE.replace(\n          '{k}',\n          this.options.ak\n        )\n\n      this.mapType = this.getMapType()\n\n      this.setView(\n        this.options.centerPoint || [32.1, 122.11],\n        this.options.zoom || 4\n      )\n      this.setMaxBounds(L.latLngBounds([-85, -3600], [85, 3600]))\n      this.setMinZoom(this.options.minZoom || 2)\n      this.setMaxZoom(this.options.maxZoom || 18)\n      if (this.options.attribution.isShow) {\n        this.attributionControl && this.removeControl(this.attributionControl)\n\n        this.attributionControl = attributionElane({\n          emptyString: this.options.attribution.emptyString,\n        }).addTo(this)\n      }\n      if (this.options.scaleCtrl.isShow) {\n        this.scaleElaneControl && this.removeControl(this.scaleElaneControl)\n        this.scaleElaneControl = new ScaleElane({\n          nautic: true,\n          imperial: false,\n          metric: false,\n        }).addTo(this)\n        ShipxyAPI._onAddController(this, this.scaleElaneControl)\n      }\n      if (this.options.mousePostionCtrl.isShow) {\n        this.positionControl && this.removeControl(this.positionControl)\n        this.positionControl = mousePosition({\n          position: 'bottomleft',\n          separator: ' <br/>',\n          emptyString: `${CanvasShipUtils.formatDegreesToDMS(\n            this.options.centerPoint[0],\n            true\n          )}<br/>${CanvasShipUtils.formatDegreesToDMS(\n            this.options.centerPoint[1],\n            false\n          )}`,\n          lngFormatter: (value: number): string =>\n            CanvasShipUtils.formatDegreesToDMS(value, true),\n\n          latFormatter: (value: number): string =>\n            CanvasShipUtils.formatDegreesToDMS(value, false),\n        })\n        this.addControl(this.positionControl)\n        ShipxyAPI._onAddController(this, this.positionControl)\n      }\n      if (this.options.zoomControlElane.isShow) {\n        const position = this.options.zoomControlElane.position\n          ? this.options.zoomControlElane.position\n          : 'topright'\n        this.zoomControl && this.removeControl(this.zoomControl)\n        this.zoomControl = L.control\n          .zoom({\n            position,\n            zoomInTitle: '放大',\n            zoomOutTitle: '缩小',\n          })\n          .addTo(this)\n        ShipxyAPI._onAddController(this, this.zoomControl)\n      }\n      // 尺子测距离\n      if (this.options.measureCtrl.isShow) {\n        this.polylineMeasureControl &&\n          this.removeControl(this.polylineMeasureControl)\n        this.polylineMeasureControl = new PolylineMeasureExtend({\n          isShow: false,\n          position: 'topleft',\n          unit: 'nauticalmiles',\n          measureControlLabel: '&#8614;', // 测量控制按钮的标签（可以使用Unicode符号）。\n          clearMeasurementsOnStop: false, // 当关闭测量控制时，是否清除所有已做的测量。\n          showMeasurementsClearControl: true,\n          //是否显示切换测量单位的控制按钮。\n          showUnitControl: true,\n          // 是否在提示框中显示方位角信息。\n          showBearings: true,\n          // 临时虚线的颜色和线宽。\n          tempLine: {\n            color: '#2F302F',\n            weight: 2,\n          },\n          // arrow.color: 折线中间箭头的颜色。\n          //  实线（绘制完成后的折线）的颜色和线宽。\n          fixedLine: {\n            color: '#2F302F',\n            weight: 3,\n            stroke: true,\n          },\n          // startCircle、intermedCircle、currentCircle 和 endCircle: 分别定义起始点、中间点、当前绘制点（绘制过程中）和终点的圆形标记样式，包括颜色、线宽、填充色、填充透明度和半径。\n          startCircle: {\n            weight: 2,\n            color: '#2F302F',\n            fillColor: '#88FF88',\n            fillOpacity: 1,\n            radius: 4,\n          },\n          intermedCircle: {\n            weight: 2,\n            color: '#2F302F',\n            fillColor: '#FFFFFF',\n            fillOpacity: 1,\n            radius: 4,\n          },\n          currentCircle: {\n            weight: 2,\n            color: '#2F302F',\n            fillColor: '#FFFFFF',\n            fillOpacity: 1,\n            radius: 3,\n          },\n          endCircle: {\n            weight: 2,\n            color: '#2F302F',\n            fillColor: '#e33647',\n            fillOpacity: 1,\n            radius: 4,\n          },\n          tooltipTextFinish: '',\n          tooltipTextDelete: '',\n          tooltipTextMove: '',\n          tooltipTextResume: '',\n          tooltipTextAdd: '',\n          bindTooltipText: '点击后拖动即可更改',\n          changeUnitsText: '更改单位',\n          unitControlTitle: {\n            //要显示在“单位控制”按钮上的标题文本\n            text: '更改单位',\n            metres: '米',\n            landmiles: '英里',\n            nauticalmiles: '海里',\n          },\n          // unitControlLabel: {\n          //   metres: '米',\n          //   kilometres: 'km',\n          //   feet: 'ft',\n          //   landmiles: '英里',\n          //   nauticalmiles: '海里'\n          // },\n          clearControlTitle: '清空测距', // 清除控制按钮的标题文本和标签。\n          measureControlTitleOn: '开启测距',\n          measureControlTitleOff: '关闭测距', // 分别为开启和关闭测量控制时的标题文本。\n          bearingTextIn: '入',\n          bearingTextOut: '出', // 分别为进入和离开方向的方位角标签，用于语言相关的提示。\n          cursor: `url(${ShipxyOptions.COM_IMG_BASE64.ruler}),crosshair`,\n          ...this.options.measureCtrl,\n        }).addTo(this)\n        this.polylineMeasureControl._resetOptionByMapType(\n          this.polylineMeasureControl\n        )\n\n        // 2. 监听测距线创建事件\n        this.on('polylinemeasure:finish', (event: any) => {\n          setTimeout(() => {\n            this.polylineMeasureControl.options.finalizeCallBack &&\n              this.polylineMeasureControl.options.finalizeCallBack()\n          }, 50)\n          this.polylineMeasureControl.addCloseButtonToPolyline(event, this)\n        })\n\n        ShipxyAPI._onAddController(this, this.polylineMeasureControl)\n      }\n\n      this.on('zoomstart', () => {\n        if (this.options.zoomAnimation) {\n          L.DomUtil.removeClass(this._panes.overlayPane, 'leaflet-zoom-hide')\n          L.DomUtil.removeClass(this._panes.markerPane, 'leaflet-zoom-hide')\n          L.DomUtil.removeClass(this._panes.tooltipPane, 'leaflet-zoom-hide')\n          if (this.getZoom() < 11) {\n            L.DomUtil.addClass(this._panes.overlayPane, 'leaflet-zoom-hide')\n            L.DomUtil.addClass(this._panes.markerPane, 'leaflet-zoom-hide')\n            L.DomUtil.addClass(this._panes.tooltipPane, 'leaflet-zoom-hide')\n          }\n        }\n      })\n\n      this.on('baselayerchange', function () {\n        if (this.minimapControl) {\n          const tileLayer = L.tileLayer(this.basemapsControl.basemap._url, {\n            minZoom: 0,\n            maxZoom: 18,\n            attribution: '',\n          })\n          this.minimapControl.changeLayer(tileLayer)\n        }\n      })\n      this.on('resize', () => {\n        if (this.shipsService) {\n          this.shipsService.resizeHTML()\n          this.getSize()\n        }\n      })\n    })\n\n    /**\n     * 回调函数\n     */\n    ShipxyAPI.Map.addInitHook(function () {\n      this.options.mapReadyCallBack && this.options.mapReadyCallBack(this)\n    })\n\n    ShipxyAPI.Map.addInitHook(function () {\n      if (!this.Draw) {\n        this.Draw = new DrawUtil(this)\n      }\n    })\n  }\n\n  /**\n   * 提供船舶三角函数\n   * @param url\n   * @param options\n   * @returns\n   */\n  static ShipSjService(url: string, options?: CanvasShipServiceOptions) {\n    return canvasShip(url, options)\n  }\n\n  // 提供接口服务\n  static ShipService(map: MyMap, options?: CanvasShipServiceOptions) {\n    map.shipsService ||\n      (map.shipsService = new CanvasShipService(map as any, options))\n    return map.shipsService\n  }\n  /**\n   * 气象服务\n   *   气象服务\n        1、气温\n        2、气压\n        3、风\n        4、台风\n        5、潮汐\n   * @params map 地图对象\n   */\n  static WeatherService(map: MyMap) {\n    map.weatherService || (map.weatherService = new WeatherServiceImpl(map))\n    return map.weatherService\n  }\n\n  /**\n   * 经纬度网格服务\n   *   经纬度网格服务，显示经纬度网格。\n   * @params map 地图对象\n   * @params options 配置信息\n   */\n  static LatlngGraticuleServer(map: MyMap, options?: OptionsLatLngGraticule) {\n    map.latlngGraticuleServer ||\n      (map.latlngGraticuleServer = latlngGraticuleServer(map, options))\n    return map.latlngGraticuleServer\n  }\n\n  /**\n   * 晨昏线\n   *   经纬度网格服务，显示经纬度网格。\n   * @params map 地图对象\n   * @params options 配置信息\n   */\n  static TerminatorSymbolServer(map: MyMap) {\n    map.terminatorSymbol || (map.terminatorSymbol = terminatorSymbol(map))\n    return map.terminatorSymbol\n  }\n\n  /**\n    * 特殊区域展示服务\n    *   特殊区域展示服务\n        1、排放控制区\n        2、排放控制区(中国)\n        3、专属经济区\n        4、全球时区\n        5、全球海区\n        6、临海基线\n    * @params map 地图对象\n    * @params options 配置信息\n    */\n  static AreaViewSymbol(\n    map: MyMap,\n    options?: Partial<AreaViewSymbolOptions> | undefined\n  ) {\n    map.areaViewSymbol || (map.areaViewSymbol = areaViewSymbol(map, options))\n    return map.areaViewSymbol\n  }\n\n  /**\n   * 浮标展示服务\n   *  浮标展示服务,提供浮标显示、添加浮标、定位浮标等功能。\n   * @params map 地图对象\n   * @params options 配置信息\n   * {\n   *  onClick\tObject\t单击事件，默认：undefined\n   *  onHover\tObject\t悬浮事件，默认：undefined\n   *  flyToZoom\tObject\t定位默认zoom，默认：10\n   *  bigIconZoom\tObject\t大图标显示级别，默认：6\n   *  isShow\tObject\t是否显示航标，默认：true\n   *  isShowTooltip\tObject\t是否显示tooltip，默认：true\n   * }\n   * @return ShipxyAPI.NavigationServiceImpl | *\n   *\n   * @example\n   *    初始化浮标展示服务\n   * ShipxyAPI.NavigationService(elane_map, {\n   *        isShow: true,\n   *        iconScale: 0.6,\n   *        smallIconScale: 0.8,//小图标显示比例\n   *        isSelectedShowReal: false,//选中是否显示真实航标\n   * });\n   */\n  static NavigationService(map: MyMap, options: any) {\n    if (!map.navigationService) {\n      map.navigationService = new NavigationServiceImpl(map, options)\n    }\n    return map.navigationService\n  }\n\n  /**\n   * 港口服务\n   * @param map\n   * @param options\n   * @returns\n   */\n  static PortService(map: MyMap, options?: any) {\n    if (!map.portCanvasService) {\n      map.portCanvasService = new PortCanvas(map, options)\n    }\n    return map.portCanvasService\n  }\n  /**\n   * 轨迹服务\n   * @param map\n   * @param options\n   * @returns\n   */\n  static TrackService(map: MyMap, options?: any) {\n    if (!map.trackService) {\n      map.trackService = new TrackServiceImpl(map, options)\n    }\n    return map.trackService\n  }\n\n  /**\n   * 预测轨迹\n   * @param map\n   * @param options\n   * @returns\n   */\n  static TrackForecast(map: MyMap) {\n    if (!map.trackForecast) {\n      map.trackForecast = new TrackForecast(map)\n    }\n    return map.trackForecast\n  }\n\n  /**\n   * 航行警告\n   * @param map\n   * @param options\n   * @returns\n   */\n  static NavigationalWarning(map: MyMap, options?: any) {\n    if (!map.navigationalWarning) {\n      map.navigationalWarning = new NavigationalWarningService(map, options)\n    }\n    return map.navigationalWarning\n  }\n\n  /**\n   * 航线绘制\n   * @param map\n   * @param data\n   * @param options\n   * @returns\n   */\n  static trackDrawSymbol(\n    map: any,\n    options?: any,\n    data?: any\n  ): TrackDrawServiceImpl {\n    if (!map.trackDrawService) {\n      map.trackDrawService = trackDrawServiceImpl(map)\n    }\n    return map.trackDrawService.addTrackDraw(options, data)\n  }\n\n  /**\n   * 绘制图层\n   * @param map\n   * @param options\n   * @returns\n   */\n  static overLayers(map: MyMap, options = {}) {\n    if (!map.overLayers) map.overLayers = new OverLayers(map, options)\n    return map.overLayers\n  }\n\n  /**\n   * ais 图层工具展示\n   * @param map\n   * @param options\n   * @returns\n   */\n  static aisManagerService(map: MyMap, options?: Partial<AisManageOptions>) {\n    map.aisManager = map.aisManager || new AisManager(map, options)\n    return map.aisManager\n  }\n\n  /* >>>>>>>>>>> 其他接口 <<<<<<<<<<*/\n  /**\n   * 地图定位\n   * @param map\n   * @param lat\n   * @param lng\n   * @param layer\n   * @returns\n   */\n  static locationMap(map: MyMap, lat: number, lng: number, layer?: any) {\n    ShipxyAPI.removeLocationMap(map, layer)\n    const latlon = CanvasShipUtils.GPSEncryptByMapToLatLng(\n      L.latLng([lat, lng]),\n      map\n    )\n    map.setView(latlon, map.getZoom())\n\n    return L.marker(latlon, {\n      icon: L.icon({\n        iconUrl: 'https://cdn.xplusship.com/img/images/center.png',\n        iconAnchor: [16, 16],\n      }),\n    }).addTo(map)\n  }\n\n  /**\n   * 取消定位\n   * @param map\n   * @param layer\n   */\n  static removeLocationMap(map: MyMap, layer?: any) {\n    layer && map.removeLayer(layer)\n  }\n}\n"],"names":["MyMap","e","Map","constructor","o","i","super","this","offsetC","_options","getMapType","a","getContainer","id","s","getCookie","isEmpty","defaultMapType","setCookie","service","defaultOptions","attribution","isShow","emptyString","attributionControl","mapTypes","ak","gratings","maxZoom","type","centerPoint","zoom","minZoom","measureCtrl","position","mousePostionCtrl","zoomControlElane","zoomviewControl","basemapsControl","scaleCtrl","addTileLayer","cjhdTileLayer","miniMapControl","options","tileLayer","zoomControl","worldCopyJump","preferCanvas","wheelPxPerZoomLevel","zoomAnimation","markerZoomAnimation","zoomSnap","zoomDelta","fadeAnimation","wheelDebounceTime","r","_onAddController","t","_container","style","order","toString","classList","contains","addDefaultHooks","include","mapType","_mapLayers","mergeOptions","addInitHook","n","providerTiles","RASTER_WORLD","replace","RASTER_WORLD_GOOGLE","setView","setMaxBounds","latLngBounds","setMinZoom","setMaxZoom","removeControl","h","addTo","scaleElaneControl","g","nautic","imperial","metric","positionControl","M","separator","l","formatDegreesToDMS","lngFormatter","latFormatter","addControl","control","zoomInTitle","zoomOutTitle","polylineMeasureControl","p","unit","measureControlLabel","clearMeasurementsOnStop","showMeasurementsClearControl","showUnitControl","showBearings","tempLine","color","weight","fixedLine","stroke","startCircle","fillColor","fillOpacity","radius","intermedCircle","currentCircle","endCircle","tooltipTextFinish","tooltipTextDelete","tooltipTextMove","tooltipTextResume","tooltipTextAdd","bindTooltipText","changeUnitsText","unitControlTitle","text","metres","landmiles","nauticalmiles","clearControlTitle","measureControlTitleOn","measureControlTitleOff","bearingTextIn","bearingTextOut","cursor","COM_IMG_BASE64","ruler","_resetOptionByMapType","on","setTimeout","finalizeCallBack","addCloseButtonToPolyline","DomUtil","removeClass","_panes","overlayPane","markerPane","tooltipPane","getZoom","addClass","minimapControl","basemap","_url","changeLayer","shipsService","resizeHTML","getSize","mapReadyCallBack","Draw","L","ShipSjService","u","ShipService","m","WeatherService","weatherService","f","LatlngGraticuleServer","latlngGraticuleServer","d","TerminatorSymbolServer","terminatorSymbol","F","AreaViewSymbol","areaViewSymbol","y","NavigationService","navigationService","v","PortService","portCanvasService","C","TrackService","trackService","S","TrackForecast","trackForecast","b","NavigationalWarning","navigationalWarning","T","trackDrawSymbol","trackDrawService","w","addTrackDraw","overLayers","k","aisManagerService","aisManager","O","locationMap","removeLocationMap","c","GPSEncryptByMapToLatLng","latLng","marker","icon","iconUrl","iconAnchor","removeLayer","ShipxyAPI","Control","version","versionType","GeoJSON","geoJSON","geoJson","Layer","LayerGroup","layerGroup","FeatureGroup","featureGroup","LatLng","Marker","Circle","circle","circleMarker","Polyline","polyline","Polygon","polygon","Rectangle","rectangle","DivIcon","divIcon","extend","Util","Browser","console","log","window","length"],"mappings":"w8CAAymD,MAAMA,UAAcC,EAAEC,IAAI,WAAAC,CAAYC,EAAEC,GAAGC,MAAMF,EAAEC,GAAGE,KAAKC,SAAQ,EAAGD,KAAKE,SAASJ,CAAC,CAAC,UAAAK,GAAa,IAAIC,EAAE,MAAMP,EAAEG,KAAKK,eAAeC,GAAG,IAAIR,EAAES,EAAEC,UAAU,gBAAgBX,KAAK,OAAOU,EAAEE,QAAQX,KAAKA,EAAqB,OAAlBM,EAAEJ,KAAKE,eAAgB,EAAOE,EAAEM,eAAeH,EAAEI,UAAU,gBAAgBd,IAAIC,IAAIA,CAAC,EAAEL,EAAMmB,QAAQ,GAAGnB,EAAMoB,eAAe,CAACC,YAAY,CAACC,QAAO,EAAGC,YAAY,6CAA6CC,oBAAmB,EAAGC,SAAS,CAAC,SAAS,YAAY,gBAAgBC,GAAG,GAAGT,eAAe,YAAYU,SAAS,CAACL,QAAO,EAAGM,QAAQ,EAAEC,KAAK,gBAAgBC,YAAY,CAAC,KAAK,QAAQC,KAAK,EAAEC,QAAQ,EAAEJ,QAAQ,GAAGK,YAAY,CAACX,QAAO,EAAGY,SAAS,WAAWC,iBAAiB,CAACb,QAAO,EAAGY,SAAS,eAAeE,iBAAiB,CAACd,QAAO,EAAGY,SAAS,YAAYG,gBAAgB,CAACf,QAAO,EAAGY,SAAS,WAAWI,gBAAgB,CAAChB,QAAO,EAAGY,SAAS,YAAYK,UAAU,CAACjB,QAAO,EAAGY,SAAS,cAAcM,aAAa,GAAGC,cAAc,CAACnB,QAAO,GAAIoB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