[Backend] 增加forge上傳檢視頁面、測試頁面

This commit is contained in:
wanli 2023-01-02 18:42:55 +08:00
parent 2a712865ab
commit 0bbdf4dbf1
8 changed files with 2370 additions and 0 deletions

View File

@ -1,6 +1,8 @@
<div class="row mb-3">
<div class="col-12 d-flex justify-content-end">
<a href="javascript:;" class="btn btn-success waves-effect waves-themed mb-3" id="addUser-btn" onclick="AddBuild()"><span class="fal fa-plus mr-1"></span>新增</a>
<a href="/index.html" class="btn btn-dark waves-effect waves-themed mb-3" id="openForgeView-btn"><span class="fal fa-plus mr-1"></span>forge管理</a>
<a href="/forgeDemo.html" class="btn btn-danger waves-effect waves-themed mb-3" id="openForgeDemo-btn"><span class="fal fa-plus mr-1"></span>forge Demo</a>
</div>
</div>
<div class="row">

View File

@ -0,0 +1,93 @@
<!--<!DOCTYPE html>
<html>-->
<head>
<title>Autodesk Forge Tutorial</title>
<meta charset="utf-8" />
<link rel="shortcut icon" href="https://github.com/Autodesk-Forge/learn.forge.viewmodels/raw/master/img/favicon.ico">
<!-- Common packages: jQuery, Bootstrap, jsTree -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jstree/3.3.7/jstree.min.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jstree/3.3.7/themes/default/style.min.css" />
<!-- Autodesk Forge Viewer files -->
<link rel="stylesheet" href="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/style.min.css" type="text/css">
<script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.min.js"></script>
<!-- this project files -->
<link href="css/main.css" rel="stylesheet" />
<script src="js/ForgeTree.js"></script>
<script src="js/ForgeViewer.js"></script>
</head>
<body>
@{
ViewData["MainNum"] = "1";
ViewData["SubNum"] = "4";
ViewData["Title"] = "forge管理";
}
<!-- Fixed navbar by Bootstrap: https://getbootstrap.com/examples/navbar-fixed-top/ -->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<ul class="nav navbar-nav left">
<li>
<a href="http://developer.autodesk.com" target="_blank">
<img alt="Autodesk Forge" src="//developer.static.autodesk.com/images/logo_forge-2-line.png" height="20">
</a>
</li>
</ul>
</div>
</nav>
<!-- End of navbar -->
<div class="container-fluid fill">
<div class="row fill">
<div class="col-sm-4 fill">
<div class="panel panel-default fill">
<div class="panel-heading" data-toggle="tooltip">
Buckets &amp; Objects
<span id="refreshBuckets" class="glyphicon glyphicon-refresh" style="cursor: pointer"></span>
<button class="btn btn-xs btn-info" style="float: right" id="showFormCreateBucket" data-toggle="modal" data-target="#createBucketModal">
<span class="glyphicon glyphicon-folder-close"></span> New bucket
</button>
</div>
<div id="appBuckets">
tree here
</div>
</div>
</div>
<div class="col-sm-8 fill">
<div id="forgeViewer"></div>
</div>
</div>
</div>
<form id="uploadFile" method='post' enctype="multipart/form-data">
<input id="hiddenUploadField" type="file" name="theFile" style="visibility:hidden" />
</form>
<!-- Modal Create Bucket -->
<div class="modal fade" id="createBucketModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Cancel">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel">Create new bucket</h4>
</div>
<div class="modal-body">
<input type="text" id="newBucketKey" class="form-control"> For demonstration purposes, objects (files)
are NOT automatically translated. After you upload, right click on
the object and select "Translate". Note: Technically your bucket name is required to be globally unique across
the entire platform - to keep things simple with this tutorial your client ID will be prepended by default to
your bucket name and in turn masked by the UI so you only have to make sure your bucket name is unique within
your current Forge app.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="createNewBucket">Go ahead, create the bucket</button>
</div>
</div>
</div>
</div>
</body>
<!--</html>-->

View File

@ -0,0 +1,23 @@
html, body {
min-height: 100%;
height: 100%;
}
.fill {
height: calc(100vh - 100px);
}
body {
padding-top: 60px; /* space for the top nav bar */
margin-right: 30px;
}
#appBuckets {
overflow: auto;
width: 100%;
height: calc(100vh - 150px);
}
#forgeViewer {
width: 100%;
}

View File

@ -0,0 +1,500 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<link rel="shortcut icon" href="https://github.com/Autodesk-Forge/learn.forge.viewmodels/raw/master/img/favicon.ico">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.7/themes/default/style.min.css" />
<!-- Autodesk Forge Viewer files -->
<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>
<button id="4F1oor" onclick="move4Floor()">4 Floor</button>
<button id="5F1oor" onclick="move5Floor()">5 Floor</button>
<button id="6F1oor" onclick="move6Floor()">6 Floor</button>
<button id="7F1oor" onclick="move7Floor()">7 Floor</button>
<button id="8F1oor" onclick="move8Floor()">8 Floor</button>
<button id="9F1oor" onclick="move9Floor()">9 Floor</button>
<button id="10F1oor" onclick="move10Floor()">10 Floor</button>
<button id="11F1oor" onclick="move11Floor()">11 Floor</button>
<button id="12F1oor" onclick="move12Floor()">12 Floor</button>
<button id="13F1oor" onclick="moveB1Floor()">B1 Floor</button>-->
<button type="button" class="btn btn-secondary" onclick="openOrCloseLight()">電源</button>
<button type="button" class="btn btn-danger" onclick="changeColorHotspot()">變更熱點顏色</button>
<button type="button" class="btn btn-dark" onclick="loadHeatMap()">載入熱圖</button>
<button type="button" class="btn btn-dark" onclick="hideModel()">隱藏物件</button>
<button type="button" class="btn btn-dark" onclick="openModel()">顯示物件</button>
<button type="button" class="btn btn-dark" onclick="transparentModel()">透明化物件</button>
<button type="button" class="btn btn-dark" onclick="cancelTransparentModel()">取消透明物件</button>
<button type="button" class="btn btn-danger" onclick="proFile()">剖面</button>
<button type="button" class="btn btn-dark" onclick="getLevels()">取得levels</button>
<button type="button" class="btn btn-success" onclick="importDevCor()">匯入設備座標及dbid</button>
<!--<input id="lightBar" type="range" min="0" max="100" step="5" onchange="changeLightPower()">亮度-->
<!-- <input type="range">Main Axis</input> -->
</div>
<div>
<div id="forgeViewer"></div>
</div>
<div class="modal" id="hotspotModal" tabindex="-1" aria-labelledby="loginModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link py-3 px-4" id="pills-register-tab" data-toggle="pill" href="#pills-register" role="tab" aria-controls="pills-register" aria-selected="false">即時值</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link py-3 px-4 active" id="pills-login-tab" data-toggle="pill" href="#pills-login" role="tab" aria-controls="pills-login" aria-selected="true">基本資料</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link py-3 px-4" id="pills-alarm-tab" data-toggle="pill" href="#pills-alarm" role="tab" aria-controls="pills-alarm" aria-selected="false">異常</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link py-3 px-4" id="pills-operation-tab" data-toggle="pill" href="#pills-operation" role="tab" aria-controls="pills-operation" aria-selected="false">運維</a>
</li>
</ul>
<div class="tab-content" id="pills-tabContent">
<div class="tab-pane fade" id="pills-register" role="tabpanel" aria-labelledby="pills-register-tab">
<div class="modal-header">
<h5 class="modal-title" id="loginModalLabel">即時值資訊</h5>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<input id="lightBar" type="range" min="0" max="100" step="1" onchange="changeLightPower()">明亮度
<!--<button type="button" class="btn btn-secondary" onclick="openOrCloseLight()">電源</button>-->
</div>
<!--<div class="form-group">
<label for="register-recipient-name" class="col-form-label">訂閱時間:</label>
<label class="col-form-label">100</label>
</div>
<div class="form-group">
<label for="register-pwd-text" class="col-form-label">執行時間:</label>
<label class="col-form-label">200</label>
</div>-->
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" onclick="closeHotspotModal()">返回</button>
</div>
</div>
<div class="tab-pane fade" id="pills-login" role="tabpanel" aria-labelledby="pills-login-tab">
<div class="modal-header">
<h5 class="modal-title" id="loginModalLabel">基本資料</h5>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="login-recipient-name" class="col-form-label">設備名稱:</label>
<label class="col-form-label" id="deviceName"></label>
</div>
<div class="form-group">
<label for="login-message-text" class="col-form-label">DBID:</label>
<label class="col-form-label" id="deviceDbid"></label>
</div>
<div class="form-group">
<label for="login-message-text" class="col-form-label">位置:</label>
<label class="col-form-label" id="devicePosition"></label>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" onclick="closeHotspotModal()">返回</button>
</div>
</div>
<div class="tab-pane fade" id="pills-alarm" role="tabpanel" aria-labelledby="pills-alarm-tab">
<div class="modal-header">
<h5 class="modal-title" id="loginModalLabel">異常資訊</h5>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="alarm-recipient-name" class="col-form-label">異常狀況:</label>
<label class="col-form-label" id="alarmStatus"></label>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" onclick="closeHotspotModal()">返回</button>
</div>
</div>
<div class="tab-pane fade" id="pills-operation" role="tabpanel" aria-labelledby="pills-operation-tab">
<div class="modal-header">
<h5 class="modal-title" id="loginModalLabel">運維資訊</h5>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="operation-recipient-name" class="col-form-label">運維人員:</label>
<label class="col-form-label" id="operationStatus"></label>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" onclick="closeHotspotModal()">返回</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!--Base JS-->
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script>
<!--<script src="js/init.js"></script>-->
<!-- Common packages: jQuery, Bootstrap, jsTree -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.7/jstree.min.js"></script>
<script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.js"></script>
<script src="js/forge/ForgeDemo.js"></script>
<style>
.show-env-bg-button {
background: red;
}
.hide-env-bg-button {
background: blue;
}
</style>
<script>
var curLightIsOpen = true;
var objSendData = { Data: null };
$(document).ready(function () {
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDLm53ZA');
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDMjAyMjEyMDEubndk');
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1vZGVsX3Rlc3QxMTIxLyVFMyU4MCU5MCVFNSU4RiVCMCVFNSU4QyU5NyVFNCVCOCVBRCVFOCU4RiVCMSVFNSVBNCVBNyVFNiVBOCU5MyVFMyU4MCU5MUFSQ18yMDIyMTIwNS5ud2Q');
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1vZGVsX3Rlc3QxMTIxLyVFMyU4MCU5MCVFNSU4RiVCMCVFNSU4QyU5NyVFNCVCOCVBRCVFOCU4RiVCMSVFNSVBNCVBNyVFNiVBOCU5MyVFMyU4MCU5MUFSQ18yMDIyMTIwNS5ud2Q');
//launchViewer('dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLmJ1NzRfMG9kUW1XWUlXWGI2bFBQemc_dmVyc2lvbj02');//wsp
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDXzEyMjEubndk');
//測試熱圖
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDXzEyMjFfMjIzMC5ud2Q');
//三菱 最新urn 資料庫
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDXzEyMjFfMjIzMC5ud2Q');
//測試單獨 7樓熱圖 DEMO
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwQVJDJUUzJTgwJTkxN0ZfREVNT18yMDIyXzEyXzI2Lm53Yw');
//測試 方案2 7樓熱圖
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1vZGVsX3Rlc3QxMTIxLyVFMyU4MCU5MEFSQyVFMyU4MCU5MTdGXzIwMjJfMTJfMjYubndj');
//測試 方案3 熱圖
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUU2JTk2JUI5JUU2JUExJTg4M18yMDIyXzEyXzI2Lm53ZA');
//測試 方案4
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUU2JTk2JUI5JUU2JUExJTg4NF8yMDIyXzEyXzI2Lm53ZA');
//12.28 三菱單層樓 + 系統
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvQVJDJUU1JTk2JUFFJUU1JUIxJUE0K01FUCVFNSU4NSVBOCVFNiVBMyU5Rl83Rl9ERU1PLm53ZA');
//目前線上整棟模型
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUU2JTk2JUI5JUU2JUExJTg4NF8yMDIyXzEyXzI2Lm53ZA');
//單層 + 系統
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1pdHN1YmlzaGkvTUVQK0FSQzdGX0RFTU9fJUU1JTg5JThBJUU5JUEwJTgyXzEyMjgubndk');
//單層
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwQVJDJUUzJTgwJTkxMUZfREVNT18yMDIyXzEyXzI5Lm53Yw');
//MEP
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwTUVQJUUzJTgwJTkxXzIwMjJfMTJfMjkubndj');
//12.29 整棟
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1pdHN1YmlzaGkvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU5JUExJUFGXzEyMjgubndk');
//12.30 整棟樓 ARC + MEP
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8xMl8zMC5ud2Q');
//12.30 整棟樓 ARC + MEP 半透明
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8lRTUlOEQlOEElRTklODAlOEYlRTYlOTglOEUlRTUlQkIlQkElRTclQUYlODlfMTJfMzAubndk');
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8lRTUlOEQlOEElRTklODAlOEYlRTYlOTglOEUlRTUlQkIlQkElRTclQUYlODlfMTJfMzAubndk');
//12.31 整棟樓
launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU2JUE4JUExJUU1JUJDJThGK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8yMDIyXzEyXzMxLm53ZA');
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwQVJDJUUzJTgwJTkxXzIwMjJfMTJfMTMubndk');//new ARC
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwTUVQJUUzJTgwJTkxXzIwMjJfMTJfMTMubndj');//new MEP
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwQVJDJUUzJTgwJTkxJUU1JTg1JUE4JUU2JUEzJTlGXzIwMjJfMTJfMTMubndj');//全棟 ARC
});
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);
}
function move4Floor() {
setElevatorSpeed(0.2);
setElevatorFloor(3);
requestAnimationFrame(movElevator);
}
function move5Floor() {
setElevatorSpeed(0.2);
setElevatorFloor(4);
requestAnimationFrame(movElevator);
}
function move6Floor() {
setElevatorSpeed(0.2);
setElevatorFloor(5);
requestAnimationFrame(movElevator);
}
function move7Floor() {
setElevatorSpeed(0.2);
setElevatorFloor(6);
requestAnimationFrame(movElevator);
}
function move8Floor() {
setElevatorSpeed(0.2);
setElevatorFloor(7);
requestAnimationFrame(movElevator);
}
function move9Floor() {
setElevatorSpeed(0.2);
setElevatorFloor(8);
requestAnimationFrame(movElevator);
}
function move10Floor() {
setElevatorSpeed(0.2);
setElevatorFloor(9);
requestAnimationFrame(movElevator);
}
function move11Floor() {
setElevatorSpeed(0.2);
setElevatorFloor(10);
requestAnimationFrame(movElevator);
}
function move12Floor() {
setElevatorSpeed(0.2);
setElevatorFloor(11);
requestAnimationFrame(movElevator);
}
function moveB1Floor() {
setElevatorSpeed(0.2);
setElevatorFloor(-1);
requestAnimationFrame(movElevator);
}
function changeLightPower() {
var value = document.getElementById('lightBar').value;
console.log("power: " + value);
setLightPower(value);
}
function openOrCloseLight() {
if (curLightIsOpen) {
curLightIsOpen = false;
setLightOpenOrClose(curLightIsOpen);
}
else {
curLightIsOpen = true;
setLightOpenOrClose(curLightIsOpen);
}
}
function changeColorHotspot() {
changeColorForHotspot(10);
}
function loadHeatMap() {
loadHeatmap();
}
function hideModel() {
hideObject();
}
function openModel() {
openObject();
}
function transparentModel() {
setObjectTransparent();
}
function cancelTransparentModel() {
cancelObjectTransparent();
}
function getLevels() {
//取得levels
getLevelsData();
}
function proFile() {
profile();
}
function importDevCor() {
ImportDevForCor();
}
function ImportDevForCor() {//callback = null
var url = "/DeviceImport/ImportDevForCor";
//let sendData = {
// "device_number": pageAct.AreaTag,
// "device_coordinate_3d": "",
// "device_dbid": "",
//};
objSendData.Data = tagIdDevList;
//ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
// if (!res || res.code != "0000" || !res.data) {
// console.log(rel.msg);
// } else {
// console.log(rel.msg);
// }
//}, null, "POST").send();
//$.post(url, objSendData.Data, function (rel) {
// if (rel.code != "0000") {
// if (rel.code == "9999") {
// //toast_error(rel.msg);
// console.log(rel.msg);
// }
// else {
// //toast_warning(rel.msg);
// console.log(rel.msg);
// }
// return;
// }
// else {
// //toast_ok(rel.msg);
// console.log(rel.msg);
// //ReloadRawDataCheckTable();
// }
//}, 'json');
//headers={'content-type': 'application/json'}
//$.ajax({
// type: "POST",
// url: url,
// data: objSendData.Data,
// cache: false,
// contentType: 'application/json',
// processData: false,
// success: function (rel) {
// //$("#save-building-btn").html('確定').attr("disabled", false);
// if (rel.code != "0000") {
// if (rel.code == "9999") {
// //toast_error(rel.msg);
// console.log(rel.msg);
// }
// else {
// //toast_warning(rel.msg);
// console.log(rel.msg);
// }
// return;
// }
// else {
// //toast_ok(rel.msg);
// console.log(rel.msg);
// //buildInfoTable.ajax.reload(null, false);
// //$('#build-modal').modal('hide');
// return;
// }
// },
// fail: function (xhr, status, error) {
// //$("#save-building-btn").html('確定').attr("disabled", false);
// //toast_error(rel.msg);
// }
//});
$.ajax({
method: "POST",
url: url,
data: JSON.stringify(tagIdDevList),
cache: false,
async: false,
contentType: "application/json; charset=UTF-8",
dataType: 'json',
success: function (rel) {
//$("#save-building-btn").html('確定').attr("disabled", false);
if (rel.code != "0000") {
if (rel.code == "9999") {
//toast_error(rel.msg);
console.log(rel.msg);
}
else {
//toast_warning(rel.msg);
console.log(rel.msg);
}
return;
}
else {
//toast_ok(rel.msg);
console.log(rel.msg);
//buildInfoTable.ajax.reload(null, false);
//$('#build-modal').modal('hide');
return;
}
},
fail: function (xhr, status, error) {
//$("#save-building-btn").html('確定').attr("disabled", false);
//toast_error(rel.msg);
}
});
}
</script>
</body>
</html>

View File

@ -0,0 +1,88 @@
<!DOCTYPE html>
<html>
<head>
<title>Autodesk Forge Tutorial</title>
<meta charset="utf-8" />
<link rel="shortcut icon" href="https://github.com/Autodesk-Forge/learn.forge.viewmodels/raw/master/img/favicon.ico">
<!-- Common packages: jQuery, Bootstrap, jsTree -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jstree/3.3.7/jstree.min.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jstree/3.3.7/themes/default/style.min.css" />
<!-- Autodesk Forge Viewer files -->
<link rel="stylesheet" href="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/style.min.css" type="text/css">
<script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.min.js"></script>
<!-- this project files -->
<link href="css/forge/main.css" rel="stylesheet" />
<script src="js/forge/ForgeTree.js"></script>
<script src="js/forge/ForgeViewer.js"></script>
</head>
<body>
<!-- Fixed navbar by Bootstrap: https://getbootstrap.com/examples/navbar-fixed-top/ -->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<ul class="nav navbar-nav left">
<li>
<a href="http://developer.autodesk.com" target="_blank">
<img alt="Autodesk Forge" src="//developer.static.autodesk.com/images/logo_forge-2-line.png" height="20">
</a>
</li>
</ul>
</div>
</nav>
<!-- End of navbar -->
<div class="container-fluid fill">
<div class="row fill">
<div class="col-sm-4 fill">
<div class="panel panel-default fill">
<div class="panel-heading" data-toggle="tooltip">
Buckets &amp; Objects
<span id="refreshBuckets" class="glyphicon glyphicon-refresh" style="cursor: pointer"></span>
<button class="btn btn-xs btn-info" style="float: right" id="showFormCreateBucket" data-toggle="modal" data-target="#createBucketModal">
<span class="glyphicon glyphicon-folder-close"></span> New bucket
</button>
</div>
<div id="appBuckets">
tree here
</div>
</div>
</div>
<div class="col-sm-8 fill">
<div id="forgeViewer"></div>
</div>
</div>
</div>
<form id="uploadFile" method='post' enctype="multipart/form-data">
<input id="hiddenUploadField" type="file" name="theFile" style="visibility:hidden" />
</form>
<!-- Modal Create Bucket -->
<div class="modal fade" id="createBucketModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Cancel">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel">Create new bucket</h4>
</div>
<div class="modal-body">
<input type="text" id="newBucketKey" class="form-control"> For demonstration purposes, objects (files)
are NOT automatically translated. After you upload, right click on
the object and select "Translate". Note: Technically your bucket name is required to be globally unique across
the entire platform - to keep things simple with this tutorial your client ID will be prepended by default to
your bucket name and in turn masked by the UI so you only have to make sure your bucket name is unique within
your current Forge app.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="createNewBucket">Go ahead, create the bucket</button>
</div>
</div>
</div>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,166 @@

$(document).ready(function () {
prepareAppBucketTree();
$('#refreshBuckets').click(function () {
$('#appBuckets').jstree(true).refresh();
});
$('#createNewBucket').click(function () {
createNewBucket();
});
$('#createBucketModal').on('shown.bs.modal', function () {
$("#newBucketKey").focus();
})
$('#hiddenUploadField').change(function () {
var node = $('#appBuckets').jstree(true).get_selected(true)[0];
var _this = this;
if (_this.files.length == 0) return;
var file = _this.files[0];
switch (node.type) {
case 'bucket':
var formData = new FormData();
formData.append('fileToUpload', file);
formData.append('bucketKey', node.id);
$.ajax({
url: '/api/forge/oss/objects',
data: formData,
processData: false,
contentType: false,
type: 'POST',
success: function (data) {
$('#appBuckets').jstree(true).refresh_node(node);
_this.value = '';
}
});
break;
}
});
});
function createNewBucket() {
var bucketKey = $('#newBucketKey').val();
var policyKey = $('#newBucketPolicyKey').val();
jQuery.post({
url: '/api/forge/oss/buckets',
contentType: 'application/json',
data: JSON.stringify({ 'bucketKey': bucketKey, 'policyKey': policyKey }),
success: function (res) {
$('#appBuckets').jstree(true).refresh();
$('#createBucketModal').modal('toggle');
},
error: function (err) {
if (err.status == 409)
alert('Bucket already exists - 409: Duplicated')
console.log(err);
}
});
}
function prepareAppBucketTree() {
$('#appBuckets').jstree({
'core': {
'themes': { "icons": true },
'data': {
"url": '/api/forge/oss/buckets',
"dataType": "json",
'multiple': false,
"data": function (node) {
return { "id": node.id };
}
}
},
'types': {
'default': {
'icon': 'glyphicon glyphicon-question-sign'
},
'#': {
'icon': 'glyphicon glyphicon-cloud'
},
'bucket': {
'icon': 'glyphicon glyphicon-folder-open'
},
'object': {
'icon': 'glyphicon glyphicon-file'
}
},
"plugins": ["types", "state", "sort", "contextmenu"],
contextmenu: { items: autodeskCustomMenu }
}).on('loaded.jstree', function () {
$('#appBuckets').jstree('open_all');
}).bind("activate_node.jstree", function (evt, data) {
if (data != null && data.node != null && data.node.type == 'object') {
$("#forgeViewer").empty();
var urn = data.node.id;
getForgeToken(function (access_token) {
jQuery.ajax({
url: 'https://developer.api.autodesk.com/modelderivative/v2/designdata/' + urn + '/manifest',
headers: { 'Authorization': 'Bearer ' + access_token },
success: function (res) {
if (res.progress === 'success' || res.progress === 'complete') launchViewer(urn);
else $("#forgeViewer").html('The translation job still running: ' + res.progress + '. Please try again in a moment.');
},
error: function (err) {
var msgButton = 'This file is not translated yet! ' +
'<button class="btn btn-xs btn-info" onclick="translateObject()"><span class="glyphicon glyphicon-eye-open"></span> ' +
'Start translation</button>'
$("#forgeViewer").html(msgButton);
}
});
})
}
});
}
function autodeskCustomMenu(autodeskNode) {
var items;
switch (autodeskNode.type) {
case "bucket":
items = {
uploadFile: {
label: "Upload file",
action: function () {
uploadFile();
},
icon: 'glyphicon glyphicon-cloud-upload'
}
};
break;
case "object":
items = {
translateFile: {
label: "Translate",
action: function () {
var treeNode = $('#appBuckets').jstree(true).get_selected(true)[0];
translateObject(treeNode);
},
icon: 'glyphicon glyphicon-eye-open'
}
};
break;
}
return items;
}
function uploadFile() {
$('#hiddenUploadField').click();
}
function translateObject(node) {
$("#forgeViewer").empty();
if (node == null) node = $('#appBuckets').jstree(true).get_selected(true)[0];
var bucketKey = node.parents[0];
var objectKey = node.id;
jQuery.post({
url: '/api/forge/modelderivative/jobs',
contentType: 'application/json',
data: JSON.stringify({ 'bucketKey': bucketKey, 'objectName': objectKey }),
success: function (res) {
$("#forgeViewer").html('Translation started! Please try again in a moment.');
},
});
}

View File

@ -0,0 +1,35 @@

var viewer;
function launchViewer(urn) {
var options = {
env: 'AutodeskProduction',
getAccessToken: getForgeToken
};
Autodesk.Viewing.Initializer(options, () => {
viewer = new Autodesk.Viewing.GuiViewer3D(document.getElementById('forgeViewer'));
viewer.start();
var documentId = 'urn:' + urn;
Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
});
}
function onDocumentLoadSuccess(doc) {
var viewables = doc.getRoot().getDefaultGeometry();
viewer.loadDocumentNode(doc, viewables).then(i => {
// documented loaded, any action?
});
}
function onDocumentLoadFailure(viewerErrorCode) {
console.error('onDocumentLoadFailure() - errorCode:' + viewerErrorCode);
}
function getForgeToken(callback) {
fetch('/api/forge/oauth/token').then(res => {
res.json().then(data => {
callback(data.access_token, data.expires_in);
});
});
}