From 6d3a838cfa731613a78704bc2955fdd84fe1f489 Mon Sep 17 00:00:00 2001 From: shefengchun <1077478963@qq.com> Date: Fri, 13 Jan 2023 16:33:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=95=B0=E6=8D=AE=E7=B4=A2?= =?UTF-8?q?=E5=BC=95=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FusionSettings/DensityCorrection.vue | 46 ++++--- .../FusionSettings/FusionLocale.vue | 130 +++++++++++++----- 2 files changed, 121 insertions(+), 55 deletions(-) diff --git a/src/components/FusionSettings/DensityCorrection.vue b/src/components/FusionSettings/DensityCorrection.vue index d986cba..a476afb 100644 --- a/src/components/FusionSettings/DensityCorrection.vue +++ b/src/components/FusionSettings/DensityCorrection.vue @@ -27,23 +27,23 @@ h6 + :isResizable="false" @moveHandler="moveHandler($event, 5)">h1 h7 + :isResizable="false" @moveHandler="moveHandler($event, 6)">h2 h8 + :isResizable="false" @moveHandler="moveHandler($event, 7)">h3 h9 + :isResizable="false" @moveHandler="moveHandler($event, 8)">h4 h10 + :isResizable="false" @moveHandler="moveHandler($event, 9)">h5 @@ -247,14 +247,15 @@ export default defineComponent({ } } const reset = (index: number) => { - if (index >= 5) { + if (index > 4) { value[index].x = config.hor_density[index - 5].def_x value[index].y = config.hor_density[index - 5].def_y - set?.SetBlendingVerDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index - 5 + 1, Number(value[index].x)); + + set?.SetBlendingHorDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index - 5+1, Number(value[index].x)); } else { value[index].x = config.ver_density[index].def_x value[index].y = config.ver_density[index].def_y - set?.SetBlendingHorDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index + 1, Number(value[index].y)) + set?.SetBlendingVerDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index+1, Number(value[index].y)) } @@ -366,7 +367,7 @@ export default defineComponent({ } // watch(() => value[0], (newVal, oldVal) => { - send_configuration(0, newVal.y, newVal.number) + send_configuration(1, newVal.y, newVal.number) if (!isactivearray.value[0]) { let x = default_location[0].x; let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y)); @@ -376,7 +377,7 @@ export default defineComponent({ }, { deep: true }) watch(() => value[1], (newVal, oldVal) => { - send_configuration(1, newVal.y, newVal.number) + send_configuration(2, newVal.y, newVal.number) if (!isactivearray.value[1]) { let x = default_location[1].x; let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y)); @@ -387,7 +388,7 @@ export default defineComponent({ watch(() => value[2], (newVal, oldVal) => { //发送x y 唯一一个 - send_configuration(2, newVal.y, newVal.number) + send_configuration(3, newVal.y, newVal.number) if (!isactivearray.value[2]) { let x = Math.ceil(newVal.x / Proportion.value.x); let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y)); @@ -397,7 +398,7 @@ export default defineComponent({ }, { deep: true }) watch(() => value[3], (newVal, oldVal) => { - send_configuration(3, newVal.y, newVal.number) + send_configuration(4, newVal.y, newVal.number) if (!isactivearray.value[3]) { let x = default_location[3].x; let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y)); @@ -407,7 +408,7 @@ export default defineComponent({ }, { deep: true }) watch(() => value[4], (newVal, oldVal) => { - send_configuration(4, newVal.y, newVal.number) + send_configuration(5, newVal.y, newVal.number) if (!isactivearray.value[4]) { let x = default_location[4].x; let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y)); @@ -420,7 +421,7 @@ export default defineComponent({ /// watch(() => value[5], (newVal, oldVal) => { - send_configuration(5, newVal.x, newVal.number) + send_configuration(6, newVal.x, newVal.number) if (!isactivearray.value[5]) { let x = Math.ceil(newVal.x / Proportion.value.x); let y = default_location[5].y @@ -430,7 +431,7 @@ export default defineComponent({ }, { deep: true }) watch(() => value[6], (newVal, oldVal) => { - send_configuration(6, newVal.x, newVal.number) + send_configuration(7, newVal.x, newVal.number) if (!isactivearray.value[6]) { let x = Math.ceil(newVal.x / Proportion.value.x); let y = default_location[6].y @@ -440,7 +441,7 @@ export default defineComponent({ }, { deep: true }) watch(() => value[7], (newVal, oldVal) => { - send_configuration(7, newVal.x, newVal.number) + send_configuration(8, newVal.x, newVal.number) if (!isactivearray.value[7]) { let x = Math.ceil(newVal.x / Proportion.value.x); let y = default_location[7].y @@ -450,7 +451,7 @@ export default defineComponent({ }, { deep: true }) watch(() => value[8], (newVal, oldVal) => { - send_configuration(8, newVal.x, newVal.number) + send_configuration(9, newVal.x, newVal.number) if (!isactivearray.value[8]) { let x = Math.ceil(newVal.x / Proportion.value.x); let y = default_location[8].y @@ -460,7 +461,7 @@ export default defineComponent({ }, { deep: true }) watch(() => value[9], (newVal, oldVal) => { - send_configuration(9, newVal.x, newVal.number) + send_configuration(10, newVal.x, newVal.number) if (!isactivearray.value[9]) { let x = Math.ceil(newVal.x / Proportion.value.x); let y = default_location[9].y @@ -473,10 +474,13 @@ export default defineComponent({ const send_configuration = (index: number, value: number, number: number) => { if (ste_status.value == 0) { - if (index < 5) { - set?.SetBlendingVerDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index + 1, Number(value)) + if (index <= 5) { + //SetBlendingHorDensity h0 v1 + // + set?.SetBlendingVerDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index, Number(value)) } else { - set?.SetBlendingHorDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index - 4, Number(value)); + // + set?.SetBlendingHorDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index - 5, Number(value)); } } save_set_cache() diff --git a/src/components/FusionSettings/FusionLocale.vue b/src/components/FusionSettings/FusionLocale.vue index 085f167..690d5dc 100644 --- a/src/components/FusionSettings/FusionLocale.vue +++ b/src/components/FusionSettings/FusionLocale.vue @@ -108,8 +108,11 @@

gamma

- + + +
+
@@ -151,6 +154,8 @@ export default defineComponent({ { alpha: 0, p: 0, gamma: 0, isshow: false, value: 0 }, { alpha: 0, p: 0, gamma: 0, isshow: false, value: 0 }, ]); + //正确的 索引编号 + let arr = [1, 0, 2, 3] let serverconfig = JSON.parse($store.state.fusion_configuration); const selectedprojector = computed(() => { return $store.getters.GetTheCurrentlySelectedCamera[0] * serverconfig.col + $store.getters.GetTheCurrentlySelectedCamera[1] @@ -196,34 +201,35 @@ export default defineComponent({ }, 100); setnowindex() }, { deep: true }) + const chang = (type: string) => { if (type == "alpha") { if ($store.state.enablefusion) set?.setBlendingAlphaParam( $store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], - group.value, - array[group.value].alpha + arr[group.value], + array[arr[group.value]].alpha ); } if (type == "p") { if ($store.state.enablefusion) set?.setBlendingPowerParam( $store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], - group.value, - array[group.value].p + arr[group.value], + array[arr[group.value]].p ); } if (type == "gamma") { if ($store.state.enablefusion) set?.setBlendingGammaParam( $store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], - group.value, - array[group.value].gamma + arr[group.value], + array[arr[group.value]].gamma ); } save_set_cache(); }; - + //左上右下 const setnowindex = () => { let sum = 0; let indexx = 4; @@ -240,34 +246,52 @@ export default defineComponent({ } } - const getconfig = () => { - try { - set?.GetBlendingConfig("").then((res) => { }) - set?.GetBlendingConfig("").then((res) => { let tmp = JSON.parse(res ? res.config : ""); $store.commit("setEnablefusion", tmp.enable); $store.commit("setfusion_configuration", res?.config); }) - } catch (error) { + //接受 赋值 + const setconfig = (config: any) => { + let tmp = JSON.parse(config); + let fortmp = null + let i + for (i of tmp.projectors) { + if (i.col === $store.getters.GetTheCurrentlySelectedCamera[1] && i.row === $store.getters.GetTheCurrentlySelectedCamera[0]) { + fortmp = JSON.parse(JSON.stringify(i)) + } + } + ste_status.value = 1; + config = JSON.parse(JSON.stringify(fortmp)) + //手动对应数据索引 + for (let index = 0; index < array.length - 1; index++) { + array[arr[index]].gamma = config.params[index].gamma.toFixed(2) + array[arr[index]].alpha = config.params[index].alpha.toFixed(2) + array[arr[index]].p = config.params[index].power.toFixed(2) + array[arr[index]].isshow = config.params[index].enable + array[arr[index]].value = Number(config.params[index].size) } + setTimeout(() => { + ste_status.value = 0; + }, 100); + setnowindex() } const startconfig = () => { + //手动对应数据索引 for (let index = 0; index < array.length - 1; index++) { - array[index].gamma = config.params[index].gamma.toFixed(2) - array[index].alpha = config.params[index].alpha.toFixed(2) - array[index].p = config.params[index].power.toFixed(2) - array[index].isshow = config.params[index].enable - array[index].value = Number(config.params[index].size) + array[arr[index]].gamma = config.params[index].gamma.toFixed(2) + array[arr[index]].alpha = config.params[index].alpha.toFixed(2) + array[arr[index]].p = config.params[index].power.toFixed(2) + array[arr[index]].isshow = config.params[index].enable + array[arr[index]].value = Number(config.params[index].size) } if (sessionStorage.FusionLocale) set_cache.value = JSON.parse(sessionStorage.FusionLocale); use_set_cache() setnowindex() } const use_server_config = () => { - for (let index = 0; index < array.length - 1; index++) { - array[index].gamma = config.params[index].gamma.toFixed(2) - array[index].alpha = config.params[index].alpha.toFixed(2) - array[index].p = config.params[index].power.toFixed(2) - array[index].isshow = config.params[index].enable - array[index].value = Number(config.params[index].size) + array[arr[index]].gamma = config.params[index].gamma.toFixed(2) + array[arr[index]].alpha = config.params[index].alpha.toFixed(2) + array[arr[index]].p = config.params[index].power.toFixed(2) + array[arr[index]].isshow = config.params[index].enable + array[arr[index]].value = Number(config.params[index].size) } } startconfig() @@ -276,7 +300,7 @@ export default defineComponent({ }) watch( - () => array[0], + () => array[0].value, (newVal, oldVal) => { if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 1, array[0].isshow, Number(array[0].value)); save_set_cache() @@ -284,7 +308,7 @@ export default defineComponent({ { deep: true } ); watch( - () => array[1], + () => array[1].value, (newVal, oldVal) => { if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 0, array[1].isshow, Number(array[1].value)); save_set_cache() @@ -292,7 +316,7 @@ export default defineComponent({ { deep: true } ); watch( - () => array[2], + () => array[2].value, (newVal, oldVal) => { if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 2, array[2].isshow, Number(array[2].value)); save_set_cache() @@ -300,7 +324,7 @@ export default defineComponent({ { deep: true } ); watch( - () => array[3], + () => array[3].value, (newVal, oldVal) => { if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 3, array[3].isshow, Number(array[3].value)); save_set_cache() @@ -308,6 +332,42 @@ export default defineComponent({ { deep: true } ); + //// + watch( + () => array[0].isshow, + (newVal, oldVal) => { + if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 1, array[0].isshow, Number(array[0].value)); + save_set_cache() + }, + { deep: true } + ); + watch( + () => array[1].isshow, + (newVal, oldVal) => { + if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 0, array[1].isshow, Number(array[1].value)); + save_set_cache() + }, + { deep: true } + ); + watch( + () => array[2].isshow, + (newVal, oldVal) => { + if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 2, array[2].isshow, Number(array[2].value)); + save_set_cache() + }, + { deep: true } + ); + watch( + () => array[3].isshow, + (newVal, oldVal) => { + if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 3, array[3].isshow, Number(array[3].value)); + save_set_cache() + }, + { deep: true } + ); + + //// + watch( () => enablefusion, (newVal, oldVal) => { @@ -318,11 +378,13 @@ export default defineComponent({ const changenablefusion = () => { $store.commit('setenablefusion', enablefusion.value); } - const save = () => { - set?.SaveBlendingConfig("") - setTimeout(() => { - set?.GetBlendingConfig("").then((res) => { $store.commit("setfusion_configuration", res?.config); }) - }, 1000); + let resnewdata = null; + const resetall = () => { + try { + set?.GetBlendingConfig("").then((res) => { resnewdata = res?.config; setconfig(resnewdata) }) + } catch (error) { + console.log("ResetBlendingConfig error") + } } return { group, @@ -331,7 +393,7 @@ export default defineComponent({ enablefusion, changenablefusion, selectedprojector, - save, + resetall, set_cache }; },