[Frontend] 測試功能,顯示tag_id相關資訊

This commit is contained in:
wanli 2023-01-02 09:49:02 +08:00
parent dd8dfc4fe9
commit 8fe1dae9f7
2 changed files with 20 additions and 12 deletions

View File

@ -227,8 +227,14 @@
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwTUVQJUUzJTgwJTkxXzIwMjJfMTJfMjkubndj'); //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwTUVQJUUzJTgwJTkxXzIwMjJfMTJfMjkubndj');
//12.29 整棟 //12.29 整棟
launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1pdHN1YmlzaGkvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU5JUExJUFGXzEyMjgubndk'); //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1pdHN1YmlzaGkvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU5JUExJUFGXzEyMjgubndk');
//12.30 整棟樓 ARC + MEP
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8xMl8zMC5ud2Q');
//12.30 整棟樓 ARC + MEP 半透明
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8lRTUlOEQlOEElRTklODAlOEYlRTYlOTglOEUlRTUlQkIlQkElRTclQUYlODlfMTJfMzAubndk');
launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8lRTUlOEQlOEElRTklODAlOEYlRTYlOTglOEUlRTUlQkIlQkElRTclQUYlODlfMTJfMzAubndk');
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwQVJDJUUzJTgwJTkxXzIwMjJfMTJfMTMubndk');//new ARC //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwQVJDJUUzJTgwJTkxXzIwMjJfMTJfMTMubndk');//new ARC
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwTUVQJUUzJTgwJTkxXzIwMjJfMTJfMTMubndj');//new MEP //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwTUVQJUUzJTgwJTkxXzIwMjJfMTJfMTMubndj');//new MEP

View File

@ -172,7 +172,7 @@ function onDocumentLoadSuccess(doc) {
const fragList = model.getFragmentList(); const fragList = model.getFragmentList();
/*loadHeatmaps(model);*/ loadHeatmaps(model);
@ -270,11 +270,11 @@ function onDocumentLoadSuccess(doc) {
e.properties.forEach(function (item) { e.properties.forEach(function (item) {
if (item.displayName == "【tag_id】") { // Tag_name tag_id 【tag_id】 if (item.displayName == "【tag_id】") { // Tag_name tag_id 【tag_id】
if (item.displayValue != "") { if (item.displayValue != "") {
//if ((item.displayValue).indexOf('TPE_B1_EE_E4') > -1) { if ((item.displayValue).indexOf('TPE_B1_ME_M10') > -1) {
console.log("--------------------------------------------------"); console.log("--------------------------------------------------");
console.log("Tag_name dbid: " + e.dbId); console.log("Tag_name dbid: " + e.dbId);
console.log("value: " + item.displayValue); console.log("value: " + item.displayValue);
//} }
//var v = getFragmentWorldMatrixByNodeId(e.dbId, viewer); //var v = getFragmentWorldMatrixByNodeId(e.dbId, viewer);
//console.log("v: " + v); //console.log("v: " + v);
@ -295,10 +295,10 @@ function onDocumentLoadSuccess(doc) {
bounds.union(box); bounds.union(box);
}, true); }, true);
var position = bounds.center(); var position = bounds.center();
//if ((item.displayValue).indexOf('TPE_B1_EE_E4') > -1) { if ((item.displayValue).indexOf('TPE_B1_ME_M10') > -1) {
console.log("position: (" + (position.x).toFixed(2) + ", " + (position.y).toFixed(2) + ", " + (position.z).toFixed(2) + ")"); console.log("position: (" + (position.x).toFixed(2) + ", " + (position.y).toFixed(2) + ", " + (position.z).toFixed(2) + ")");
console.log("--------------------------------------------------"); console.log("--------------------------------------------------");
//} }
} }
//getFragmentWorldMatrixByNodeId(e.dbId, viewer); //getFragmentWorldMatrixByNodeId(e.dbId, viewer);
//let fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag); //let fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
@ -1067,19 +1067,19 @@ async function loadHeatmaps(model) {
//x: -17.33, y: 51.03, z: -2.52 //x: -17.33, y: 51.03, z: -2.52
const devices = [ const devices = [
{ {
id: "Oficina 5", id: "Oficina 3",
//name: "Oficina-", //name: "Oficina-",
position: { x: 6.98, y: -19.00, z: 16.86 }, // x: 0, y: 25, z: -2.5 (-4.93, -20.61, 16.86) position: { x: 6.98, y: -19.00, z: 16.86 }, // x: 0, y: 25, z: -2.5 (-4.93, -20.61, 16.86)
sensorTypes: ["temperature", "humidity"] sensorTypes: ["temperature", "humidity"]
}, },
{ {
id: "Oficina 4", id: "Oficina 2",
//name: "Oficina-", //name: "Oficina-",
position: { x: 35.85, y: -2.24, z: 16.86 }, // x: 0, y: 25.03, z: -2.52 (23.94, -3.85, 16.86) position: { x: 35.85, y: -2.24, z: 16.86 }, // x: 0, y: 25.03, z: -2.52 (23.94, -3.85, 16.86)
sensorTypes: ["temperature", "humidity"] sensorTypes: ["temperature", "humidity"]
}, },
{ {
id: "Oficina 3", id: "Oficina 1",
//name: "Oficina-", //name: "Oficina-",
position: { x: 6.98, y: -2.24, z: 16.86 }, // x: 0, y: 25.03, z: -2.52 (-4.93, -3.85, 16.86) position: { x: 6.98, y: -2.24, z: 16.86 }, // x: 0, y: 25.03, z: -2.52 (-4.93, -3.85, 16.86)
sensorTypes: ["temperature", "humidity"] sensorTypes: ["temperature", "humidity"]
@ -1130,7 +1130,7 @@ async function loadHeatmaps(model) {
// }, // },
// true // true
//); //);
roomDbIds.push(7567);//5113 834 838 8106 8177 792 8181 roomDbIds.push(11449);//5113 834 838 8106 8177 792 8181 7567
//roomDbIds.push(8183); //roomDbIds.push(8183);
//roomDbIds.push(8185); //roomDbIds.push(8185);
@ -1166,9 +1166,11 @@ async function loadHeatmaps(model) {
dataVizExtn.registerSurfaceShadingColors("temperature", [0xff0000, 0x0000ff]); dataVizExtn.registerSurfaceShadingColors("temperature", [0xff0000, 0x0000ff]);
function getSensorValue(device, sensorType) { function getSensorValue(device, sensorType) {
return sensorVals[parseInt(device.id.slice(-1)) - 1]; return sensorVals[parseInt(device.id.slice(-1)) - 1]; // 值: 0~1之間
//return 0;
} }
dataVizExtn.renderSurfaceShading("Room Panel", "temperature", getSensorValue); dataVizExtn.renderSurfaceShading("Room Panel", "temperature", getSensorValue);
setInterval(() => { setInterval(() => {
@ -1336,7 +1338,7 @@ async function test() {
if (material) { if (material) {
//设置透明度 //设置透明度
material.opacity = 0.5; material.opacity = 0;
material.transparent = true; material.transparent = true;
//标记更新 //标记更新
material.needsUpdate = true material.needsUpdate = true