-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
- var sysIconList = [
- { mainSys: "EE", subSys: "E1", iconClass: "./gif/E1_white.png" },
- { mainSys: "EE", subSys: "E2", iconClass: "./gif/E2_white.png" },
- { mainSys: "EE", subSys: "E3", iconClass: "./gif/E3_white.png" },
- { mainSys: "EE", subSys: "E4", iconClass: "./gif/E4-1_white.png" }, // 電表
- { mainSys: "LT", subSys: "L1", iconClass: "./gif/L1_white.png" },
- { mainSys: "LT", subSys: "L2", iconClass: "./gif/L2_white.png" },// 景觀照明 0131目前沒有
- { mainSys: "ME", subSys: "M1", iconClass: "./gif/M1_white.png" },// 儲冰 0131目前沒有
- { mainSys: "ME", subSys: "M5", iconClass: "./gif/M5-2_white.png" }, // 送排風
- { mainSys: "ME", subSys: "M8", iconClass: "./gif/M8_white.png" },// 排油煙0131目前沒有
- { mainSys: "ME", subSys: "M10", iconClass: "./gif/M10_white.png" },
- { mainSys: "ME", subSys: "M12", iconClass: "./gif/M12_white.png" },
- { mainSys: "ELEV", subSys: "EL", iconClass: "./gif/EL_white.png" },
- { mainSys: "FE", subSys: "F1", iconClass: "./gif/F1_white.png" },
- { mainSys: "FE", subSys: "F2", iconClass: "./gif/lamp_white.png" }, // 排煙 0131目前沒有
- { mainSys: "WP", subSys: "W1", iconClass: "./gif/W1_white.png" },// 電子水表0131目前沒有
- { mainSys: "WP", subSys: "W2", iconClass: "./gif/W2_white.png" },
- { mainSys: "WP", subSys: "P1", iconClass: "./gif/P1_white.png" },
- { mainSys: "S", subSys: "C", iconClass: "./gif/C_white.png" }, // CCTV
- { mainSys: "S", subSys: "P", iconClass: "./gif/P_white.png" }, // 緊急求救
- { mainSys: "S", subSys: "R", iconClass: "./gif/R_white.png" }, // 門禁
- { mainSys: "P", subSys: "PSC", iconClass: "./gif/PSC_white.png" }, // 停管
- { mainSys: "W3", subSys: "W1", iconClass: "./gif/W3_white.png" },// 0131目前沒有
- ];
+
+
+
- var tempSysSubText = [
- { text: "電梯系統", mainSys: "ELEV", subSys: "EL", }, // 1
- { text: "空調系統", mainSys: "ME", subSys: "M10", }, // 2
- { text: "照明系統", mainSys: "LT", subSys: "L1", }, // 3
- { text: "環境感測設備", mainSys: "ME", subSys: "M12", }, // 4
- { text: "電錶系統", mainSys: "EE", subSys: "E4", }, // 5
- { text: "供水系統", mainSys: "WP", subSys: "W2", }, // 6
- { text: "高壓配電盤", mainSys: "EE", subSys: "E1", }, // 7
- { text: "汙廢水設備", mainSys: "WP", subSys: "P1", }, // 8
- { text: "低壓配電盤", mainSys: "EE", subSys: "E2", }, //9
- { text: "緊急發電機", mainSys: "EE", subSys: "E3", },//10
- { text: "消防設備", mainSys: "FE", subSys: "F1", }, //11
- { text: "CCTV系統", mainSys: "S", subSys: "C", }, //12
- { text: "門禁系統", mainSys: "S", subSys: "R", }, //13
- { text: "停管系統", mainSys: "P", subSys: "PSC", }, //14
- { text: "緊急求救系統", mainSys: "S", subSys: "P", }, //15
- { text: "送排風系統", mainSys: "ME", subSys: "M5", }, //16
- //{ text: "景觀照明系統", mainSys: "LT", subSys: "L2", },
- //{ text: "儲冰系統", mainSys: "ME", subSys: "M1", },
- // { text: "排油煙設備", mainSys: "ME", subSys: "M8", },
- //{ text: "排煙系統", mainSys: "FE", subSys: "F2", },
- //{ text: "電子水錶", mainSys: "WP", subSys: "W1", },
- // { text: "熱水系統", mainSys: "W3", subSys: "W1", },
- ];
- $(document).ready(function () {
+
+
+
+
+
+
- $(loadEle).Loading("start");
- $(loadEle).Loading("close");
- show3DModel();
- getSubList();
- getFirstEletric();
- });
- function demoSubList() {
- let isExiNames = $("#sysSubBtnList .dev-group button[id^=sysSubCardBtn]").toArray().map(x => $(x).text());
- let strHtml = ``;
- $.each(tempSysSubText, (idx, obj) => {
- if (isExiNames.indexOf(obj.text) == -1 && $("#sysSubBtnList .dev-group").length < 16) {
- let iconObj = sysIconList.filter(x => x.mainSys == obj.mainSys && x.subSys == obj.subSys)[0];
- strHtml = `
-
-
-
`;
- $("#sysSubBtnList").append(strHtml);
+
\ No newline at end of file
+ }
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Frontend/js/forge/forgemodel.js b/Frontend/js/forge/forgemodel.js
index 8db7e22..6543cc1 100644
--- a/Frontend/js/forge/forgemodel.js
+++ b/Frontend/js/forge/forgemodel.js
@@ -220,11 +220,6 @@ class elevator3D {
// 設置當前片段的位置
fragProxy.position = fragPosition;
- // if(nodeId === 13704) {
- // // 改變感測器熱點位置
- // this.sensorObjs&&this.sensorObjs[0]?.changePos(13706, fragProxy.position.z)
- // }
-
// 更新當前片段的動畫變換矩陣
fragProxy.updateAnimTransform();
})
@@ -305,9 +300,9 @@ class elevator3D {
}
fragProxyZ = fragProxy.position.z;
- if (nodeId === 13704) {
+ if (nodeId === 13777) {
// 改變感測器熱點位置
- this.sensorObjs && this.sensorObjs[0]?.changePos(13706, fragProxyZ)
+ this.sensorObjs && this.sensorObjs[0]?.changePos(nodeId + 2, fragProxyZ)
}
fragProxy.updateAnimTransform()
})
@@ -748,7 +743,7 @@ async function testNewLight(dataList) {
dataList.forEach((myData, index) => {
const position = JSON.parse(myData.device_coordinate_3d);
if (lightList.findIndex(x => x.device_guid == myData.device_guid) == -1) {
- lightList.push({ dbid: myData.forge_dbid, device_guid: myData.device_guid, lightObject: new THREE.SpotLight(0xe1cf18, 200, 20, 0.6, 0.5, 10) });
+ lightList.push({ dbid: myData.forge_dbid, device_guid: myData.device_guid, lightObject: new THREE.SpotLight(0xe1cf18, 0, 20, 0.6, 0.5, 10) });
}
lightList[index].lightObject.position.set(position.x, position.y, position.z);
@@ -776,7 +771,7 @@ async function addHotPoint(data) {
let spriteIcon = "";
const dbIdStart = 10;
const dbIdEnd = 19;
- if (pageAct.sysSubTag === "M12") {
+ if (pageAct.sysSubTag === "M12" && !pageAct.floTag) {
return
} else {
spriteColor = new THREE.Color(0xffffff);
@@ -886,8 +881,8 @@ async function addHotPoint(data) {
// 熱點 更換顏色
async function changeColorForHotspot(dbId, type = null) {
const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
- console.log(dbId, dataVizExtn.viewableData.getViewableColor(dbId, false))
- let spriteColorFocus = dataVizExtn.viewableData?.getViewableColor(dbId, false) || new THREE.Color(0xffffff);
+ // console.log(dbId, dataVizExtn.viewableData.getViewableColor(dbId, false))
+ let spriteColorFocus = new THREE.Color(0xffffff);
if (type == "focus" && pageAct.sysSubTag !== "M12") {
spriteColorFocus = new THREE.Color(0x00ffe1);
} else if (type == "error") {
@@ -1145,7 +1140,7 @@ function profile(callback = null) {
//新增燈光
async function newLight(lightPosition) {
//聚光燈
- var spotLight = new THREE.SpotLight(0xffffff, 200, 20, 0.6, 0.5, 10);
+ var spotLight = new THREE.SpotLight(0xe1cf18, 0, 20, 0.6, 0.5, 10);
spotLight.position.set(lightPosition.x, lightPosition.y, lightPosition.z);
// console.log(lightPosition.x, lightPosition.y, lightPosition.z)
spotLight.castShadow = false;
diff --git a/Frontend/js/site.js b/Frontend/js/site.js
index fdd43bc..586828d 100644
--- a/Frontend/js/site.js
+++ b/Frontend/js/site.js
@@ -595,11 +595,10 @@ class Forge3DElevFull {
frags.forEach((fragProxy) => {
fragProxy.frag.position.z = this.elev3DOption.floorHeight.filter(x => x.floor == subData["CP"])[0]?.height ?? 0;
- console.log("1", fragProxy.frag.position.z)
let start = 0;
- if (node === 13704 && start == 0) {
+ if (node === 13777 && start == 0) {
// 改變感測器熱點位置
- this.sensorObjs && this.sensorObjs[0]?.changePos(13706, fragProxy.frag.position.z);
+ this.sensorObjs && this.sensorObjs[0]?.changePos(node + 2, fragProxy.frag.position.z);
start = 1;
}
fragProxy.frag.updateAnimTransform();
@@ -649,12 +648,10 @@ class Forge3DElevFull {
let frags = elevObj.obj.fragProxys.filter(x => x.nodeId == node);
frags.forEach((fragProxy) => {
fragProxy.frag.position.z = this.elev3DOption.floorHeight.filter(x => x.floor == subData["CP"])[0]?.height ?? 0;
- console.log("2", fragProxy.frag.position.z)
- // debugger
let start = 0;
- if (node === 13704 && start == 0) {
+ if (node === 13777 && start == 0) {
// 改變感測器熱點位置
- this.sensorObjs && this.sensorObjs[0]?.changePos(13706, fragProxy.frag.position.z);
+ this.sensorObjs && this.sensorObjs[0]?.changePos(node + 2, fragProxy.frag.position.z);
start = 1;
}
fragProxy.frag.updateAnimTransform()
@@ -717,6 +714,8 @@ class Forge3DSensor {
this.DataVizCore = null;
this.tempVal = 20;
this.curDevice = option.curDevice ?? null;
+ this.selector = option.selector ?? "#forgeViewer"
+ this.elevCb = option.elevCb ?? null
this.#init();
}
@@ -729,6 +728,7 @@ class Forge3DSensor {
await this.addHotPoint();
this.changeColorForSensorHotspot(this.curDevice.forge_dbid, 35)
this.subSensorDevice();
+ this.elevCb()
}
@@ -745,7 +745,7 @@ class Forge3DSensor {
async registerHotPoint(color = "") {
var viewer = this.viewer;
const viewableType = this.DataVizCore.ViewableType.SPRITE;//DataVizCore.ViewableType.SPRITE;
- const spriteColor = new THREE.Color(0x000000);
+ const spriteColor = new THREE.Color(0xff8c00);
// const highlightedColor = new THREE.Color(0xe0e0ff);
let spriteIcon = "/file/img/forge/sensor_circle.svg";
if (location.href.indexOf("localhost:5966") != -1) {
@@ -769,32 +769,32 @@ class Forge3DSensor {
await viewableData.finish();
this.dataVizExtn.addViewables(viewableData);
// console.log("1",this.dataVizExtn)
- viewer.addEventListener(this.DataVizCore.MOUSE_CLICK, onSpriteClicked.bind(this));// SPRITE_SELECTED
+ viewer.addEventListener(this.DataVizCore.MOUSE_CLICK, this.onSpriteClicked.bind(this));// SPRITE_SELECTED
+ // viewer.addEventListener(this.DataVizCore.MOUSE_CLICK_OUT, onSpriteClickedOut.bind(this));
- // ---------------- 熱點點擊事件 --------------------
- function onSpriteClicked(event) {
- event.hasStopped = true;
- const dbIdStart = 10;
- // debugger
- if (event != undefined && event != null) {
- if (event.dbId >= dbIdStart) {
- changeColorForHotspot(event.dbId);
- changeScaleForHotspot(event.dbId, false);
- let myData = [this.curDevice].filter(x => x.forge_dbid == event.dbId)[0];
- moveViewToDevice(myData.forge_dbid);//移動視角至該設備
-
- $(selector).trigger("autodesk:click:sprite", { event, myData });
- } else {
- $(selector).trigger("autodesk:clickOut:sprite", { event });
- }
+ }
+ // ---------------- 熱點點擊事件 --------------------
+ onSpriteClicked(event) {
+ console.log(event)
+ event.hasStopped = true;
+ const dbIdStart = 10;
+ if (event != undefined && event != null) {
+ if (event.dbId >= dbIdStart) {
+ let myData = [this.curDevice].filter(x => x.forge_dbid == event.dbId)[0];
+ this.changeColorForSensorHotspot(event.dbId, this.tempVal)
+ moveViewToDevice(myData.forge_dbid);//移動視角至該設備
+ $(this.selector).trigger("autodesk:click:sprite", { event, myData });
+ } else {
+ $(this.selector).trigger("autodesk:clickOut:sprite", { event });
}
}
}
// 改變熱點位置
- changePos(dbId, positionZ) {
- this.dataVizExtn.invalidateViewables(dbId, (viewable) => {
+ async changePos(dbId, positionZ) {
+ // const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization") || this.dataVizExtn;
+ this.dataVizExtn?.invalidateViewables(dbId, (viewable) => {
// console.log(viewable._position)
const z = viewable._position.z + positionZ
const newPos = { ...viewable._position, z }
@@ -806,7 +806,8 @@ class Forge3DSensor {
}
// 熱點 更換顏色---環境感知器
- changeColorForSensorHotspot(dbId, temp) {
+ async changeColorForSensorHotspot(dbId, temp) {
+ // const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
const temps = [new THREE.Color(0x00009c), new THREE.Color(0xffff31), new THREE.Color(0xff8c00), new THREE.Color(0xff0000)]
let index = Math.floor(temp / 10) - 1 || 0;
if (index > 3) {