|
@@ -8,6 +8,7 @@ import { FXAAShader } from "../public/shader/FAAXShader.js"
|
|
|
import '../public/libs/tools.js'
|
|
|
|
|
|
// 定义一个函数,接受元素ID和一个回调函数作为参数,用于处理点击事件
|
|
|
+window.waterMap = {}
|
|
|
|
|
|
function getsqlData(sdkInstance, uwbInstance) {
|
|
|
let g_PosArrayResult = null;
|
|
@@ -40,6 +41,122 @@ function getsqlData(sdkInstance, uwbInstance) {
|
|
|
var one_second_ago = new Date(now.getTime() - 1 * 1000).Format(
|
|
|
"yyyy-MM-dd hh:mm:ss.S"
|
|
|
);
|
|
|
+
|
|
|
+ {
|
|
|
+ let result = g_PosArrayResult;
|
|
|
+ for (var item of result) {
|
|
|
+ let x = item.x;
|
|
|
+ let y = item.y;
|
|
|
+ let z = item.z;
|
|
|
+ let ang_x = 0.0;
|
|
|
+ let ang_y = 0.0;
|
|
|
+ let ang_z = 0.0;
|
|
|
+ let benchType = item.bench_type
|
|
|
+ if (item.use_fix_pos == 1) {
|
|
|
+ x = JSON.parse(JSON.stringify(item.fix_pos_x));
|
|
|
+ y = JSON.parse(JSON.stringify(item.fix_pos_y));
|
|
|
+ z = JSON.parse(JSON.stringify(item.fix_pos_z));
|
|
|
+ ang_x = JSON.parse(JSON.stringify(item.fix_angle_x));
|
|
|
+ ang_y = JSON.parse(JSON.stringify(item.fix_angle_y));
|
|
|
+ ang_z = JSON.parse(JSON.stringify(item.fix_angle_z));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ }
|
|
|
+
|
|
|
+ var distance = 10000.0;
|
|
|
+
|
|
|
+ var xSubTmp = x;
|
|
|
+ var ySubTmp = y;
|
|
|
+ var zSubTmp = z;
|
|
|
+ var ang_xSubTmp = ang_x;
|
|
|
+ var ang_ySubTmp = ang_y;
|
|
|
+ var ang_zSubTmp = ang_z;
|
|
|
+
|
|
|
+ if (g_PosArrayResult) {
|
|
|
+ var iCount = 0;
|
|
|
+ for (var itemSub of g_PosArrayResult) {
|
|
|
+
|
|
|
+ iCount++;
|
|
|
+ var xSub = itemSub.x;
|
|
|
+ var ySub = itemSub.y;
|
|
|
+ var zSub = itemSub.z;
|
|
|
+ var ang_xSub = 0.0;
|
|
|
+ var ang_ySub = 0.0;
|
|
|
+ var ang_zSub = 0.0;
|
|
|
+ xSub = itemSub.fix_pos_x;
|
|
|
+ ySub = itemSub.fix_pos_y;
|
|
|
+ zSub = itemSub.fix_pos_z;
|
|
|
+ ang_xSub = itemSub.fix_angle_x;
|
|
|
+ ang_ySub = itemSub.fix_angle_y;
|
|
|
+ ang_zSub = itemSub.fix_angle_z;
|
|
|
+ var disTmp = Math.sqrt(Math.pow(x - xSub, 2) + Math.pow(y - ySub, 2) + Math.pow(z - zSub, 2))
|
|
|
+ if (disTmp < distance) {
|
|
|
+ distance = disTmp;
|
|
|
+ xSubTmp = xSub;
|
|
|
+ ySubTmp = ySub;
|
|
|
+ zSubTmp = zSub;
|
|
|
+ ang_xSubTmp = ang_xSub;
|
|
|
+ ang_ySubTmp = ang_ySub;
|
|
|
+ ang_zSubTmp = ang_zSub;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ x = xSubTmp;
|
|
|
+ y = ySubTmp;
|
|
|
+ z = zSubTmp;
|
|
|
+ ang_x = ang_xSubTmp;
|
|
|
+ ang_y = ang_ySubTmp;
|
|
|
+ ang_z = ang_zSubTmp;
|
|
|
+ x = JSON.parse(JSON.stringify(xSubTmp));
|
|
|
+ y = JSON.parse(JSON.stringify(ySubTmp));
|
|
|
+ z = JSON.parse(JSON.stringify(zSubTmp));
|
|
|
+ ang_x = JSON.parse(JSON.stringify(ang_xSubTmp));
|
|
|
+ ang_y = JSON.parse(JSON.stringify(ang_ySubTmp));
|
|
|
+ ang_z = JSON.parse(JSON.stringify(ang_zSubTmp));
|
|
|
+
|
|
|
+ let card_id = item.card_id;
|
|
|
+ let bench_id = item.bench_id;
|
|
|
+ let show_remote_button = item.show_remote_button;
|
|
|
+ // 添加水滴
|
|
|
+ let benchList = window.store ? window.store.getters['benchList/getBenchList'] : [];
|
|
|
+ let currentBench = benchList.find(b => b.id == bench_id);
|
|
|
+ let texture = null;
|
|
|
+ if (currentBench) {
|
|
|
+ switch(currentBench.status) {
|
|
|
+ case "ready":
|
|
|
+ texture = textureReady;
|
|
|
+ break;
|
|
|
+ case "running":
|
|
|
+ texture = textureRunning;
|
|
|
+ break;
|
|
|
+ case "offline":
|
|
|
+ texture = textureOffline;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ texture = textureOffline;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ texture = textureOffline;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 创建精灵对象
|
|
|
+ let spriteMaterial = new THREE.SpriteMaterial({
|
|
|
+ map: texture
|
|
|
+ });
|
|
|
+ let sprite = new THREE.Sprite(spriteMaterial);
|
|
|
+ sprite.userData = {};
|
|
|
+ // sprite.scale.set(100, 100, 1);
|
|
|
+ sprite.position.set(x, y + 10, z);
|
|
|
+ window.waterMap[bench_id] = sprite;
|
|
|
+ console.log('添加模型和水滴1111')
|
|
|
+ sdkInstance.sceneRenderer.scene.add(sprite)
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
let dracoLoader = new THREE.DRACOLoader();
|
|
|
THREE.DRACOLoader.setDecoderPath("../gltf/");
|
|
|
|
|
@@ -143,42 +260,8 @@ function getsqlData(sdkInstance, uwbInstance) {
|
|
|
};
|
|
|
childMeshTmp.userData = customData;
|
|
|
|
|
|
- // 添加水滴
|
|
|
- let benchList = window.store ? window.store.getters['benchList/getBenchList'] : [];
|
|
|
- let currentBench = benchList.find(b => b.id == bench_id);
|
|
|
- let texture = null;
|
|
|
- if (currentBench) {
|
|
|
- switch(currentBench.status) {
|
|
|
- case "ready":
|
|
|
- texture = textureReady;
|
|
|
- break;
|
|
|
- case "running":
|
|
|
- texture = textureRunning;
|
|
|
- break;
|
|
|
- case "offline":
|
|
|
- texture = textureOffline;
|
|
|
- break;
|
|
|
- default:
|
|
|
- texture = textureOffline;
|
|
|
- break;
|
|
|
- }
|
|
|
- } else {
|
|
|
- texture = textureOffline;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- // 创建精灵对象
|
|
|
- let spriteMaterial = new THREE.SpriteMaterial({
|
|
|
- map: texture
|
|
|
- });
|
|
|
- let sprite = new THREE.Sprite(spriteMaterial);
|
|
|
- sprite.userData = customData;
|
|
|
- // sprite.scale.set(100, 100, 1);
|
|
|
- sprite.position.set(x, y + 10, z);
|
|
|
-
|
|
|
console.log('添加模型和水滴1111')
|
|
|
sdkInstance.sceneRenderer.scene.add(childMeshTmp)
|
|
|
- sdkInstance.sceneRenderer.scene.add(sprite)
|
|
|
}
|
|
|
|
|
|
};
|
|
@@ -282,43 +365,7 @@ function getsqlData(sdkInstance, uwbInstance) {
|
|
|
benchFlag: true,
|
|
|
};
|
|
|
childMeshTmp.userData = customData;
|
|
|
-
|
|
|
-
|
|
|
- // 添加水滴
|
|
|
- // 加载图片纹理
|
|
|
- let benchList = window.store ? window.store.getters['benchList/getBenchList'] : [];
|
|
|
- let currentBench = benchList.find(b => b.id == bench_id);
|
|
|
- let texture = null;
|
|
|
- if (currentBench) {
|
|
|
- switch(currentBench.status) {
|
|
|
- case "ready":
|
|
|
- texture = textureReady;
|
|
|
- break;
|
|
|
- case "running":
|
|
|
- texture = textureRunning;
|
|
|
- break;
|
|
|
- case "offline":
|
|
|
- texture = textureOffline;
|
|
|
- break;
|
|
|
- default:
|
|
|
- texture = textureOffline;
|
|
|
- break;
|
|
|
- }
|
|
|
- } else {
|
|
|
- texture = textureOffline;
|
|
|
- }
|
|
|
-
|
|
|
- // 创建精灵对象
|
|
|
- let spriteMaterial = new THREE.SpriteMaterial({
|
|
|
- map: texture
|
|
|
- });
|
|
|
- let sprite = new THREE.Sprite(spriteMaterial);
|
|
|
- // sprite.scale.set(100, 100, 1);
|
|
|
- sprite.userData = customData;
|
|
|
- sprite.position.set(x, y + 10, z);
|
|
|
- console.log('添加模型和水滴2222')
|
|
|
sdkInstance.sceneRenderer.scene.add(childMeshTmp)
|
|
|
- sdkInstance.sceneRenderer.scene.add(sprite)
|
|
|
}
|
|
|
};
|
|
|
if (!sessionStorage.getItem('3dMode') || sessionStorage.getItem('3dMode') == 0) {
|