加入投影机布局选择

This commit is contained in:
shefengchun 2023-02-21 17:10:54 +08:00
parent fdeb182c75
commit 6c304fdfe6
6 changed files with 128 additions and 95 deletions

View File

@ -1565,7 +1565,7 @@ export default class ClientConnection {
public async SetProjectorLayout(row: number, column: number) {
return await this.doRpc<Protocol.GetBlendingConfigResponseEntity>(
new Protocol.SetProjectorResolutionRequestEntity(row, column)
new Protocol.SetProjectorLayoutRequestEntity(row, column)
);
}

View File

@ -9,7 +9,7 @@
v-model:x="value_point[index].x" v-model:y="value_point[index].y" @activated="options_model = index"
@click="options_model = index" @dragging="dragStartHandle($event, index)">
<span>{{
index+ 1
index + 1
}}</span>
</Vue3DraggableResizable>
</div>
@ -17,7 +17,7 @@
</div>
</div>
<div>
<div class="row" >
<div class="row">
<div class="col-1"></div>
<div class="col-2 q-px-md">
<div class="col-2"> <q-select class="q-pt-md" :label="$t('point amount')"
@ -25,19 +25,14 @@
:options="options_value_point_amount" emit-value map-options />
</div>
</div>
<div class="col-2" >
<!-- <div class="col-1 q-pt-md "><q-btn color="white" @click="()=>{add_dialog;add_control_points(Number(value_point_amount))}"
text-color="black" :label="$t('add control points')" /></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-2">
<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>
<div class="col-2">
<div class="col-1 q-pt-md "><q-btn color="white" @click="() => { del_dialog = true }" :disable="value_point_amount<=9" text-color="black"
:label="$t('reduce control points')" /></div>
<div class="col-1 q-pt-md "><q-btn color="white" @click="() => { del_dialog = true }"
:disable="value_point_amount <= 9" text-color="black" :label="$t('reduce control points')" /></div>
</div>
</div>
@ -47,12 +42,11 @@
v-model="options_model" @update:model-value="(val) => { options_model = val }" :options="options" emit-value
map-options /></div>
<div class="col-2 q-px-md"> <q-input v-if="value[options_model]" filled type="number" class="q-pt-md" :dense="true"
v-model="value[options_model].x" @update:model-value="chang(options_model, $event, 'h')" label="x"
lazy-rules />
v-model="value[options_model].x" @update:model-value="chang(options_model, $event, 'h')" label="x" lazy-rules />
</div>
<div class="col-2 q-px-md"><q-input v-if="value[options_model]" filled type="number" class="q-pt-md" :dense="true"
v-model="value[options_model].y" @update:model-value="chang(options_model, $event, 'h')" label="y"
lazy-rules /></div>
v-model="value[options_model].y" @update:model-value="chang(options_model, $event, 'h')" label="y" lazy-rules />
</div>
<div class="q-pt-md col-2">
<q-btn color="white" @click="reset(options_model, true, 'h')" text-color="black" :label="$t('reset')" />
</div>
@ -93,9 +87,13 @@
</q-card-section>
<q-card-section class="q-pt-none">
<div class="row">
<div class="col-10"><q-input filled v-model="now_amount" min="3" disable type="number" :label="$t('Please enter the points you need to add')" @update:model-value="(val:any)=>{preview(val)}" /></div>
<div class="col-1 q-pa-sm"> <q-btn color="white" text-color="black" label="↑" @click="()=>{preview(Math.sqrt(now_amount)+1)}" /> </div>
<div class="col-1 q-pa-sm"> <q-btn color="white" text-color="black" label="↓" @click="()=>{preview(Math.sqrt(now_amount)-1)}"/></div>
<div class="col-10"><q-input filled v-model="now_amount" min="3" disable type="number"
:label="$t('Please enter the points you need to add')" @update:model-value="(val: any) => { preview(val) }" />
</div>
<div class="col-1 q-pa-sm"> <q-btn color="white" text-color="black" label="↑"
@click="() => { preview(Math.sqrt(now_amount) + 1) }" /> </div>
<div class="col-1 q-pa-sm"> <q-btn color="white" text-color="black" label="↓"
@click="() => { preview(Math.sqrt(now_amount) - 1) }" /></div>
</div>
</q-card-section>
@ -104,8 +102,7 @@
<q-btn flat :label="$t('ok')" @click="add" color="primary" v-close-popup />
</q-card-actions>
</q-card>
</q-dialog>
</q-dialog>
</template>
<style scoped>
@ -173,7 +170,7 @@ export default defineComponent({
const value_point_amount = ref(9)
const del_dialog = ref(false)
const add_dialog = ref(false)
const now_amount=ref(9)
const now_amount = ref(9)
const options_value_point_amount = ref(<string[]>[])
const deepcopy = (o1: any, o2: any) => {
@ -189,7 +186,7 @@ export default defineComponent({
};
const use_server_config = () => {
value_point_amount.value=9
value_point_amount.value = 9
let a = 9
value.value = []
value_point.value = []
@ -220,7 +217,7 @@ export default defineComponent({
}
const save_set_cache = () => {
let tmp = { value: value.value, value_point_amount: value_point_amount.value, value_point: value_point.value}
let tmp = { value: value.value, value_point_amount: value_point_amount.value, value_point: value_point.value }
set_cache.value[selectedprojector.value] = JSON.stringify(tmp);
}
@ -251,11 +248,11 @@ export default defineComponent({
{ deep: true }
);
// watch(()=>now_amount,(newVal, oldVal)=>{
// console.log("🚀 ~ file: SurfaceCorrection.vue:244 ~ watch ~ newVal:", newVal)
// watch(()=>now_amount,(newVal, oldVal)=>{
// console.log("🚀 ~ file: SurfaceCorrection.vue:244 ~ watch ~ newVal:", newVal)
// },
// { deep: true })
// },
// { deep: true })
const set_cache: any = ref([]);
//
@ -421,9 +418,9 @@ export default defineComponent({
value_point.value[index].y = Math.trunc(tmp.y)
value_point.value[index].x = Math.trunc(tmp.x)
}
send_value(-1,0,0)
send_value(-1, 0, 0)
}
const resetall_all=()=>{
const resetall_all = () => {
for (let index = 0; index < value_point.value.length; index++) {
value.value[index].x = value.value[index].def_x
value.value[index].y = value.value[index].def_y
@ -431,17 +428,17 @@ export default defineComponent({
value_point.value[index].y = Math.trunc(tmp.y)
value_point.value[index].x = Math.trunc(tmp.x)
}
send_value(-2,0,0)
send_value(-2, 0, 0)
for (let key in config.multi_curved_surface) {
for (let index = 0; index < config.multi_curved_surface[key].length; index++) {
config.multi_curved_surface[key][index].x = config.multi_curved_surface[key][index].def_x
config.multi_curved_surface[key][index].y = config.multi_curved_surface[key][index].def_y
}
start_point(Number(key))
}
value_point_amount.value = 9
start_point(Number(9))
for (let index = 0; index < config.multi_curved_surface[key].length; index++) {
config.multi_curved_surface[key][index].x = config.multi_curved_surface[key][index].def_x
config.multi_curved_surface[key][index].y = config.multi_curved_surface[key][index].def_y
}
start_point(Number(key))
}
value_point_amount.value = 9
start_point(Number(9))
}
const recalculate_coordinates = () => {
@ -512,7 +509,7 @@ export default defineComponent({
});
}
const del_control_points = (amount: number) => {
let tmp=amount
let tmp = amount
if (amount <= 9) return
let cardinality = Math.sqrt(amount)
amount = (cardinality + -1) ** 2
@ -541,8 +538,8 @@ export default defineComponent({
options_value_point_amount.value.push(key)
}
value_point_amount.value = 9
amount=9
now_amount.value=9
amount = 9
now_amount.value = 9
$store.commit("setfusion_configuration", res?.config);
value.value = []
value_point.value = []
@ -563,65 +560,65 @@ export default defineComponent({
});
}
const add=()=>{
const add = () => {
let tmpconfig: any = null
let row = $store.getters.GetTheCurrentlySelectedCamera[0]
let col = $store.getters.GetTheCurrentlySelectedCamera[1]
let amount = now_amount.value
set?.AddBlendingCtrlPoint('9', 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_point_amount.value = []
for (let key in tmpconfig.multi_curved_surface) {
options_value_point_amount.value.push(key)
}
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_point_amount.value = []
for (let key in tmpconfig.multi_curved_surface) {
options_value_point_amount.value.push(key)
}
value_point_amount.value = amount
$store.commit("setfusion_configuration", res?.config);
value.value = []
value_point.value = []
for (let index = 0; index < tmpconfig.multi_curved_surface[amount].length; index++) {
let tmp: DensityCorrectionPoint = tmpconfig.multi_curved_surface[amount][index];
value.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_point.value.push(tmp_point)
}
});
value_point_amount.value = amount
$store.commit("setfusion_configuration", res?.config);
value.value = []
value_point.value = []
for (let index = 0; index < tmpconfig.multi_curved_surface[amount].length; index++) {
let tmp: DensityCorrectionPoint = tmpconfig.multi_curved_surface[amount][index];
value.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_point.value.push(tmp_point)
}
});
set?.SetBlendingOption("blending_grids_control_point_count", `${value_point_amount.value}`)
}
const preview = (val: number) => {
val = Number(val)
if(val<3)return
if (val < 3) return
let width = allconfig.projector_width / (val - 1)
let height = allconfig.projector_height / (val - 1)
value.value = []
value_point.value = []
for (let index = 0; index < val; index++) {
for (let indexx = 0; indexx < val; indexx++) {
let y=allconfig.projector_height-height*index
let x=width*indexx
let tmp: DensityCorrectionPoint = {x,y,def_x:x,def_y:y,control_point:index+indexx+1};
let y = allconfig.projector_height - height * index
let x = width * indexx
let tmp: DensityCorrectionPoint = { x, y, def_x: x, def_y: y, control_point: index + indexx + 1 };
value.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)
@ -635,9 +632,9 @@ export default defineComponent({
value_point.value.push(tmp_point)
}
}
now_amount.value=val**2
value_point_amount.value=val**2
options_model.value=1
now_amount.value = val ** 2
value_point_amount.value = val ** 2
options_model.value = 1
}
defineExpose({
options_model,

View File

@ -50,6 +50,9 @@
<div class="col-3 q-px-md"> <q-select class="q-pt-md " :label="$t('change resolution')"
@update:model-value="(val) => { set_resolution(val) }" :dense="true" filled v-model="now_resolution"
:options="options_resolution" emit-value map-options /></div>
<div class="col-3 q-px-md"> <q-select class="q-pt-md " :label="$t('Change projector layout')"
@update:model-value="(val) => { send_projectorlayout(val) }" :dense="true" filled v-model="now_select_projectorlayout"
:options="projectorlayout" emit-value map-options /></div>
</div>
<div class="col-10">
<div class="q-ta-md">
@ -345,7 +348,7 @@ export default defineComponent({
const config = ref({ col: 0, row: 0 });
const EnableBlending = ref(false);
let optionsstr = ref();
optionsstr.value = "FusionLocale";
optionsstr.value = "";
const disable_blending_params_id = ref("blending@disable_blending_params");
const disable_blending_params = ref(false);
const show_blending_grids_id = ref("blending_grids_show");
@ -448,7 +451,7 @@ export default defineComponent({
setTimeout(() => {
clear_sessionStorage()
}, 500);
getconfig()
//getconfig()
options.value = "FusionLocale"
};
@ -500,6 +503,7 @@ export default defineComponent({
});
get_scenes()
set?.SetBlendingOption("blending_grids_select_ui", "blending")
optionsstr.value = "FusionLocale";
}, 1000);
});
const save_cover_name = ref("")
@ -568,6 +572,33 @@ export default defineComponent({
set?.SetBlendingOption('blending_grids_select_projector', value);
now_selsect_projector.value=value
}
/**
* 设置投影机布局
*/
const projectorlayout=[{label:'1x1',value:0},{label:'1x2',value:1}]
const now_select_projectorlayout=ref(1)
const send_projectorlayout=(val:number) => {
let arr = projectorlayout[val].label.split('x');
set?.SetProjectorLayout(Number(arr[0]),Number(arr[1])).then(res => {
let tmpp=JSON.parse(res!.config)
config.value.row = tmpp.row;
config.value.col = tmpp.col;
$q.loading.show({
message: 'Loading please wait'
})
$store.commit("setfusion_configuration", res?.config);
let tmp = options.value
options.value = ""
$store.commit("setSelectedProjector", "0/0");
setTimeout(() => {
clear_sessionStorage()
options.value = tmp
$q.loading.hide()
}, 800);
getconfig()
})
}
return {
currently_selected_projector,
name_to_be_deleted,
@ -604,7 +635,10 @@ export default defineComponent({
child,
options_resolution,
now_resolution,
set_resolution
set_resolution,
send_projectorlayout,
now_select_projectorlayout,
projectorlayout
};
},
});

View File

@ -3703,7 +3703,7 @@ export namespace Protocol {
export class SetProjectorLayoutRequestEntity extends PacketEntity {
constructor(row: number, column: number, rpc_id = 0) {
super();
super.command = Commands.kSetProjectorResolution;
super.command = Commands.kSetProjectorLayout;
super.flag = PacketEntity.FLAG_REQUEST;
super.rpc_id = rpc_id;

View File

@ -493,5 +493,6 @@ export default {
"The Folder Name Cannot Start With a '.'",
"change resolution":"change resolution",
"Loading please wait":"Loading please wait",
"Please enter the square number":"Please enter the square number"
"Please enter the square number":"Please enter the square number",
"Change projector layout":"Change projector layout"
};

View File

@ -761,5 +761,6 @@ export default {
"Version Mismatch !": "版本不匹配!",
"Version Mismatch ! Please Upgrade The Software Again ! Otherwise, The File Function Cannot Be Used !":
"版本不匹配!请重新升级软件!否则文件功能无法正常使用!",
"Please enter the square number":"请输入平方数"
"Please enter the square number":"请输入平方数",
"Change projector layout":"更改投影机布局"
};