riku
2024-06-13 021e4bb85124931388b067c262d844bcd6f1db09
src/utils/map/index_old.js
@@ -1,5 +1,8 @@
/* eslint-disable no-undef */
// import '@/lib/AMap';
import { useToolboxStore } from '@/stores/toolbox';
const toolboxStore = useToolboxStore();
var mapInitDone = false;
var onMapMountedEvents = [];
@@ -8,6 +11,8 @@
var map;
// 卫星图层
var satellite;
// 地图拖动控制
var controlbar;
// 鼠标绘图
var mouseTool;
// 3D图层
@@ -48,24 +53,37 @@
    viewMode: '3D', // 地图模式
    resizeEnable: true,
    center: [121.6039283, 31.25295567],
    zooms: [3, 18],
    zooms: [0, 18],
    zoom: 14
  });
  // 添加卫星地图
  // satellite = new AMap.TileLayer.Satellite();
  // satellite.show();
  // map.add([satellite]);
  satellite = new AMap.TileLayer.Satellite();
  satellite.show();
  map.add([satellite]);
  toolboxStore.featuresStatus = true;
  _initControlbar();
  // _initMouseTool();
  _init3DLayer();
  _initDragEvent();
}
// 鼠标绘图初始化
function _initMouseTool() {
  mouseTool = new AMap.MouseTool(map);
function _initControlbar() {
  controlbar = new AMap.ControlBar({
    position: {
      right: '300px',
      top: '260px'
    }
  });
  map.addControl(controlbar);
  toolboxStore.controlbarStatus = true;
}
// 鼠标绘图初始化
// function _initMouseTool() {
//   mouseTool = new AMap.MouseTool(map);
// }
// 3D图层初始化
function _init3DLayer() {
@@ -87,4 +105,13 @@
  });
}
export { createMap, onMapMounted, map, mouseTool, object3Dlayer, isDragging };
export {
  createMap,
  onMapMounted,
  map,
  controlbar,
  mouseTool,
  satellite,
  object3Dlayer,
  isDragging
};