forked from drone/command-center-dashboard

罗广辉
2025-04-03 dfe5ba4f8b390ebeff0f51ce3f80cd02dc27fd9a
Merge remote-tracking branch 'origin/master'
2 files modified
66 ■■■■■ changed files
src/store/modules/common.js 12 ●●●●● patch | view | raw | blame | history
src/utils/cesium-tsa.js 54 ●●●●● patch | view | raw | blame | history
src/store/modules/common.js
@@ -1,3 +1,13 @@
/*
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2025-03-31 10:39:40
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2025-04-03 12:01:58
 * @FilePath: \command-center-dashboard\src\store\modules\common.js
 * @Description:
 *
 * Copyright (c) 2025 by shuishen, All Rights Reserved.
 */
import { setStore, getStore, removeStore } from 'utils/store'
import website from '@/config/website'
@@ -17,7 +27,7 @@
        setting: website.setting,
        // 地图设置
        mapSetting: {
            mode: 3, // 0为标准地图, 1为卫星地图
      mode: 0, // 0为标准地图, 1为卫星地图
            roadLine: true,
            visual: '3D',
            isDark: false,
src/utils/cesium-tsa.js
@@ -275,6 +275,30 @@
                    mapLayer: viewer?.imageryLayers.addImageryProvider(item.layer),
                }
        if (curLayer.key == 'imageryProvider_standZh') {
          curLayer.mapLayer.brightness = 0.6    // 亮度(默认值)
          curLayer.mapLayer.contrast = 1.8     // 对比度(负值降低对比度)
          curLayer.mapLayer.hue = 1           // 色相(弧度值,3.0可能导致紫色)
          curLayer.mapLayer.saturation = 0    // 增加饱和度强化蓝色
          curLayer.mapLayer.gamma = 0.3         // 伽马校正(小于1.0使颜色更鲜艳)
          curLayer.invertColor = true  // 启用反色
        }
        if (curLayer.key == 'imageryProvider_stand') {
          curLayer.mapLayer.brightness = 0.6    // 亮度(默认值)
          curLayer.mapLayer.contrast = 1.8     // 对比度(负值降低对比度)
          curLayer.mapLayer.hue = 1           // 色相(弧度值,3.0可能导致紫色)
          curLayer.mapLayer.saturation = 0    // 增加饱和度强化蓝色
          curLayer.mapLayer.gamma = 0.3         // 伽马校正(小于1.0使颜色更鲜艳)
          curLayer.invertColor = true  // 启用反色
          // curLayer.filterRGB = [0, 50, 100]
          filterLayer({
            bInvertColor: true,
            bFilterColor: true,
            filterColor: '#4e70a6'
          })
        }
                if (curLayer.mapLayer) curLayer.mapLayer.show = true
                viewer?.imageryLayers.lowerToBottom(curLayer.mapLayer)
@@ -292,6 +316,36 @@
        switchModel(store.state.common.mapSetting.visual)
    }
  const filterLayer = (options) => {
    const { bInvertColor, bFilterColor, filterColor } = options
    const color = new Cesium.Color.fromCssColorString(filterColor)
    const filterRGB = [
      Math.round(color.red * 255),
      Math.round(color.green * 255),
      Math.round(color.blue * 255)
    ]
    let fragShader = viewer.scene.globe._surfaceShaderSet.baseFragmentShaderSource.sources
    for (let i = 0; i < fragShader.length; i++) {
      const strS = 'color = czm_saturation(color, textureSaturation);\n#endif\n'
      let strT = 'color = czm_saturation(color, textureSaturation);\n#endif\n'
      if (bInvertColor) {
        strT += `
          color.r = 1.0 - color.r;
          color.g = 1.0 - color.g;
          color.b = 1.0 - color.b;
        `
      }
      if (bFilterColor) {
        strT += `
          color.r = color.r * ${filterRGB[0]}.0/255.0;
          color.g = color.g * ${filterRGB[1]}.0/255.0;
          color.b = color.b * ${filterRGB[2]}.0/255.0;
        `
      }
      fragShader[i] = fragShader[i].replace(strS, strT)
    }
  }
    const addCustomLayers = (layerName, options) => {
        if (options.type == 'arcgis') {
            var imageryProvider = new Cesium.WebMapTileServiceImageryProvider({