From f6a7456d77dd42f6d13e0fbcbecc693792f231ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=93=B6=E4=B8=AD=E6=B2=99?= <464652163@qq.com>
Date: Mon, 8 Jan 2024 09:43:40 +0800
Subject: [PATCH] 123
---
.../bim/bimHome/components/ThreeView2.vue | 114 +++++++++++++++---
1 file changed, 96 insertions(+), 18 deletions(-)
diff --git a/src/views/bim/bimHome/components/ThreeView2.vue b/src/views/bim/bimHome/components/ThreeView2.vue
index 0744946..8728d8c 100644
--- a/src/views/bim/bimHome/components/ThreeView2.vue
+++ b/src/views/bim/bimHome/components/ThreeView2.vue
@@ -12,12 +12,32 @@
{{ isRemoveBottom ? '移除地板' : '恢复地板' }}
-
+
@@ -64,6 +84,9 @@ let romeObj = []
let checkArr = [];
let checkindex = 0;
+//墙体
+let isShowWall = false;
+
let mouse = new THREE.Vector2();
let labelRenderer = new CSS2DRenderer(); //新建CSS2DRenderer
const data = reactive({
@@ -191,10 +214,7 @@ const loadSence = () => {
})
scene.add(model);
- // 将预警设备染色
- warn();
- // 更换墙体纹理
- changeMap();
+
});
};
const renderScene = () => {
@@ -457,6 +477,10 @@ const toHomeView = () => {
isAddLabel.value = true;
// 清除精灵图
controls.reset();
+ // 恢复初始颜色
+ cleanColor();
+ // 隐藏图例
+ isShowWall = false;
}
// 拉近距离
const nearCamera = (floor) => {
@@ -515,7 +539,18 @@ const createLableObj = (text, t) => {
// 巡检逻辑
} else {
laberDiv.className = "laber_state";
- laberDiv.innerHTML = `设备名称:${text}是否通过:${t ? '通过' : '停下,巡检没通过'}
`
+ laberDiv.innerHTML = `
+
设备名称:${text}
+
+ 是否通过:
+
+ 通过,检查下一个
+
+
+ 不通过,已记录异常,检查下一个
+
+
+
`
}
let pointLabel = new CSS2DObject(laberDiv);
return pointLabel;
@@ -567,6 +602,7 @@ const xfadd = (obj, state) => {
}
// 更换纹理贴图方法
const changeMap = (img) => {
+ isShowWall = true;
// 获取墙体
model.traverse(e => {
if (['wallnew1', 'wallnew2', 'wallnew3', 'wallnew4'].indexOf(e.name) != -1) {
@@ -574,27 +610,35 @@ const changeMap = (img) => {
e.material = new THREE.MeshBasicMaterial({
transparent: true,
opacity: 0.5,
- color: new THREE.Color('rgb( 3,95,180)')
+ color: new THREE.Color('rgb( 88,211,247)')
});
} else if (['wall1988_01', 'wall1988_02', 'wall1988_03'].indexOf(e.name) != -1) {
e.material = new THREE.MeshBasicMaterial({
transparent: true,
opacity: 0.5,
- color: new THREE.Color('rgb( 180,95,4 )')
+ color: new THREE.Color('rgb( 0,128,255)')
});
} else if (['wall2010_01', 'wall2010_02'].indexOf(e.name) != -1) {
e.material = new THREE.MeshBasicMaterial({
transparent: true,
opacity: 0.5,
- color: new THREE.Color('rgb(4,180,134)')
+ color: new THREE.Color('rgb(247,254,46)')
+ });
+ } else if (['wall2022_01'].indexOf(e.name) != -1) {
+ e.material = new THREE.MeshBasicMaterial({
+ transparent: true,
+ opacity: 0.5,
+ color: new THREE.Color('rgb(253,45,45)')
});
}
})
+ console.log(123, isShowWall)
}
// 巡检
const check = () => {
if (currentIndex < romeObj.length) {
var checkPosition = checkArr[checkindex].getWorldPosition(new THREE.Vector3());
+
gsap.to(camera.position, {
x: checkPosition.x,
y: checkPosition.y + 5.2,
@@ -602,16 +646,13 @@ const check = () => {
duration: 10,
ease: 'power1.inOut',
onComplete: () => {
- // 显示标签,已经检查通过
- addLabel(checkArr[checkindex], checkArr[checkindex].isPass);
- // 如果巡检通过,巡检下一个设备
- if (checkArr[checkindex].isPass) {
- setTimeout(() => {
- check()
- }, 2000)
- }
+ setTimeout(() => {
+ check()
+ }, 5000)
}
});
+ // 显示标签,已经检查通过
+ addLabel(checkArr[checkindex], checkArr[checkindex].isPass);
let nextObj;
if (checkindex == checkArr.length - 1) {
nextObj = checkArr[0].getWorldPosition(new THREE.Vector3())
@@ -631,6 +672,7 @@ const check = () => {
console.log('nextObj', checkindex)
}
}
+
\ No newline at end of file