From aab47a13d4c307f8a933e71c550117ceb26b2c35 Mon Sep 17 00:00:00 2001 From: wanli Date: Mon, 9 Jan 2023 17:26:15 +0800 Subject: [PATCH] =?UTF-8?q?[Frontend]=20=E6=B8=AC=E8=A9=A6=E8=A8=AD?= =?UTF-8?q?=E5=82=99=E6=B8=85=E5=96=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/forgetTest2.html | 14 +- Frontend/js/forge/modeltest.js | 494 ++++++++++++++++----------------- 2 files changed, 258 insertions(+), 250 deletions(-) diff --git a/Frontend/forgetTest2.html b/Frontend/forgetTest2.html index 7eda69e..a937a3c 100644 --- a/Frontend/forgetTest2.html +++ b/Frontend/forgetTest2.html @@ -51,6 +51,7 @@ + @@ -244,7 +245,7 @@ //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1pdHN1YmlzaGkvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU5JUExJUFGXzEyMjgubndk'); //12.30 整棟樓 ARC + MEP - launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8xMl8zMC5ud2Q'); + //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8xMl8zMC5ud2Q'); //12.30 整棟樓 ARC + MEP 半透明 //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8lRTUlOEQlOEElRTklODAlOEYlRTYlOTglOEUlRTUlQkIlQkElRTclQUYlODlfMTJfMzAubndk'); @@ -254,8 +255,11 @@ //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwTUVQJUUzJTgwJTkxXzIwMjJfMTJfMTMubndj');//new MEP //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwQVJDJUUzJTgwJTkxJUU1JTg1JUE4JUU2JUEzJTlGXzIwMjJfMTJfMTMubndj');//全棟 ARC - + //01.06 加上room_id(樓層有燈具) + //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU2JUE4JUExJUU1JUJDJThGK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8yMDIzXzAxXzA2Lm53ZA'); + //01.06 樓層刪除燈具 + launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1vZGVsX3Rlc3QxMTIxLyVFMyU4MCU5MCVFNSU4RiVCMCVFNSU4QyU5NyVFNCVCOCVBRCVFOCU4RiVCMSVFNSVBNCVBNyVFNiVBOCU5MyVFMyU4MCU5MUFSQyVFOSU5QiU5OSVFNiVBOCVBMSVFNSVCQyU4RitNRVAlRTYlOEIlODYlRTclQjMlQkIlRTclQjUlQjFfJUU1JTg4JUFBJUU3JTg3JTg4JUU1JTg1JUI3XzIwMjNfMDFfMDYubndk'); }); //function move1Floor() { @@ -412,6 +416,10 @@ createHeatmapRect(labels, colorStops); } + function showList() { + consoleList(); + } + function createHeatmapRect(labels, colorStops) { if (!this.canvas) { return; @@ -438,7 +446,7 @@ context.fillRect(10, 20, 280, 20); } - + diff --git a/Frontend/js/forge/modeltest.js b/Frontend/js/forge/modeltest.js index 765fd66..44ae412 100644 --- a/Frontend/js/forge/modeltest.js +++ b/Frontend/js/forge/modeltest.js @@ -5,6 +5,7 @@ var elevatorSpeed; var allDbIdsStr; let bulbLight;//點燈 var spotLight;//聚光燈 +let testLight; var myDataList;//設備清單 var viewableData; var dataVizExtn; @@ -12,7 +13,9 @@ var spriteColorRed; var levels;//剖面用 var light; let pointLightHelper; - +var tagIdDevList = [];//模型設備List: device_number、device_coordinate_3d、forge_dbid +var roomDataList = [];//模型房間List: room_id、room_name + function launchViewer(urn) { var av = Autodesk.Viewing; var options = { @@ -139,12 +142,10 @@ function onDocumentLoadSuccess(doc) { viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT, function () { - var instanceTree = viewer.model.getData().instanceTree; - - var domElem = document.getElementById('all_id'); - allDbIdsStr = Object.keys(instanceTree.nodeAccess.dbIdToIndex); - domElem.innerText = allDbIdsStr; - + var instanceTree = viewer.model.getData().instanceTree; + var domElem = document.getElementById('all_id'); + allDbIdsStr = Object.keys(instanceTree.nodeAccess.dbIdToIndex); + domElem.innerText = allDbIdsStr; //parseInt(allDbIdsStr[i] //for (var i = 0; i < allDbIdsStr.length; i++) { // //setTransparency(parseInt(allDbIdsStr[i]), 0.2); @@ -161,105 +162,152 @@ function onDocumentLoadSuccess(doc) { // }) //} - // ------------------ 取得tag_id底下的nodeId -------------------------------------- - var curDbId = 0; - var tagId = 0; - var _parentId = 0; - var _childId = 0; - var itemName = ''; - var childIdArr = new Array(); - let evelMap = new Map(); + //// ------------------ 取得tag_id底下的nodeId -------------------------------------- + //var curDbId = 0; + ////var tagId = 0; + ////var _parentId = 0; + ////var _childId = 0; + ////var itemName = ''; + ////var childIdArr = new Array(); + ////let evelMap = new Map(); - let tree = viewer.model.getData().instanceTree; - const model = viewer.model; - const fragList = model.getFragmentList(); + //let tree = viewer.model.getData().instanceTree; + //const model = viewer.model; + //const fragList = model.getFragmentList(); - //loadHeatmaps(model); + // //loadHeatmaps(model); + ////allDbIdsStr.forEach((dbId) => { + //// curDbId = parseInt(dbId); + //// viewer.getProperties(curDbId, function (e) { + //// e.properties.forEach(function (item) { + //// if (item.displayName == "tag_id" && e.name == "【電梯】") { + + //// //getFragmentWorldMatrixByNodeId(e.dbId, viewer); + //// //let fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag); + + //// tree.enumNodeFragments(e.dbId, function (frag) { + + //// let fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag); + //// let matrix = new THREE.Matrix4(); + //// console.log("proxy: " + fragProxy.position); + + //// fragProxy.getWorldMatrix(matrix); + + //// }); + + + + //// tagId = e.dbId; + //// viewer.getProperties(tagId, function (e2) { + //// e2.properties.forEach(function (item2) { + //// if (item2.displayName == "child") { + //// _parentId = item2.displayValue; + + //// viewer.getProperties(_parentId, function (e3) { + //// let itemMap = new Map(); + //// e3.properties.forEach(function (item3) { + //// if (item3.displayName == "child") { + //// _childId = item3.displayValue; + //// childIdArr.push(_childId); + + //// var n = 0; + //// viewer.getProperties(childIdArr[n], function (e5) { + //// e5.properties.forEach(function (item5) { + //// if (item5.displayName == "Name") { + //// itemName = item5.displayValue; + //// itemMap.set(childIdArr[0], itemName) + //// console.log("childIdArr[0] ", childIdArr[0]) + //// console.log("item name: ", itemName); + //// n += 3; + //// } + //// }); + //// }) + + //// n = 1; + //// viewer.getProperties(childIdArr[n], function (e6) { + //// e6.properties.forEach(function (item6) { + //// if (item6.displayName == "Name") { + //// itemName = item6.displayValue; + //// itemMap.set(childIdArr[1], itemName) + //// console.log("childIdArr[1] ", childIdArr[1]) + //// console.log("item name: ", itemName); + //// n += 3; + //// } + //// }); + //// }) + + //// n = 2; + //// viewer.getProperties(childIdArr[n], function (e7) { + //// e7.properties.forEach(function (item7) { + //// if (item7.displayName == "Name") { + //// itemName = item7.displayValue; + //// itemMap.set(childIdArr[2], itemName) + //// console.log("childIdArr[2] ", childIdArr[2]) + //// console.log("item name: ", itemName); + //// n += 3; + //// } + //// }); + //// }) + + //// } + //// }); + //// evelMap.set(item.displayValue, itemMap) + //// }) + + //// } + //// }); + //// }) + //// } + //// }); + + //// }) + + ////}) + //allDbIdsStr.forEach((dbId) => { // curDbId = parseInt(dbId); // viewer.getProperties(curDbId, function (e) { // e.properties.forEach(function (item) { - // if (item.displayName == "tag_id" && e.name == "【電梯】") { + // if (item.displayName == "【tag_id】") { // Tag_name tag_id 【tag_id】 + // if (item.displayValue != "") { + // if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) {// TPE_B1_ME_M10 + // console.log("--------------------------------------------------"); + // console.log("Tag_name dbid: " + e.dbId); + // console.log("value: " + item.displayValue); + // } + // //var v = getFragmentWorldMatrixByNodeId(e.dbId, viewer); + // //console.log("v: " + v); + + // //tree.enumNodeFragments(e.dbId, function (frag) { + // // fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag); + // // fragProxy.getAnimTransform(); + // // console.log("postion: " + fragProxy.position + ", fragP: " + fragProxy.fragPosition); + // //}); + + + + // let bounds = new THREE.Box3(); + + // instanceTree.enumNodeFragments(e.dbId, (fragId) => { + // let box = new THREE.Box3(); + // fragList.getWorldBounds(fragId, box); + // bounds.union(box); + // }, true); + // var position = bounds.center(); + // if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) { + // console.log("position: (" + (position.x).toFixed(2) + ", " + (position.y).toFixed(2) + ", " + (position.z).toFixed(2) + ")"); + // console.log("--------------------------------------------------"); + // } + // } // //getFragmentWorldMatrixByNodeId(e.dbId, viewer); // //let fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag); - // tree.enumNodeFragments(e.dbId, function (frag) { - // let fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag); - // let matrix = new THREE.Matrix4(); - // console.log("proxy: " + fragProxy.position); - - // fragProxy.getWorldMatrix(matrix); - - // }); - - - - // tagId = e.dbId; - // viewer.getProperties(tagId, function (e2) { - // e2.properties.forEach(function (item2) { - // if (item2.displayName == "child") { - // _parentId = item2.displayValue; - - // viewer.getProperties(_parentId, function (e3) { - // let itemMap = new Map(); - // e3.properties.forEach(function (item3) { - // if (item3.displayName == "child") { - // _childId = item3.displayValue; - // childIdArr.push(_childId); - - // var n = 0; - // viewer.getProperties(childIdArr[n], function (e5) { - // e5.properties.forEach(function (item5) { - // if (item5.displayName == "Name") { - // itemName = item5.displayValue; - // itemMap.set(childIdArr[0], itemName) - // console.log("childIdArr[0] ", childIdArr[0]) - // console.log("item name: ", itemName); - // n += 3; - // } - // }); - // }) - - // n = 1; - // viewer.getProperties(childIdArr[n], function (e6) { - // e6.properties.forEach(function (item6) { - // if (item6.displayName == "Name") { - // itemName = item6.displayValue; - // itemMap.set(childIdArr[1], itemName) - // console.log("childIdArr[1] ", childIdArr[1]) - // console.log("item name: ", itemName); - // n += 3; - // } - // }); - // }) - - // n = 2; - // viewer.getProperties(childIdArr[n], function (e7) { - // e7.properties.forEach(function (item7) { - // if (item7.displayName == "Name") { - // itemName = item7.displayValue; - // itemMap.set(childIdArr[2], itemName) - // console.log("childIdArr[2] ", childIdArr[2]) - // console.log("item name: ", itemName); - // n += 3; - // } - // }); - // }) - - // } - // }); - // evelMap.set(item.displayValue, itemMap) - // }) - - // } - // }); - // }) // } // }); @@ -267,54 +315,64 @@ function onDocumentLoadSuccess(doc) { //}) - allDbIdsStr.forEach((dbId) => { - curDbId = parseInt(dbId); - viewer.getProperties(curDbId, function (e) { - e.properties.forEach(function (item) { - if (item.displayName == "【tag_id】") { // Tag_name tag_id 【tag_id】 - if (item.displayValue != "") { - if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) {// TPE_B1_ME_M10 - console.log("--------------------------------------------------"); - console.log("Tag_name dbid: " + e.dbId); - console.log("value: " + item.displayValue); + ////---------------------- end --------------------------------------------------- + + // ------------------ 2023.01.06 取得tag_id、底下的nodeId -------------------------------------- + var curDbId = 0; + + let tree = viewer.model.getData().instanceTree; + const model = viewer.model; + const fragList = model.getFragmentList(); + + + allDbIdsStr.forEach((dbId) => { + curDbId = parseInt(dbId); + viewer.getProperties(curDbId, function (e) { + e.properties.forEach(function (item) { + if (item.displayName == "【tag_id】") { // Tag_name tag_id 【tag_id】 + if (item.displayValue != "") { + ////if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) {// TPE_B1_ME_M10 + //console.log("--------------------------------------------------"); + //console.log("Tag_name dbid: " + e.dbId); + //console.log("value: " + item.displayValue); + ////} + var str = item.displayValue.split('_'); + if (str.length == 2) { //兩段為房間 ex: U7F_01 + roomDataList.push({ room_id: e.dbId, room_name: item.displayValue }); + } + else if (str.length == 8) { //八段為設備 ex: TPE_B1_ME_M10_U7F_NA_FCU_N1 + //取得座標 + let bounds = new THREE.Box3(); + instanceTree.enumNodeFragments(e.dbId, (fragId) => { + let box = new THREE.Box3(); + fragList.getWorldBounds(fragId, box); + bounds.union(box); + }, true); + var position = bounds.center(); + ////if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) { + //console.log("position: (" + (position.x).toFixed(2) + ", " + (position.y).toFixed(2) + ", " + (position.z).toFixed(2) + ")"); + //console.log("--------------------------------------------------"); + ////} + tagIdDevList.push({ device_number: item.displayValue, device_coordinate_3d: '{ "x": ' + (position.x).toFixed(2) + ', "y": ' + (position.y).toFixed(2) + ', "z": ' + (position.z).toFixed(2) + ' }', forge_dbid: e.dbId }); + } + + + + + + + + } - //var v = getFragmentWorldMatrixByNodeId(e.dbId, viewer); - //console.log("v: " + v); - //tree.enumNodeFragments(e.dbId, function (frag) { - // fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag); - // fragProxy.getAnimTransform(); - // console.log("postion: " + fragProxy.position + ", fragP: " + fragProxy.fragPosition); - //}); - - - - let bounds = new THREE.Box3(); - - instanceTree.enumNodeFragments(e.dbId, (fragId) => { - let box = new THREE.Box3(); - fragList.getWorldBounds(fragId, box); - bounds.union(box); - }, true); - var position = bounds.center(); - if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) { - console.log("position: (" + (position.x).toFixed(2) + ", " + (position.y).toFixed(2) + ", " + (position.z).toFixed(2) + ")"); - console.log("--------------------------------------------------"); - } } - //getFragmentWorldMatrixByNodeId(e.dbId, viewer); - //let fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag); + }); - - } - }); + }) }) - - }) - - //---------------------- end --------------------------------------------------- + //---------------------- end --------------------------------------------------- @@ -359,116 +417,51 @@ function onDocumentLoadSuccess(doc) { // }) //}) - - //let tree = viewer.model.getData().instanceTree; - let nodeId = 12112;//12104; //749; //10952; - let nodeId2 = 12111;//12105; //750; - let nodeId3 = 12110;//12104; //751; - tree.enumNodeFragments(nodeId, function (frag) { - fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag); - fragProxy.getAnimTransform(); - let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26 - fragProxy.position = fragPosition + // //let tree = viewer.model.getData().instanceTree; + //let nodeId = 12112;//12104; //749; //10952; + //let nodeId2 = 12111;//12105; //750; + //let nodeId3 = 12110;//12104; //751; - fragProxy.updateAnimTransform() + //tree.enumNodeFragments(nodeId, function (frag) { + // fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag); + // fragProxy.getAnimTransform(); + // let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26 + // fragProxy.position = fragPosition + // fragProxy.updateAnimTransform() + //}); + //viewer.impl.sceneUpdated(true); - }); - viewer.impl.sceneUpdated(true); + ////------------ add ------------- + //tree.enumNodeFragments(nodeId2, function (frag) { + // fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag); + // fragProxy.getAnimTransform(); + // let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26 - //------------ add ------------- - tree.enumNodeFragments(nodeId2, function (frag) { - fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag); - fragProxy.getAnimTransform(); - let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26 + // fragProxy.position = fragPosition - fragProxy.position = fragPosition + // fragProxy.updateAnimTransform() - fragProxy.updateAnimTransform() + //}); + //viewer.impl.sceneUpdated(true); - }); - viewer.impl.sceneUpdated(true); + //tree.enumNodeFragments(nodeId3, function (frag) { + // fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag); + // fragProxy.getAnimTransform(); + // let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26 - tree.enumNodeFragments(nodeId3, function (frag) { - fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag); - fragProxy.getAnimTransform(); - let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26 + // fragProxy.position = fragPosition - fragProxy.position = fragPosition + // fragProxy.updateAnimTransform() - fragProxy.updateAnimTransform() - - }); - viewer.impl.sceneUpdated(true); + //}); + //viewer.impl.sceneUpdated(true); }); - - //add toolbar fail - //function ToolbarExtension(viewer, options) { - // Autodesk.Viewing.Extension.call(this, viewer, options); - //} - - //ToolbarExtension.prototype = Object.create(Autodesk.Viewing.Extension.prototype); - //ToolbarExtension.prototype.constructor = ToolbarExtension; - - //ToolbarExtension.prototype.load = function () { - // this.viewer.setLightPreset(6); - // this.viewer.setEnvMapBackground(true); - // this.viewer.fitToView(); - // return true; - //}; - - //ToolbarExtension.prototype.unload = function () { - - //}; - //Autodesk.Viewing.theExtensionManager.registerExtension('ToolbarExtension', ToolbarExtension); - - //ToolbarExtension.prototype.onToolbarCreated = function (toolbar) { - // //alert('TODO: customize Viewer toolbar'); - - // var viewer = this.viewer; - // var button1 = new Autodesk.Viewing.UI.Button('show-env-bg-button'); - // button1.onClick = function (e) { - // viewer.setEnvMapBackground(true); - // }; - // button1.addClass('show-env-bg-button'); - // button1.setToolTip('Show Environment'); - - // //SubToolbar - // this.subToolbar = new Autodesk.Viewing.UI.ControlGroup('my-custom-toolbar'); - // this.subToolbar.addControl(button1); - // toolbar.addControl(this.subToolbar); - - //}; - - - //加入點燈光 - //bulbLight = new THREE.PointLight(0xffffff, 1, 1, 2);//0xff0000 - //bulbLight.position.set(-17.33, 51.03, -2.52);//17.880840301513672 - //bulbLight.castShadow = true; - //bulbLight.intensity = 50; - //bulbLight.distance = 1; - //bulbLight.emissiveIntensity = bulbLight.intensity / Math.pow(0.02, 2.0); - //viewer.scene.add(bulbLight); - - //聚光燈 - //spotLight = new THREE.SpotLight(0xffff00, 80, 10);//0xffffff - //spotLight.position.set(-7.58, 18.20, -0.25); //set(-17.33, 51.03, -2.52); - //spotLight.castShadow = true; - //spotLight.visible = true; - //var geom = new THREE.BoxGeometry(); //create 幾何對象 -17.33, 51.03, -4.52 - //var material = new THREE.MeshLambertMaterial({ color: 0xffff00 });//0xff0000 - //var cube = new THREE.Mesh(geom, material); - //cube.position.set(-7.58, 18.20, -1); //set(-17.33, 51.03, -10);//-4.52 - //viewer.scene.add(cube); - //spotLight.target = cube; - //viewer.scene.add(spotLight); - - //light = newLight(); - newLight(); - + //newLight(); + //testLight = new THREE.SpotLight(); } //------------------- 加入熱點 ----------------- @@ -482,7 +475,8 @@ async function addHotPoint(data) { const spriteIcon = "https://d2zqnmauvnpnnm.cloudfront.net/assets-1/images/circle.svg"; //"/img/forge/hotspot.svg"; const style = new DataVizCore.ViewableStyle(viewableType, spriteColor, spriteIcon); - var a = newLight(); + //var a = newLight(); + newLight(); //function onSpriteClicked(event) { // console.log(`Sprite clicked: ${event.dbId}`); //} @@ -521,7 +515,7 @@ async function addHotPoint(data) { event.hasStopped = true; if (event != undefined && event != null) { if (event.dbId >= 10 && event.dbId <= 13) {//event.dbId > 0 && event.dbId < 19 - setLightValues(20, 0x00ff00) + setLightValues(20, 0x00ff00); console.log(`Sprite clicked: ${event.dbId}`); openHotspotModal(); } @@ -1387,26 +1381,26 @@ async function newLight() { //angle - 光從其上界為 Math.PI / 2 的方向散射的最大角度。 //半影 - 由於半影而衰減的聚光燈錐體的百分比。取值介於 0 和 1 之間。默認值為零。 //decay - 光沿光的距離變暗的量。 - //spotLight = new THREE.SpotLight(0xff0000, 200, 20, 0.6, 0.5, 10);//0xffffff 80, 10 //15, 20 , Math.PI / 12 - //spotLight.position.set(43.72, -15.65, -44.96); //set(-17.33, 51.03, -2.52); // -7.58, 18.20, -0.25 -44.96 - //spotLight.castShadow = false; - //spotLight.visible = true; + spotLight = new THREE.SpotLight(0xff0000, 200, 20, 0.6, 0.5, 10);//0xffffff 80, 10 //15, 20 , Math.PI / 12 + spotLight.position.set(43.72, -15.65, -44.96); //set(-17.33, 51.03, -2.52); // -7.58, 18.20, -0.25 -44.96 + spotLight.castShadow = false; + spotLight.visible = true; - //spotLight.target.position.set(43.72, -15.65, -60);// -15.65 -48 - //viewer.scene.add(spotLight.target); + spotLight.target.position.set(43.72, -15.65, -60);// -15.65 -48 + viewer.scene.add(spotLight.target); - //viewer.scene.add(spotLight); + viewer.scene.add(spotLight); - //viewer.impl.sceneUpdated(true); + viewer.impl.sceneUpdated(true); //return spotLight; //加入點燈光 - bulbLight = new THREE.PointLight(0xff0000, 50, 20, 2);//0xff0000 - bulbLight.position.set(43.72, -15.65, -44.96);//17.880840301513672 - bulbLight.castShadow = true; - bulbLight.visible = true; - viewer.scene.add(bulbLight); + //bulbLight = new THREE.PointLight(0xffffff, 50, 20, 2);//0xff0000 + //bulbLight.position.set(43.72, -15.65, -44.96);//17.880840301513672 + //bulbLight.castShadow = true; + //bulbLight.visible = true; + //viewer.scene.add(bulbLight); //pointLightHelper = new THREE.PointLightHelper(pointLight); //viewer.scene.add(pointLightHelper); @@ -1439,13 +1433,15 @@ function setLightValues(intensity, color) {// distance, angle, penumbra, decay, function setLightOpenOrClose(value) {//, light if (value) { //light.visible = true; - //spotLight.visible = true; - bulbLight.visible = true; + spotLight.visible = true; + //bulbLight.visible = true; + //testLight.visible = true; } else { //light.visible = false; - //spotLight.visible = false; - bulbLight.visible = false; + spotLight.visible = false; + //bulbLight.visible = false; + //testLight.visible = false; } viewer.impl.sceneUpdated(true); } @@ -1457,3 +1453,7 @@ function setLightTransparency(value) { } //------------- end ----------------------------------- +function consoleList() { + console.log(tagIdDevList); + console.log(roomDataList); +} \ No newline at end of file