Riku
2025-03-20 7d02024c5351e620dcc2d49f36331e4a37228ea4
src/utils/map/marks.js
@@ -3,8 +3,6 @@
 */
import { map } from './index_old';
import sector from './sector';
import { DialogUtil } from './dialog';
import { useToolboxStore } from '@/stores/toolbox';
const toolboxStore = useToolboxStore();
@@ -21,16 +19,13 @@
    if (!toolboxStore.dataMarkerStatus) {
      return;
    }
    if (_massMarks) {
      map.remove(_massMarks);
      _massMarks = undefined;
    }
    this.clearMassMarks();
    const lnglats = fDatas.lnglats_GD;
    var data = [];
    for (let i = 0; i < lnglats.length; i++) {
      data.push({
        lnglat: lnglats[i], //点标记位置
        name: `${fDatas.times[i]}<br/>${_factor.factorName}: ${_factor.datas[i].factorData} mg/m³`,
        name: `${fDatas.times[i]}<br/>${_factor.factorName}: ${_factor.datas[i].factorData} μg/m³`,
        id: i
      });
    }
@@ -77,14 +72,27 @@
    _massMarks = massMarks;
    map.add(massMarks);
  },
  clearMassMarks() {
    if (_massMarks) {
      map.remove(_massMarks);
      _massMarks = undefined;
    }
  },
  createLabelMarks(img, dataList) {
  /**
   * 创建标记点
   * @param {string | Array} img 图标或图标数组
   * @param {Array} dataList 监测数据
   * @param {boolean} collision 标注避让
   * @returns
   */
  createLabelMarks(img, dataList, collision = true) {
    // eslint-disable-next-line no-undef
    const layer = new AMap.LabelsLayer({
      zooms: [3, 20],
      zIndex: 1000,
      // 开启标注避让,默认为开启,v1.4.15 新增属性
      collision: true,
      collision: collision,
      // 开启标注淡入动画,默认为开启,v1.4.15 新增属性
      animation: true
    });
@@ -102,10 +110,10 @@
        zIndex: 10,
        icon: {
          type: 'image',
          image: img,
          image: typeof img === 'string' ? img : img[i],
          // clipOrigin: [14, 92],
          // clipSize: [50, 68],
          size: [24, 24],
          size: [30, 30],
          anchor: 'bottom-center',
          angel: 0,
          retina: true
@@ -115,12 +123,12 @@
          direction: 'top',
          offset: [0, -5],
          style: {
            fontSize: 15,
            fontSize: 16,
            fontWeight: 'normal',
            fillColor: '#fff',
            strokeColor: '#333',
            strokeWidth: 2
            // backgroundColor: '#b1009b'
            strokeWidth: 0,
            backgroundColor: '#122b54a9'
          }
        }
      };