123
							parent
							
								
									3339a3d389
								
							
						
					
					
						commit
						d2ab5baea8
					
				| 
						 | 
					@ -78,7 +78,7 @@ let objM = [];
 | 
				
			||||||
// 监测设备
 | 
					// 监测设备
 | 
				
			||||||
let warnSets = [];
 | 
					let warnSets = [];
 | 
				
			||||||
// 设置漫游索引
 | 
					// 设置漫游索引
 | 
				
			||||||
let currentIndex = 0;
 | 
					let currentIndex = 1;
 | 
				
			||||||
let romeObj = []
 | 
					let romeObj = []
 | 
				
			||||||
// 设置巡检
 | 
					// 设置巡检
 | 
				
			||||||
let checkArr = [];
 | 
					let checkArr = [];
 | 
				
			||||||
| 
						 | 
					@ -173,16 +173,6 @@ const loadSence = () => {
 | 
				
			||||||
                yjobj.push(e);
 | 
					                yjobj.push(e);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
        // 设置漫游点位
 | 
					 | 
				
			||||||
        const objname = ['start', 'middle1', 'middle2', 'end']
 | 
					 | 
				
			||||||
        objname.forEach((item, index) => {
 | 
					 | 
				
			||||||
            var targetModel = model.getObjectByName(item);
 | 
					 | 
				
			||||||
            if (targetModel) romeObj.push(
 | 
					 | 
				
			||||||
                targetModel
 | 
					 | 
				
			||||||
            )
 | 
					 | 
				
			||||||
            console.log('targetModel', targetModel)
 | 
					 | 
				
			||||||
        })
 | 
					 | 
				
			||||||
        // 漫游结束
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // 获取巡检设备
 | 
					        // 获取巡检设备
 | 
				
			||||||
        const checkname = [{
 | 
					        const checkname = [{
 | 
				
			||||||
| 
						 | 
					@ -426,47 +416,6 @@ const centerSelectedGroup = (obj) => {
 | 
				
			||||||
    tween.start();
 | 
					    tween.start();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 漫游
 | 
					 | 
				
			||||||
const roam = () => {
 | 
					 | 
				
			||||||
    if (currentIndex < romeObj.length) {
 | 
					 | 
				
			||||||
        console.log('照相机坐标', camera.position);
 | 
					 | 
				
			||||||
        console.log('物体坐标', romeObj[currentIndex].getWorldPosition(new THREE.Vector3()));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        var nextPosition = romeObj[currentIndex].getWorldPosition(new THREE.Vector3());
 | 
					 | 
				
			||||||
        // 在动画完成后触发下一个漫游
 | 
					 | 
				
			||||||
        gsap.to(camera.position, {
 | 
					 | 
				
			||||||
            x: nextPosition.x,
 | 
					 | 
				
			||||||
            y: nextPosition.y + 2.2,
 | 
					 | 
				
			||||||
            z: nextPosition.z,
 | 
					 | 
				
			||||||
            duration: 10,
 | 
					 | 
				
			||||||
            ease: 'power1.inOut',
 | 
					 | 
				
			||||||
            onComplete: () => {
 | 
					 | 
				
			||||||
                roam()
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        let lookObj;
 | 
					 | 
				
			||||||
        if (currentIndex == romeObj.length - 1) {
 | 
					 | 
				
			||||||
            lookObj = romeObj[0].getWorldPosition(new THREE.Vector3())
 | 
					 | 
				
			||||||
        } else if (currentIndex < romeObj.length) {
 | 
					 | 
				
			||||||
            lookObj = romeObj[currentIndex + 1].getWorldPosition(new THREE.Vector3())
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        gsap.to(controls.target, {
 | 
					 | 
				
			||||||
            x: lookObj.x,
 | 
					 | 
				
			||||||
            y: lookObj.y + 2.2,
 | 
					 | 
				
			||||||
            z: lookObj.z,
 | 
					 | 
				
			||||||
            duration: 10,
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            ease: "power1.inOut",
 | 
					 | 
				
			||||||
            onComplete: () => { },
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
        currentIndex++;
 | 
					 | 
				
			||||||
        console.log('lookObj', currentIndex)
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
        toHomeView();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
// 返回初始值
 | 
					// 返回初始值
 | 
				
			||||||
const toHomeView = () => {
 | 
					const toHomeView = () => {
 | 
				
			||||||
    // 清除选中框
 | 
					    // 清除选中框
 | 
				
			||||||
| 
						 | 
					@ -624,18 +573,6 @@ const xfadd = (obj, state) => {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
// 移除消防标签
 | 
					// 移除消防标签
 | 
				
			||||||
const removexf = () => {
 | 
					const removexf = () => {
 | 
				
			||||||
    // model.traverse(e => {
 | 
					 | 
				
			||||||
    //     if (e.isMesh && e.children.length > 0) {
 | 
					 | 
				
			||||||
    //         e.remove(e.children[0])
 | 
					 | 
				
			||||||
    //     } else {
 | 
					 | 
				
			||||||
    //         e.traverse(o => {
 | 
					 | 
				
			||||||
    //             if (o.isMesh && o.children.length > 0) {
 | 
					 | 
				
			||||||
    //                 o.remove(o.children[0])
 | 
					 | 
				
			||||||
    //             }
 | 
					 | 
				
			||||||
    //         })
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    //     }
 | 
					 | 
				
			||||||
    // })
 | 
					 | 
				
			||||||
    console.log(xfobj.length);
 | 
					    console.log(xfobj.length);
 | 
				
			||||||
    xfobj.forEach((o) => {
 | 
					    xfobj.forEach((o) => {
 | 
				
			||||||
        // 倒序
 | 
					        // 倒序
 | 
				
			||||||
| 
						 | 
					@ -677,11 +614,11 @@ const changeMap = (img) => {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
// 巡检
 | 
					// 巡检
 | 
				
			||||||
const check = () => {
 | 
					const check = () => {
 | 
				
			||||||
 | 
					    console.log('照相机坐标', camera.position);
 | 
				
			||||||
 | 
					    console.log('物体坐标', checkArr[checkindex].getWorldPosition(new THREE.Vector3())); 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (currentIndex < romeObj.length) {
 | 
					    if (checkindex < checkArr.length ) {  
 | 
				
			||||||
        // .getWorldPosition()属性需要用三维向量表示摸个坐标后方可读取
 | 
					 | 
				
			||||||
        var checkPosition = checkArr[checkindex].getWorldPosition(new THREE.Vector3());
 | 
					        var checkPosition = checkArr[checkindex].getWorldPosition(new THREE.Vector3());
 | 
				
			||||||
 | 
					 | 
				
			||||||
        gsap.to(camera.position, {
 | 
					        gsap.to(camera.position, {
 | 
				
			||||||
            x: checkPosition.x,
 | 
					            x: checkPosition.x,
 | 
				
			||||||
            y: checkPosition.y + 5.2,
 | 
					            y: checkPosition.y + 5.2,
 | 
				
			||||||
| 
						 | 
					@ -689,23 +626,24 @@ const check = () => {
 | 
				
			||||||
            duration: 10,
 | 
					            duration: 10,
 | 
				
			||||||
            ease: 'power1.inOut',
 | 
					            ease: 'power1.inOut',
 | 
				
			||||||
            onComplete: () => {
 | 
					            onComplete: () => {
 | 
				
			||||||
                check()
 | 
					                // 显示标签,已经检查通过
 | 
				
			||||||
 | 
					                addLabel(checkArr[checkindex], checkArr[checkindex].isPass);
 | 
				
			||||||
 | 
					                if (checkindex == checkArr.length - 1) { // 巡检结束
 | 
				
			||||||
 | 
					                    checkComplete();
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    check()
 | 
				
			||||||
 | 
					                    
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        var pos1 = new THREE.Vector3( camera.position );
 | 
					 | 
				
			||||||
        console.log(12354, pos1);
 | 
					 | 
				
			||||||
        var pos2 = new THREE.Vector3( checkPosition );
 | 
					 | 
				
			||||||
        console.log(54321, pos2);
 | 
					 | 
				
			||||||
        var distance = pos1.distanceTo(pos2);
 | 
					 | 
				
			||||||
        console.log(0, distance);
 | 
					 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        let nextObj;
 | 
					        let nextObj;
 | 
				
			||||||
        if (checkindex == checkArr.length - 1) {
 | 
					        if (checkindex == checkArr.length - 1) {
 | 
				
			||||||
            nextObj = checkArr[0].getWorldPosition(new THREE.Vector3())
 | 
					            nextObj = checkArr[0].getWorldPosition(new THREE.Vector3())
 | 
				
			||||||
            return;
 | 
					 | 
				
			||||||
        } else if (checkindex < checkArr.length - 1) {
 | 
					        } else if (checkindex < checkArr.length - 1) {
 | 
				
			||||||
            nextObj = checkArr[checkindex + 1].getWorldPosition(new THREE.Vector3())
 | 
					            nextObj = checkArr[checkindex + 1].getWorldPosition(new THREE.Vector3())
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        gsap.to(controls.target, {
 | 
					        gsap.to(controls.target, {
 | 
				
			||||||
            x: nextObj.x,
 | 
					            x: nextObj.x,
 | 
				
			||||||
            y: nextObj.y + 5.2,
 | 
					            y: nextObj.y + 5.2,
 | 
				
			||||||
| 
						 | 
					@ -713,22 +651,17 @@ const check = () => {
 | 
				
			||||||
            duration: 10,
 | 
					            duration: 10,
 | 
				
			||||||
            ease: "power1.inOut",
 | 
					            ease: "power1.inOut",
 | 
				
			||||||
            onComplete: () => {
 | 
					            onComplete: () => {
 | 
				
			||||||
                if (checkindex == romeObj.length) { // 巡检结束
 | 
					                
 | 
				
			||||||
                    checkComplete();
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                // 显示标签,已经检查通过
 | 
					 | 
				
			||||||
                // addLabel(checkArr[checkindex], checkArr[checkindex].isPass);
 | 
					 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        checkindex++;
 | 
					        checkindex++;
 | 
				
			||||||
        console.log('nextObj', checkindex)
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
// 巡检结束
 | 
					// 巡检结束
 | 
				
			||||||
const checkComplete = () => {
 | 
					const checkComplete = () => {
 | 
				
			||||||
    toHomeView();
 | 
					    toHomeView();
 | 
				
			||||||
    bimStore().setCheckArr(romeObj);
 | 
					    bimStore().setCheckArr(checkArr);
 | 
				
			||||||
    emit('checkComplete', romeObj);
 | 
					    emit('checkComplete', checkArr);
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue