Commit 4b276dad by zhaopanyu

zpy

parent ea809f6d
......@@ -337,7 +337,7 @@ export default {
},
// 添加颜色映射选择器
currentColorMap: 'CustomGrayScale', // 默认使用灰度渐变
colorMaps: ['CustomGrayScale', 'CustomRedScale'], // 可用的颜色映射
colorMaps: ['CustomGrayScale', 'CustomRedScale', 'CustomGrayScale2'], // 可用的颜色映射
textStyle: {
color: '#000000',
size: 22,
......@@ -1449,6 +1449,74 @@ export default {
}
});
// 注册灰度渐变色映射
colorProvider.register('CustomGrayScale2', (map) => {
if (!map) {
console.error('CustomGrayScale2映射对象为空');
return;
}
const colors = new Array(255);
try {
// -4000到181范围保持纯白色
interpolate(colors, 0, 110, {
A: 255,
R: 255,
G: 255,
B: 255
}, {
A: 255,
R: 255,
G: 255,
B: 255
});
// 181开始,从(253,253,253)开始到566
interpolate(colors, 111, 120, {
A: 255,
R: 253,
G: 253,
B: 253
}, {
A: 255,
R: 240,
G: 240,
B: 240
});
// 566开始,颜色开始变深
interpolate(colors, 121, 160, {
A: 255,
R: 240,
G: 240,
B: 240
}, {
A: 255,
R: 180,
G: 180,
B: 180
});
// 继续渐变到深色
interpolate(colors, 161, 254, {
A: 255,
R: 180,
G: 180,
B: 180
}, {
A: 255,
R: 6,
G: 6,
B: 6
});
map.set(colors);
} catch (error) {
console.error('设置CustomGrayScale2颜色映射失败:', error);
}
});
console.log('颜色映射注册成功');
} catch (error) {
console.error('注册颜色映射失败:', error);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment