Riku
2025-03-02 de6fd089b37613808e5a3bef38ecc0761f7456e0
src/views/satellitetelemetry/component/SatelliteMixTool.vue
@@ -1,94 +1,104 @@
<template>
  <CardDialog
    v-model="dialogVisible"
    title="走航融合"
    draggable
    :modal="false"
    width="400px"
  >
    <template #default>
      <el-row>
        <OptionMission v-model="mission"></OptionMission>
        <el-text size="small" :type="fusionData ? 'success' : 'warning'">{{
          fusionData ? '走航数据已融合' : '走航数据未融合'
        }}</el-text>
      </el-row>
      <el-row>
        <el-button
          type="primary"
          class="el-button-custom"
          size="small"
          :disabled="!gridCellList || !fusionData"
          @click="handleFusionClick"
        >
          {{ '叠加融合' }}
        </el-button>
        <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"
          :loading="loading"
          @click="handleUnderwayClick"
        >
          {{ underwayVisible ? '隐藏走航路线' : '显示走航路线' }}
        </el-button>
      </el-row>
      <el-row class="m-t-8">
        <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-button
          type="primary"
          class="el-button-custom"
          size="small"
          @click="handleColorClick"
        >
          {{ isStandardColor ? '绘制对比色' : '绘制标准色' }}
        </el-button>
        <el-button
          type="primary"
          class="el-button-custom"
          size="small"
          @click="handleOpacityClick"
        >
          {{ !isOpacity ? '透明化' : '取消透明化' }}
        </el-button>
      </el-row>
    </template>
    <template #footer>
      <el-row justify="start" align="middle" class="p-b-2 one-row">
        <!-- <el-text size="small" type="warning">搜索范围</el-text> -->
      </el-row>
    </template>
  </CardDialog>
  <div>
    <el-button
      @click="dialogVisible = !dialogVisible"
      type="primary"
      class="el-button-custom p-events-auto"
      >走航融合</el-button
    >
    <CardDialog
      v-model="dialogVisible"
      title="走航融合"
      draggable
      :modal="false"
      width="400px"
    >
      <template #default>
        <el-row>
          <OptionMission v-model="mission"></OptionMission>
          <el-text size="small" :type="fusionData ? 'success' : 'warning'">{{
            fusionData ? '走航数据已融合' : '走航数据未融合'
          }}</el-text>
        </el-row>
        <el-row>
          <el-button
            type="primary"
            class="el-button-custom"
            size="small"
            :disabled="!gridCellList || !fusionData"
            @click="handleFusionClick"
          >
            {{ '叠加融合' }}
          </el-button>
          <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"
            :loading="loading"
            @click="handleUnderwayClick"
          >
            {{ underwayVisible ? '隐藏走航路线' : '显示走航路线' }}
          </el-button>
        </el-row>
        <el-row class="m-t-8">
          <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-button
            type="primary"
            class="el-button-custom"
            size="small"
            @click="handleColorClick"
          >
            {{ isStandardColor ? '绘制对比色' : '绘制标准色' }}
          </el-button>
          <el-button
            type="primary"
            class="el-button-custom"
            size="small"
            @click="handleOpacityClick"
          >
            {{ !isOpacity ? '透明化' : '取消透明化' }}
          </el-button>
        </el-row>
      </template>
      <template #footer>
        <el-row justify="start" align="middle" class="p-b-2 one-row">
          <!-- <el-text size="small" type="warning">搜索范围</el-text> -->
        </el-row>
      </template>
    </CardDialog>
  </div>
</template>
<script setup>
import { ref, onMounted, onUnmounted, watch } from 'vue';
import moment from 'moment';
import { map, onMapMounted } from '@/utils/map/index_old';
import gridApi from '@/api/gridApi';
import SatelliteProxy from '../SatelliteProxy';
import { SatelliteProxy } from '../SatelliteProxy';
const satelliteProxy = new SatelliteProxy();
const props = defineProps({
  groupId: {
@@ -97,7 +107,7 @@
  }
});
const dialogVisible = ref(true);
const dialogVisible = ref(false);
const mission = ref(undefined);
const gridCellList = ref(undefined);
@@ -111,9 +121,6 @@
const isStandardColor = ref(true);
const isOpacity = ref(false);
// 地图网格相关对象
let mapViews;
// 检查走航数据是否和100米网格已融合
function checkUnderwayFusionResult() {
  const time = moment(mission.value.startTime).format('YYYY-MM-DD HH:mm:ss');
@@ -126,42 +133,22 @@
  });
}
function drawGrid(gridInfo) {
  SatelliteProxy.clearAll(mapViews);
  mapViews = SatelliteProxy.drawPolyline(gridInfo);
function resetButton() {
  gridVisible.value = true;
  underwayVisible.value = false;
  rankVisible.value = false;
  dataVisible.value = false;
  isStandardColor.value = true;
  isOpacity.value = false;
}
function prepareGrid(gridInfo) {
  satelliteProxy.gridPrepare(gridInfo);
}
// 绘制网格遥感数据值和网格颜色
function drawTextAndColor(gridData) {
  const { resGridViews, pointsRes } = SatelliteProxy.drawColor({
    gridViews: mapViews.gridViews,
    points: mapViews.points,
    gridDataDetail: gridData,
    lastGridViews: mapViews.lastGridViews,
    opacity: 1,
    zIndex: 11
  });
  mapViews.lastGridViews = resGridViews;
  mapViews.lastPoints = pointsRes;
  // 文本标记
  const { textViews: dataTxt, labelsLayer: dataLayer } =
    SatelliteProxy.drawDataText(
      mapViews.lastPoints,
      gridData,
      mapViews.dataTxt,
      mapViews.dataLayer
    );
  mapViews.dataTxt = dataTxt;
  mapViews.dataLayer = dataLayer;
  const { textViews: rankTxt, labelsLayer: rankLayer } =
    SatelliteProxy.drawRankText(
      mapViews.lastPoints,
      gridData,
      mapViews.rankTxt,
      mapViews.rankLayer
    );
  mapViews.rankTxt = rankTxt;
  mapViews.rankLayer = rankLayer;
function drawGrid(gridData) {
  satelliteProxy.drawGrid({ gridData, opacity: 1, zIndex: 11 });
}
watch(mission, (nV, oV) => {
@@ -174,10 +161,10 @@
watch(
  () => props.groupId,
  (nV, oV) => {
    if (nV != oV) {
    if (dialogVisible.value && nV != oV) {
      gridApi.fetchGridCell(nV).then((res) => {
        gridCellList.value = res.data;
        drawGrid(gridCellList.value);
        prepareGrid(gridCellList.value);
      });
    }
  },
@@ -186,29 +173,37 @@
  }
);
watch(dialogVisible, (nV, oV) => {
  if (nV != oV) {
    gridApi.fetchGridCell(props.groupId).then((res) => {
      gridCellList.value = res.data;
      prepareGrid(gridCellList.value);
    });
  }
});
let selectedGridData;
// 叠加融合
function handleFusionClick() {
  // resetButton();
  const d = fusionData.value;
  if (gridDataDetailMap.has(d.id)) {
    const gridData = gridDataDetailMap.get(d.id);
    selectedGridData = gridData;
    drawTextAndColor(gridData);
    drawGrid(gridData);
  } else {
    gridApi.fetchGridDataDetail(d.id, d.groupId).then((res) => {
      gridDataDetailMap.set(d.id, res.data);
      const gridData = res.data;
      selectedGridData = gridData;
      drawTextAndColor(gridData);
      drawGrid(gridData);
    });
  }
}
function handleGridClick() {
  gridVisible.value = !gridVisible.value;
  gridVisible.value
    ? map.add(mapViews.lastGridViews)
    : map.remove(mapViews.lastGridViews);
  satelliteProxy.changeVisibility({ showGridViews: gridVisible.value });
}
function handleUnderwayClick() {
@@ -218,36 +213,27 @@
function handleRankClick() {
  rankVisible.value = !rankVisible.value;
  rankVisible.value ? map.add(mapViews.rankTxt) : map.remove(mapViews.rankTxt);
  satelliteProxy.changeVisibility({ showRankTxt: rankVisible.value });
}
function handleDataClick() {
  dataVisible.value = !dataVisible.value;
  dataVisible.value ? map.add(mapViews.dataTxt) : map.remove(mapViews.dataTxt);
  satelliteProxy.changeVisibility({ showDataTxt: dataVisible.value });
}
function handleColorClick() {
  isStandardColor.value = !isStandardColor.value;
  const { resGridViews, pointsRes } = SatelliteProxy.drawColor({
    gridViews: mapViews.gridViews,
    points: mapViews.points,
    gridDataDetail: selectedGridData,
    lastGridViews: mapViews.lastGridViews,
    customColor: !isStandardColor.value,
  satelliteProxy.drawGrid({
    gridData: selectedGridData,
    useCustomColor: !isStandardColor.value,
    opacity: 1,
    zIndex: 11
  });
  mapViews.lastGridViews = resGridViews;
  mapViews.lastPoints = pointsRes;
}
function handleOpacityClick() {
  isOpacity.value = !isOpacity.value;
  mapViews.lastGridViews.forEach((e) => {
    e.setOptions({
      fillOpacity: isOpacity.value ? 0.1 : 1
    });
  });
  satelliteProxy.changeGridOpacity({ opacityValue: isOpacity.value ? 0.1 : 1 });
}
/**走航轨迹*******************************************************************/