From 57f85757166e67c59d2c10cee937935ce05d71b5 Mon Sep 17 00:00:00 2001 From: hzz Date: Wed, 17 May 2023 15:15:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BD=91=E7=BB=9C=E5=88=86?= =?UTF-8?q?=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/FactoryView/threeMap.vue | 58 +++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/src/views/FactoryView/threeMap.vue b/src/views/FactoryView/threeMap.vue index a153ad2..8f330ca 100644 --- a/src/views/FactoryView/threeMap.vue +++ b/src/views/FactoryView/threeMap.vue @@ -380,6 +380,8 @@ const init = () => { createSwitch({x:-208.35,y:0 ,z:107.47}) //机加车间 createSwitch({x:-40.22,y:0 ,z:19.90}) + //服装军团 + createSwitch({x:-81.96,y:0 ,z:-283.33}) //电控分厂 createSwitch({x:-232.96,y:0 ,z:-64.48}) //大配套中心 @@ -388,6 +390,31 @@ const init = () => { createSwitch({x:5.29,y:0 ,z:19.00}) //家纺 医防 createSwitch({x:88.55,y:0 ,z:-214.89}) + //二道岗 + createSwitch({x:306.5,y:0,z:5.43}) + /*交换机结束********************************* */ + /*创建wifi */ + //机加 + createWifi({x:-46.96,y:2 ,z:156.57}) + //大件 + createWifi({x:52.60,y:2 ,z:96.44}) + createWifi({x:52.60,y:2 ,z:157.07}) + //精饰 + createWifi({x:133.14,y:2 ,z:107.43}) + createWifi({x:133.14,y:2 ,z:156.25}) + //焊接 + createWifi({x:305.73,y:2 ,z:110.45}) + createWifi({x:305.73,y:2 ,z:238.67}) + //服装 + createWifi({x:-89.13,y:4 ,z:-245.33}) + createWifi({x:-132.07,y:2 ,z:-245.33}) + createWifi({x:-222.31,y:2 ,z:-245.33}) + //家纺 医防 + createWifi({x:140.83,y:2 ,z:-197.34}) + createWifi({x:259.37,y:2 ,z:-197.34}) + createWifi({x:140.83,y:2 ,z:-111.84}) + createWifi({x:259.50,y:2 ,z:-111.81}) + /*创建红线******************/ @@ -523,8 +550,8 @@ const init = () => { const intersects = raycaster.intersectObjects(scene.children); if (intersects.length > 0) { var selected = intersects[0]; //取第一个物体 - // console.log("坐标", "{x:" + selected.point.x.toFixed(2) + ",y:" + (selected.point.y.toFixed(2) - 1) + ",z:" + selected.point.z.toFixed(2)+ "}"); - console.log("非正常坐标", "{x:" + (+selected.point.x+6).toFixed(2) + ",y:0 ,z:" + (selected.point.z-33).toFixed(2)+ "}"); + console.log("坐标", "{x:" + selected.point.x.toFixed(2) + ",y:" + (selected.point.y.toFixed(2) - 1) + ",z:" + selected.point.z.toFixed(2)+ "}"); + console.log("非正常坐标", "{x:" + (+selected.point.x-0.83).toFixed(2) + ",y:2 ,z:" + (selected.point.z+3.52).toFixed(2)+ "}"); let workerShop = intersects[0]?.object?.name if (workerShopRoute.hasOwnProperty(workerShop) && !edit) { //router.push({ path: workerShopRoute[workerShop] }) @@ -654,14 +681,37 @@ function createLine(color: number, pointsList: any) { } +//创建wifi +function createWifi(position: positionType) { + const loader = new GLTFLoader(); + + loader.load('/models/glb/tothefuture_wifi.glb', function (gltf) { + const mesh = gltf.scene.children[0]; + console.log(mesh); + + const s = 0.3; + mesh.scale.set(s, s, s); + mesh.position.set(position.x, position.y, position.z); + // mesh.rotation.x = THREE.MathUtils.degToRad(270) + mesh.castShadow = true; + mesh.receiveShadow = true; + scene.add(mesh); + + }, undefined, function (error) { + + console.error(error); + + }); +} + //创建交换机 -function createSwitch(position: positionType) { +function createSwitch(position: positionType,scale:number=0.2) { const loader = new GLTFLoader(); loader.load('/models/gltf/scene.gltf', function (gltf) { const mesh = gltf.scene.children[0]; - const s = 0.2; + const s = scale; mesh.scale.set(s, s, 0.5); mesh.position.set(position.x, position.y, position.z); // mesh.rotation.z = THREE.MathUtils.degToRad(180)