This commit is contained in:
dev01 2022-12-30 18:27:07 +08:00
commit fae9317bb0
2 changed files with 36 additions and 12 deletions

View File

@ -31,10 +31,11 @@
var global_emergency_alarm_device_number = []; var global_emergency_alarm_device_number = [];
var zoomToggle = 3; var zoomToggle = 3;
var urn_all = "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1pdHN1YmlzaGkvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU5JUExJUFGXzEyMjgubndk"; var urn_all = "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1pdHN1YmlzaGkvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU5JUExJUFGXzEyMjgubndk";
var urn_test = "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8lRTUlOEQlOEElRTklODAlOEYlRTYlOTglOEUlRTUlQkIlQkElRTclQUYlODlfMTJfMzAubndk";
$(function () { $(function () {
getHotspotPoint(() => { getHotspotPoint(() => {
show3DModel(urn_all); show3DModel(urn_test);
}); });
initChart(); initChart();
getFloData(); getFloData();
@ -869,7 +870,7 @@
function show3DModel(urn) { function show3DModel(urn) {
launchViewerForHotspot(urn, (viewer, nodeIds) => { launchViewerForHotspot(urn, (viewer, nodeIds) => {
getLevelsData(); getLevelsData("7F", "8F");//剖面的下方樓層,剖面的上方樓層
loadHeatmapForFloor(); loadHeatmapForFloor();
}); });
} }

View File

@ -6,6 +6,8 @@ var elevatorSpeed;
var selector = "#forgeViewer"; var selector = "#forgeViewer";
let myDataList; let myDataList;
var levels;//剖面用 var levels;//剖面用
var lowerIdx;//剖面的下方樓層
var upperIdx;//剖面的上方樓層
function launchViewer(urn, callback, _selector = "#forgeViewer") { function launchViewer(urn, callback, _selector = "#forgeViewer") {
selector = _selector; selector = _selector;
@ -763,19 +765,19 @@ async function loadHeatmaps(model) {
//取三個空調設備的位置打點 //取三個空調設備的位置打點
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"]
@ -837,28 +839,40 @@ async function loadHeatmapsForFloor(model) {
const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization"); const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
//x: -17.33, y: 51.03, z: -2.52 //x: -17.33, y: 51.03, z: -2.52
//var devices;
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"]
} }
]; ];
//myDataList.forEach((myData, index) => {
// //const dbId = 10 + index;
// //const myPosition = myData.position;
// //const viewable = new DataVizCore.SpriteViewable(myPosition, style, dbId);
// //myData._dbId = dbId;
// //viewableData.addViewable(viewable);
// devices.push(index, myData.position, ["temperature", "humidity"]);
//});
// Initialize sensor values // Initialize sensor values
let sensorVals = []; let sensorVals = [];
for (let i = 0; i < devices.length; i++) { for (let i = 0; i < devices.length; i++) {
@ -867,7 +881,7 @@ async function loadHeatmapsForFloor(model) {
const roomDbIds = []; const roomDbIds = [];
roomDbIds.push(7567); roomDbIds.push(11449);
const { const {
SurfaceShadingData, SurfaceShadingData,
@ -932,8 +946,17 @@ async function getRemoteLevels() {
return levels2; return levels2;
} }
async function getLevelsData() { async function getLevelsData(lowerFloor, upperFloor) {
const data = await this.getRemoteLevels(); 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; this.levels = data;
profile(); profile();
} }
@ -957,9 +980,9 @@ function getCutPlaneParam(idx, n) {
} }
function profile() { function profile() {
const upperIdx = 6; //const upperIdx = 6;
const upperCutPlaneParam = this.getCutPlaneParam(upperIdx, 1); const upperCutPlaneParam = this.getCutPlaneParam(upperIdx, 1);
const lowerIdx = 7; //const lowerIdx = 7;
const lowerCutPlaneParam = this.getCutPlaneParam(lowerIdx, -1); const lowerCutPlaneParam = this.getCutPlaneParam(lowerIdx, -1);
this.viewer.setCutPlanes([upperCutPlaneParam, lowerCutPlaneParam]); this.viewer.setCutPlanes([upperCutPlaneParam, lowerCutPlaneParam]);
} }