From 93e57c3086ea02f16866d37342cb065b7a04d80e Mon Sep 17 00:00:00 2001 From: dev01 Date: Sat, 31 Dec 2022 18:03:16 +0800 Subject: [PATCH] =?UTF-8?q?[Frontend][=E7=B3=BB=E7=B5=B1=E7=9B=A3=E6=8E=A7?= =?UTF-8?q?]=20=E5=B9=B3=E9=9D=A2=E5=9C=96=20=E7=86=B1=E9=BB=9E=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E5=BB=BA=E7=BD=AE=20|=203D=20=E7=86=B1=E9=BB=9E=20foc?= =?UTF-8?q?us=20=E7=A8=8B=E5=BA=8F=E5=BB=BA=E7=BD=AE=20|=202D=E5=B9=B3?= =?UTF-8?q?=E9=9D=A2=E5=9C=96=20=E8=A8=AD=E5=82=99=E5=9C=93=E9=BB=9E=20?= =?UTF-8?q?=E6=89=93=E9=96=8B=20popover=20=E7=A8=8B=E5=BA=8F=E5=BB=BA?= =?UTF-8?q?=E7=BD=AE=20|=202D=E5=B9=B3=E9=9D=A2=E5=9C=96=E5=9C=93=E9=BB=9E?= =?UTF-8?q?=E8=88=873D=E7=86=B1=E9=BB=9E=E4=BA=92=E5=8B=95=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E5=BB=BA=E7=BD=AE=20|=202D=20=E5=B9=B3=E9=9D=A2?= =?UTF-8?q?=E5=9C=96=E5=89=96=E9=9D=A2=E7=86=B1=E5=9C=96=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E5=BB=BA=E7=BD=AE=20|=20=E7=B8=BD=E6=94=AC=203D=20=E7=86=B1?= =?UTF-8?q?=E5=9C=96=E4=B8=B2=E6=8E=A5=E8=B3=87=E6=96=99=E5=BA=AB=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E5=BB=BA=E7=BD=AE=20|=203D=20=E7=86=B1=E5=9C=96=20?= =?UTF-8?q?=E4=B8=B2=E6=8E=A5=E8=A8=82=E9=96=B1=E7=A8=8B=E5=BA=8F=E5=BB=BA?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_sysMonAll.html | 78 ++--- Frontend/_sysMonFloor.html | 206 ++++++++++-- Frontend/_systemMonitor.html | 13 +- Frontend/index.html | 55 ++- Frontend/js/forge/forgemodel.js | 317 ++++++++++++++---- .../yourteam/plugins/yt-tooltip/yt-tooltip.js | 4 + 6 files changed, 533 insertions(+), 140 deletions(-) diff --git a/Frontend/_sysMonAll.html b/Frontend/_sysMonAll.html index 5165df3..9ed3dd6 100644 --- a/Frontend/_sysMonAll.html +++ b/Frontend/_sysMonAll.html @@ -36,7 +36,7 @@ \ No newline at end of file diff --git a/Frontend/_sysMonFloor.html b/Frontend/_sysMonFloor.html index 56cf959..d501cd6 100644 --- a/Frontend/_sysMonFloor.html +++ b/Frontend/_sysMonFloor.html @@ -22,9 +22,12 @@ + + \ No newline at end of file diff --git a/Frontend/_systemMonitor.html b/Frontend/_systemMonitor.html index 653bb26..00e74ad 100644 --- a/Frontend/_systemMonitor.html +++ b/Frontend/_systemMonitor.html @@ -25,15 +25,16 @@ }) onEvent("yt:tab:change", "[name=floBtn]", function () { - debugger $.each(tolSubList, (idx, sub) => { - sub.unsubscribeAll(); - sub.detach(); - }) - tolSubList=[]; + sub.unsubscribeAll(); + sub.detach(); + }) + tolSubList=[]; pageAct.floTag = $(this).data("id"); + pageAct.floGuid = $(this).data("guid"); if ($(this).data("id") == "all") { pageAct.floTag = null; + pageAct.floGuid = null; $("#js-page-content").load("_sysMonAll.html", loadCallback); } else { $("#js-page-content").load("_sysMonFloor.html", loadCallback); @@ -55,7 +56,7 @@ } else { let strHtml = ``; $.each(res.data, (index, floObj) => { - strHtml += ``; + strHtml += ``; }) $("#floList").html(strHtml); floList = res.data; diff --git a/Frontend/index.html b/Frontend/index.html index b66d937..c61e9df 100644 --- a/Frontend/index.html +++ b/Frontend/index.html @@ -2043,6 +2043,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li } // 執行初步 Loading var loadEle = pageLoading(); + var errRecTable = null, opeRecTable = null; /** * 頁面 Loading 建立 @@ -2363,7 +2364,11 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li } // Card 呈現初始化 - function initPopover(type = null, extOption = {},selector = "[name=devItem]") { + function initPopover(type = null, extOption = {}, selector = "[name=devItem]") { + if (type == null && pageAct.sysMainTag == "LT") { + type = "light"; + } + $(selector).each((index, ele) => { let devNum = $(ele).data("number"); //設備編號 let devGuid = $(ele).data("id"); //guid @@ -2409,13 +2414,15 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li //loadErrRecTable(); loadErr($(oriEle).data("number")); $(tooltipEle).find("#info").html(typeof drawInfoTabBlo != "undefined" ? drawInfoTabBlo(devGuid) : ""); - changeColorForHotspot($(oriEle).data("dbId")); - changeScaleForHotspot($(oriEle).data("dbId")); - typeof subDeviceSetTable != "undefined " ? subDeviceSetTable($(oriEle).data("number")) : "" + if ($(oriEle).data("dbId")) { + controlFocusHotspot($(oriEle).data("dbId")); + } + typeof subDeviceSetTable != "undefined" ? subDeviceSetTable($(oriEle).data("number")) : "" }, onHide: function (tooltipEle, oriEle) { - changeColorForHotspot($(oriEle).data("dbId"),false); - changeScaleForHotspot($(oriEle).data("dbId"),false); + controlFocusHotspot($(oriEle).data("dbId"),false); + // sysMonFloor Echart 解除 focus + typeof chartUnFocus != "undefined" ? chartUnFocus(oriEle) : ""; } }; @@ -2427,7 +2434,9 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li // Card - 運維紀錄 Table function loadOpeRecTable(devGuid) { - + if (opeRecTable) { + opeRecTable.destroy(); + } let url = baseApiUrl + "/api/Device/GetOpeDevice?device_guid=" + devGuid; let tag = "#opeRecTable"; @@ -2461,7 +2470,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li ]; - let opeRecTable = new YourTeam.JqDataTables.getTableByAjax(url, tag, null, columns, column_defs, null, null, null, null, null, null, "tpi"); + opeRecTable = new YourTeam.JqDataTables.getTableByAjax(url, tag, null, columns, column_defs, null, null, null, null, null, null, "tpi"); } function loadLightSchTable(devGuid) { @@ -2525,12 +2534,16 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li let lightSchTable = new YourTeam.JqDataTables.getTableByAjax(url, tag, null, columns, column_defs, null, null, null, null, null, null, "tpi"); } + function controlFocusHotspot(dbId,open = true) { + changeColorForHotspot(dbId, open); + changeScaleForHotspot(dbId, open); + } + // Baja 取得異常紀錄 function loadErr(allPath) { if (allPath != undefined && allPath != null) { - let _pathArr = allPath.split("_");//TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1 - let _devicePath = _pathArr[0] + "_" + _pathArr[1] + "_" + _pathArr[2] + "_" + _pathArr[3] + "_" + _pathArr[4] + "_" + _pathArr[5]; - getOneDeviceAlarmTop10ByBaja(_devicePath, callbackForErr); + + getOneDeviceAlarmTop10ByBaja(allPath, callbackForErr); } else { console.log("no device"); @@ -2539,6 +2552,10 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li // Card - 異常紀錄 Table function callbackForErr(result) { + if (errRecTable) { + errRecTable.destroy(); + } + let tag = "#errRecTable"; let datas; @@ -2607,6 +2624,22 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li }) } + function crePosPopover(position, obj) { + let _position = {}; + _position.tpLeft = position[0]; + _position.tpTop = position[1]; + _position.tpOffHeight = 24; + let parentEle = creDiv(); + parentEle.append(`詳細資料`); + parentEle.data("id", obj.device_guid); + parentEle.data("number", obj.device_number); + parentEle.data("dbId", obj._dbId); + parentEle.data("name", obj.full_name); + initPopover(null, _position, parentEle); + + return parentEle; + } + //============================================================================== // ↑ 系統監控 - 共用 Function ↑ //============================================================================== diff --git a/Frontend/js/forge/forgemodel.js b/Frontend/js/forge/forgemodel.js index f35fbf8..7bc71bf 100644 --- a/Frontend/js/forge/forgemodel.js +++ b/Frontend/js/forge/forgemodel.js @@ -1,9 +1,10 @@ var viewer; + let fragProxy; var targetFloorZ; var elevatorSpeed; var selector = "#forgeViewer"; -var myDataList;//設備list +let myDataList; var levels;//剖面用 var lowerIdx;//剖面的下方樓層 var upperIdx;//剖面的上方樓層 @@ -27,6 +28,31 @@ function launchViewer(urn, callback, _selector = "#forgeViewer") { callback ? callback(viewer, nodeIds) : ""; }) + + //test + // for (let i = 0; i < urn.length; i++) { + // Autodesk.Viewing.Document.load(urn[i]["urn"], async (doc) => { + // let viewables = doc.getRoot().getDefaultGeometry(); + // let model = await viewer.loadDocumentNode(doc, viewables, { + // preserveView: false, + // keepCurrentModels: true, + // placementTransform: (new THREE.Matrix4()).setPosition(urn[i]["xform"]), + // keepCurrentModels: true, + // globalOffset: { + // x: 0, + // y: 0, + // z: 0 + // } + // }); + + // await viewer.waitForLoadDone(); //!<<< Wait for loading materials, properties and geometries for this model (URN) + // }); + // } + + //loadHeatmaps(viewer.getAllModels()[0]); //!<<< equals to viewer.model + + + }); } @@ -247,6 +273,13 @@ class elevator3D { hideColor(nodeId); return; } + //let fragPosition = new THREE.Vector3(position);// 一樓0 二樓15 三樓 26 + + //fragProxy.position = fragPosition; + + //fragProxy.updateAnimTransform(); + + //viewer.impl.sceneUpdated(true); } } @@ -254,7 +287,14 @@ function onDocumentLoadSuccess(doc, eleOption) { var viewables = doc.getRoot().getDefaultGeometry(); viewer.loadDocumentNode(doc, viewables).then(i => { // documented loaded, any action? + }); + // viewer.addEventListener(Autodesk.Viewing.AGGREGATE_SELECTION_CHANGED_EVENT, (args) => { + // var currSelection = viewer.getSelection(); + // var domElem = document.getElementById('id_printer'); + // domElem.innerText = currSelection[0]; + // }); + viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT, function () { let instanceTree = viewer.model.getData().instanceTree; console.log(instanceTree.nodeAccess) @@ -264,6 +304,8 @@ function onDocumentLoadSuccess(doc, eleOption) { }); }); + + } // 輔助函數,使用 Promise 封裝 viewer.getProperties 函數 @@ -303,7 +345,7 @@ async function getNodeIdByDbIds(checkName = "【電梯】", callback = null) { let elements = await viewerGetProperties(targetNodeIds,"【tag_id】"); // 從 elements 中篩選出包含 【tag_id】 屬性的元素 - elements = elements.filter(x => x.properties.findIndex(y => y.displayName == "【tag_id】" && y.displayValue == checkName) != -1); + elements = elements.filter(x => x.properties.findIndex(y => y.displayName == "【tag_id】" && y.displayValue.indexOf(checkName) != -1) != -1); if (elements) { hasElement = true; @@ -351,11 +393,14 @@ function setElevatorSpeed(speed) { //0.01 ~ 1 } function movElevator() { + + let tree = viewer.model.getData().instanceTree; let nodeId = 10952; let fragProxyZ = 0; var movStatus = 0; // 0=no 1=up 2=down + if (fragProxy.position.z > targetFloorZ) { movStatus = 2 } @@ -370,6 +415,7 @@ function movElevator() { tree.enumNodeFragments(nodeId, function (frag) { fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag); fragProxy.getAnimTransform(); + //let fragPosition = new THREE.Vector3(0, 0, 15);// 一樓0 二樓15 三樓 26 if (movStatus == 2) { fragProxy.position.z -= elevatorSpeed; } @@ -393,6 +439,15 @@ function movElevator() { requestAnimationFrame(movElevator); } } + + + //let fragPosition = new THREE.Vector3(position);// 一樓0 二樓15 三樓 26 + + //fragProxy.position = fragPosition; + + //fragProxy.updateAnimTransform(); + + //viewer.impl.sceneUpdated(true); } function getAllDbIds(viewer) { @@ -440,7 +495,7 @@ class ADHeatMaps { constructor(option = {}) { this.devices = option.devices ?? []; this.checkNodeString = "【ROOM】"; - this.tempVal = 0; + this.tempVals = []; this.roomDbIds = []; //房間 dbId this.model = null; this.dataVizExtn = null; @@ -479,6 +534,7 @@ class ADHeatMaps { device.sensorTypes ); shadingNode.addPoint(shadingPoint); + device.temp = 0; }); heatmapData.addChild(shadingNode); @@ -495,34 +551,59 @@ class ADHeatMaps { this.dataVizExtn = dataVizExtn; - this.changeTemp(this.tempVal); + $.each(this.roomDbIds.map(x => x.nodeId), (idx, rDbid) => { + this.dataVizExtn.renderSurfaceShading("RoomPanel" + rDbid, "temperature", this.getSensorValue.bind(this)); + }) + + /*this.changeTemp(this.tempVal);*/ this.onComplete ? this.onComplete() : ""; } + getSensorValue = function(device, sensorType) { + let dev = this.devices.filter(x => x.id == device.id)[0]; + return dev.temp / 40; + } + // 改變溫度 changeTemp = function (devId, temp) { this.tempVal = temp; // 透過 device id 取得 roomDbId - /*const rDbid = this.roomDbIds.filter(x => x.)[0]?.roomDbId;*/ - if (rDbid != null) { - // 取得新的溫度值 - let getSensorValue = (device, sensorType) => { - return this.tempVal / 40; + this.devices.forEach((dev) => { + if (devId == dev.id) { + dev.temp = temp; } - // 對 "Room Panel" 做表面顏色的渲染,並使用新的溫度值 - this.dataVizExtn.renderSurfaceShading("RoomPanel" + rDbid, "temperature", getSensorValue); - } + }) + + this.dataVizExtn.updateSurfaceShading(this.getSensorValue.bind(this)); + + //if (rDbid != null) { + // // 取得新的溫度值 + // let getSensorValue = (device, sensorType) => { + // return this.tempVal / 40; + // } + // // 對 "Room Panel" 做表面顏色的渲染,並使用新的溫度值 + // this.dataVizExtn.renderSurfaceShading("RoomPanel" + rDbid, "temperature", getSensorValue); + //} } } function setTransparentBuilding() { + //allDbIdsStr.forEach((dbId) => { + // setTransparency(dbId, 0.2); + //}) + for (var i = 0; i < allDbIdsStr.length; i++) { setTransparency(parseInt(allDbIdsStr[i]), 0.2); } + } function recoverTransparentBuilding() { + //allDbIdsStr.forEach((dbId) => { + // setTransparency(dbId, 1); + //}) + for (var i = 0; i < allDbIdsStr.length; i++) { setTransparency(parseInt(allDbIdsStr[i]), 1); } @@ -575,6 +656,16 @@ function hideColor(nodeId) {//顏色改成透明 } +//------------------ 紀錄熱點座標 --------------- +function getHopspotPoint(data) { + //var av = Autodesk.Viewing; + myDataList = data; + //viewer.addEventListener(av.GEOMETRY_LOADED_EVENT, addHotPoint, { + // once: true, + //}); +} +//-------------------- end ---------------------- + //------------------- 加入熱點 ----------------- async function addHotPoint(data) { var viewer = data.target; @@ -604,7 +695,7 @@ async function addHotPoint(data) { myDataList.forEach((myData, index) => { const dbId = 10 + index; - const myPosition = JSON.parse(myData.device_coordinate_3d); + const myPosition = myData.position; const viewable = new DataVizCore.SpriteViewable(myPosition, style, dbId); myData._dbId = dbId; viewableData.addViewable(viewable); @@ -620,6 +711,7 @@ async function addHotPoint(data) { if (event != undefined && event != null) { if (event.dbId >= dbIdStart && event.dbId <= dbIdEnd) {//event.dbId > 0 && event.dbId < 19 console.log(`Sprite clicked: ${event.dbId}`); + openHotspotModal(); for (let i = dbIdStart; i <= dbIdEnd; i++) { changeColorForHotspot(i, false); changeScaleForHotspot(i, false); @@ -646,6 +738,7 @@ async function addHotPoint(data) { // if (dbIds.length > 0) { // // 處理已選取元件的邏輯 // $(selector).trigger("autodesk:click:sprite", event); + // //openHotspotModal(); // console.log(`------ name: ${viewer.model.getInstanceTree().getNodeName(dbIds)} , dbId: ${dbIds}`);//, id: ${event.clickInfo.object.id}, position.x: ${event.clickInfo.point.x}, y: ${event.clickInfo.point.y}, z: ${event.clickInfo.point.z} // } else { // // 處理沒有選取元件的邏輯 @@ -687,16 +780,52 @@ async function changeScaleForHotspot(dbId, type = true) { }; }); } -//------------------------------ end ---------------------------------- -//------------------------------ 熱圖 --------------------------------- -async function loadHeatmaps(model, roomsArr) { +//------------------- end -------------- + +//----------------- 開關熱點小視窗 ---------------------- +function openHotspotModal() { + //var modal = document.getElementById("hotspotModal"); + //modal.style.display = "block"; + //$("#pills-register-tab").removeClass("active"); + //$("#pills-alarm-tab").removeClass("active"); + //$("#pills-operation-tab").removeClass("active"); + //$("#pills-login-tab").tab("show"); +} + +function closeHotspotModal() { + //var modal = document.getElementById("hotspotModal"); + //modal.style.display = "none"; + +} +//------------------ end -------------------------------- + +//------------------ 熱圖 ------------------------------- +async function loadHeatmaps(model) { const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization"); - var devices = []; - myDataList.forEach((myData, index) => { - devices.push({ id: index, position: JSON.parse(myData.device_coordinate_3d), sensorTypes: ["temperature", "humidity"] }); - }); + //取三個空調設備的位置打點 + const devices = [ + { + id: "Oficina 5", + //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) + sensorTypes: ["temperature", "humidity"] + }, + { + id: "Oficina 4", + //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) + sensorTypes: ["temperature", "humidity"] + }, + { + id: "Oficina 3", + //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) + sensorTypes: ["temperature", "humidity"] + } + ]; + //冷氣N5: (-4.93, -20.61, 16.86), N4: (23.94, -3.85, 16.86), N3: (-4.93, -3.85, 16.86) // Initialize sensor values let sensorVals = []; @@ -705,9 +834,7 @@ async function loadHeatmaps(model, roomsArr) { } const roomDbIds = []; - for (var i = 0; i < roomsArr.length; i++) { - roomDbIds.push(roomsArr[i]); - } + roomDbIds.push(7567); const { SurfaceShadingData, @@ -732,10 +859,11 @@ async function loadHeatmaps(model, roomsArr) { // Setup surface shading await dataVizExtn.setupSurfaceShading(model, heatmapData); + dataVizExtn.registerSurfaceShadingColors("temperature", [0xff0000, 0x0000ff]); function getSensorValue(device, sensorType) { - return sensorVals[parseInt(device.id)]; + return sensorVals[parseInt(device.id.slice(-1)) - 1]; } dataVizExtn.renderSurfaceShading("Room Panel", "temperature", getSensorValue); @@ -748,9 +876,97 @@ async function loadHeatmaps(model, roomsArr) { dataVizExtn.updateSurfaceShading(getSensorValue); }, 2000); } -//------------------------------ end ---------------------------------- +//------------------ end -------------------------------- +async function loadHeatmapsForFloor(model) { -//--------------------------- -- 剖面 --------------------------------- + const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization"); + + //x: -17.33, y: 51.03, z: -2.52 + const devices = [ + { + id: "Oficina 5", + //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) + sensorTypes: ["temperature", "humidity"] + }, + { + id: "Oficina 4", + //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) + sensorTypes: ["temperature", "humidity"] + }, + { + id: "Oficina 3", + //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) + sensorTypes: ["temperature", "humidity"] + } + ]; + + // Initialize sensor values + let sensorVals = []; + for (let i = 0; i < devices.length; i++) { + sensorVals[i] = Math.random(); + } + + const roomDbIds = []; + + roomDbIds.push(7567); + + const { + SurfaceShadingData, + SurfaceShadingPoint, + SurfaceShadingNode, + } = Autodesk.DataVisualization.Core; + + const shadingNode = new SurfaceShadingNode("Room Panel", roomDbIds); + + devices.forEach((device) => { + const shadingPoint = new SurfaceShadingPoint( + device.id, + device.position, + device.sensorTypes + ); + shadingNode.addPoint(shadingPoint); + }); + + const heatmapData = new SurfaceShadingData(); + heatmapData.addChild(shadingNode); + heatmapData.initialize(model); + + // Setup surface shading + await dataVizExtn.setupSurfaceShading(model, heatmapData); + + //dataVizExtn.registerSurfaceShadingColors("co2", [0x00ff00, 0xff0000]); + dataVizExtn.registerSurfaceShadingColors("temperature", [0xff0000, 0x0000ff]); + + function getSensorValue(device, sensorType) { + return sensorVals[parseInt(device.id.slice(-1)) - 1]; + } + + dataVizExtn.renderSurfaceShading("Room Panel", "temperature", getSensorValue); + + setInterval(() => { + // Modify sensor values. + for (let i = 0; i < devices.length; i++) { + sensorVals[i] = Math.random(); + } + dataVizExtn.updateSurfaceShading(getSensorValue); + }, 2000); +} + +// +async function loadHeatmap() { + const model = viewer.model; + loadHeatmaps(model); +} + +async function loadHeatmapForFloor() { + const model = viewer.model; + loadHeatmapsForFloor(model); +} + +//------------ 剖面 ---------------------- async function getRemoteLevels() { const aecData = await Autodesk.Viewing.Document.getAecModelData(this.viewer.model.getDocumentNode()); if (!aecData.levels) return null; @@ -760,6 +976,21 @@ async function getRemoteLevels() { return levels2; } +async function getLevelsData(lowerFloor, upperFloor) { + + const data = await this.getRemoteLevels(); + for (var i = 0; i < data.length; i++) { + if ((data[i].name).indexOf(lowerFloor) != -1) { + lowerIdx = i; + } + if ((data[i].name).indexOf(upperFloor) != -1) { + upperIdx = i; + } + } + this.levels = data; + profile(); +} + function getCutPlaneParam(idx, n) { if (idx < 0 || !n) return; @@ -779,38 +1010,10 @@ function getCutPlaneParam(idx, n) { } function profile() { + //const upperIdx = 6; const upperCutPlaneParam = this.getCutPlaneParam(upperIdx, 1); + //const lowerIdx = 7; const lowerCutPlaneParam = this.getCutPlaneParam(lowerIdx, -1); this.viewer.setCutPlanes([upperCutPlaneParam, lowerCutPlaneParam]); } -//------------------------------ end ---------------------------------- - - -//======================== 外部呼叫function =========================== -//紀錄熱點座標 -function getHopspotPoint(data) { - myDataList = data; -} - -//呼叫載入熱圖 -async function toLoadHeatmap(roomArr) { - const model = viewer.model; - loadHeatmaps(model, roomArr); -} - -//取得levels,執行剖面 -async function getLevelsData(lowerFloor, upperFloor) { - - const data = await this.getRemoteLevels(); - for (var i = 0; i < data.length; i++) { - if ((data[i].name).indexOf(lowerFloor) != -1) { - lowerIdx = i; - } - if ((data[i].name).indexOf(upperFloor) != -1) { - upperIdx = i; - } - } - this.levels = data; - profile(); -} -//============================= end =================================== \ No newline at end of file +//----------------- end ----------------------------------------------- \ No newline at end of file diff --git a/Frontend/js/yourteam/plugins/yt-tooltip/yt-tooltip.js b/Frontend/js/yourteam/plugins/yt-tooltip/yt-tooltip.js index aa8a5e1..8f11ec3 100644 --- a/Frontend/js/yourteam/plugins/yt-tooltip/yt-tooltip.js +++ b/Frontend/js/yourteam/plugins/yt-tooltip/yt-tooltip.js @@ -92,6 +92,7 @@ $.fn.YTTooltip = function (option) { }) } $("body").append(clone); + $(obj.ele).trigger("yt:tooltip:show"); //push 已顯示紀錄 obj.isShowArr.push(ranId); obj.tooltipDiv = clone; @@ -125,6 +126,7 @@ $.fn.YTTooltip = function (option) { } setTimeout(function () { obj.onShow ? obj.onShow(clone, obj.ele, obj) : ""; + $(obj.ele).trigger("yt:tooltip:shown"); }, 10) event(); } else { @@ -158,6 +160,8 @@ $.fn.YTTooltip = function (option) { let _obj = $(obj.ele)[0]._ytTooltip; onHide ? onHide($("#yt_tooltip_" + tooId), _obj.ele, _obj) : ""; + $(obj.ele).trigger("yt:tooltip:hide"); + $("#yt_tooltip_" + tooId).remove(); obj.isShowArr.splice($.inArray(tooId, obj.isShowArr), 1); //setTimeout(function () {