| | |
| | | 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) |
| | |
| | | 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({ |