Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
commit
6303bef388
@ -28,34 +28,33 @@
|
||||
</div>
|
||||
|
||||
<div class="row bg-dark p-2 mb-5 align-items-center">
|
||||
<div class="col-auto">
|
||||
<a href="#" class="btn btn-info">全選</a>
|
||||
</div>
|
||||
|
||||
<div class="col-auto">
|
||||
<div class="frame-wrap">
|
||||
<input id="checkAll" type="checkbox" name="all" onclick="check_all(this,'c')"
|
||||
style="display:none" />
|
||||
<label for="checkAll" type="button" class="btn btn-info mr-3">全選</label>
|
||||
<div class="custom-control custom-checkbox custom-control-inline">
|
||||
<input type="checkbox" class="custom-control-input" id="defaultInline1">
|
||||
<input type="checkbox" name="c" class="custom-control-input" id="defaultInline1">
|
||||
<label class="custom-control-label" for="defaultInline1">施工詳圖</label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox custom-control-inline">
|
||||
<input type="checkbox" class="custom-control-input" id="defaultInline2">
|
||||
<input type="checkbox" name="c" class="custom-control-input" id="defaultInline2">
|
||||
<label class="custom-control-label" for="defaultInline2">設備規範</label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox custom-control-inline">
|
||||
<input type="checkbox" class="custom-control-input" id="defaultInline3">
|
||||
<input type="checkbox" name="c" class="custom-control-input" id="defaultInline3">
|
||||
<label class="custom-control-label" for="defaultInline3">工程介面圖說</label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox custom-control-inline">
|
||||
<input type="checkbox" class="custom-control-input" id="defaultInline4">
|
||||
<input type="checkbox" name="c" class="custom-control-input" id="defaultInline4">
|
||||
<label class="custom-control-label" for="defaultInline4">門禁規範</label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox custom-control-inline">
|
||||
<input type="checkbox" class="custom-control-input" id="defaultInline5">
|
||||
<input type="checkbox" name="c" class="custom-control-input" id="defaultInline5">
|
||||
<label class="custom-control-label" for="defaultInline5">監控平面圖</label>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox custom-control-inline">
|
||||
<input type="checkbox" class="custom-control-input" id="defaultInline6">
|
||||
<input type="checkbox" name="c" class="custom-control-input" id="defaultInline6">
|
||||
<label class="custom-control-label" for="defaultInline6">其它</label>
|
||||
</div>
|
||||
</div>
|
||||
@ -78,28 +77,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>TEST03</td>
|
||||
<td>TEST03</td>
|
||||
<td>A-01.dwg</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<a href="#" class="btn btn-info">編輯</a>
|
||||
<a href="#" class="btn btn-danger">刪除</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>TEST06</td>
|
||||
<td>TEST06</td>
|
||||
<td>A-01.dwg</td>
|
||||
<td>AS-01.dwg</td>
|
||||
<td>
|
||||
<a href="#" class="btn btn-info">編輯</a>
|
||||
<a href="#" class="btn btn-danger">刪除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@ -135,52 +113,50 @@
|
||||
<input type="text" id="inpName" name="inpName" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="dropdown col-md-6 mt-3">
|
||||
<label>主要類別</label>
|
||||
<button class="btn btn-dark dropdown-toggle col-12" type="button" id="dropdownMenuButton"
|
||||
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
主要類別
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<a class="dropdown-item" href="#">建築</a>
|
||||
<a class="dropdown-item" href="#">電力控制</a>
|
||||
<a class="dropdown-item" href="#">水力控制</a>
|
||||
<a class="dropdown-item" href="#">系統控制</a>
|
||||
<div class="col-md-6 mt-3">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="example-select">主要類別</label>
|
||||
<select class="form-control" id="example-select select2bs4">
|
||||
<option>建築</option>
|
||||
<option>電力控制</option>
|
||||
<option>水力控制</option>
|
||||
<option>系統控制</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dropdown col-md-6 mt-3">
|
||||
<label>子類別</label>
|
||||
<button class="btn btn-dark dropdown-toggle col-12" type="button" id="dropdownMenuButton"
|
||||
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
子類別
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<a class="dropdown-item" href="#">施工詳圖</a>
|
||||
<a class="dropdown-item" href="#">設備規範</a>
|
||||
<a class="dropdown-item" href="#">工程介面圖說</a>
|
||||
<a class="dropdown-item" href="#">門禁規範</a>
|
||||
<a class="dropdown-item" href="#">監控平面圖</a>
|
||||
<a class="dropdown-item" href="#">其它</a>
|
||||
<div class="col-md-6 mt-3">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="example-select">子類別</label>
|
||||
<select class="form-control" id="example-select select2bs4">
|
||||
<option>施工詳圖</option>
|
||||
<option>設備規範</option>
|
||||
<option>工程介面圖說</option>
|
||||
<option>門禁規範</option>
|
||||
<option>監控平面圖</option>
|
||||
<option>其它</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 mt-6">
|
||||
<label>原設計</label>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<button type="button" class="btn btn-info">上傳檔案</button>
|
||||
</div>
|
||||
<div class="col-md-12 mt-1">
|
||||
<small>欲上傳之檔案名稱</small>
|
||||
<input id="myDesignDiagram" type="file" style="display:none" />
|
||||
<label for="myDesignDiagram" type="button" class="file-upload btn btn-info"
|
||||
style="cursor : pointer ">上傳檔案</label>
|
||||
<div id='forDesignDiagram' class="col-sm-12 forimage mt-2 offset-3 p-0"></div>
|
||||
</div>
|
||||
<div id="designDiagram" class="col-md-12 ml-3"></div>
|
||||
<div class="col-md-12 mt-3">
|
||||
<label>竣工圖</label>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<button type="button" class="btn btn-info">上傳檔案</button>
|
||||
</div>
|
||||
<div class="col-md-12 mt-1">
|
||||
<small>欲上傳之檔案名稱</small>
|
||||
<input id="myAsBuilt" type="file" style="display:none" />
|
||||
<label for="myAsBuilt" type="button" class="file-upload btn btn-info"
|
||||
style="cursor : pointer ">上傳檔案</label>
|
||||
<div id='forAsBuilt' class="col-sm-12 forimage mt-2 offset-3 p-0"></div>
|
||||
</div>
|
||||
<div id="asBuiltDrawing" class="col-md-12 ml-3"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
@ -191,3 +167,62 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
$(function () {
|
||||
initList();
|
||||
})
|
||||
|
||||
function initList() {
|
||||
let sendData = {
|
||||
building_tag: pageAct.buiTag
|
||||
}
|
||||
objSendData.Data = sendData;
|
||||
let url = baseApiUrl + "/GraphManage/GraManList";
|
||||
function success(res) {
|
||||
let strHtml = ``;
|
||||
$.each(res, function (index, val) {
|
||||
|
||||
strHtml = `<tr>
|
||||
<td>${res.code}</td>
|
||||
<td>${res.code}</td>
|
||||
<td>${res.code}</td>
|
||||
<td>${res.code}</td>
|
||||
<td>
|
||||
<a href="#" class="btn btn-info">編輯</a>
|
||||
<a href="#" class="btn btn-danger">刪除</a>
|
||||
</td>
|
||||
</tr>`;
|
||||
});
|
||||
|
||||
$('tbody').html(strHtml);
|
||||
}
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send();
|
||||
}
|
||||
|
||||
// 取上傳檔名
|
||||
$("#myDesignDiagram").on("change", function (e) {
|
||||
let fileHelper = new YourTeam.Utility.File();
|
||||
let fileName = this.files[0].name;
|
||||
|
||||
strHtml = `<small>${fileName}</small>`;
|
||||
$('#designDiagram').html(strHtml);
|
||||
});
|
||||
|
||||
// 取上傳檔名
|
||||
$("#myAsBuilt").on("change", function (e) {
|
||||
let fileHelper = new YourTeam.Utility.File();
|
||||
let fileName = this.files[0].name;
|
||||
|
||||
strHtml = `<small>${fileName}</small>`;
|
||||
$('#asBuiltDrawing').html(strHtml);
|
||||
});
|
||||
|
||||
// 全選功能
|
||||
function check_all(obj, cName) {
|
||||
var checkboxs = document.getElementsByName(cName);
|
||||
for (var i = 0; i < checkboxs.length; i++) { checkboxs[i].checked = obj.checked; }
|
||||
}
|
||||
|
||||
</script>
|
@ -18,24 +18,31 @@
|
||||
<div class="row bg-dark p-2 mb-5">
|
||||
<div class="col-auto">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed">日期</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed">日區間</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed">月</button>
|
||||
<button type="button" onclick="setDateType('day')" class="btn btn-secondary waves-effect waves-themed">日期</button>
|
||||
<button type="button" onclick="setDateType('range')" class="btn btn-secondary waves-effect waves-themed">日區間</button>
|
||||
<button type="button" onclick="setDateType('month')" class="btn btn-secondary waves-effect waves-themed">月</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed">今天</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed">昨天</button>
|
||||
<button type="button" onclick="setDateType('today')" class="btn btn-secondary waves-effect waves-themed">今天</button>
|
||||
<button type="button" onclick="setDateType('ytd')" class="btn btn-secondary waves-effect waves-themed">昨天</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="form-group">
|
||||
<input class="form-control" id="example-date" type="date" name="date" value="2023-07-23">
|
||||
<input class="form-control" id="startdate" type="date" name="date" value="">
|
||||
<input class="form-control" id="getmonth" type="month" style="display: none"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto" id="enddate" style="display: none">
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="date" name="date" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<a href="#" class="btn btn-info">查詢</a> <a href="#" class="btn btn-info waves-effect waves-themed">
|
||||
<a href="#" onclick="searchDate()" class="btn btn-info">查詢</a>
|
||||
<a href="#" class="btn btn-info waves-effect waves-themed">
|
||||
<span class="fal fa-file-excel mr-1"></span>
|
||||
匯出
|
||||
</a>
|
||||
@ -86,6 +93,7 @@
|
||||
});
|
||||
|
||||
function initList() {
|
||||
pageAct.mainStatus = false;
|
||||
let sendData = {
|
||||
building_tag: pageAct.buiTag
|
||||
}
|
||||
@ -95,8 +103,8 @@
|
||||
let strHtml = ``;
|
||||
let i1 = null, i2 = null, first = true;
|
||||
|
||||
|
||||
$.each(res.data.history_Main_Systems, function (index, val) {
|
||||
if (pageAct.mainStatus) {
|
||||
strHtml += `<li>
|
||||
<a href="#" data-filter-tags="user interface buttons compass action dropdown navigation sidebars" data-maintag="${val.main_system_tag}">
|
||||
<span class="nav-link-text">${val.full_name}</span>
|
||||
@ -104,6 +112,7 @@
|
||||
<ul style="${index == 0 ? `display:block;` : ``}">`;
|
||||
|
||||
i1 = (val.history_Sub_systems != null && i1 == null) ? index : null;
|
||||
}
|
||||
|
||||
$.each(val.history_Sub_systems, function (index2, val2) {
|
||||
i2 = (val2.device != null && i2 == null) ? index2 : null;
|
||||
@ -114,7 +123,7 @@
|
||||
${val2.full_name} ${val2.sub_system_tag}
|
||||
</span>
|
||||
</a>
|
||||
<ul style="${index == i1 && index2 == i2 ? `display:block;` : ``}">`;
|
||||
<ul style="${(i1 != null ? index == i1 : first) && index2 == i2 ? `display:block;` : ``}">`;
|
||||
|
||||
$.each(val2.device, function (index3, val3) {
|
||||
strHtml += `<li>
|
||||
@ -125,16 +134,29 @@
|
||||
</a>
|
||||
</li>`;
|
||||
|
||||
if (pageAct.mainStatus) {
|
||||
if (index == i1 && index2 == i2 && first) {
|
||||
first = false;
|
||||
pageAct.deviceNumber = val3.device_number;
|
||||
pageAct.deviceName = val3.full_name;
|
||||
devPointsList();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (index2 == i2 && first) {
|
||||
first = false;
|
||||
pageAct.deviceNumber = val3.device_number;
|
||||
pageAct.deviceName = val3.full_name;
|
||||
devPointsList();
|
||||
}
|
||||
}
|
||||
});
|
||||
strHtml += `</ul> </li>`;
|
||||
});
|
||||
|
||||
if (pageAct.mainStatus) {
|
||||
strHtml += `</ul> </li>`;
|
||||
}
|
||||
});
|
||||
|
||||
$('#js_nested_list').html(strHtml);
|
||||
@ -181,7 +203,7 @@
|
||||
function callBackFromHistory(res) {
|
||||
let strHtml = ``;
|
||||
res = JSON.parse(res);
|
||||
console.log(res);
|
||||
if (res.data.length > 0) {
|
||||
$.each(res.data, function (index, val) {
|
||||
strHtml += `<tr>
|
||||
<td>${val.deviceName}</td>
|
||||
@ -189,6 +211,10 @@
|
||||
<td>${displayDate(val.timestamp)}</td>
|
||||
</tr>`;
|
||||
});
|
||||
}
|
||||
else
|
||||
strHtml += `<tr><td colspan="3">查無資料</td></tr>`;
|
||||
|
||||
$('#tableData tbody').html(strHtml);
|
||||
}
|
||||
|
||||
@ -203,4 +229,70 @@
|
||||
getData();
|
||||
}
|
||||
}
|
||||
|
||||
function setDateType(type) {
|
||||
pageAct.dateType = type;
|
||||
let now = formatDate(new Date(Date.now()), "date");
|
||||
let ytd = formatDate(new Date(new Date().setDate(new Date().getDate() - 1)), "date");
|
||||
let tmr = formatDate(new Date(new Date().setDate(new Date().getDate() + 1)), "date");
|
||||
if (type == "day" || type == "today" || type == "ytd") {
|
||||
let date = type == "ytd" ? ytd : now;
|
||||
$('#startdate').css('display', 'block');
|
||||
$('#enddate').css('display', 'none');
|
||||
$('#getmonth').css('display', 'none');
|
||||
$('#startdate').val(date);
|
||||
|
||||
if (type == "today")
|
||||
getData(formatDate(now, "date", true), formatDate(tmr, "date", true));
|
||||
else if (type == "ytd")
|
||||
getData(formatDate(ytd, "date", true), formatDate(now, "date", true));
|
||||
}
|
||||
else if (type == "range") {
|
||||
$('#startdate').css('display', 'block');
|
||||
$('#enddate').css('display', 'block');
|
||||
$('#getmonth').css('display', 'none');
|
||||
$('#startdate').val(now);
|
||||
$('#enddate input').val(tmr);
|
||||
}
|
||||
else if (type == "month") {
|
||||
$('#startdate').css('display', 'none');
|
||||
$('#enddate').css('display', 'none');
|
||||
$('#getmonth').css('display', 'block');
|
||||
$('#getmonth').val(now.substr(0, 7));
|
||||
}
|
||||
else if (type == "ytd") {
|
||||
$('#startdate').css('display', 'block');
|
||||
$('#enddate').css('display', 'none');
|
||||
$('#getmonth').css('display', 'none');
|
||||
$('#startdate').val(ytd);
|
||||
}
|
||||
}
|
||||
|
||||
function searchDate() {
|
||||
let start = new Date($('#startdate').val());
|
||||
let end = new Date(new Date().setDate(new Date($('#enddate input').val()).getDate() + 1));
|
||||
|
||||
if (pageAct.dateType == "day")
|
||||
end = new Date(new Date().setDate(start.getDate() + 1));
|
||||
else if (pageAct.dateType == "month") {
|
||||
start = new Date($('#getmonth').val());
|
||||
end = new Date(new Date().setDate(start.getDate() + 30));
|
||||
}
|
||||
else if (pageAct.dateType != "range")
|
||||
return;
|
||||
|
||||
getData(formatDate(start, "date", true), formatDate(end, "date", true));
|
||||
}
|
||||
|
||||
function formatDate(date, type, send = false) {
|
||||
if (!send)
|
||||
return displayDate(date, type).replaceAll("/", "-");
|
||||
else {
|
||||
date = displayDate(date, type);
|
||||
let month = date.split('/')[1];
|
||||
let year = date.split('/')[0];
|
||||
let day= date.split('/')[2];
|
||||
return month + "/" + day + "/" + year;
|
||||
}
|
||||
}
|
||||
</script>
|
@ -13,6 +13,16 @@
|
||||
<link rel="stylesheet" href="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/style.min.css" type="text/css">
|
||||
|
||||
|
||||
<div id="MyControls" class="adsk control">
|
||||
<p style="text-align: center; font-weight: bold;">Robot Controls</p>
|
||||
<p id="id_printer">Selected_ID: </p>
|
||||
<p id="all_id">All_ID: </p>
|
||||
<button id="1F1oor" onclick="move1Floor()">1 Floor</button>
|
||||
<button id="2F1oor" onclick="move2Floor()">2 Floor</button>
|
||||
<button id="3F1oor" onclick="move3Floor()">3 Floor</button>
|
||||
<!-- <input type="range">Main Axis</input> -->
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div id="forgeViewer"></div>
|
||||
</div>
|
||||
@ -44,8 +54,26 @@
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU2JUIwJUI4JUU2JTk4JUE1JUU2JUEzJUE3JUUzJTgwJTkxJUUzJTgwJTkwTUVQJUUzJTgwJTkxVjMubndk');
|
||||
launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwVEVTVCVFMyU4MCU5MS5ud2Q');//[TEST].nwd
|
||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwTUVQJUUzJTgwJTkxLm53Yw');//[TEST].nwd
|
||||
launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1vZGVsX3Rlc3QxMTIxLyVFMyU4MCU5MFRFU1QlRTMlODAlOTEubndk');
|
||||
|
||||
|
||||
});
|
||||
function move1Floor() {
|
||||
setElevatorSpeed(0.2);
|
||||
setElevatorFloor(0);
|
||||
requestAnimationFrame(movElevator);
|
||||
}
|
||||
function move2Floor() {
|
||||
setElevatorSpeed(0.2);
|
||||
setElevatorFloor(1);
|
||||
requestAnimationFrame(movElevator);
|
||||
}
|
||||
function move3Floor() {
|
||||
setElevatorSpeed(0.2);
|
||||
setElevatorFloor(2);
|
||||
requestAnimationFrame(movElevator);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
@ -42,6 +42,9 @@ var sensorStyleDefinitions = {
|
||||
|
||||
// Initialize sensor values
|
||||
let sensorVals = [];
|
||||
let fragProxy;
|
||||
var targetFloorZ;
|
||||
var elevatorSpeed;
|
||||
for (let i = 0; i < devices.length; i++) {
|
||||
sensorVals[i] = Math.random();
|
||||
}
|
||||
@ -87,12 +90,168 @@ function launchViewer(urn) {
|
||||
});
|
||||
}
|
||||
|
||||
function getAllLeafComponents(viewer, callback) {
|
||||
var cbCount = 0;
|
||||
var tree;
|
||||
var jsData = []
|
||||
|
||||
function getLeafComponentsRec(current, parent) {
|
||||
cbCount++;
|
||||
if (tree.getChildCount(current) != 0) {
|
||||
tree.enumNodeChildren(current, function (children) {
|
||||
getLeafComponentsRec(children, current);
|
||||
}, false);
|
||||
}
|
||||
var nodeName = viewer.model.getInstanceTree().getNodeName(current)
|
||||
jsData.push({ id: current, parent: parent, text: nodeName })
|
||||
|
||||
if (--cbCount == 0) callback(jsData);
|
||||
}
|
||||
viewer.getObjectTree(function (objectTree) {
|
||||
tree = objectTree;
|
||||
var rootId = tree.getRootId()
|
||||
var nodeName = viewer.model.getInstanceTree().getNodeName(rootId)
|
||||
jsData.push({ id: rootId, parent: '#', text: nodeName })
|
||||
var allLeafComponents = getLeafComponentsRec(rootId, '#');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function onDocumentLoadSuccess(doc) {
|
||||
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 () {
|
||||
var instanceTree = viewer.model.getData().instanceTree;
|
||||
var allDbIdsStr = Object.keys(instanceTree.nodeAccess.dbIdToIndex);
|
||||
var domElem = document.getElementById('all_id');
|
||||
domElem.innerText = allDbIdsStr;
|
||||
//allDbIdsStr.map(function (id) { return parseInt(id) });
|
||||
//getAllLeafComponents(viewer, function (jsonData) {
|
||||
// console.log("data: " + jsonData);
|
||||
//});
|
||||
//var a = getAllDbIds(viewer);
|
||||
//console.log("a: " + a);//10952
|
||||
|
||||
let tree = viewer.model.getData().instanceTree;
|
||||
let nodeId = 10952;
|
||||
|
||||
tree.enumNodeFragments(nodeId, function (frag) {
|
||||
fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
|
||||
fragProxy.getAnimTransform();
|
||||
//fragProxy.quaternion = new THREE.Quaternion().setFromAxisAngle(
|
||||
// new THREE.Vector3(0, 0.3, 0),
|
||||
// -Math.PI / 2);
|
||||
//fragProxy.quaternion = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0));
|
||||
//fragProxy.quaternion = new THREE.Quaternion().setPosition(new THREE.Vector3(10, 5, 0), 5);
|
||||
//fragProxy.updateAnimTransform();
|
||||
//do some work with fragment proxy
|
||||
|
||||
|
||||
//var fragPosition = new THREE.Vector3(
|
||||
// 10 - fragProxy.offset.x,
|
||||
// 10 - fragProxy.offset.y,
|
||||
// 10 - fragProxy.offset.z)
|
||||
|
||||
|
||||
let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26
|
||||
|
||||
fragProxy.position = fragPosition
|
||||
|
||||
fragProxy.updateAnimTransform()
|
||||
|
||||
});
|
||||
viewer.impl.sceneUpdated(true);
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
function setElevatorFloor(floor) {
|
||||
if (floor == 0)
|
||||
targetFloorZ = 0;
|
||||
else if (floor == 1)
|
||||
targetFloorZ = 15;
|
||||
else if (floor == 2)
|
||||
targetFloorZ = 26;
|
||||
}
|
||||
|
||||
function setElevatorSpeed(speed) { //0.01 ~ 1
|
||||
elevatorSpeed = speed;
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
else if (fragProxy.position.z < targetFloorZ) {
|
||||
movStatus = 1
|
||||
}
|
||||
|
||||
if (movStatus == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
else if (movStatus == 1) {
|
||||
fragProxy.position.z += elevatorSpeed;
|
||||
}
|
||||
|
||||
fragProxyZ = fragProxy.position.z;
|
||||
fragProxy.updateAnimTransform()
|
||||
|
||||
});
|
||||
viewer.impl.sceneUpdated(true);
|
||||
|
||||
if (movStatus == 2) {
|
||||
if (fragProxyZ >= targetFloorZ) {
|
||||
requestAnimationFrame(movElevator);
|
||||
}
|
||||
}
|
||||
else if (movStatus == 1) {
|
||||
if (fragProxyZ <= targetFloorZ) {
|
||||
requestAnimationFrame(movElevator);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//let fragPosition = new THREE.Vector3(position);// 一樓0 二樓15 三樓 26
|
||||
|
||||
//fragProxy.position = fragPosition;
|
||||
|
||||
//fragProxy.updateAnimTransform();
|
||||
|
||||
//viewer.impl.sceneUpdated(true);
|
||||
}
|
||||
|
||||
function getAllDbIds(viewer) {
|
||||
var instanceTree = viewer.model.getData().instanceTree;
|
||||
|
||||
var allDbIdsStr = Object.keys(instanceTree.nodeAccess.dbIdToIndex);
|
||||
|
||||
return allDbIdsStr.map(function (id) { return parseInt(id) });
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user