Merge remote-tracking branch 'remotes/origin/blending' into merge_fm_fusion

# Conflicts:
#	src/common/ClientConnection.ts
#	src/components/FileManageDialog.vue
#	src/entities/WSProtocol.ts
#	src/i18n/en-US/index.ts
#	src/i18n/zh-CN/index.ts
#	src/pages/TopToolBar.vue
#	src/store/index.ts
This commit is contained in:
fangxiang 2023-02-15 17:50:36 +08:00
commit 3e2a941f80
20 changed files with 3512 additions and 1323 deletions

View File

@ -10,7 +10,7 @@
},
"dependencies": {
"@quasar/cli": "^2.0.0",
"@quasar/extras": "^1.15.10",
"@quasar/extras": "^1.15.11",
"@tinymce/tinymce-vue": "4",
"@types/element-resize-detector": "^1.1.3",
"autoprefixer": "^10.4.2",
@ -19,7 +19,7 @@
"core-js": "^3.21.0",
"element-resize-detector": "^1.2.4",
"qrcode.vue": "^3.3.3",
"quasar": "^2.11.5",
"quasar": "^2.11.6",
"reconnecting-websocket": "^4.4.0",
"sortablejs": "^1.15.0",
"to": "^0.2.9",
@ -29,6 +29,7 @@
"vue": "^3.0.0",
"vue-i18n": "^9.1.9",
"vue-router": "^4.0.0",
"vue3-draggable-resizable": "^1.6.5",
"vuex": "^4.0.1",
"zrender": "^5.3.1"
},

View File

@ -1261,7 +1261,7 @@ export default class ClientConnection {
console.error(e);
}
}
//
//
public async getMagicWallGridState() {
try {
return await this.doRpc<Protocol.RpcGetMagicWallGridStateResponseEntity>(
@ -1272,7 +1272,7 @@ export default class ClientConnection {
}
}
public async setMagicWallGridState(show_grid:boolean) {
public async setMagicWallGridState(show_grid: boolean) {
try {
return await this.doRpc<Protocol.RpcSetMagicWallGridStateResponseEntity>(
new Protocol.RpcSetMagicWallGridStateRequestEntity(show_grid)
@ -1361,6 +1361,7 @@ export default class ClientConnection {
row: number,
column: number,
correction_type: number,
control_point_count: number,
control_point: number,
x: number,
y: number
@ -1370,6 +1371,7 @@ export default class ClientConnection {
row,
column,
correction_type,
control_point_count,
control_point,
x,
y
@ -1461,6 +1463,94 @@ export default class ClientConnection {
);
}
public async SetBlendingHorDensity(
row: number,
column: number,
control_point_count: number,
control_point: number,
value: number
) {
return await this.doRpc<Protocol.NoneResponse>(
new Protocol.SetBlendingHorDensityRequestEntity(
row,
column,
control_point_count,
control_point,
value
)
);
}
public async SetBlendingVerDensity(
row: number,
column: number,
control_point_count: number,
control_point: number,
value: number
) {
return await this.doRpc<Protocol.NoneResponse>(
new Protocol.SetBlendingVerDensityRequestEntity(
row,
column,
control_point_count,
control_point,
value
)
);
}
public async ResetBlendingConfig() {
return await this.doRpc<Protocol.GetBlendingConfigResponseEntity>(
new Protocol.ResetBlendingConfigRequestEntity()
);
}
public async SetBlendingOption(id: string, value: string) {
return await this.doRpc<Protocol.NoneResponse>(
new Protocol.SetBlendingOptionRequestEntity(id, value)
);
}
public async EnumBlendingScene() {
return await this.doRpc<Protocol.EnumBlendingSceneResponseEntity>(
new Protocol.EnumBlendingSceneRequestEntity()
);
}
public async ApplyBlendingScene(name: string) {
return await this.doRpc<Protocol.GetBlendingConfigResponseEntity>(
new Protocol.ApplyBlendingSceneRequestEntity(name)
);
}
public async DeleteBlendingScene(name: string) {
return await this.doRpc<Protocol.RpcBlendingResponseEntity>(
new Protocol.DeleteBlendingSceneRequestEntity(name)
);
}
public async AddBlendingCtrlPoint(
type: string,
row: number,
column: number,
count: number
) {
return await this.doRpc<Protocol.GetBlendingConfigResponseEntity>(
new Protocol.AddBlendingCtrlPointRequestEntity(type, row, column, count)
);
}
public async DelBlendingCtrlPoint(
type: string,
row: number,
column: number,
count: number
) {
return await this.doRpc<Protocol.GetBlendingConfigResponseEntity>(
new Protocol.DelBlendingCtrlPointRequestEntity(type, row, column, count)
);
}
public async setCloudServerSetting(
cloud_server_address: string,
cloud_server_verify_key: string,
@ -1483,7 +1573,7 @@ export default class ClientConnection {
}
this.ws = null;
}
public async getFileListFileManager(dir_path:string) {
public async getFileListFileManager(dir_path: string) {
try {
return await this.doRpc<Protocol.RpcFileManagerGetFileListResponse>(
new Protocol.RpcFileManagerGetFileListRequest(dir_path)
@ -1492,34 +1582,42 @@ export default class ClientConnection {
console.error(e);
}
}
public async RenameFileManager(base_dir:string,file_name:string,new_file_name:string) {
public async RenameFileManager(
base_dir: string,
file_name: string,
new_file_name: string
) {
try {
return await this.doRpc<Protocol.RpcFileManagerRenameResponse>(
new Protocol.RpcFileManagerRenameRequest(base_dir,file_name,new_file_name)
new Protocol.RpcFileManagerRenameRequest(
base_dir,
file_name,
new_file_name
)
);
} catch (e) {
console.error(e);
}
}
public async DeleteFileManager(base_dir:string,file_name:string) {
public async DeleteFileManager(base_dir: string, file_name: string) {
try {
return await this.doRpc<Protocol.RpcFileManagerDeleteResponse>(
new Protocol.RpcFileManagerDeleteRequest(base_dir,file_name)
new Protocol.RpcFileManagerDeleteRequest(base_dir, file_name)
);
} catch (e) {
console.error(e);
}
}
public async CreateDirectoryFileManager(base_dir:string,dir_name:string) {
public async CreateDirectoryFileManager(base_dir: string, dir_name: string) {
try {
return await this.doRpc<Protocol.RpcFileManagerCreateDirectoryResponse>(
new Protocol.RpcFileManagerCreateDirectoryRequest(base_dir,dir_name)
new Protocol.RpcFileManagerCreateDirectoryRequest(base_dir, dir_name)
);
} catch (e) {
console.error(e);
}
}
public async CheckModeIndex(mode_index:number) {
public async CheckModeIndex(mode_index: number) {
try {
return await this.doRpc<Protocol.RpcCheckModeIndexResponseEntity>(
new Protocol.RpcCheckModeIndexRequestEntity(mode_index)

View File

@ -156,7 +156,7 @@
</q-btn>
<q-btn
flat
v-if="!uploading &&!iswujie"
v-if="!uploading && !iswujie"
no-caps
icon="upload"
:label="$t('upload file')"
@ -192,7 +192,6 @@
($q.platform.is.ipad && $store.state.landspace ? '61' : '68') +
'vh',
}"
class="q-mb-md"
v-show="!uploading"
:rows="files"
:columns="columns"
@ -805,9 +804,9 @@ export default defineComponent({
console.log(e);
}
};
let iswujie=ref(false)
let iswujie = ref(false);
if ((window as any).$wujie) {
iswujie.value=true
iswujie.value = true;
}
//
// watch(
@ -900,7 +899,7 @@ export default defineComponent({
prompt: {
model: "",
isValid: (val: string) =>
!!val && val.trim().length > 0&& val.indexOf(".") != 0 ,
!!val && val.trim().length > 0 && val.indexOf(".") != 0,
type: "text",
},
ok: {

View File

@ -0,0 +1,92 @@
<template>
<div>
<q-list dense bordered separator>
<q-item clickable v-ripple v-for="(item, index) in data">
<q-item-section>
<DebuggingItem
:name="Object.keys(item)[0]"
:value="Object.values(item)[0]"
>
</DebuggingItem>
</q-item-section>
</q-item>
<q-item clickable v-ripple v-for="(item, index) in btn">
<q-item-section>
<div>
<q-btn
color="white"
text-color="black"
@click="send_btn(Object.keys(item)[0])"
:label="$t(btn_name(Object.keys(item)[0]))"
/>
</div>
</q-item-section>
</q-item>
</q-list>
</div>
</template>
<script lang="ts">
import {
defineComponent,
ref,
watch,
computed,
defineProps,
withDefaults,
reactive,
onMounted,
onBeforeUnmount,
} from "vue";
import { useStore } from "src/store";
import { useI18n } from "vue-i18n";
import vue3ResizeDrag from "/src/third_lib/vue3-resize-drag/components/vue3-resize-drag/index.vue";
import GlobalData from "src/common/GlobalData";
import DebuggingItem from "src/components/FusionSettings/DebuggingItem.vue";
export default defineComponent({
name: "Debugging",
components: {
vue3ResizeDrag,
DebuggingItem,
},
setup() {
let set = GlobalData.getInstance().getCurrentClient();
let $store = useStore();
let $t = useI18n();
const data = computed(() => {
let array = [];
let tmp = JSON.parse($store.state.fusion_configuration).options;
for (let key in tmp) {
if (key.indexOf("@") != -1 && key.indexOf("@btn") == -1) {
array.push({ [key]: tmp[key] });
}
}
return array;
});
const btn = computed(() => {
let array = [];
let tmp = JSON.parse($store.state.fusion_configuration).options;
for (let key in tmp) {
if (key.indexOf("@btn") != -1) {
array.push({ [key]: tmp[key] });
}
}
return array;
});
const btn_name = (name: string): string => {
return name.split("@")[2];
};
const send_btn = (name: string) => {
set?.SetBlendingOption(name, "1");
};
return {
btn_name,
send_btn,
data,
btn,
};
},
});
</script>

View File

@ -0,0 +1,98 @@
<template>
<div><span>{{ $t(show_name) }}</span> <q-checkbox v-model="val" @click="send" /></div>
</template>
<script lang="ts">
import {
defineComponent,
ref,
watch,
computed,
defineProps,
withDefaults,
reactive,
onMounted,
onBeforeUnmount,
} from "vue";
import { useStore } from "src/store";
import { useI18n } from "vue-i18n";
import vue3ResizeDrag from "/src/third_lib/vue3-resize-drag/components/vue3-resize-drag/index.vue";
import GlobalData from "src/common/GlobalData";
export default defineComponent({
name: "DebuggingItem",
components: {
vue3ResizeDrag,
},
props: {
name: {
type: String,
default: ''
},
value: {
type: String,
default: ''
}
},
setup(props) {
let set = GlobalData.getInstance().getCurrentClient();
let $store = useStore();
let $t = useI18n();
const val = ref(false)
const show_name = computed(() => {
let tmp=""
if(props.name.indexOf("@") != -1){
tmp=props.name.split("@")[1]
}else{
tmp=props.name
}
return tmp
})
val.value=props.value=="1"?true:false
const send = () => {
set?.SetBlendingOption(props.name, val.value ? "1" : "0");
}
const use_sessionStorage=()=>{
if(sessionStorage.Debugging){
let tmp=JSON.parse(sessionStorage.Debugging);
for (let index = 0;index < tmp.length; index++) {
if(Object.keys(tmp[index])[0]==props.name){
val.value=Object.values(tmp[index])[0]=="1"?true:false
break
}
}
}
}
onMounted(()=>{
use_sessionStorage()
})
onBeforeUnmount(() => {
let key=props.name
let value=val.value
if(sessionStorage.Debugging){
let tmp=JSON.parse(sessionStorage.Debugging);
let count=0;
for (let index = 0;index < tmp.length; index++) {
if(Object.keys(tmp[index])[0]==key){
tmp[index]={[key]:value}
break
}
count=index
}
if(count==tmp.length-1)tmp.push({[key]:value});
sessionStorage.Debugging = JSON.stringify(tmp);
}else{
sessionStorage.Debugging = JSON.stringify([{[key]:value}]);
}
});
return {
send,
val,
show_name,
...props
}
}
})
</script>

View File

@ -1,97 +1,880 @@
<template>
<div class="row">
<div class="col-2 q-pa-lg"></div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg">
<q-input filled type="number" class="q-pt-md" :dense="true" v-model="value[0]" label="" lazy-rules />
<div class="row">
<div class="col-1"></div>
<div class="col-10 q-pt-md">
<div ref="div" style="width: 100%; background-color: #646464; height: 40vh">
<div style="position: absolute">
<Vue3DraggableResizable v-show="now_v_h == 'vertical'"
:class="[options_model_v == index ? 'action' : 'point']" v-for="(item, index) in value_v_point.length"
:initW="point.w" :initH="point.h" :resizable="false" :x="0" v-model:y="value_v_point[index].y"
@activated="options_model_v = index; now_v_h = 'vertical'"
@click="options_model_v = index; now_v_h = 'vertical'" @dragging="dragStartHandle($event, index, 'v')">
<span>v{{
index+ 1
}}</span>
</Vue3DraggableResizable>
<Vue3DraggableResizable v-show="now_v_h == 'vertical'"
:class="[options_model_v == index ? 'action' : 'point']" v-for="(item, index) in value_v_point.length"
:initW="point.w" :initH="point.h" :resizable="false" :x="max.x - 20"
@click="options_model_v = index; now_v_h = 'vertical'" v-model:y="value_v_point[index].y"
@activated="options_model_v = index; now_v_h = 'vertical'" @dragging="dragStartHandle($event, index, 'v')">
<span>v{{
index+ 1
}}</span>
</Vue3DraggableResizable>
<Vue3DraggableResizable v-show="now_v_h == 'level'" :class="[options_model_h == index ? 'action' : 'point']"
v-for="(item, index) in value_h_point.length" :initW="point.w" :initH="point.h" :resizable="false"
v-model:x="value_h_point[index].x" :y="0" @activated="options_model_h = index; now_v_h = 'level'"
@click="options_model_h = index; now_v_h = 'level'" @dragging="dragStartHandle($event, index, 'h')">
<span>h{{
index+ 1
}}</span>
</Vue3DraggableResizable>
<Vue3DraggableResizable v-show="now_v_h == 'level'" :class="[options_model_h == index ? 'action' : 'point']"
v-for="(item, index) in value_h_point.length" :initW="point.w" :initH="point.h" :resizable="false"
v-model:x="value_h_point[index].x" @activated="options_model_h = index; now_v_h = 'level'" :y="max.y - 20"
@click="options_model_h = index; now_v_h = 'level'" @dragging="dragStartHandle($event, index, 'h')">
<span>h{{
index+ 1
}}</span>
</Vue3DraggableResizable>
</div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg">
<q-input filled type="number" class="q-pt-md" :dense="true" v-model="value[1]" label="" lazy-rules />
</div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg">
<q-input filled type="number" class="q-pt-md" :dense="true" v-model="value[2]" label="" lazy-rules />
</div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg">
<q-input filled type="number" class="q-pt-md" :dense="true" v-model="value[3]" label="" lazy-rules />
</div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg"> </div>
<div class="col-2 q-pa-lg">
<q-input filled type="number" class="q-pt-md" :dense="true" v-model="value[3]" label="" lazy-rules />
</div>
<div class="col-2 q-pa-lg">
<q-input filled type="number" class="q-pt-md" :dense="true" v-model="value[4]" label="" lazy-rules />
</div>
<div class="col-2 q-pa-lg">
<q-input filled type="number" class="q-pt-md" :dense="true" v-model="value[5]" label="" lazy-rules />
</div>
<div class="col-2 q-pa-lg">
<q-input filled type="number" class="q-pt-md" :dense="true" v-model="value[6]" label="" lazy-rules />
</div>
<div class="col-2 q-pa-lg">
<q-input filled type="number" class="q-pt-md" :dense="true" v-model="value[7]" label="" lazy-rules />
</div>
<div class="col-2 q-pa-lg">
<q-input filled type="number" class="q-pt-md" :dense="true" v-model="value[8]" label="" lazy-rules />
</div>
<div class="col-2 q-pa-lg">
<!-- <q-input filled type="number" class="q-pt-md" :dense="true" v-model="value[9]" label="" lazy-rules /> -->
</div>
</div>
</div>
</div>
<div>
<div class="row">
<div class="col-1"></div>
<div class="col-5">
<q-radio v-model="now_v_h" val="level" :label="$t('level')" />
</div>
<div class="col-5"><q-radio v-model="now_v_h" val="vertical" :label="$t('vertical')" /></div>
</div>
<div class="row" v-show="now_v_h == 'vertical'">
<div class="col-1"></div>
<div class="col-2"> <q-select class="q-pt-md" :label="$t('vertical')"
@update:model-value="(val) => { options_v = val }" :dense="true" filled v-model="options_model_v"
:options="options_v" emit-value map-options /></div>
<div class="col-2"> <q-input filled type="number" class="q-pt-md" :dense="true"
v-model="value_v[options_model_v].y" @update:model-value="chang(options_model_v, $event, 'v')" lazy-rules />
</div>
<div class="q-pt-md col-2">
<q-btn color="white" @click="reset(options_model_v, true, 'v')" text-color="black" :label="$t('reset')" />
</div>
<div class="col-2"> <q-select class="q-pt-md" :label="$t('vertical point')"
@update:model-value="(val) => { chang_point_amount(val, 'v') }" :dense="true" filled
v-model="value_v_point_amount" :options="options_value_v_point_amount" emit-value map-options /></div>
<div class="col-1 q-pt-md "><q-btn color="white"
@click="add_dialog=true" text-color="black"
:label="$t('add control points')" /></div>
<div class="col-1 q-pt-md "><q-btn color="white" @click="() => { del_dialog = true }" :disable="value_v_point_amount<=5" text-color="black"
:label="$t('reduce control points')" /></div>
</div>
<div class="row" v-show="now_v_h == 'level'">
<div class="col-1"></div>
<div class="col-2"> <q-select class="q-pt-md" :label="$t('level')"
@update:model-value="(val) => { options_h = val }" :dense="true" filled v-model="options_model_h"
:options="options_h" emit-value map-options /></div>
<div class="col-2"> <q-input filled type="number" class="q-pt-md" :dense="true"
v-model="value_h[options_model_h].x" @update:model-value="chang(options_model_h, $event, 'h')" lazy-rules />
</div>
<div class="q-pt-md col-2">
<q-btn color="white" @click="reset(options_model_h, true, 'h')" text-color="black" :label="$t('reset')" />
</div>
<div class="col-2"> <q-select class="q-pt-md" :label="$t('level point')"
@update:model-value="(val) => { chang_point_amount(val, 'h') }" :dense="true" filled
v-model="value_h_point_amount" :options="options_value_h_point_amount" emit-value map-options /></div>
<div class="col-1 q-pt-md "><q-btn color="white"
@click="add_dialog=true" text-color="black"
:label="$t('add control points')" /></div>
<div class="col-1 q-pt-md "><q-btn color="white" @click="() => { del_dialog = true }" :disable="value_h_point_amount<=5" text-color="black"
:label="$t('reduce control points')" /></div>
</div>
<div class="q-pt-md"> <q-btn color="white" @click="resetall" text-color="black" :label="$t('resetall')" /></div>
</div>
<div style="position: absolute;bottom: 0;">
<q-checkbox v-model="auxiliary_line" @update:model-value="(value, evt) => { send_auxiliary_line(value) }"
:label="$t('auxiliary lines')" />
</div>
<q-dialog v-model="del_dialog">
<q-card style="width: 700px; max-width: 80vw;">
<q-card-section>
<div class="text-h6">{{ $t('confirm delete') }}</div>
</q-card-section>
<q-card-section class="q-pt-none">
{{ $t('OK to delete you will lose the data you adjusted now') }}
</q-card-section>
<q-card-actions align="right" class="bg-white text-teal">
<q-btn flat :label="$t('Cancel')" color="primary" v-close-popup />
<q-btn flat :label="$t('ok')" @click="del" color="primary" v-close-popup />
</q-card-actions>
</q-card>
</q-dialog>
<q-dialog v-model="add_dialog">
<q-card style="width: 700px; max-width: 80vw;">
<q-card-section>
<div class="text-h6">{{ $t('Whether to add control points') }}</div>
</q-card-section>
<q-card-section class="q-pt-none">
<q-input filled v-model="now_amount" type="number" :label="$t('Please enter the points you need to add')" />
</q-card-section>
<q-card-actions align="right" class="bg-white text-teal">
<q-btn flat :label="$t('Cancel')" color="primary" v-close-popup />
<q-btn flat :label="$t('ok')" @click="add" color="primary" v-close-popup />
</q-card-actions>
</q-card>
</q-dialog>
</template>
<style scoped>
.action {
background-color: rgb(27, 180, 111);
border-radius: 50%;
}
.point {
background-color: rgb(186, 245, 245);
border-radius: 50%;
}
</style>
<script lang="ts">
import { defineComponent, ref, watch, computed, defineProps, withDefaults, reactive} from "vue";
import {
defineComponent,
onMounted,
ref,
computed,
watch,
nextTick,
onBeforeUnmount,
defineExpose
} from "vue";
import { useStore } from "src/store";
import { useI18n } from "vue-i18n";
import Vue3DraggableResizable from 'vue3-draggable-resizable'
import 'vue3-draggable-resizable/dist/Vue3DraggableResizable.css'
import DensityCorrection from "src/entities/DensityCorrection";
import DensityCorrectionPoint from "src/entities/DensityCorrectionPoint";
import { config } from "process";
import { QSelect, QInput, QBtn } from "quasar";
import { div } from "zrender/lib/core/vector";
import GlobalData from "src/common/GlobalData";
export default defineComponent({
name: "ComponentDensityCorrection",
setup() {
let $store = useStore();
let $t = useI18n();
const value=reactive([0,0,0,0,0,0,0,0,0,0,0]);
let model = ref(null);
let options = ref(['10', '20', '30', '40', '50']);
return {
model,
options,
value
};
},
});
</script>
name: "ComponentDensityCorrection",
components: {
Vue3DraggableResizable
},
setup() {
let set = GlobalData.getInstance().getCurrentClient();
let $store = useStore();
let $t = useI18n();
const ste_status = ref(0);
let config = JSON.parse($store.state.fusion_configuration).projectors[0];
const configselsect = computed(() => {
return $store.state.selected_projector;
});
//
let serverconfig = JSON.parse($store.state.fusion_configuration);
const selectedprojector = computed(() => {
return (
$store.getters.GetTheCurrentlySelectedCamera[0] * serverconfig.col +
$store.getters.GetTheCurrentlySelectedCamera[1]
);
});
const now_v_h = ref("")
const value_h_point_amount = ref(5)
const value_v_point_amount = ref(5)
const add_dialog=ref(false)
const now_amount=ref(0)
const options_value_h_point_amount = ref(<string[]>[])
const options_value_v_point_amount = ref(<string[]>[])
const deepcopy = (o1: any, o2: any) => {
for (let k in o2) {
if (typeof o2[k] === "object") {
o1[k] = {};
deepcopy(o1[k], o2[k]);
} else {
o1[k] = o2[k];
}
}
};
const use_server_config = () => {
value_h_point_amount.value = 5
value_v_point_amount.value = 5
let a = 5
value_h.value = []
value_h_point.value = []
for (let index = 0; index < config.multi_hor_density[a].length; index++) {
let tmp: DensityCorrectionPoint = config.multi_hor_density[a][index];
value_h.value.push(tmp)
let x_y = coordinate_transformation_value_to_xy(tmp.x, tmp.y)
let def_x_f = coordinate_transformation_value_to_xy(tmp.def_x, tmp.def_y)
let tmp_point: DensityCorrectionPoint = {
control_point: tmp.control_point,
x: x_y.x,
y: x_y.y,
def_x: def_x_f.x,
def_y: def_x_f.y
}
value_h_point.value.push(tmp_point)
}
value_v.value = []
value_v_point.value = []
for (let index = 0; index < config.multi_ver_density[a].length; index++) {
let tmp: DensityCorrectionPoint = config.multi_ver_density[a][index];
value_v.value.push(tmp)
let x_y = coordinate_transformation_value_to_xy(tmp.x, tmp.y)
let def_x_f = coordinate_transformation_value_to_xy(tmp.def_x, tmp.def_y)
let tmp_point: DensityCorrectionPoint = {
control_point: tmp.control_point,
x: x_y.x,
y: x_y.y,
def_x: def_x_f.x,
def_y: def_x_f.y
}
value_v_point.value.push(tmp_point)
}
}
const use_set_cache = () => {
if (set_cache.value[selectedprojector.value] != null) {
let tmp = JSON.parse(set_cache.value[selectedprojector.value]);
value_h.value = []
value_v.value = []
value_h_point.value = []
value_v_point.value = []
deepcopy(value_h.value, tmp.value_h)
deepcopy(value_v.value, tmp.value_v)
value_h_point_amount.value = tmp.value_h_point_amount
value_v_point_amount.value = tmp.value_v_point_amount
deepcopy(value_h_point.value, tmp.value_h_point)
deepcopy(value_v_point.value, tmp.value_v_point)
recalculate_coordinates()
}
}
const save_set_cache = () => {
let tmp = { value_h: value_h.value, value_v: value_v.value, value_v_point_amount: value_v_point_amount.value, value_h_point_amount: value_h_point_amount.value, value_v_point: value_v_point.value, value_h_point: value_h_point.value }
set_cache.value[selectedprojector.value] = JSON.stringify(tmp);
}
const auxiliary_line = ref(false)
watch(
() => configselsect,
(newVal, oldVal) => {
let tmp = JSON.parse($store.state.fusion_configuration);
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));
use_server_config();
use_set_cache();
options_value_h_point_amount.value = Object.keys(config.multi_hor_density)
options_value_v_point_amount.value = Object.keys(config.multi_ver_density)
setTimeout(() => {
ste_status.value = 0;
}, 100);
},
{ deep: true }
);
const set_cache: any = ref([]);
//
let value_h = ref(<DensityCorrection[]>[]);
let value_v = ref(<DensityCorrection[]>[]);
//
let value_h_point = ref(<DensityCorrectionPoint[]>[]);
let value_v_point = ref(<DensityCorrectionPoint[]>[]);
/**
* 当前选中的点的索引
*/
const options_model_v = ref(0)
const options_model_h = ref(0)
const div = ref();
const max = ref({ x: 0, y: 0 })
const point = ref({ w: 20, h: 20 })
watch(() => now_v_h, (newval, oldval) => {
if (newval.value == 'level') {
set?.SetBlendingOption("blending_grids_select_ui", "hor_density")
} else {
set?.SetBlendingOption("blending_grids_select_ui", "ver_density")
}
}, { deep: true })
watch(() => value_v_point_amount, (newval, oldval) => {
set?.SetBlendingOption("blending_grids_control_point_count", `${newval.value}`)
if (now_v_h.value == 'level') {
set?.SetBlendingOption("blending_grids_select_ui", "hor_density")
} else {
set?.SetBlendingOption("blending_grids_select_ui", "ver_density")
}
save_set_cache()
}, { deep: true })
watch(() => value_h_point_amount, (newval, oldval) => {
set?.SetBlendingOption("blending_grids_control_point_count", `${newval.value}`)
if (now_v_h.value == 'level') {
set?.SetBlendingOption("blending_grids_select_ui", "hor_density")
} else {
set?.SetBlendingOption("blending_grids_select_ui", "ver_density")
}
save_set_cache()
}, { deep: true })
watch(() => options_model_h, (newval, oldval) => {
set?.SetBlendingOption("blending_grids_select_point", `${value_h_point.value[newval.value].control_point}`)
}, { deep: true })
watch(() => options_model_v, (newval, oldval) => {
set?.SetBlendingOption("blending_grids_select_point", `${value_v_point.value[newval.value].control_point}`)
}, { deep: true })
/**
* 分辨率和页面的比例
*/
let Proportion = ref({ x: 100, y: 1000 });
nextTick(() => {
max.value.x = div.value.offsetWidth
max.value.y = div.value.offsetHeight
})
const chang_point_amount = (val: number, type: string) => {
start_point(val, type)
save_set_cache()
}
const dragStartHandle = ($event: any, index: number, type: string) => {
let obj_x = $event.x
let obj_y = $event.y
let tmp = coordinate_transformation_xy_to_value(obj_x, obj_y)
if (type == 'v') {
value_v.value[index].y = Math.trunc(tmp.y)
send_value(index, type, Math.trunc(tmp.y))
}
if (type == 'h') {
value_h.value[index].x = Math.trunc(tmp.x)
send_value(index, type, Math.trunc(tmp.x))
}
save_set_cache()
}
const chang = (index: number, $event: any, type: string) => {
$event = Number($event)
if (type == 'v') {
let tmp = coordinate_transformation_value_to_xy(0, $event)
value_v_point.value[index].y = Math.trunc(tmp.y)
send_value(index, type, Math.trunc(value_v.value[index].y))
}
if (type == 'h') {
let tmp = coordinate_transformation_value_to_xy($event, 0)
value_h_point.value[index].x = Math.trunc(tmp.x)
send_value(index, type, Math.trunc(value_h.value[index].x))
}
save_set_cache()
}
const options_v = computed(() => {
let tmp = []
for (let index = 0; index < Number(value_v_point_amount.value); index++) {
tmp.push({
label: `v${index + 1}`,
value: index,
})
}
return tmp
})
const options_h = computed(() => {
let tmp = []
for (let index = 0; index < Number(value_h_point_amount.value); index++) {
tmp.push({
label: `h${index + 1}`,
value: index,
})
}
return tmp
})
/**
* 将分辨率的坐标转换为 页面的坐标
* @param x x坐标
* @param y y坐标
*/
const coordinate_transformation_value_to_xy = (x: number, y: number): { x: number, y: number } => {
x = x / Proportion.value.x
y = (config.height - y) / Proportion.value.y
return { x, y }
}
/**
* 将页面的坐标转换为 分辨率的坐标
* @param x x坐标
* @param y y坐标
*/
const coordinate_transformation_xy_to_value = (x: number, y: number): { x: number, y: number } => {
x = x * Proportion.value.x
y = (max.value.y - y) * Proportion.value.y
return { x, y }
}
const start_point = (a: number, type: string) => {
if (type == 'h' || type == 'all') {
value_h.value = []
value_h_point.value = []
for (let index = 0; index < config.multi_hor_density[a].length; index++) {
let tmp: DensityCorrectionPoint = config.multi_hor_density[a][index];
value_h.value.push(tmp)
let x_y = coordinate_transformation_value_to_xy(tmp.x, tmp.y)
let def_x_f = coordinate_transformation_value_to_xy(tmp.def_x, tmp.def_y)
let tmp_point: DensityCorrectionPoint = {
control_point: tmp.control_point,
x: x_y.x,
y: x_y.y,
def_x: def_x_f.x,
def_y: def_x_f.y
}
value_h_point.value.push(tmp_point)
}
}
if (type == 'v' || type == 'all') {
value_v.value = []
value_v_point.value = []
for (let index = 0; index < config.multi_ver_density[a].length; index++) {
let tmp: DensityCorrectionPoint = config.multi_ver_density[a][index];
value_v.value.push(tmp)
let x_y = coordinate_transformation_value_to_xy(tmp.x, tmp.y)
let def_x_f = coordinate_transformation_value_to_xy(tmp.def_x, tmp.def_y)
let tmp_point: DensityCorrectionPoint = {
control_point: tmp.control_point,
x: x_y.x,
y: x_y.y,
def_x: def_x_f.x,
def_y: def_x_f.y
}
value_v_point.value.push(tmp_point)
}
}
}
const start = () => {
let tmp: DensityCorrectionPoint = { control_point: 0, x: 0, y: 0, def_x: 0, def_y: 0 };
value_v.value.push(tmp)
value_h.value.push(tmp)
value_v_point.value.push(tmp)
value_h_point.value.push(tmp)
}
start()
onMounted(() => {
Proportion.value.x = config.width / (div.value.offsetWidth - point.value.w)
Proportion.value.y = config.height / (div.value.offsetHeight - point.value.h)
options_value_h_point_amount.value = Object.keys(config.multi_hor_density)
options_value_v_point_amount.value = Object.keys(config.multi_ver_density)
let tmp = JSON.parse($store.state.fusion_configuration).options;
auxiliary_line.value = tmp.blending_grids_density_assistant_lines == "1"
now_v_h.value = "level"
start_point(5, 'all')
if (
sessionStorage.DensityCorrection &&
sessionStorage.DensityCorrection.length > 0
) {
set_cache.value = JSON.parse(sessionStorage.DensityCorrection);
use_set_cache();
}
window.onresize = () => {
return (() => {
if (div != null) {
recalculate_coordinates()
}
})();
};
})
onBeforeUnmount(() => {
sessionStorage.DensityCorrection = JSON.stringify(set_cache.value);
});
const reset = (index: number, send: boolean, type: string) => {
if (type == 'v') {
value_v.value[index].x = value_v.value[index].def_x
value_v.value[index].y = value_v.value[index].def_y
chang(index, value_v.value[index].def_y, type)
}
if (type == 'h') {
value_h.value[index].x = value_h.value[index].def_x
value_h.value[index].y = value_h.value[index].def_y
chang(index, value_h.value[index].def_x, type)
}
save_set_cache()
}
const send_value = (index: number, type: string, value: number) => {
let row = $store.getters.GetTheCurrentlySelectedCamera[0]
let col = $store.getters.GetTheCurrentlySelectedCamera[1]
if (type == 'v') {
set?.SetBlendingVerDensity(row, col, Number(value_v_point_amount.value), index + 1, Number(value));
}
if (type == 'h') {
set?.SetBlendingHorDensity(row, col, Number(value_h_point_amount.value), index + 1, Number(value));
}
}
const resetall = () => {
switch (now_v_h.value) {
case 'vertical':
for (let index = 0; index < value_v_point_amount.value; index++) {
reset(index, true, 'v')
}
break;
case 'level':
for (let index = 0; index < value_h_point_amount.value; index++) {
reset(index, true, 'h')
}
break;
default:
break;
}
}
const del_dialog = ref(false)
const add_control_points = (amount: number, type: string) => {
if (amount < 5) return
let tmpconfig: any = null
let row = $store.getters.GetTheCurrentlySelectedCamera[0]
let col = $store.getters.GetTheCurrentlySelectedCamera[1]
switch (type) {
case 'v':
set?.AddBlendingCtrlPoint('ver_density', row, col, Number(amount)).then((res) => {
if (res == null || typeof (res) == "undefined") return
update(res?.config)
let tmp = JSON.parse(res?.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;
tmpconfig = JSON.parse(JSON.stringify(fortmp));
config = JSON.parse(JSON.stringify(fortmp));
options_value_v_point_amount.value = []
for (let key in tmpconfig.multi_ver_density) {
options_value_v_point_amount.value.push(key)
}
// console.log(amount)
// console.log(tmpconfig.multi_ver_density)
value_v_point_amount.value = amount
$store.commit("setfusion_configuration", res?.config);
value_v.value = []
value_v_point.value = []
for (let index = 0; index < tmpconfig.multi_ver_density[amount].length; index++) {
let tmp: DensityCorrectionPoint = tmpconfig.multi_ver_density[amount][index];
value_v.value.push(tmp)
let x_y = coordinate_transformation_value_to_xy(tmp.x, tmp.y)
let def_x_f = coordinate_transformation_value_to_xy(tmp.def_x, tmp.def_y)
let tmp_point: DensityCorrectionPoint = {
control_point: tmp.control_point,
x: x_y.x,
y: x_y.y,
def_x: def_x_f.x,
def_y: def_x_f.y
}
value_v_point.value.push(tmp_point)
}
});
break;
case 'h':
set?.AddBlendingCtrlPoint('hor_density', row, col, Number(amount)).then((res) => {
if (res == null || typeof (res) == "undefined") return
update(res?.config)
let tmp = JSON.parse(res?.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;
tmpconfig = JSON.parse(JSON.stringify(fortmp));
config = JSON.parse(JSON.stringify(fortmp));
options_value_h_point_amount.value = []
for (let key in tmpconfig.multi_hor_density) {
options_value_h_point_amount.value.push(key)
}
value_h_point_amount.value = amount
$store.commit("setfusion_configuration", res?.config);
value_h.value = []
value_h_point.value = []
for (let index = 0; index < tmpconfig.multi_hor_density[amount].length; index++) {
let tmp: DensityCorrectionPoint = tmpconfig.multi_hor_density[amount][index];
value_h.value.push(tmp)
let x_y = coordinate_transformation_value_to_xy(tmp.x, tmp.y)
let def_x_f = coordinate_transformation_value_to_xy(tmp.def_x, tmp.def_y)
let tmp_point: DensityCorrectionPoint = {
control_point: tmp.control_point,
x: x_y.x,
y: x_y.y,
def_x: def_x_f.x,
def_y: def_x_f.y
}
value_h_point.value.push(tmp_point)
}
});
break;
default:
break;
}
}
/**
* 更新比例 更新坐标
*/
const recalculate_coordinates = () => {
try {
Proportion.value.x = config.width / (div.value.offsetWidth - point.value.w)
Proportion.value.y = config.height / (div.value.offsetHeight - point.value.h)
max.value.x = div.value.offsetWidth
max.value.y = div.value.offsetHeight
for (let index = 0; index < value_v_point_amount.value; index++) {
let x_y = coordinate_transformation_value_to_xy(value_v.value[index].x, value_v.value[index].y)
let def_x_f = coordinate_transformation_value_to_xy(value_v.value[index].def_x, value_v.value[index].def_y)
value_v_point.value[index].x = x_y.x
value_v_point.value[index].y = x_y.y
value_v_point.value[index].def_x = def_x_f.x
value_v_point.value[index].def_y = def_x_f.y
}
for (let index = 0; index < value_h_point_amount.value; index++) {
let x_y = coordinate_transformation_value_to_xy(value_h.value[index].x, value_h.value[index].y)
let def_x_f = coordinate_transformation_value_to_xy(value_h.value[index].def_x, value_h.value[index].def_y)
value_h_point.value[index].x = x_y.x
value_h_point.value[index].y = x_y.y
value_h_point.value[index].def_x = def_x_f.x
value_h_point.value[index].def_x = def_x_f.y
}
} catch (error) {
}
}
const reduce_control_points = (amount: number, type: string) => {
if (amount <= 5) return
let tmpconfig: any = null
let row = $store.getters.GetTheCurrentlySelectedCamera[0]
let col = $store.getters.GetTheCurrentlySelectedCamera[1]
switch (type) {
case 'v':
set?.DelBlendingCtrlPoint('ver_density', row, col, Number(amount)).then((res) => {
if (res == null || typeof (res) == "undefined") return
let tmp = JSON.parse(res?.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;
options_value_v_point_amount.value = []
tmpconfig = JSON.parse(JSON.stringify(fortmp));
config = JSON.parse(JSON.stringify(fortmp));
for (let key in tmpconfig.multi_ver_density) {
options_value_v_point_amount.value.push(key)
}
value_v_point_amount.value = Number(options_value_v_point_amount.value[options_value_v_point_amount.value.length-1])
amount=Number(options_value_v_point_amount.value[options_value_v_point_amount.value.length-1])
// console.log(tmpconfig.multi_ver_density)
// console.log(value_v_point_amount.value)
// console.log(amount,'a')
$store.commit("setfusion_configuration", res?.config);
value_v.value = []
value_v_point.value = []
for (let index = 0; index < tmpconfig.multi_ver_density[amount].length; index++) {
let tmp: DensityCorrectionPoint = config.multi_ver_density[amount][index];
value_v.value.push(tmp)
let x_y = coordinate_transformation_value_to_xy(tmp.x, tmp.y)
let def_x_f = coordinate_transformation_value_to_xy(tmp.def_x, tmp.def_y)
let tmp_point: DensityCorrectionPoint = {
control_point: tmp.control_point,
x: x_y.x,
y: x_y.y,
def_x: def_x_f.x,
def_y: def_x_f.y
}
value_v_point.value.push(tmp_point)
}
options_model_v.value=0
});
break;
case 'h':
set?.DelBlendingCtrlPoint('hor_density', row, col, Number(amount)).then((res) => {
if (res == null || typeof (res) == "undefined") return
let tmp = JSON.parse(res?.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;
tmpconfig = JSON.parse(JSON.stringify(fortmp));
config = JSON.parse(JSON.stringify(fortmp));
options_value_h_point_amount.value = []
for (let key in tmpconfig.multi_hor_density) {
options_value_h_point_amount.value.push(key)
}
value_h_point_amount.value = Number(options_value_h_point_amount.value[options_value_h_point_amount.value.length-1])
amount=Number(options_value_h_point_amount.value[options_value_h_point_amount.value.length-1])
//value_h_point_amount.value = amount
$store.commit("setfusion_configuration", res?.config);
value_h.value = []
value_h_point.value = []
// console.log(tmpconfig.multi_hor_density)
for (let index = 0; index < tmpconfig.multi_hor_density[amount].length; index++) {
let tmp: DensityCorrectionPoint = tmpconfig.multi_hor_density[amount][index];
value_h.value.push(tmp)
let x_y = coordinate_transformation_value_to_xy(tmp.x, tmp.y)
let def_x_f = coordinate_transformation_value_to_xy(tmp.def_x, tmp.def_y)
let tmp_point: DensityCorrectionPoint = {
control_point: tmp.control_point,
x: x_y.x,
y: x_y.y,
def_x: def_x_f.x,
def_y: def_x_f.y
}
value_h_point.value.push(tmp_point)
}
options_model_h.value=0
});
break;
default:
break;
}
}
const update = (config: string) => {
let tmp = JSON.parse($store.state.fusion_configuration);
let fortmp = null;
let i;
for (i of tmp.projectors) {
if (
i.col === $store.getters.GetTheCurrentlySelectedCamera[1] &&
i.row === $store.getters.GetTheCurrentlySelectedCamera[0]