riku
2025-03-20 3970cefa60ea7e5d899b7475345b65646c19c110
走航融合(待完成)
已修改4个文件
已添加1个文件
877 ■■■■■ 文件已修改
src/components.d.ts 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/model/SatelliteGrid.js 362 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/map/grid.js 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/underwaymix/UnderwayMixMode.vue 335 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/underwaymix/component/GridStyleTool.vue 145 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components.d.ts
@@ -34,16 +34,15 @@
    ElFormItem: typeof import('element-plus/es')['ElFormItem']
    ElIcon: typeof import('element-plus/es')['ElIcon']
    ElInput: typeof import('element-plus/es')['ElInput']
    ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
    ElOption: typeof import('element-plus/es')['ElOption']
    ElPagination: typeof import('element-plus/es')['ElPagination']
    ElPopover: typeof import('element-plus/es')['ElPopover']
    ElRadio: typeof import('element-plus/es')['ElRadio']
    ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
    ElRow: typeof import('element-plus/es')['ElRow']
    ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
    ElSelect: typeof import('element-plus/es')['ElSelect']
    ElSlider: typeof import('element-plus/es')['ElSlider']
    ElSpace: typeof import('element-plus/es')['ElSpace']
    ElSwitch: typeof import('element-plus/es')['ElSwitch']
    ElTable: typeof import('element-plus/es')['ElTable']
    ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
src/model/SatelliteGrid.js
@@ -10,15 +10,22 @@
  constructor(name) {
    this.name = name;
  }
  // åœ°å›¾ç½‘格相关对象
  // é»˜è®¤åœ°å›¾ç½‘格相关对象
  mapViews;
  mapViewsList = [];
  gridDataDetail;
  infoMap = new Map();
  // åœ°å›¾ç½‘格对象Map结构,存储对应key下的网格对象、网格坐标信息
  mapViewsMap = new Map();
  // ç½‘格数据Map结构,存储对应key下的网格监测数据信息
  gridDataDetailMap = new Map();
  districtPolygon;
  firstEvent;
  events = new Map();
@@ -83,8 +90,6 @@
      }
    }
  }
  firstEvent;
  // ç»˜åˆ¶ç½‘格线
  drawPolyline(gridInfo, event) {
@@ -166,14 +171,16 @@
    points,
    gridDataDetail,
    lastGridViews,
    opacity,
    zIndex,
    customColor
    customColor,
    style
  }) {
    // æ ¹æ®æ•°æ®ç­›é€‰æœ‰æ•°æ®çš„网格
    const res = [];
    // ä»¥åŠå¯¹åº”的中心点坐标
    const pointsRes = [];
    // ç½‘格按照其编号升序排列,然后计算编号和下表的偏差值
    const offset = gridViews[0].getExtData().gridCell.cellIndex - 0;
    gridDataDetail.forEach((d) => {
      // æ ¹æ®æ•°æ®å…³è”的网格编号,找到对应网格
      const cellId = d.cellId;
@@ -182,8 +189,8 @@
          '遥测数据的网格索引编号超出网格组范围,数据和网格组可能不对应'
        );
      }
      res.push(gridViews[cellId - 1]);
      pointsRes.push(points[cellId - 1]);
      res.push(gridViews[cellId - offset]);
      pointsRes.push(points[cellId - offset]);
    });
    // æ ¹æ®ç»˜åˆ¶é¢œè‰²æ–¹å¼ç»˜åˆ¶ç½‘æ ¼
@@ -192,16 +199,14 @@
      resGridViews = gridMapUtil.drawGridColorCustom(
        res,
        gridDataDetail,
        opacity,
        zIndex
        style.opacity
      );
    } else {
      resGridViews = gridMapUtil.drawGridColor(
        res,
        gridDataDetail,
        'PM25',
        opacity,
        zIndex
        style
      );
    }
@@ -223,167 +228,86 @@
  // ç»˜åˆ¶ç½‘格遥感数据值和网格颜色
  drawGrid({
    gridDataDetail,
    useCustomColor,
    opacity,
    zIndex,
    showDataTxt,
    showRankTxt,
    useDataTxtColor,
    mapViews
    mapViews,
    data,
    grid = { useCustomColor: false, style: { opacity: 1, zIndex: 11 } },
    dataTxt = { isShow: false, useCustomColor: false, useColor: false },
    rankTxt = { isShow: false }
  }) {
    const _mapViews = mapViews ? mapViews : this.mapViews;
    // SatelliteProxy.clearText(mapViews);
    this.gridDataDetail = data;
    const { resGridViews, pointsRes } = this.drawColor({
      gridViews: _mapViews.gridViews,
      points: _mapViews.points,
      gridDataDetail: gridDataDetail,
      gridDataDetail: data,
      lastGridViews: _mapViews.lastGridViews,
      customColor: useCustomColor,
      opacity: opacity,
      zIndex: zIndex
      customColor: grid.useCustomColor,
      style: grid.style
    });
    _mapViews.lastGridViews = resGridViews;
    _mapViews.lastPoints = pointsRes;
    // æ•°æ®æ ‡è®°
    const { textViews: dataTxt, labelsLayer: dataLayer } = this.drawDataText(
    const { textViews: dtv } = this.drawDataText(
      _mapViews.lastPoints,
      gridDataDetail,
      data,
      _mapViews.dataTxt,
      useCustomColor,
      useDataTxtColor
      dataTxt.useCustomColor,
      dataTxt.useColor
    );
    _mapViews.dataTxt = dataTxt;
    _mapViews.dataLayer = dataLayer;
    _mapViews.dataTxt = dtv;
    const { textViews: rankTxt, labelsLayer: rankLayer } = this.drawRankText(
    const { textViews: rtv } = this.drawRankText(
      _mapViews.lastPoints,
      gridDataDetail,
      data,
      _mapViews.rankTxt,
      _mapViews.rankLayer
    );
    _mapViews.rankTxt = rankTxt;
    _mapViews.rankLayer = rankLayer;
    _mapViews.rankTxt = rtv;
    if (showDataTxt) {
    if (dataTxt.isShow) {
      map.add(_mapViews.dataTxt);
    }
    if (showRankTxt) {
    if (rankTxt.isShow) {
      map.add(_mapViews.rankTxt);
    }
  }
  //
  drawGrids({
    gridDataDetailList,
    useCustomColor,
    opacity,
    zIndex,
    showDataTxt,
    showRankTxt
  }) {
    if (this.mapViewsList.length < gridDataDetailList.length) {
      let index = this.mapViewsList.length;
      while (index < gridDataDetailList.length) {
        const newMapViews = {
          gridViews: gridMapUtil.drawPolylines({
            points: this.mapViews.gridPoints,
            event: this.firstEvent
          }),
          gridPoints: JSON.parse(JSON.stringify(this.mapViews.gridPoints)),
          points: JSON.parse(JSON.stringify(this.mapViews.points))
        };
        this.mapViewsList.push(newMapViews);
      }
    }
    this.mapViewsList.forEach((m, i) => {
      this.drawGrid({
        gridDataDetail: gridDataDetailList[i],
        useCustomColor,
        opacity,
        zIndex,
        showDataTxt,
        showRankTxt,
        mapViews: m
      });
    });
  }
  drawNewGrid({
    gridDataDetail,
    useCustomColor,
    opacity,
    zIndex,
    showDataTxt,
    showRankTxt
  }) {
    const newMapViews = {
      gridViews: gridMapUtil.drawPolylines({
        points: this.mapViews.gridPoints,
        event: this.firstEvent
      }),
      gridPoints: JSON.parse(JSON.stringify(this.mapViews.gridPoints)),
      points: JSON.parse(JSON.stringify(this.mapViews.points))
    };
    this.mapViewsList.push(newMapViews);
    this.drawGrid({
      gridDataDetail,
      useCustomColor,
      opacity,
      zIndex,
      showDataTxt,
      showRankTxt,
      mapViews: newMapViews
    });
  }
  drawTagGrid({
    tag,
    gridDataDetail,
    useCustomColor,
    opacity,
    zIndex,
    showDataTxt,
    showRankTxt
  }) {
  /**
   * æ ¹æ®tag标签,展示已有的网格或绘制一组新的网格
   * @param {Object} param0 {
   * tag, æ ‡ç­¾
   * gridDataDetail, ç½‘格数据数组
   * useCustomColor, æ˜¯å¦ä½¿ç”¨å¯¹æ¯”色
   * opacity, é€æ˜Žåº¦ï¼Œå–值[0, 1]
   * zIndex, åœ°å›¾æ˜¾ç¤ºå±‚级
   * showDataTxt, æ˜¯å¦æ˜¾ç¤ºæ•°æ®æ–‡æœ¬
   * showRankTxt, æ˜¯å¦æ˜¾ç¤ºæŽ’名文本
   * extData, è‡ªå®šä¹‰é¢å¤–信息对象
   * }
   */
  drawTagGrid({ tag, data, grid, dataTxt, rankTxt, extData }) {
    if (!this.mapViewsMap.has(tag)) {
      const newMapViews = {
        gridViews: gridMapUtil.drawPolylines({
          points: this.mapViews.gridPoints,
          event: this.firstEvent
        }),
        gridPoints: JSON.parse(JSON.stringify(this.mapViews.gridPoints)),
        points: JSON.parse(JSON.stringify(this.mapViews.points))
      };
      const newMapViews = this._createNewMapViews({ extData });
      this.infoMap.set(tag, extData);
      this.mapViewsMap.set(tag, newMapViews);
      this.gridDataDetailMap.set(tag, data);
    }
    const _mapViews = this.mapViewsMap.get(tag);
    this.drawGrid({
      gridDataDetail,
      useCustomColor,
      opacity,
      zIndex,
      showDataTxt,
      showRankTxt,
      mapViews: _mapViews
      mapViews: _mapViews,
      data,
      grid,
      dataTxt,
      rankTxt
    });
  }
  // è°ƒæ•´å„类地图覆盖物的可见性
  changeVisibility({ tag, showGridViews, showDataTxt, showRankTxt }) {
    let _mapViewsList = [];
    if (this.mapViews) {
      _mapViewsList.push(this.mapViews);
    }
    if (tag && this.mapViewsMap.has(tag)) {
      _mapViewsList.push(this.mapViewsMap.get(tag));
    } else {
      this.mapViewsMap.forEach((v) => {
        _mapViewsList.push(v);
      });
    }
  changeVisibility({ tags = [], showGridViews, showDataTxt, showRankTxt }) {
    let { _mapViewsList } = this._getMapViews(...tags);
    if (showGridViews != undefined) {
      if (showGridViews) {
        // map.add(this.mapViews.lastGridViews);
@@ -426,17 +350,8 @@
  }
  changeGridOpacity({ tag, isOpacity, opacityValue }) {
    let _mapViewsList = [];
    if (this.mapViews) {
      _mapViewsList.push(this.mapViews);
    }
    if (tag && this.mapViewsMap.has(tag)) {
      _mapViewsList.push(this.mapViewsMap.get(tag));
    } else {
      this.mapViewsMap.forEach((v) => {
        _mapViewsList.push(v);
      });
    }
    let { _mapViewsList } = tag ? this._getMapViews(tag) : this._getMapViews();
    _mapViewsList.forEach((v) => {
      if (v.lastGridViews) {
        v.lastGridViews.forEach((e) => {
@@ -451,6 +366,37 @@
        });
      }
    });
  }
  changeGridColor({
    tag,
    useCustomColor,
    opacity,
    zIndex,
    isMixGridHighlight
  }) {
    let { _mapViewsList, _gridDataDetailList } = this._getMapViews(tag);
    if (_mapViewsList.length == _gridDataDetailList.length) {
      _mapViewsList.forEach((v, i) => {
        if (v.lastGridViews) {
          const lastGridDataDetail = _gridDataDetailList[i];
          if (useCustomColor) {
            gridMapUtil.drawGridColorCustom(
              v.lastGridViews,
              lastGridDataDetail,
              { opacity, zIndex }
            );
          } else {
            gridMapUtil.drawGridColor(
              v.lastGridViews,
              lastGridDataDetail,
              'PM25',
              { opacity, zIndex, isMixGridHighlight }
            );
          }
        }
      });
    }
  }
  setGridEvent(name, event) {
@@ -485,4 +431,120 @@
      });
    }
  }
  /**
   * å°†å¤šç»„网格进行融合
   * é‡å çš„网格进行监测数据均值计算并重新计算对应颜色,形成新的一组融合网格
   * @param {...String} tags éœ€è¦èžåˆçš„网格标签,当为空时,默认融合所有网格
   */
  mixGrid(tags) {
    tags.sort((a, b) => {
      return a < b ? -1 : 1;
    });
    const mixTag = tags.join('-');
    if (this.mapViewsMap.has(mixTag)) {
      this.changeVisibility({
        tag: mixTag,
        showGridViews: true
      });
    } else {
      // const mixMapViews = this._createNewMapViews();
      // æ ¹æ®æ ‡ç­¾tag,获取对应多组网格数据
      let { _gridDataDetailList } = this._getMapViews(...tags);
      const _dataMap = new Map();
      // å°†æ¯ç»„每个网格数据按照网格编号进行分类,相同网格的数组归集至一起
      _gridDataDetailList.forEach((list) => {
        list.forEach((gdd) => {
          if (!_dataMap.has(gdd.cellId)) {
            _dataMap.set(gdd.cellId, {
              source: [],
              res: {}
            });
          }
          _dataMap.get(gdd.cellId).source.push(gdd);
        });
      });
      // è®¡ç®—每个网格下的数据均值
      const resGridDataDetail = [];
      _dataMap.forEach((v, k) => {
        let total = 0,
          count = v.source.length;
        v.source.forEach((s) => {
          total += s.pm25;
        });
        v.res = {
          isMixData: true,
          groupId: v.source[0].groupId,
          cellId: v.source[0].cellId,
          pm25: count == 0 ? null : Math.round((total / count) * 10) / 10,
          originData: v.source
        };
        // æ•°æ®é‡è¶…过1个时,表明该网格数据是融合的,展示高亮的样式
        if (count > 1) {
          v.res.gridStyle = {
            strokeWeight: 2,
            strokeColor: 'blue'
          };
        }
        resGridDataDetail.push(v.res);
      });
      // é‡æ–°æŒ‰ç…§ç›‘测数据排序并标记排名
      resGridDataDetail.sort((a, b) => {
        return b.pm25 - a.pm25;
      });
      resGridDataDetail.forEach((gdd, i) => {
        gdd.rank = i + 1;
      });
      this.drawTagGrid({
        tag: mixTag,
        data: resGridDataDetail,
        grid: {
          style: {
            isMixGridHighlight: true
          }
        }
      });
    }
    return mixTag;
  }
  _getMapViews(...tags) {
    let _mapViewsList = [],
      _gridDataDetailList = [];
    if (tags.length > 0) {
      tags.forEach((tag) => {
        if (this.mapViewsMap.has(tag) && this.gridDataDetailMap.has(tag)) {
          _mapViewsList.push(this.mapViewsMap.get(tag));
          _gridDataDetailList.push(this.gridDataDetailMap.get(tag));
        }
      });
    } else {
      this.mapViewsMap.forEach((v) => {
        _mapViewsList.push(v);
      });
      this.gridDataDetailMap.forEach((v) => {
        _gridDataDetailList.push(v);
      });
      if (this.mapViews && this.gridDataDetail) {
        _mapViewsList.push(this.mapViews);
        _gridDataDetailList.push(this.gridDataDetail);
      }
    }
    return { _mapViewsList, _gridDataDetailList };
  }
  _createNewMapViews({ extData }) {
    return {
      gridViews: gridMapUtil.drawPolylines({
        points: this.mapViews.gridPoints,
        event: this.firstEvent
      }),
      gridPoints: JSON.parse(JSON.stringify(this.mapViews.gridPoints)),
      points: JSON.parse(JSON.stringify(this.mapViews.points)),
      extData
    };
  }
}
src/utils/map/grid.js
@@ -348,7 +348,8 @@
   * @param {string} factorName ç›‘测因子名称
   * @param {number} opacity é€æ˜Žåº¦
   */
  drawGridColor(gridViews, gridDataDetail, factorName, opacity, zIndex) {
  drawGridColor(gridViews, gridDataDetail, factorName, style) {
    let { strokeWeight, strokeColor, opacity, zIndex } = style;
    const res = [];
    // éåŽ†å«æ˜Ÿé¥æµ‹æ•°æ®æ•°ç»„
    gridDataDetail.forEach((d, i) => {
@@ -365,11 +366,25 @@
          nextColor.map((v) => v * 255),
          ratio
        );
        const _extData = grid.getExtData();
        grid.setOptions({
          zIndex: zIndex ? zIndex : 10,
          fillColor: _color,
          fillOpacity: opacity ? opacity : color[3] == 0 ? 0 : 0.7
          ...style,
          fillColor: _color, //多边形填充颜色
          fillOpacity: style.opacity ? style.opacity : color[3] == 0 ? 0 : 1,
          extData: {
            ..._extData,
            gridData: d
          }
        });
        if (d.gridStyle && style.isMixGridHighlight) {
          const _strokeWeight = d.gridStyle.strokeWeight;
          const _strokeColor = d.gridStyle.strokeColor;
          grid.setOptions({
            strokeWeight: _strokeWeight, //线条宽度,默认为 1
            strokeColor: _strokeColor //线条颜色
          });
        }
        res.push(grid);
      }
@@ -378,7 +393,9 @@
    return res;
  },
  drawGridColorCustom(gridViews, gridDataDetail, opacity) {
  drawGridColorCustom(gridViews, gridDataDetail, style) {
    const { strokeWeight, strokeColor, opacity, zIndex } = style;
    var max, min;
    gridDataDetail.forEach((t) => {
      if (!t.pm25) return;
@@ -407,8 +424,9 @@
          ratio
        );
        grid.setOptions({
          fillColor: _color,
          fillOpacity: opacity ? opacity : color[3] == 0 ? 0 : 0.7
          ...style,
          fillColor: _color, //多边形填充颜色
          fillOpacity: style.opacity ? style.opacity : color[3] == 0 ? 0 : 0.7
        });
        res.push(grid);
src/views/underwaymix/UnderwayMixMode.vue
@@ -1,158 +1,146 @@
<template>
  <div class="p-events-none m-t-2">
    <el-row justify="space-between">
      <el-row class="wrap">
        <el-col span="2">
          <el-row>
            <BaseCard v-show="show" size="medium" direction="left">
              <template #content>
                <el-row>
                  <el-form :inline="true">
                    <el-form-item label="走航融合">
                      <el-select
                        v-model="selectedfusionData"
                        multiple
                        clearable
                        @change="handleChange"
                        placeholder="选择任务"
                        size="small"
                        style="width: 160px"
                        :loading="fusionLoading"
                      >
                        <el-option
                          v-for="(s, i) in fusionDataList"
                          :key="i"
                          :label="s.mixDataId"
                          :value="i"
                        />
                      </el-select>
                    </el-form-item>
                    <el-form-item>
                      <el-button
                        type="primary"
                        class="el-button-custom"
                        size="small"
                        :disabled="
                          !gridCellList || selectedfusionData.length == 0
                        "
                        @click="handleFusionClick"
                      >
                        {{ '叠加融合' }}
                      </el-button>
                    </el-form-item>
                  </el-form>
                </el-row>
                <div class="m-t-8">操作</div>
                <el-row class="m-t-8">
                  <el-button
                    type="primary"
                    class="el-button-custom"
                    size="small"
                    @click="handleRankClick"
                  >
                    {{ mixActive ? '取消' : '显示排名' }}
                  </el-button>
                  <CheckButton
                    active-text="取消融合"
                    inactive-text="隐藏融合"
                    :default-value="false"
                    @change="handleMixClick"
                  >
                  </CheckButton>
                </el-row>
                <div class="m-t-8">网格要素</div>
                <el-row class="m-t-8">
                  <CheckButton
                    active-text="显示网格"
                    inactive-text="隐藏网格"
                    :default-value="true"
                    @change="handleGridClick"
                  >
                  </CheckButton>
                  <!-- <el-button
                    type="primary"
                    class="el-button-custom"
                    size="small"
                    @click="handleGridClick"
                  >
                    {{ gridVisible ? '隐藏融合' : '显示融合' }}
                  </el-button> -->
                  <el-button
                    type="primary"
                    class="el-button-custom"
                    size="small"
                    @click="handleRankClick"
                  >
                    {{ rankVisible ? '隐藏排名' : '显示排名' }}
                  </el-button>
                  <el-button
                    type="primary"
                    class="el-button-custom"
                    size="small"
                    @click="handleDataClick"
                  >
                    {{ dataVisible ? '隐藏数据' : '显示数据' }}
                  </el-button>
                </el-row>
                <div class="m-t-8">网格样式</div>
                <el-row class="m-t-8">
                  <el-button
                    type="primary"
                    class="el-button-custom"
                    size="small"
                    @click="handleOpacityClick"
                  >
                    {{ !isOpacity ? '透明化' : '取消透明化' }}
                  </el-button>
                  <el-button
                    type="primary"
                    class="el-button-custom"
                    size="small"
                    @click="handleColorClick"
                  >
                    {{ isStandardColor ? '绘制对比色' : '绘制标准色' }}
                  </el-button>
                </el-row>
                <div class="m-t-8">走航要素</div>
                <el-row class="m-t-8">
                  <!-- <el-divider content-position="left"></el-divider> -->
  <!-- <div class="p-events-none m-t-2"> -->
  <el-row justify="space-between">
    <el-row class="wrap">
      <el-col span="2">
        <el-row>
          <BaseCard v-show="show" size="medium" direction="left">
            <template #content>
              <el-row>
                <el-form :inline="true">
                  <el-form-item label="走航融合">
                    <el-select
                      v-model="selectedfusionData"
                      multiple
                      clearable
                      @change="handleChange"
                      placeholder="选择任务"
                      size="small"
                      style="width: 160px"
                      :loading="fusionLoading"
                    >
                      <el-option
                        v-for="(s, i) in fusionDataList"
                        :key="i"
                        :label="s.mixDataId"
                        :value="i"
                      />
                    </el-select>
                  </el-form-item>
                  <el-form-item>
                    <el-button
                      type="primary"
                      class="el-button-custom"
                      size="small"
                      :disabled="
                        !gridCellList || selectedfusionData.length == 0
                      "
                      @click="handleFusionClick"
                    >
                      {{ '叠加融合' }}
                    </el-button>
                  </el-form-item>
                </el-form>
              </el-row>
              <div class="m-t-8">操作</div>
              <el-row class="m-t-8">
                <CheckButton
                  active-text="开启融合"
                  inactive-text="隐藏融合"
                  :default-value="false"
                  @change="handleMixClick"
                >
                </CheckButton>
              </el-row>
              <div class="m-t-8">网格要素</div>
              <el-row class="m-t-8">
                <CheckButton
                  active-text="显示网格"
                  inactive-text="隐藏网格"
                  :default-value="true"
                  @change="handleGridClick"
                >
                </CheckButton>
                <el-button
                  type="primary"
                  class="el-button-custom"
                  size="small"
                  @click="handleRankClick"
                >
                  {{ rankVisible ? '隐藏排名' : '显示排名' }}
                </el-button>
                <el-button
                  type="primary"
                  class="el-button-custom"
                  size="small"
                  @click="handleDataClick"
                >
                  {{ dataVisible ? '隐藏数据' : '显示数据' }}
                </el-button>
              </el-row>
              <div class="m-t-8">网格样式</div>
              <el-row class="m-t-8">
                <el-button
                  type="primary"
                  class="el-button-custom"
                  size="small"
                  @click="handleOpacityClick"
                >
                  {{ !isOpacity ? '透明化' : '取消透明化' }}
                </el-button>
                <el-button
                  type="primary"
                  class="el-button-custom"
                  size="small"
                  @click="handleColorClick"
                >
                  {{ isStandardColor ? '绘制对比色' : '绘制标准色' }}
                </el-button>
              </el-row>
              <div class="m-t-8">走航要素</div>
              <el-row class="m-t-8">
                <!-- <el-divider content-position="left"></el-divider> -->
                  <el-button
                    type="primary"
                    class="el-button-custom"
                    size="small"
                    :loading="missionLoading || loading"
                    @click="handleUnderwayClick"
                  >
                    {{ underwayVisible ? '隐藏走航路线' : '显示走航路线' }}
                  </el-button>
                </el-row>
              </template>
              <template #footer> </template>
            </BaseCard>
          </el-row>
        </el-col>
        <el-col span="2">
          <el-row>
            <CardButton
              name="走航融合"
              direction="right"
              @click="() => (show = !show)"
            ></CardButton>
          </el-row>
        </el-col>
      </el-row>
                <el-button
                  type="primary"
                  class="el-button-custom"
                  size="small"
                  :loading="missionLoading || loading"
                  @click="handleUnderwayClick"
                >
                  {{ underwayVisible ? '隐藏走航路线' : '显示走航路线' }}
                </el-button>
              </el-row>
            </template>
            <template #footer> </template>
          </BaseCard>
        </el-row>
      </el-col>
      <el-col span="2">
        <el-row>
          <CardButton
            name="走航融合"
            direction="right"
            @click="() => (show = !show)"
          ></CardButton>
        </el-row>
      </el-col>
    </el-row>
  </div>
    <GridStyleTool :gridCtrls="gridCtrls"></GridStyleTool>
  </el-row>
  <!-- </div> -->
</template>
<script setup>
import { ref, onMounted, onUnmounted, watch } from 'vue';
import { ref, onMounted, onUnmounted, watch, computed } from 'vue';
import moment from 'moment';
import gridApi from '@/api/gridApi';
import { SatelliteGrid } from '@/model/SatelliteGrid';
import GridStyleTool from './component/GridStyleTool.vue';
const satelliteGrid = new SatelliteGrid();
const satelliteGrid = new SatelliteGrid('走航融合');
const gridCtrls = ref([satelliteGrid]);
// å€Ÿç”¨å«æ˜Ÿé¥æµ‹æ¨¡å—中的100米网格
const props = defineProps({
@@ -174,6 +162,7 @@
const gridDataDetailMap = new Map();
const mixActive = ref(false);
const gridVisible = ref(true);
const underwayVisible = ref(false);
const rankVisible = ref(false);
@@ -220,11 +209,6 @@
  satelliteGrid.gridPrepare(gridInfo);
}
// ç»˜åˆ¶ç½‘格遥感数据值和网格颜色
function drawGrid(gridDataDetail) {
  satelliteGrid.drawGrid({ gridDataDetail, opacity: 1, zIndex: 11 });
}
// watch(mission, (nV, oV) => {
//   if (nV != oV) {
//     checkUnderwayFusionResult();
@@ -254,37 +238,54 @@
  selectedfusionData.value.forEach((i) => {
    const d = fusionDataList.value[i];
    if (gridDataDetailMap.has(d.id)) {
      // const gdd = gridDataDetailMap.get(d.id);
      // satelliteGrid.drawTagGrid({
      //   tag: d.id,
      //   gridDataDetail: gdd,
      //   opacity: 1,
      //   zIndex: 11
      // });
      satelliteGrid.changeVisibility({ tag: d.id, showGridViews: true });
      satelliteGrid.changeVisibility({ tags: [d.id], showGridViews: true });
      // gridCtrls.value = Array.from(satelliteGrid.mapViewsMap);
      gridCtrls.value = [satelliteGrid];
    } else {
      gridApi.fetchGridDataDetail(d.id, d.groupId).then((res) => {
        gridDataDetailMap.set(d.id, res.data);
        const gdd = res.data;
        satelliteGrid.drawTagGrid({
          tag: d.id,
          gridDataDetail: gdd,
          opacity: 1,
          zIndex: 11
          data: gdd,
          extData: {
            name: `走航网格 - ${d.mixDataId}`
          }
        });
        gridCtrls.value = [satelliteGrid];
        // gridCtrls.value = Array.from(satelliteGrid.mapViewsMap);
        // console.log(gridCtrls.value);
      });
    }
  });
}
function handleMixClick(params) {}
function handleMixClick() {
  mixActive.value = !mixActive.value;
  const tags = fusionDataList.value
    .filter((v, i) => selectedfusionData.value.indexOf(i) != -1)
    .map((v) => v.id);
  satelliteGrid.changeVisibility({
    showGridViews: false,
    showDataTxt: false,
    showRankTxt: false
  });
  if (mixActive.value) {
    satelliteGrid.mixGrid(tags);
  } else {
    satelliteGrid.changeVisibility({
      tags,
      showGridViews: true
    });
  }
}
function handleGridClick() {
  gridVisible.value = !gridVisible.value;
  selectedfusionData.value.forEach((i) => {
    const d = fusionDataList.value[i];
    satelliteGrid.changeVisibility({
      tag: d.id,
      tags: [d.id],
      showGridViews: gridVisible.value
    });
  });
@@ -300,7 +301,7 @@
  selectedfusionData.value.forEach((i) => {
    const d = fusionDataList.value[i];
    satelliteGrid.changeVisibility({
      tag: d.id,
      tags: [d.id],
      showRankTxt: rankVisible.value
    });
  });
@@ -311,7 +312,7 @@
  selectedfusionData.value.forEach((i) => {
    const d = fusionDataList.value[i];
    satelliteGrid.changeVisibility({
      tag: d.id,
      tags: [d.id],
      showDataTxt: dataVisible.value
    });
  });
@@ -322,10 +323,8 @@
  selectedfusionData.value.forEach((i) => {
    const d = fusionDataList.value[i];
    if (gridDataDetailMap.has(d.id)) {
      const gdd = gridDataDetailMap.get(d.id);
      satelliteGrid.drawTagGrid({
      satelliteGrid.changeGridColor({
        tag: d.id,
        gridDataDetail: gdd,
        useCustomColor: !isStandardColor.value,
        opacity: 1,
        zIndex: 11
src/views/underwaymix/component/GridStyleTool.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,145 @@
<template>
  <el-row class="wrap">
    <el-col span="2">
      <el-row>
        <CardButton
          name="网格样式"
          direction="left"
          @click="() => (show = !show)"
        ></CardButton>
      </el-row>
    </el-col>
    <el-col span="2">
      <BaseCard v-show="show" direction="right" borderless="r">
        <template #content>
          <div class="content-wrap">
            <div v-for="(g, i) in gridCtrlList" :key="i">
              {{ g.name }}
              <div v-for="(value, t) in g.views" :key="t">
                <!-- {{ value[0] }} -->
                {{ value[1].extData.name }}
                <!-- {{ key }} -->
                <!-- <el-text>{{ g.name }}</el-text> -->
                <!-- <div class="m-t-8">网格要素</div> -->
                <el-row class="m-t-8">
                  <CheckButton
                    active-text="显示网格"
                    inactive-text="隐藏网格"
                    :default-value="true"
                    @change="handleGridClick"
                  >
                  </CheckButton>
                  <CheckButton
                    active-text="显示排名"
                    inactive-text="隐藏排名"
                    :default-value="false"
                    @change="handleGridClick"
                  >
                  </CheckButton>
                  <CheckButton
                    active-text="显示数据"
                    inactive-text="隐藏数据"
                    :default-value="false"
                    @change="handleGridClick"
                  >
                  </CheckButton>
                </el-row>
                <el-row class="m-b-8" gap="2">
                  <div class="m-t-8">网格透明度</div>
                  <el-slider
                    v-model="opacityValue"
                    :min="0"
                    :max="1"
                    :step="0.1"
                    show-stops
                    @change="handleOpacityChange"
                    style="width: 200px"
                  />
                </el-row>
              </div>
            </div>
          </div>
        </template>
      </BaseCard>
    </el-col>
  </el-row>
</template>
<script setup>
/**
 * ç½‘格样式控制工具
 */
import { ref, watch, computed } from 'vue';
const props = defineProps({
  // ç½‘格管理对象[SatelliteGrid]数组
  gridCtrls: {
    type: Array,
    default: () => []
  }
});
const gridCtrlList = computed(() => {
  return props.gridCtrls.map((g) => {
    return {
      name: g.name,
      views: Array.from(g.mapViewsMap)
    };
  });
});
// watch(
//   () => props.gridCtrls,
//   (nV, oV) => {
//     gridCtrlList.value = nV.map((v) => {
//       return Array.from(v.infoMap);
//     });
//   },
//   { deep: true }
// );
const show = ref(true);
const gridVisible = ref(false);
const rankVisible = ref(false);
const dataVisible = ref(false);
const isStandardColor = ref(true);
const isOpacity = ref(false);
const opacityValue = ref(0.7);
const emits = defineEmits([
  'showRank',
  'showData',
  'changeColor',
  'changeOpacity'
]);
function handleRankClick() {
  rankVisible.value = !rankVisible.value;
  emits('showRank', rankVisible.value);
}
function handleDataClick() {
  dataVisible.value = !dataVisible.value;
  emits('showData', dataVisible.value);
}
function handleColorClick() {
  isStandardColor.value = !isStandardColor.value;
  emits('changeColor', isStandardColor.value);
}
function handleOpacityClick() {
  // isOpacity.value = !isOpacity.value;
  // emits('changeOpacity', isOpacity.value);
}
function handleOpacityChange(value) {
  emits('changeOpacity', value);
}
</script>
<style scoped>
.content-wrap {
  min-width: 300px;
  min-height: 600px;
}
</style>