完成动态曲面添加

This commit is contained in:
shefengchun 2023-02-21 14:10:48 +08:00
parent e4003940da
commit fdeb182c75
5 changed files with 177 additions and 34 deletions

View File

@ -17,7 +17,7 @@
</div>
</div>
<div>
<div class="row" v-show="false">
<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,9 +25,12 @@
:options="options_value_point_amount" emit-value map-options />
</div>
</div>
<div class="col-2">
<div class="col-2" >
<div class="col-1 q-pt-md "><q-btn color="white" @click="add_control_points(Number(value_point_amount))"
<!-- <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>
@ -53,11 +56,17 @@
<div class="q-pt-md col-2">
<q-btn color="white" @click="reset(options_model, true, 'h')" text-color="black" :label="$t('reset')" />
</div>
<div class="col-2 q-pt-md ">
<!-- <div class="col-2 q-pt-md ">
<div><q-btn color="white" @click="resetall" text-color="black" :label="$t('resetall')" /></div>
</div>
</div> -->
</div>
<div class="row">
<div class="col-1"></div>
<div class="q-pt-md q-px-md col-5"> <q-btn color="white" @click="resetall" text-color="black"
:label="$t('Reset the current program control point')" /></div>
<div class="q-pt-md q-px-md col-5"> <q-btn color="white" @click="resetall_all" text-color="black"
:label="$t('Reset all program control points')" /></div>
</div>
</div>
<q-dialog v-model="del_dialog">
@ -75,6 +84,28 @@
</q-card>
</q-dialog>
<q-dialog position="bottom" 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">
<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>
</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>
@ -141,8 +172,8 @@ 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 options_value_point_amount = ref(<string[]>[])
const deepcopy = (o1: any, o2: any) => {
@ -220,7 +251,11 @@ export default defineComponent({
{ deep: true }
);
// watch(()=>now_amount,(newVal, oldVal)=>{
// console.log("🚀 ~ file: SurfaceCorrection.vue:244 ~ watch ~ newVal:", newVal)
// },
// { deep: true })
const set_cache: any = ref([]);
//
@ -379,6 +414,16 @@ export default defineComponent({
set?.setBlendingCorrection(row, col, 9, value_point.value.length, index + 1, Number(x), Number(y));
}
const resetall = () => {
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
let tmp = coordinate_transformation_value_to_xy(value.value[index].x, value.value[index].y)
value_point.value[index].y = Math.trunc(tmp.y)
value_point.value[index].x = Math.trunc(tmp.x)
}
send_value(-1,0,0)
}
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
@ -387,6 +432,17 @@ export default defineComponent({
value_point.value[index].x = Math.trunc(tmp.x)
}
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))
}
const recalculate_coordinates = () => {
try {
@ -486,6 +542,7 @@ export default defineComponent({
}
value_point_amount.value = 9
amount=9
now_amount.value=9
$store.commit("setfusion_configuration", res?.config);
value.value = []
value_point.value = []
@ -506,10 +563,87 @@ export default defineComponent({
});
}
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)
}
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
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};
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)
}
}
now_amount.value=val**2
value_point_amount.value=val**2
options_model.value=1
}
defineExpose({
options_model,
});
return {
resetall_all,
resetall,
div,
max,
@ -526,7 +660,11 @@ export default defineComponent({
chang_point_amount,
del_dialog,
add_control_points,
del_control_points
del_control_points,
add_dialog,
add,
now_amount,
preview
}
}
})

View File

@ -294,6 +294,7 @@ export default defineComponent({
break;
case 'SurfaceCorrection':
set?.SetBlendingOption("blending_grids_select_point", `9:${child.value!.options_model+1}`)
set?.SetBlendingOption("blending_grids_control_point_count", `${child.value!.value_point_amount}`)
break;
case 'DensityCorrection':
if(child.value!.now_v_h=='vertical'){
@ -408,6 +409,7 @@ export default defineComponent({
break;
case 'SurfaceCorrection':
tmp = '9'
set?.SetBlendingOption("blending_grids_select_point", `9:1`)
break;
case 'DensityCorrection':
tmp = 'hor_density'

View File

@ -492,5 +492,6 @@ export default {
"the folder name cannot start with a '.'":
"The Folder Name Cannot Start With a '.'",
"change resolution":"change resolution",
"Loading please wait":"Loading please wait"
"Loading please wait":"Loading please wait",
"Please enter the square number":"Please enter the square number"
};

View File

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

View File

@ -302,6 +302,22 @@
class="shadow-2 text-white"
@dragstart.prevent
>
<q-item
clickable
v-close-popup
@click="
$refs.fusion_settings_dialog.showDialog();
getconfig();
"
v-if="$store.state.custom_defines.function_fusion"
>
<q-item-section avatar>
<q-icon name="open_with" />
</q-item-section>
<q-item-section>
{{ $t("fusion settings") }}
</q-item-section>
</q-item>
<q-item
clickable
:disable="!$store.state.power_state"
@ -357,7 +373,7 @@
</q-item-section>
</q-item>
<q-item
v-if="!iswujie"
v-if="!iswujie"
clickable
v-close-popup
@click="$refs.background_image_dialog.showDialog()"
@ -371,7 +387,7 @@
</q-item-section>
</q-item>
<q-item
v-if="!iswujie"
v-if="!iswujie"
clickable
v-close-popup
@click="$refs.recovery_database_dialog.showDialog()"
@ -407,7 +423,7 @@
</q-item-section>
</q-item>
<q-item
v-if="!iswujie"
v-if="!iswujie"
clickable
v-close-popup
@click="$refs.upgrade_dialog.showDialog()"
@ -443,22 +459,7 @@
</q-item-section>
</q-item>
<q-item
clickable
v-close-popup
@click="
$refs.fusion_settings_dialog.showDialog();
getconfig();
"
v-if="$store.state.custom_defines.function_fusion"
>
<q-item-section avatar>
<q-icon name="open_with" />
</q-item-section>
<q-item-section>
{{ $t("fusion settings") }}
</q-item-section>
</q-item>
<q-item
clickable
@ -725,9 +726,9 @@ export default defineComponent({
show_device_list.value =
typeof (<any>window).user_search?.hide_device_list == "undefined";
});
let iswujie=ref(false)
let iswujie = ref(false);
if ((window as any).$wujie) {
iswujie.value=true
iswujie.value = true;
}
return {
getconfig,
@ -833,12 +834,12 @@ export default defineComponent({
},
logout() {
const w = window as any;
console.log(w)
console.log(w);
if (w.controlLogout && typeof w.controlLogout == "function") {
console.log(1)
console.log(1);
w.controlLogout();
} else {
console.log(2)
console.log(2);
Cookies.remove("auto_login");
SessionStorage.clear();
try {