Commit 485644ae by jiang'yun

修改

parent dfd5cc55
<template> <template>
<div class="navbar"> <div class="navbar">
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" /> <hamburger
id="hamburger-container"
<breadcrumb v-if="!topNav" id="breadcrumb-container" class="breadcrumb-container" /> :is-active="sidebar.opened"
class="hamburger-container"
@toggleClick="toggleSideBar"
/>
<breadcrumb
v-if="!topNav"
id="breadcrumb-container"
class="breadcrumb-container"
/>
<top-nav v-if="topNav" id="topmenu-container" class="topmenu-container" /> <top-nav v-if="topNav" id="topmenu-container" class="topmenu-container" />
<div class="right-menu"> <div class="right-menu">
<template v-if="device!=='mobile'"> <template v-if="device !== 'mobile'">
<search id="header-search" class="right-menu-item" /> <!-- <search id="header-search" class="right-menu-item" /> -->
<el-tooltip content="源码地址" effect="dark" placement="bottom"> <!-- <el-tooltip content="源码地址" effect="dark" placement="bottom">
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" /> <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
</el-tooltip> </el-tooltip>
<el-tooltip content="文档地址" effect="dark" placement="bottom"> <el-tooltip content="文档地址" effect="dark" placement="bottom">
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" /> <ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
</el-tooltip> </el-tooltip> -->
<screenfull id="screenfull" class="right-menu-item hover-effect" />
<!-- <screenfull id="screenfull" class="right-menu-item hover-effect" /> -->
<!--
<el-tooltip content="布局大小" effect="dark" placement="bottom"> <el-tooltip content="布局大小" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" /> <size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip> </el-tooltip> -->
</template> </template>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click"> <el-dropdown
class="avatar-container right-menu-item hover-effect"
trigger="click"
>
<div class="avatar-wrapper"> <div class="avatar-wrapper">
<img :src="avatar" class="user-avatar"> <img :src="avatar" class="user-avatar" />
<i class="el-icon-caret-bottom" /> <i class="el-icon-caret-bottom" />
</div> </div>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
...@@ -47,15 +58,15 @@ ...@@ -47,15 +58,15 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from "vuex";
import Breadcrumb from '@/components/Breadcrumb' import Breadcrumb from "@/components/Breadcrumb";
import TopNav from '@/components/TopNav' import TopNav from "@/components/TopNav";
import Hamburger from '@/components/Hamburger' import Hamburger from "@/components/Hamburger";
import Screenfull from '@/components/Screenfull' import Screenfull from "@/components/Screenfull";
import SizeSelect from '@/components/SizeSelect' import SizeSelect from "@/components/SizeSelect";
import Search from '@/components/HeaderSearch' import Search from "@/components/HeaderSearch";
import RuoYiGit from '@/components/RuoYi/Git' import RuoYiGit from "@/components/RuoYi/Git";
import RuoYiDoc from '@/components/RuoYi/Doc' import RuoYiDoc from "@/components/RuoYi/Doc";
export default { export default {
components: { components: {
...@@ -66,48 +77,46 @@ export default { ...@@ -66,48 +77,46 @@ export default {
SizeSelect, SizeSelect,
Search, Search,
RuoYiGit, RuoYiGit,
RuoYiDoc RuoYiDoc,
}, },
computed: { computed: {
...mapGetters([ ...mapGetters(["sidebar", "avatar", "device"]),
'sidebar',
'avatar',
'device'
]),
setting: { setting: {
get() { get() {
return this.$store.state.settings.showSettings return this.$store.state.settings.showSettings;
}, },
set(val) { set(val) {
this.$store.dispatch('settings/changeSetting', { this.$store.dispatch("settings/changeSetting", {
key: 'showSettings', key: "showSettings",
value: val value: val,
}) });
} },
}, },
topNav: { topNav: {
get() { get() {
return this.$store.state.settings.topNav return this.$store.state.settings.topNav;
} },
} },
}, },
methods: { methods: {
toggleSideBar() { toggleSideBar() {
this.$store.dispatch('app/toggleSideBar') this.$store.dispatch("app/toggleSideBar");
}, },
logout() { logout() {
this.$confirm('确定注销并退出系统吗?', '提示', { this.$confirm("确定注销并退出系统吗?", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
cancelButtonText: '取消', cancelButtonText: "取消",
type: 'warning' type: "warning",
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = '/index'
}) })
}).catch(() => {}) .then(() => {
} this.$store.dispatch("LogOut").then(() => {
} location.href = "/index";
} });
})
.catch(() => {});
},
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -116,18 +125,18 @@ export default { ...@@ -116,18 +125,18 @@ export default {
overflow: hidden; overflow: hidden;
position: relative; position: relative;
background: #fff; background: #fff;
box-shadow: 0 1px 4px rgba(0,21,41,.08); box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
.hamburger-container { .hamburger-container {
line-height: 46px; line-height: 46px;
height: 100%; height: 100%;
float: left; float: left;
cursor: pointer; cursor: pointer;
transition: background .3s; transition: background 0.3s;
-webkit-tap-highlight-color:transparent; -webkit-tap-highlight-color: transparent;
&:hover { &:hover {
background: rgba(0, 0, 0, .025) background: rgba(0, 0, 0, 0.025);
} }
} }
...@@ -164,10 +173,10 @@ export default { ...@@ -164,10 +173,10 @@ export default {
&.hover-effect { &.hover-effect {
cursor: pointer; cursor: pointer;
transition: background .3s; transition: background 0.3s;
&:hover { &:hover {
background: rgba(0, 0, 0, .025) background: rgba(0, 0, 0, 0.025);
} }
} }
} }
......
...@@ -319,6 +319,52 @@ const interpolate = function (target, startIndex, endIndex, startColor, endColor ...@@ -319,6 +319,52 @@ const interpolate = function (target, startIndex, endIndex, startColor, endColor
} }
}; };
// 注:interpolate函数需保持原有实现(线性插值保证平滑)
function interpolate2(target, startIndex, endIndex, startColor, endColor) {
// 添加参数验证
if (!target || !Array.isArray(target)) {
console.error('interpolate: target必须是数组');
return;
}
if (typeof startIndex !== 'number' || typeof endIndex !== 'number' ||
startIndex < 0 || endIndex >= target.length || startIndex > endIndex) {
console.error(`interpolate: 索引无效 - startIndex: ${startIndex}, endIndex: ${endIndex}, target.length: ${target.length}`);
return;
}
if (!startColor || !endColor ||
typeof startColor.R !== 'number' || typeof startColor.G !== 'number' || typeof startColor.B !== 'number' ||
typeof endColor.R !== 'number' || typeof endColor.G !== 'number' || typeof endColor.B !== 'number') {
console.error('interpolate: 颜色必须包含有效的RGB值');
return;
}
const offset = startIndex;
const stop = (endIndex - startIndex);
let r, g, b;
const stepR = (endColor.R - startColor.R) / (stop);
const stepG = (endColor.G - startColor.G) / (stop);
const stepB = (endColor.B - startColor.B) / (stop);
try {
for (let i = 0; i <= stop; ++i) {
r = startColor.R + i * stepR;
g = startColor.G + i * stepG;
b = startColor.B + i * stepB;
target[offset + i] = new RgbaColor(
Math.round(r < 255 ? r : 255),
Math.round(g < 255 ? g : 255),
Math.round(b < 255 ? b : 255),
255
);
}
} catch (error) {
console.error(`interpolate: 创建颜色时出错 - ${error.message}`);
}
}
export default { export default {
name: "seismic", name: "seismic",
components: { components: {
...@@ -2000,6 +2046,74 @@ export default { ...@@ -2000,6 +2046,74 @@ export default {
}); });
// 注册多段颜色渐变 // 注册多段颜色渐变
// colorProvider.register('BlueWhiteRed', (map) => {
// if (!map) {
// console.error('BlueWhiteRed映射对象为空');
// return;
// }
//
// const colors = new Array(256);
//
// try {
// // 第一段:253, 27, 21 到 255, 205, 203 (0-63)
// interpolate(colors, 0, 63, {
// A: 255,
// R: 254,
// G: 13,
// B: 6
// }, {
// A: 255,
// R: 255,
// G: 205,
// B: 203
// });
//
// // 第二段:255, 205, 203 到 255, 251, 251 (64-127)
// interpolate(colors, 64, 127, {
// A: 255,
// R: 255,
// G: 205,
// B: 203
// }, {
// A: 255,
// R: 255,
// G: 251,
// B: 251
// });
//
// // 第三段:255, 251, 251 到 206, 207, 255 (128-191)
// interpolate(colors, 128, 191, {
// A: 255,
// R: 255,
// G: 251,
// B: 251
// }, {
// A: 255,
// R: 206,
// G: 207,
// B: 255
// });
//
// // 第四段:206, 207, 255 到 30, 38, 253 (192-255)
// interpolate(colors, 192, 255, {
// A: 255,
// R: 206,
// G: 207,
// B: 255
// }, {
// A: 255,
// R: 9,
// G: 25,
// B: 254
// });
//
// map.set(colors);
// } catch (error) {
// console.error('设置BlueWhiteRed颜色映射失败:', error);
// }
// });
// 注册多段颜色渐变(仅修改内部逻辑,保持原有结构)
colorProvider.register('BlueWhiteRed', (map) => { colorProvider.register('BlueWhiteRed', (map) => {
if (!map) { if (!map) {
console.error('BlueWhiteRed映射对象为空'); console.error('BlueWhiteRed映射对象为空');
...@@ -2009,65 +2123,23 @@ export default { ...@@ -2009,65 +2123,23 @@ export default {
const colors = new Array(256); const colors = new Array(256);
try { try {
// 第一段:253, 27, 21 到 255, 205, 203 (0-63) // 定义核心颜色节点
interpolate(colors, 0, 63, { const redColor = { A: 255, R: 254, G: 13, B: 6 }; // 起始红色
A: 255, const whiteColor = { A: 255, R: 255, G: 255, B: 255 }; // 中间纯白
R: 254, const blueColor = { A: 255, R: 9, G: 25, B: 254 }; // 最终蓝色
G: 13,
B: 6 // 按100个颜色段的节奏拆分0-255区间,保证渐变平滑
}, { // 第一段:红→白(0-127,约50个核心渐变段)
A: 255, interpolate2(colors, 0, 127, redColor, whiteColor);
R: 255, // 第二段:白→蓝(128-255,约50个核心渐变段)
G: 205, interpolate2(colors, 128, 255, whiteColor, blueColor);
B: 203 console.log(colors)
});
// 第二段:255, 205, 203 到 255, 251, 251 (64-127)
interpolate(colors, 64, 127, {
A: 255,
R: 255,
G: 205,
B: 203
}, {
A: 255,
R: 255,
G: 251,
B: 251
});
// 第三段:255, 251, 251 到 206, 207, 255 (128-191)
interpolate(colors, 128, 191, {
A: 255,
R: 255,
G: 251,
B: 251
}, {
A: 255,
R: 206,
G: 207,
B: 255
});
// 第四段:206, 207, 255 到 30, 38, 253 (192-255)
interpolate(colors, 192, 255, {
A: 255,
R: 206,
G: 207,
B: 255
}, {
A: 255,
R: 9,
G: 25,
B: 254
});
map.set(colors); map.set(colors);
} catch (error) { } catch (error) {
console.error('设置BlueWhiteRed颜色映射失败:', error); console.error('设置BlueWhiteRed颜色映射失败:', error);
} }
}); });
console.log('颜色映射注册成功'); console.log('颜色映射注册成功');
} catch (error) { } catch (error) {
console.error('注册颜色映射失败:', error); console.error('注册颜色映射失败:', error);
......
...@@ -575,6 +575,51 @@ const interpolate = function (target, startIndex, endIndex, startColor, endColor ...@@ -575,6 +575,51 @@ const interpolate = function (target, startIndex, endIndex, startColor, endColor
console.error(`interpolate: 创建颜色时出错 - ${error.message}`); console.error(`interpolate: 创建颜色时出错 - ${error.message}`);
} }
}; };
function interpolate2 (target, startIndex, endIndex, startColor, endColor) {
// 添加参数验证
if (!target || !Array.isArray(target)) {
console.error('interpolate: target必须是数组');
return;
}
if (typeof startIndex !== 'number' || typeof endIndex !== 'number' ||
startIndex < 0 || endIndex >= target.length || startIndex > endIndex) {
console.error(`interpolate: 索引无效 - startIndex: ${startIndex}, endIndex: ${endIndex}, target.length: ${target.length}`);
return;
}
if (!startColor || !endColor ||
typeof startColor.R !== 'number' || typeof startColor.G !== 'number' || typeof startColor.B !== 'number' ||
typeof endColor.R !== 'number' || typeof endColor.G !== 'number' || typeof endColor.B !== 'number') {
console.error('interpolate: 颜色必须包含有效的RGB值');
return;
}
const offset = startIndex;
const stop = (endIndex - startIndex);
let r, g, b;
const stepR = (endColor.R - startColor.R) / (stop);
const stepG = (endColor.G - startColor.G) / (stop);
const stepB = (endColor.B - startColor.B) / (stop);
try {
for (let i = 0; i <= stop; ++i) {
r = startColor.R + i * stepR;
g = startColor.G + i * stepG;
b = startColor.B + i * stepB;
target[offset + i] = new RgbaColor(
Math.round(r < 255 ? r : 255),
Math.round(g < 255 ? g : 255),
Math.round(b < 255 ? b : 255),
255
);
}
} catch (error) {
console.error(`interpolate: 创建颜色时出错 - ${error.message}`);
}
}
export default { export default {
name: "YsgcIndex2", name: "YsgcIndex2",
components: { components: {
...@@ -7831,8 +7876,8 @@ export default { ...@@ -7831,8 +7876,8 @@ export default {
} }
}); });
// 注册多段颜色渐变 // 注册多段颜色渐变(仅修改内部逻辑,保持原有结构)
colorProvider.register('BlueWhiteRed', (map) => { colorProvider.register('RedWhiteBlue', (map) => {
if (!map) { if (!map) {
console.error('BlueWhiteRed映射对象为空'); console.error('BlueWhiteRed映射对象为空');
return; return;
...@@ -7841,58 +7886,15 @@ export default { ...@@ -7841,58 +7886,15 @@ export default {
const colors = new Array(256); const colors = new Array(256);
try { try {
// 第一段:253, 27, 21 到 255, 205, 203 (0-63) const colorStops = [
interpolate(colors, 0, 63, { { idx: 0, color: { R: 254, G: 70, B: 80 } },
A: 255, { idx: 127, color: { R: 255, G: 255, B: 255 } },
R: 254, { idx: 255, color: { R: 30, G: 45, B: 255 } }
G: 13, ];
B: 6
}, {
A: 255,
R: 255,
G: 205,
B: 203
});
// 第二段:255, 205, 203 到 255, 251, 251 (64-127)
interpolate(colors, 64, 127, {
A: 255,
R: 255,
G: 205,
B: 203
}, {
A: 255,
R: 255,
G: 251,
B: 251
});
// 第三段:255, 251, 251 到 206, 207, 255 (128-191)
interpolate(colors, 128, 191, {
A: 255,
R: 255,
G: 251,
B: 251
}, {
A: 255,
R: 206,
G: 207,
B: 255
});
// 第四段:206, 207, 255 到 30, 38, 253 (192-255)
interpolate(colors, 192, 255, {
A: 255,
R: 206,
G: 207,
B: 255
}, {
A: 255,
R: 9,
G: 25,
B: 254
});
// 逐段插值,匹配图片的颜色过渡
interpolate2(colors, colorStops[0].idx, colorStops[1].idx, colorStops[0].color, colorStops[1].color);
interpolate2(colors, colorStops[1].idx, colorStops[2].idx, colorStops[1].color, colorStops[2].color);
map.set(colors); map.set(colors);
} catch (error) { } catch (error) {
console.error('设置BlueWhiteRed颜色映射失败:', error); console.error('设置BlueWhiteRed颜色映射失败:', error);
...@@ -8875,7 +8877,7 @@ export default { ...@@ -8875,7 +8877,7 @@ export default {
changeColor(val) { changeColor(val) {
var colorMap = SeismicColors.getDefault().createNamedColorMap(val, 256) var colorMap = SeismicColors.getDefault().createNamedColorMap(val, 256)
this.pipeline.setColorMap(colorMap); this.pipeline.setColorMap(colorMap);
this.pipeline.getColorMap().setAlpha(230)
console.log(this.plots) console.log(this.plots)
if (this._seismicWidget) { if (this._seismicWidget) {
this._seismicWidget.invalidate(); // 使组件重新渲染 this._seismicWidget.invalidate(); // 使组件重新渲染
......
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