webGl旋转问题解决
parent
1073c8a188
commit
cff600a3b7
|
@ -38,7 +38,11 @@ export default {
|
|||
this.me.hideParts = val;
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
isClient() {
|
||||
return this.me.bimCfg.clientApi;
|
||||
},
|
||||
doSaveHide() {
|
||||
this.$modal.confirm("确定保存吗?").then(() => {
|
||||
let obj = {};
|
||||
|
@ -81,6 +85,7 @@ export default {
|
|||
doHideFeatures(hideParts) {
|
||||
let that = this;
|
||||
this.hideParts = hideParts || [];
|
||||
if (!this.isClient()) {
|
||||
api.Public.clearHandler();
|
||||
api.Feature.getByEvent(false);
|
||||
api.Feature.getByEvent(true, async (n) => {
|
||||
|
@ -95,6 +100,24 @@ export default {
|
|||
that.hideEl++;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
api.Public.pickupCoordinate(false);
|
||||
api.Public.event("LEFT_CLICK", (t) => {
|
||||
api.Feature.GetFeatureByEvent(t.position, async n => {
|
||||
if (n && n["id"]) {
|
||||
let featureId = n.id;
|
||||
let datas = await that.getServerFeatureInfos(that, [featureId]);
|
||||
datas.forEach(it => {
|
||||
that.hideParts.push(it);
|
||||
});
|
||||
//that.hideParts.push(featureId);
|
||||
api.Feature.setVisible(featureId, false);
|
||||
that.hideEl++;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
async getServerFeatureInfos(that, ids) {
|
||||
if (ids.length == 0) {
|
||||
|
@ -128,6 +151,7 @@ export default {
|
|||
.hide-features {
|
||||
padding: 0px 0px 20px;
|
||||
height: 80vh;
|
||||
|
||||
.sel-list {
|
||||
padding: 0px 10px 10px;
|
||||
height: 100%;
|
||||
|
|
|
@ -185,10 +185,17 @@ export default {
|
|||
},
|
||||
addModel(modelId, cb) {
|
||||
let url = `${window.config.modelUrl}/Tools/output/model/${modelId}/root.glt`;
|
||||
let modelInfo = this.projectMessage.find(m => m.modelId == modelId);
|
||||
let direction = null;
|
||||
if (this.me.bimCfg.clientApi) {
|
||||
url = `/bimdata/Tools/output/model/${modelId}/root.glt`;
|
||||
if (modelInfo) {
|
||||
direction = modelInfo.bimCfg.direction;
|
||||
}
|
||||
}
|
||||
console.log("加载模型:" + url);
|
||||
|
||||
|
||||
api.Model.add(
|
||||
url,
|
||||
modelId,
|
||||
|
@ -197,7 +204,7 @@ export default {
|
|||
},
|
||||
() => {
|
||||
console.log("加载模型成功");
|
||||
let modelInfo = this.projectMessage.find(m => m.modelId == modelId);
|
||||
|
||||
if (modelInfo) {
|
||||
let cfg = modelInfo.bimCfg;
|
||||
let x = cfg?.x || 0;
|
||||
|
@ -249,6 +256,7 @@ export default {
|
|||
setTimeout(() => {
|
||||
let featureIds = (this.me.hideParts || []).map(it => it.featureId);
|
||||
if (featureIds.length > 0) {
|
||||
console.log("隐藏", featureIds.join("#"));
|
||||
api.Feature.setVisible(featureIds.join("#"), false);
|
||||
}
|
||||
hideFn();
|
||||
|
@ -256,8 +264,7 @@ export default {
|
|||
};
|
||||
hideFn();
|
||||
}, 1000);
|
||||
}
|
||||
);
|
||||
}, direction);
|
||||
},
|
||||
onCheckTree(checkNode, event) {
|
||||
let checked = event.checkedNodes.includes(checkNode);
|
||||
|
|
|
@ -21,25 +21,37 @@
|
|||
</el-form-item>
|
||||
<div class="button-group">
|
||||
<el-button type="primary" @click="updatePosition">更新位置</el-button>
|
||||
|
||||
</div>
|
||||
<template v-if="isClient">
|
||||
<template v-if="clientEditMode">
|
||||
<el-button type="primary" @click="doSaveEditData">保存</el-button>
|
||||
<el-button @click="doCancelEditMode">取消编辑旋转模式</el-button>
|
||||
</template>
|
||||
<el-button v-else type="primary" @click="updateRotate">更新旋转角度</el-button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="nav-title">旋转</div>
|
||||
<el-form-item label="绕X轴">
|
||||
<el-slider v-model="form.rotateX" :min="-180" :max="180"></el-slider>
|
||||
<el-input-number v-model="form.rotateX" placeholder="请输入旋转角度" :min="-180" :max="180"></el-input-number>
|
||||
<el-input-number v-model="form.rotateX" placeholder="请输入旋转角度" :min="-180"
|
||||
:max="180"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="绕Y轴">
|
||||
<el-slider v-model="form.rotateY" :min="-180" :max="180"></el-slider>
|
||||
<el-input-number v-model="form.rotateY" placeholder="请输入旋转角度" :min="-180" :max="180"></el-input-number>
|
||||
<el-input-number v-model="form.rotateY" placeholder="请输入旋转角度" :min="-180"
|
||||
:max="180"></el-input-number>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="绕Z轴">
|
||||
<el-slider v-model="form.rotateZ" :min="-180" :max="180"></el-slider>
|
||||
<el-input-number v-model="form.rotateZ" placeholder="请输入旋转角度" :min="-180" :max="180"></el-input-number>
|
||||
<el-input-number v-model="form.rotateZ" placeholder="请输入旋转角度" :min="-180"
|
||||
:max="180"></el-input-number>
|
||||
</el-form-item>
|
||||
<div class="button-group">
|
||||
<el-button type="primary" @click="updateRotate">更新旋转角度</el-button>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<div class="footer-btn">
|
||||
<el-button @click="resetRotate">清除模型偏移和旋转</el-button>
|
||||
<el-button type="primary" @click="onSubmit">保存</el-button>
|
||||
|
@ -86,10 +98,28 @@ export default {
|
|||
rotateZ: 0,
|
||||
|
||||
},
|
||||
movePoint: null
|
||||
movePoint: null,
|
||||
clientEditMode: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doSaveEditData() {
|
||||
this.clientEditMode = false;
|
||||
api.Edit.setEditMode("")
|
||||
api.Edit.save(d => {
|
||||
let m = d.model.find(it => it.id == this.modelId);
|
||||
this.saveData.direction = {
|
||||
flyto: true,
|
||||
matrix: m.matrix,
|
||||
rotate: m.rotate,
|
||||
transform: m.transform
|
||||
}
|
||||
});
|
||||
},
|
||||
doCancelEditMode() {
|
||||
this.clientEditMode = false;
|
||||
api.Edit.setEditMode("")
|
||||
},
|
||||
doModelMove() {
|
||||
ElMessage.info("左键单击选择移动位置,右键单击结束操作!");
|
||||
if (this.me.bimCfg.clientApi) {
|
||||
|
@ -107,6 +137,8 @@ export default {
|
|||
this.$modal.confirm("确定保存吗?").then(() => {
|
||||
let model = this.me.models.find(model => model.modelId == this.modelId);
|
||||
if (model) {
|
||||
this.saveData.hideParts = model.bimCfg?.hideParts || [];
|
||||
this.saveData.direction = this.saveData.direction || model.bimCfg?.direction;
|
||||
model.bimConfig = JSON.stringify(this.saveData);
|
||||
model.bimCfg = this.saveData;
|
||||
updateBimModel(model).then(res => {
|
||||
|
@ -167,8 +199,8 @@ export default {
|
|||
|
||||
updateRotate() {
|
||||
if (this.isClient) {
|
||||
api.Model.ClearModelRotation(this.modelId);
|
||||
api.Model.rotateForEdit(this.modelId,this.form.rotateX, this.form.rotateY, this.form.rotateZ)
|
||||
api.Edit.setEditMode("Rotate")
|
||||
this.clientEditMode = true;
|
||||
} else {
|
||||
api.Model.rotateForEdit(this.form.rotateX, this.form.rotateY, this.form.rotateZ, this.modelId)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue