Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
		
						commit
						84bddaaa94
					
				@ -761,13 +761,42 @@ namespace Backend.Controllers
 | 
			
		||||
                {
 | 
			
		||||
                    if (post.Count > 0)
 | 
			
		||||
                    {
 | 
			
		||||
                        //清空device_node資料表
 | 
			
		||||
                        //await backendRepository.TruncateTable("device_node");
 | 
			
		||||
 | 
			
		||||
                        //int node_priority = 1;
 | 
			
		||||
                        foreach(var idfc in post)
 | 
			
		||||
                        {
 | 
			
		||||
                            Dictionary<string, object> device = new Dictionary<string, object>();
 | 
			
		||||
                            device.Add("@device_coordinate_3d", idfc.device_coordinate_3d);
 | 
			
		||||
                            device.Add("@forge_dbid", idfc.forge_dbid);
 | 
			
		||||
                            //if(idfc.device_number.IndexOf("_LT_L1") > -1)
 | 
			
		||||
                            //{
 | 
			
		||||
                            //    //取得device_guid
 | 
			
		||||
                            //    var sWhere = $@"where deleted = 0 and device_number = " + idfc.device_number;
 | 
			
		||||
                            //    var device_guid = await backendRepository.GetOneAsync<string>("device_node", sWhere, "device_guid");
 | 
			
		||||
 | 
			
		||||
                            await backendRepository.UpdateOneByCustomTable(device, "device", $@" device_number = '{idfc.device_number}'");
 | 
			
		||||
                            //    //燈具
 | 
			
		||||
                            //    Dictionary<string, object> device = new Dictionary<string, object>();
 | 
			
		||||
                            //    device.Add("@device_node_guid", Guid.NewGuid());
 | 
			
		||||
                            //    device.Add("@deleted", 0);
 | 
			
		||||
                            //    device.Add("@device_guid", device_guid);
 | 
			
		||||
                            //    device.Add("@device_node_coordinate_3d", idfc.device_coordinate_3d);
 | 
			
		||||
                            //    device.Add("@forge_dbid", idfc.forge_dbid);
 | 
			
		||||
                            //    device.Add("@priority", node_priority);
 | 
			
		||||
                            //    device.Add("@created_by", myUserInfo.Userinfo_guid);
 | 
			
		||||
                            //    device.Add("@created_at", DateTime.Now);
 | 
			
		||||
 | 
			
		||||
                            //    node_priority++;
 | 
			
		||||
                            //    await backendRepository.AddOneByCustomTableReturnId(device, "device_node", false);
 | 
			
		||||
                            //}
 | 
			
		||||
                            //else
 | 
			
		||||
                            //{
 | 
			
		||||
                                Dictionary<string, object> device = new Dictionary<string, object>();
 | 
			
		||||
                                device.Add("@device_coordinate_3d", idfc.device_coordinate_3d);
 | 
			
		||||
                                device.Add("@forge_dbid", idfc.forge_dbid);
 | 
			
		||||
                                await backendRepository.UpdateOneByCustomTable(device, "device", $@" device_number = '{idfc.device_number}'");
 | 
			
		||||
                            //}
 | 
			
		||||
                            
 | 
			
		||||
 | 
			
		||||
                            
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    apiResult.Code = "0000";
 | 
			
		||||
 | 
			
		||||
@ -1,93 +0,0 @@
 | 
			
		||||
<!--<!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 & 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">×</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>-->
 | 
			
		||||
@ -7,16 +7,20 @@
 | 
			
		||||
 | 
			
		||||
            <div class="row">
 | 
			
		||||
                <div class="col-2">
 | 
			
		||||
                    <div class="row d-inline-block col-12 alert alert-secondary p-1 px-2 mb-0">
 | 
			
		||||
                        <span><i class="fas fa-exclamation-circle mr-2"></i>按右鍵即可展開選單</span>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row d-inline-block col-12 p-0 my-2 text-center">
 | 
			
		||||
                        <input id="graCatSearch" name="graCatSearch" type="text" class="form-control form-control-sm  d-inline-block" placeholder="搜尋" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="d-flex" id="graTree"></div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="col-10">
 | 
			
		||||
                    <div class="my-2">
 | 
			
		||||
                    <div class="row my-2">
 | 
			
		||||
                        <a href="javascript:;" id="creGraMan" class="btn btn-success">
 | 
			
		||||
                            +新增
 | 
			
		||||
                        </a>
 | 
			
		||||
                        <label id="curLevText" class="ml-3 mb-0 row m-0 align-items-center fs-1"></label>
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
                    <table id="graTable" class="table table-bordered table-striped text-center m-0">
 | 
			
		||||
@ -42,7 +46,7 @@
 | 
			
		||||
            <form id="uploadForm">
 | 
			
		||||
                <div class="modal-body">
 | 
			
		||||
                    <div class="row">
 | 
			
		||||
                        <div class="col-md-6">
 | 
			
		||||
                        <!--<div class="col-md-6">
 | 
			
		||||
                            <div class="form-group">
 | 
			
		||||
                                <label class="form-label" for="upPicNum">圖號</label>
 | 
			
		||||
                                <input type="text" id="graPicNum" name="graPicNum" class="form-control">
 | 
			
		||||
@ -53,14 +57,14 @@
 | 
			
		||||
                                <label class="form-label" for="upPicName">圖名</label>
 | 
			
		||||
                                <input type="text" id="graPicName" name="graPicName" class="form-control">
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="col-md-6 mt-3">
 | 
			
		||||
                        </div>-->
 | 
			
		||||
                        <div class="col-md-6">
 | 
			
		||||
                            <div class="form-group">
 | 
			
		||||
                                <label class="form-label" for="graSelMain">圖資類別</label>
 | 
			
		||||
                                <label id="graLayer" class="m-0 fs-1 col-12 p-0"></label>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="col-md-12 mt-6">
 | 
			
		||||
                        <div class="col-md-12 mt-2">
 | 
			
		||||
                            <label>原設計</label>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="col-md-12">
 | 
			
		||||
@ -82,7 +86,7 @@
 | 
			
		||||
                            </div>
 | 
			
		||||
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="col-md-12 mt-3">
 | 
			
		||||
                        <!--<div class="col-md-12 mt-3">
 | 
			
		||||
                            <label>竣工圖</label>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="col-md-12">
 | 
			
		||||
@ -100,7 +104,7 @@
 | 
			
		||||
                                    <input name="file" type="file" multiple />
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        </div>-->
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="modal-footer">
 | 
			
		||||
@ -129,8 +133,8 @@
 | 
			
		||||
                <button type="button" class="btn btn-primary" id="delGraManBtn">確定</button>
 | 
			
		||||
                <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
 | 
			
		||||
            </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
@ -159,39 +163,25 @@
 | 
			
		||||
        let tag = "#graTable";
 | 
			
		||||
 | 
			
		||||
        let column_defs = [
 | 
			
		||||
            { "targets": [0], "width": "10%", "sortable": true },
 | 
			
		||||
            { "targets": [1], "width": "25%", "sortable": true },
 | 
			
		||||
            { "targets": [2], "width": "25%", "sortable": true },
 | 
			
		||||
            { "targets": [3], "width": "25%", "sortable": true },
 | 
			
		||||
            { "targets": [4], "width": "15%", "sortable": false },
 | 
			
		||||
            { "targets": [0], "width": "20%", "sortable": true },
 | 
			
		||||
            { "targets": [1], "width": "60%", "sortable": true },
 | 
			
		||||
            { "targets": [2], "width": "20%", "sortable": true },
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        let columns = [
 | 
			
		||||
            {
 | 
			
		||||
                "title": "圖號",
 | 
			
		||||
                "data": "code",
 | 
			
		||||
                "title": "編號",
 | 
			
		||||
                "data": "id",
 | 
			
		||||
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "title": "圖名",
 | 
			
		||||
                "data": "name",
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "title": "原設計",
 | 
			
		||||
                "title": "檔案",
 | 
			
		||||
                "data": "oriOrgName",
 | 
			
		||||
                "render": function (data, type, row, meta) {
 | 
			
		||||
                    return `<a id="oriDwgDown${row.id}" href="javascript:;">${row.oriOrgName ?? ""}</a>`;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "title": "竣工圖",
 | 
			
		||||
                "data": "donOrgName",
 | 
			
		||||
                "render": function (data, type, row, meta) {
 | 
			
		||||
                    return `<a id="donDwgDown${row.id}" href="javascript:;">${row.donOrgName ?? ""}</a>`;
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
 | 
			
		||||
            {
 | 
			
		||||
                "title": "功能",
 | 
			
		||||
                "data": "id",
 | 
			
		||||
@ -241,30 +231,30 @@
 | 
			
		||||
                        $(file.previewElement).removeClass("dz-image-preview").addClass("dz-file-preview");
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
               
 | 
			
		||||
 | 
			
		||||
            },
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        uploader.graMyDesignDiagram = $("#graMyDesignDiagram").dropzone(option);
 | 
			
		||||
        uploader.graMyAsBuilt = $("#graMyAsBuilt").dropzone(option);
 | 
			
		||||
        /*uploader.graMyAsBuilt = $("#graMyAsBuilt").dropzone(option);*/
 | 
			
		||||
 | 
			
		||||
        uploader["graMyDesignDiagram"][0].dropzone.on("addedfile", file => {
 | 
			
		||||
            uploadFiles["graMyDesignDiagram"] = file;
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
        uploader["graMyAsBuilt"][0].dropzone.on("addedfile", file => {
 | 
			
		||||
            uploadFiles["graMyAsBuilt"] = file;
 | 
			
		||||
        })
 | 
			
		||||
        //uploader["graMyAsBuilt"][0].dropzone.on("addedfile", file => {
 | 
			
		||||
        //    uploadFiles["graMyAsBuilt"] = file;
 | 
			
		||||
        //})
 | 
			
		||||
 | 
			
		||||
        uploader["graMyDesignDiagram"][0].dropzone.on("removedfile", file => {
 | 
			
		||||
            uploadFiles["graMyDesignDiagram"] = {};
 | 
			
		||||
            file.previewElement.remove();
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
        uploader["graMyAsBuilt"][0].dropzone.on("removedfile", file => {
 | 
			
		||||
            uploadFiles["graMyAsBuilt"] = {};
 | 
			
		||||
            file.previewElement.remove();
 | 
			
		||||
        })
 | 
			
		||||
        //uploader["graMyAsBuilt"][0].dropzone.on("removedfile", file => {
 | 
			
		||||
        //    uploadFiles["graMyAsBuilt"] = {};
 | 
			
		||||
        //    file.previewElement.remove();
 | 
			
		||||
        //})
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // 新增資料
 | 
			
		||||
@ -277,13 +267,13 @@
 | 
			
		||||
        curActGraid = parseInt(id);
 | 
			
		||||
        readGraph(id);
 | 
			
		||||
    })
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    onEvent("click", "button[id^=graDelBtn]", function () {
 | 
			
		||||
        let id = $(this).prop("id").split("graDelBtn")[1];
 | 
			
		||||
        curActGraid = parseInt(id);
 | 
			
		||||
        $("#delModal").modal("show");
 | 
			
		||||
    })
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    onEvent("click", "a[id^=oriDwgDown]", function () {
 | 
			
		||||
        let dowLoaEle = YT.Alert.Tip("準備下載中...", "show", true);
 | 
			
		||||
        let rowData = graTable.row($(this).closest("tr")).data();
 | 
			
		||||
@ -293,7 +283,7 @@
 | 
			
		||||
            $(dowLoaEle.ele).YTAlert().hide();
 | 
			
		||||
        });
 | 
			
		||||
    })
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    onEvent("click", "a[id^=donDwgDown]", function () {
 | 
			
		||||
        let dowLoaEle = YT.Alert.Tip("準備下載中...", "show", true);
 | 
			
		||||
        let rowData = graTable.row($(this).closest("tr")).data();
 | 
			
		||||
@ -319,8 +309,6 @@
 | 
			
		||||
        fileHelper.readAndPreviewImages(this.files, 'upForAsBuilt', 0, 86, '<div class="file-item">', '<button class="del-small-trash" name="btnDelImg" ><i class="fa fa-times"></i></button></div>');
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // 關閉 modal
 | 
			
		||||
    $('#uploadPicture').on('hidden.bs.modal', function (e) {
 | 
			
		||||
        console.log("123456789");
 | 
			
		||||
@ -349,11 +337,11 @@
 | 
			
		||||
        $("#graPicNum").val("");
 | 
			
		||||
        $("#graPicName").val("");
 | 
			
		||||
        uploadFiles["graMyDesignDiagram"] = {};
 | 
			
		||||
        uploadFiles["graMyAsBuilt"] = {};
 | 
			
		||||
        /*uploadFiles["graMyAsBuilt"] = {};*/
 | 
			
		||||
        uploader["graMyDesignDiagram"][0].dropzone.removeAllFiles(true);
 | 
			
		||||
        $("#graMyDesignDiagram .dz-preview").remove();
 | 
			
		||||
        uploader["graMyAsBuilt"][0].dropzone.removeAllFiles(true);
 | 
			
		||||
        $("#graMyAsBuilt .dz-preview").remove();
 | 
			
		||||
        //uploader["graMyAsBuilt"][0].dropzone.removeAllFiles(true);
 | 
			
		||||
        //$("#graMyAsBuilt .dz-preview").remove();
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    function getGraCatList(callback) {
 | 
			
		||||
@ -365,18 +353,19 @@
 | 
			
		||||
            } else {
 | 
			
		||||
                res.data.forEach(x => x.parent = x.system_parent_id);
 | 
			
		||||
                res.data.forEach(x => x.text = x.system_key);
 | 
			
		||||
                res.data.forEach(x => x.parent = x.parent == 0 ? "#" : x.parent);
 | 
			
		||||
                res.data.forEach(x => x.parent = x.parent);
 | 
			
		||||
                callback ? callback(res.data) : "";
 | 
			
		||||
            }
 | 
			
		||||
        }, null, "POST").send();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function initTree(data) {
 | 
			
		||||
 | 
			
		||||
        treeEvent();
 | 
			
		||||
        let option = {
 | 
			
		||||
            core: {
 | 
			
		||||
                "check_callback": true,
 | 
			
		||||
                data: data,
 | 
			
		||||
                data: setTreeData(data),
 | 
			
		||||
                themes: {
 | 
			
		||||
                    name: "default-dark"
 | 
			
		||||
                },
 | 
			
		||||
@ -440,6 +429,7 @@
 | 
			
		||||
        $('#graTree').on("loaded.jstree", function (e, data) {
 | 
			
		||||
            let topNode = $('#graTree').jstree(true).get_node("#");
 | 
			
		||||
            $('#graTree').jstree(true).select_node(topNode.children[0]);
 | 
			
		||||
            $("#graTree").jstree("open_node", 0);
 | 
			
		||||
        })
 | 
			
		||||
        $('#graTree').on("select_node.jstree", function (e, data) {
 | 
			
		||||
            dtAjaxResetSendData(graTable, { layer_id: parseInt(data.node.id) });
 | 
			
		||||
@ -447,6 +437,7 @@
 | 
			
		||||
 | 
			
		||||
            curLayerId = parseInt(data.node.id);
 | 
			
		||||
            $("#graLayer").text(levelNameByNodeId(data.node));
 | 
			
		||||
            $("#curLevText").text(levelNameByNodeId(data.node));
 | 
			
		||||
        })
 | 
			
		||||
        $("#graTree").on('create_node.jstree', function (e, data) {
 | 
			
		||||
            let main = {};
 | 
			
		||||
@ -479,7 +470,7 @@
 | 
			
		||||
                    toast_error(res.msg || common.SysErr);
 | 
			
		||||
                } else {
 | 
			
		||||
                    getGraCatList((graCatData) => {
 | 
			
		||||
                        data.instance.settings.core.data = graCatData;
 | 
			
		||||
                        data.instance.settings.core.data = setTreeData(graCatData);
 | 
			
		||||
                        data.instance.refresh(true);
 | 
			
		||||
                    })
 | 
			
		||||
                }
 | 
			
		||||
@ -509,6 +500,12 @@
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function setTreeData(dataList) {
 | 
			
		||||
        let parent = { parent: "#", text: "圖資管理", id: 0 };
 | 
			
		||||
        dataList.push(parent);
 | 
			
		||||
        return dataList;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function readGraph(id) {
 | 
			
		||||
        let url = baseApiUrl + "/GraphManage/GraManRead";
 | 
			
		||||
        objSendData.Data = { id: parseInt(id) };
 | 
			
		||||
@ -516,7 +513,7 @@
 | 
			
		||||
            if (!res || res.code != "0000" || !res.data) {
 | 
			
		||||
 | 
			
		||||
            } else {
 | 
			
		||||
                
 | 
			
		||||
 | 
			
		||||
                $("#graModal").modal("show");
 | 
			
		||||
 | 
			
		||||
                let fileObj = {};
 | 
			
		||||
@ -524,13 +521,13 @@
 | 
			
		||||
                $("#graPicName").val(res.data?.name);
 | 
			
		||||
                $("#graLayer").text(levelNameByNodeId(res.data?.layer_id));
 | 
			
		||||
                if (res.data?.oriSavName != null) {
 | 
			
		||||
                    fileObj = { name: res.data?.oriOrgName, dataUrl: baseApiUrl + varGraPath + res.data?.oriSavName, savename: res.data?.oriSavName, size:res.data?.oriSize };
 | 
			
		||||
                    fileObj = { name: res.data?.oriOrgName, dataUrl: baseApiUrl + varGraPath + res.data?.oriSavName, savename: res.data?.oriSavName, size: res.data?.oriSize };
 | 
			
		||||
                    uploader["graMyDesignDiagram"][0].dropzone?.displayExistingFile(fileObj);
 | 
			
		||||
                }
 | 
			
		||||
                if (res.data?.donSavName != null) {
 | 
			
		||||
                    fileObj = { name: res.data?.donOrgName, dataUrl: baseApiUrl + varGraPath + res.data?.donSavName, savename: res.data?.donSavName, size: res.data?.donSize };
 | 
			
		||||
                    uploader["graMyAsBuilt"][0].dropzone?.displayExistingFile(fileObj);
 | 
			
		||||
                }
 | 
			
		||||
                //if (res.data?.donSavName != null) {
 | 
			
		||||
                //    fileObj = { name: res.data?.donOrgName, dataUrl: baseApiUrl + varGraPath + res.data?.donSavName, savename: res.data?.donSavName, size: res.data?.donSize };
 | 
			
		||||
                //    uploader["graMyAsBuilt"][0].dropzone?.displayExistingFile(fileObj);
 | 
			
		||||
                //}
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        }, null, "POST").send();
 | 
			
		||||
@ -539,14 +536,15 @@
 | 
			
		||||
    function levelNameByNodeId(node) {
 | 
			
		||||
        let names = [];
 | 
			
		||||
        let curNode = $('#graTree').jstree(true).get_node(node);
 | 
			
		||||
 | 
			
		||||
        $.each(curNode.parents, (idx, nodeId) => {
 | 
			
		||||
            if (nodeId != "#") {
 | 
			
		||||
                let node = $('#graTree').jstree(true).get_node(nodeId);
 | 
			
		||||
        let parents = curNode.parents.reverse();
 | 
			
		||||
        
 | 
			
		||||
        for (let i = parents.length - 1; i >= 0; i--) {
 | 
			
		||||
            if (parents[i] != "#") { 
 | 
			
		||||
                let node = $('#graTree').jstree(true).get_node(parents[i]);
 | 
			
		||||
                names.push(node.text);
 | 
			
		||||
            }
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        names.push(curNode.text);
 | 
			
		||||
        return names.join("/");
 | 
			
		||||
 | 
			
		||||
@ -556,18 +554,18 @@
 | 
			
		||||
        let cookies = new YourTeam.Utility.Cookie();
 | 
			
		||||
        let url = "";
 | 
			
		||||
        let graMyDesDiaFile = uploader["graMyDesignDiagram"][0].dropzone.files.filter(x => x.accepted == true)[0];
 | 
			
		||||
        let graMyAsBuiFile = uploader["graMyAsBuilt"][0].dropzone.files.filter(x => x.accepted == true)[0];
 | 
			
		||||
        /*let graMyAsBuiFile = uploader["graMyAsBuilt"][0].dropzone.files.filter(x => x.accepted == true)[0];*/
 | 
			
		||||
        let fd = new FormData();
 | 
			
		||||
        fd.append("code", $("#graPicNum").val());
 | 
			
		||||
        fd.append("layer_id", curLayerId);
 | 
			
		||||
        fd.append("name", $("#graPicName").val());
 | 
			
		||||
        fd.append("oriOrgName", graMyDesDiaFile?.name ?? null);
 | 
			
		||||
        fd.append("donOrgName", graMyAsBuiFile?.name ?? null);
 | 
			
		||||
        /*fd.append("donOrgName", graMyAsBuiFile?.name ?? null);*/
 | 
			
		||||
        fd.append("oriSavName", graMyDesDiaFile?.savename ?? null);
 | 
			
		||||
        fd.append("donSavName", graMyAsBuiFile?.savename ?? null);
 | 
			
		||||
        /*fd.append("donSavName", graMyAsBuiFile?.savename ?? null);*/
 | 
			
		||||
        fd.append("oriFile", graMyDesDiaFile?.savename ? null : graMyDesDiaFile ?? null);
 | 
			
		||||
        fd.append("donFile", graMyAsBuiFile?.savename ? null : graMyAsBuiFile ?? null);
 | 
			
		||||
        
 | 
			
		||||
        /*fd.append("donFile", graMyAsBuiFile?.savename ? null : graMyAsBuiFile ?? null);*/
 | 
			
		||||
 | 
			
		||||
        if (curActGraid == 0) {
 | 
			
		||||
            url = baseApiUrl + "/GraphManage/SaveGraMan";
 | 
			
		||||
        } else {
 | 
			
		||||
@ -608,6 +606,6 @@
 | 
			
		||||
                    graTable.ajax.reload();
 | 
			
		||||
                }
 | 
			
		||||
            }, null, "POST").send();
 | 
			
		||||
        } 
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
</script>
 | 
			
		||||
@ -17,20 +17,27 @@
 | 
			
		||||
        <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="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 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>-->
 | 
			
		||||
        <label>Intensity:</label><input id="LightIntensity" />
 | 
			
		||||
        <label>Distance:</label><input id="LightDistance" />
 | 
			
		||||
        <label>Angle:</label><input id="LightAngle" />
 | 
			
		||||
        <label>Penumbra:</label><input id="LightPenumbra" />
 | 
			
		||||
        <label>Decay:</label><input id="LightDecay" />
 | 
			
		||||
        <button onclick="setLightValue()">設定燈光</button>
 | 
			
		||||
        <button id="Light1" onclick="newALight()">新增燈光</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>
 | 
			
		||||
@ -184,6 +191,7 @@
 | 
			
		||||
 | 
			
		||||
    <script>
 | 
			
		||||
        var curLightIsOpen = true;
 | 
			
		||||
        var light;
 | 
			
		||||
 | 
			
		||||
        $(document).ready(function () {
 | 
			
		||||
            //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDLm53ZA');
 | 
			
		||||
@ -230,11 +238,11 @@
 | 
			
		||||
            //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1pdHN1YmlzaGkvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU5JUExJUFGXzEyMjgubndk');
 | 
			
		||||
 | 
			
		||||
            //12.30 整棟樓 ARC + MEP
 | 
			
		||||
            //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8xMl8zMC5ud2Q');
 | 
			
		||||
            launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8xMl8zMC5ud2Q');
 | 
			
		||||
 | 
			
		||||
            //12.30 整棟樓 ARC + MEP 半透明
 | 
			
		||||
            //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8lRTUlOEQlOEElRTklODAlOEYlRTYlOTglOEUlRTUlQkIlQkElRTclQUYlODlfMTJfMzAubndk');
 | 
			
		||||
            launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8lRTUlOEQlOEElRTklODAlOEYlRTYlOTglOEUlRTUlQkIlQkElRTclQUYlODlfMTJfMzAubndk');
 | 
			
		||||
            //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8lRTUlOEQlOEElRTklODAlOEYlRTYlOTglOEUlRTUlQkIlQkElRTclQUYlODlfMTJfMzAubndk');
 | 
			
		||||
 | 
			
		||||
            //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwQVJDJUUzJTgwJTkxXzIwMjJfMTJfMTMubndk');//new ARC
 | 
			
		||||
            //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwTUVQJUUzJTgwJTkxXzIwMjJfMTJfMTMubndj');//new MEP
 | 
			
		||||
@ -244,82 +252,96 @@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        });
 | 
			
		||||
        function move1Floor() {
 | 
			
		||||
            setElevatorSpeed(0.2);
 | 
			
		||||
            setElevatorFloor(0);
 | 
			
		||||
            requestAnimationFrame(movElevator);
 | 
			
		||||
        //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 newALight() {
 | 
			
		||||
            //light = newLight();
 | 
			
		||||
            //newLight();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        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 setLightValue() {
 | 
			
		||||
            var intensity = document.getElementById("LightIntensity").value;
 | 
			
		||||
            var distance = document.getElementById("LightDistance").value;
 | 
			
		||||
            var angle = document.getElementById("LightAngle").value;
 | 
			
		||||
            var penumbra = document.getElementById("LightPenumbra").value;
 | 
			
		||||
            var decay = document.getElementById("LightDecay").value;
 | 
			
		||||
            setLightValues(intensity, distance, angle, penumbra, decay);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        function changeLightPower() {
 | 
			
		||||
@ -329,13 +351,15 @@
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        function openOrCloseLight() {
 | 
			
		||||
            if (curLightIsOpen) {
 | 
			
		||||
                curLightIsOpen = false;
 | 
			
		||||
                setLightOpenOrClose(curLightIsOpen);
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                curLightIsOpen = true;
 | 
			
		||||
                setLightOpenOrClose(curLightIsOpen);
 | 
			
		||||
            if (light != null) {
 | 
			
		||||
                if (curLightIsOpen) {
 | 
			
		||||
                    curLightIsOpen = false;
 | 
			
		||||
                    setLightOpenOrClose(curLightIsOpen, light);
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    curLightIsOpen = true;
 | 
			
		||||
                    setLightOpenOrClose(curLightIsOpen, light);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,8 @@ let fragProxy;
 | 
			
		||||
var targetFloorZ;
 | 
			
		||||
var elevatorSpeed;
 | 
			
		||||
var selector = "#forgeViewer";
 | 
			
		||||
let myDataList;
 | 
			
		||||
var myDataList;
 | 
			
		||||
var lightList = [];//燈光清單
 | 
			
		||||
var levels;//剖面用
 | 
			
		||||
var lowerIdx;//剖面的下方樓層
 | 
			
		||||
var upperIdx;//剖面的上方樓層
 | 
			
		||||
@ -675,15 +676,7 @@ 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) {
 | 
			
		||||
@ -714,10 +707,13 @@ async function addHotPoint(data) {
 | 
			
		||||
 | 
			
		||||
    myDataList.forEach((myData, index) => {
 | 
			
		||||
        const dbId = 10 + index;
 | 
			
		||||
        const myPosition = myData.position;
 | 
			
		||||
        const myPosition = JSON.parse(myData.device_coordinate_3d);
 | 
			
		||||
        const viewable = new DataVizCore.SpriteViewable(myPosition, style, dbId);
 | 
			
		||||
        myData._dbId = dbId;
 | 
			
		||||
        viewableData.addViewable(viewable);
 | 
			
		||||
        if (myData.device_number.indexOf("_LT_L1_") > -1) {
 | 
			
		||||
            lightList.push({ dbid: myData.forge_dbid, name: myData.device_number, spotLight: newLight(myPosition) });
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    await viewableData.finish();
 | 
			
		||||
@ -730,7 +726,6 @@ 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);
 | 
			
		||||
@ -757,7 +752,6 @@ 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 {
 | 
			
		||||
    //            // 處理沒有選取元件的邏輯
 | 
			
		||||
@ -802,49 +796,14 @@ async function changeScaleForHotspot(dbId, type = true) {
 | 
			
		||||
 | 
			
		||||
//------------------- 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) {
 | 
			
		||||
//------------------------------ 熱圖 ---------------------------------
 | 
			
		||||
async function loadHeatmaps(model, roomsArr) {
 | 
			
		||||
    const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
 | 
			
		||||
    var devices = [];
 | 
			
		||||
 | 
			
		||||
    //取三個空調設備的位置打點
 | 
			
		||||
    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)
 | 
			
		||||
    myDataList.forEach((myData, index) => {
 | 
			
		||||
        devices.push({ id: index, position: JSON.parse(myData.device_coordinate_3d), sensorTypes: ["temperature", "humidity"] });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // Initialize sensor values
 | 
			
		||||
    let sensorVals = [];
 | 
			
		||||
@ -853,7 +812,9 @@ async function loadHeatmaps(model) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const roomDbIds = [];
 | 
			
		||||
    roomDbIds.push(7567);
 | 
			
		||||
    for (var i = 0; i < roomsArr.length; i++) {
 | 
			
		||||
        roomDbIds.push(roomsArr[i]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const {
 | 
			
		||||
        SurfaceShadingData,
 | 
			
		||||
@ -878,11 +839,10 @@ async function loadHeatmaps(model) {
 | 
			
		||||
 | 
			
		||||
    // Setup surface shading
 | 
			
		||||
    await dataVizExtn.setupSurfaceShading(model, heatmapData);
 | 
			
		||||
 | 
			
		||||
    dataVizExtn.registerSurfaceShadingColors("temperature", [0xff0000, 0x0000ff]);
 | 
			
		||||
 | 
			
		||||
    function getSensorValue(device, sensorType) {
 | 
			
		||||
        return sensorVals[parseInt(device.id.slice(-1)) - 1];
 | 
			
		||||
        return sensorVals[parseInt(device.id)];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    dataVizExtn.renderSurfaceShading("Room Panel", "temperature", getSensorValue);
 | 
			
		||||
@ -895,95 +855,7 @@ async function loadHeatmaps(model) {
 | 
			
		||||
        dataVizExtn.updateSurfaceShading(getSensorValue);
 | 
			
		||||
    }, 2000);
 | 
			
		||||
}
 | 
			
		||||
//------------------ 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);
 | 
			
		||||
}
 | 
			
		||||
//------------------------------ end ----------------------------------
 | 
			
		||||
 | 
			
		||||
//------------ 剖面 ----------------------
 | 
			
		||||
async function getRemoteLevels() {
 | 
			
		||||
@ -1037,4 +909,49 @@ function profile() {
 | 
			
		||||
    const lowerCutPlaneParam = this.getCutPlaneParam(lowerIdx, -1);
 | 
			
		||||
    this.viewer.setCutPlanes([upperCutPlaneParam, lowerCutPlaneParam]);
 | 
			
		||||
}
 | 
			
		||||
//----------------- end -----------------------------------------------
 | 
			
		||||
//----------------- end -----------------------------------------------
 | 
			
		||||
//新增燈光
 | 
			
		||||
async function newLight(lightPosition) {
 | 
			
		||||
    //聚光燈
 | 
			
		||||
    spotLight = new THREE.SpotLight(0xff0000, 200, 20, 0.6, 0.5, 10);
 | 
			
		||||
    spotLight.position.set(lightPosition.x, lightPosition.y, lightPosition.z);
 | 
			
		||||
    spotLight.castShadow = false;
 | 
			
		||||
    spotLight.visible = true;
 | 
			
		||||
    spotLight.target.position.set(lightPosition.x, lightPosition.y, lightPosition.z-20);
 | 
			
		||||
    viewer.scene.add(spotLight.target);
 | 
			
		||||
    viewer.scene.add(spotLight);
 | 
			
		||||
    viewer.impl.sceneUpdated(true);
 | 
			
		||||
 | 
			
		||||
    return spotLight;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//調整燈光參數 setLightValues(13593, 10, 10, 0.1, 0.3, 1, 0xffff00);
 | 
			
		||||
async function setLightValues(dbid, intensity, distance, angle, penumbra, decay, color) {
 | 
			
		||||
    for (var i = 0; i < lightList.length; i++) {
 | 
			
		||||
        if (lightList[i].dbid == dbid) {
 | 
			
		||||
            lightList[i].spotLight.intensity = intensity;
 | 
			
		||||
            lightList[i].spotLight.distance = distance;
 | 
			
		||||
            lightList[i].spotLight.angle = angle;
 | 
			
		||||
            lightList[i].spotLight.penumbra = penumbra;
 | 
			
		||||
            lightList[i].spotLight.decay = decay;
 | 
			
		||||
            
 | 
			
		||||
            var tempcolor = new THREE.Color().setHex(color);
 | 
			
		||||
            lightList[i].spotLight.color = tempcolor;
 | 
			
		||||
            viewer.impl.sceneUpdated(true);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//======================== 外部呼叫function ===========================
 | 
			
		||||
//紀錄熱點座標
 | 
			
		||||
function getHopspotPoint(data) {
 | 
			
		||||
    myDataList = data;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//呼叫載入熱圖
 | 
			
		||||
async function toLoadHeatmap(roomArr) {
 | 
			
		||||
    const model = viewer.model;
 | 
			
		||||
    loadHeatmaps(model, roomArr);
 | 
			
		||||
}
 | 
			
		||||
//============================= end ===================================
 | 
			
		||||
@ -5,7 +5,7 @@ var elevatorSpeed;
 | 
			
		||||
var allDbIdsStr;
 | 
			
		||||
let bulbLight;//點燈
 | 
			
		||||
let spotLight;//聚光燈
 | 
			
		||||
var myDataList;
 | 
			
		||||
var myDataList;//設備清單
 | 
			
		||||
var viewableData;
 | 
			
		||||
var dataVizExtn;
 | 
			
		||||
var spriteColorRed;
 | 
			
		||||
@ -71,6 +71,7 @@ function onDocumentLoadSuccess(doc) {
 | 
			
		||||
         var currSelection = viewer.getSelection();
 | 
			
		||||
         var domElem = document.getElementById('id_printer');
 | 
			
		||||
         domElem.innerText = currSelection[0];
 | 
			
		||||
         var a = newLight();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
         //var color = new THREE.Vector4(255 / 255, 0, 0, 1);
 | 
			
		||||
@ -172,7 +173,7 @@ function onDocumentLoadSuccess(doc) {
 | 
			
		||||
    const fragList = model.getFragmentList();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
     loadHeatmaps(model);
 | 
			
		||||
     //loadHeatmaps(model);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -270,7 +271,7 @@ function onDocumentLoadSuccess(doc) {
 | 
			
		||||
            e.properties.forEach(function (item) {
 | 
			
		||||
                if (item.displayName == "【tag_id】") { // Tag_name tag_id 【tag_id】
 | 
			
		||||
                    if (item.displayValue != "") {
 | 
			
		||||
                        if ((item.displayValue).indexOf('TPE_B1_ME_M10') > -1) {
 | 
			
		||||
                        if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) {// TPE_B1_ME_M10
 | 
			
		||||
                            console.log("--------------------------------------------------");
 | 
			
		||||
                            console.log("Tag_name dbid: " + e.dbId);
 | 
			
		||||
                            console.log("value: " + item.displayValue);
 | 
			
		||||
@ -295,7 +296,7 @@ function onDocumentLoadSuccess(doc) {
 | 
			
		||||
                            bounds.union(box);
 | 
			
		||||
                        }, true);
 | 
			
		||||
                        var position = bounds.center();
 | 
			
		||||
                        if ((item.displayValue).indexOf('TPE_B1_ME_M10') > -1) {
 | 
			
		||||
                        if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) {
 | 
			
		||||
                        console.log("position: (" + (position.x).toFixed(2) + ", " + (position.y).toFixed(2) + ", " + (position.z).toFixed(2) + ")");
 | 
			
		||||
                        console.log("--------------------------------------------------");
 | 
			
		||||
                        }
 | 
			
		||||
@ -463,6 +464,9 @@ function onDocumentLoadSuccess(doc) {
 | 
			
		||||
    //spotLight.target = cube;
 | 
			
		||||
    //viewer.scene.add(spotLight);
 | 
			
		||||
 | 
			
		||||
    //var light = newLight();
 | 
			
		||||
    /*newLight();*/
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//------------------- 加入熱點 -----------------
 | 
			
		||||
@ -477,28 +481,24 @@ async function addHotPoint(data) {
 | 
			
		||||
 | 
			
		||||
    const style = new DataVizCore.ViewableStyle(viewableType, spriteColor, spriteIcon);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //function onSpriteClicked(event) {
 | 
			
		||||
    //    console.log(`Sprite clicked: ${event.dbId}`);
 | 
			
		||||
    //}
 | 
			
		||||
 | 
			
		||||
    //熱點 點擊事件註冊
 | 
			
		||||
    viewer.addEventListener(DataVizCore.MOUSE_CLICK, onSpriteClicked);//MOUSE_CLICK SPRITE_SELECTED
 | 
			
		||||
    //viewer.addEventListener(DataVizCore.MOUSE_CLICK_OUT, onSpriteClickedOut);
 | 
			
		||||
    //viewer.addEventListener(DataVizCore.MOUSE_DOWN, onSpriteClicked);
 | 
			
		||||
    //viewer.addEventListener(DataVizCore.MOUSE_HOVERING, onSpriteHovering);
 | 
			
		||||
 | 
			
		||||
    viewer.addEventListener(
 | 
			
		||||
        Autodesk.Viewing.SELECTION_CHANGED_EVENT,
 | 
			
		||||
        onSelectionChange
 | 
			
		||||
    );
 | 
			
		||||
    //viewer.addEventListener(
 | 
			
		||||
    //    Autodesk.Viewing.SELECTION_CHANGED_EVENT,
 | 
			
		||||
    //    onSelectionChange
 | 
			
		||||
    //);
 | 
			
		||||
 | 
			
		||||
    viewableData = new DataVizCore.ViewableData();
 | 
			
		||||
    viewableData.spriteSize = 24; // Sprites as points of size 24 x 24 pixels
 | 
			
		||||
 | 
			
		||||
    //熱圖 打點  x: 0, y: 25.03, z: -2.52  三菱
 | 
			
		||||
    myDataList = [{ position: { x: -21.95, y: 8.92, z: 63.27 } }, //-21.95, 8.92, 63.27
 | 
			
		||||
                        { position: { x: -21.95, y: 7.61, z: 63.27 } },//-21.95, 7.61, 63.27
 | 
			
		||||
    //熱圖 打點  x: 0, y: 25.03, z: -2.52  三菱 43.72, -15.65, -44.96 // 43.72, -15.65, -44.96
 | 
			
		||||
    myDataList = [{ position: { x: 43.72, y: -15.65, z: -44.96 } }, //-21.95, 8.92, 63.27 // -7.58, 18.20, -0.25
 | 
			
		||||
                        { position: { x: 43.72, y: -15.65, z: -60 } },//-21.95, 7.61, 63.27
 | 
			
		||||
                        { position: { x: -21.95, y: 6.43, z: 63.27 } },//-21.95, 6.43, 63.27
 | 
			
		||||
                        { position: { x: -21.95, y: 5.31, z: 63.27 } }//-21.95, 5.31, 63.27
 | 
			
		||||
                       ];// x: -17.33, y: 51.03, z: -2.52 ; x: -23.21, y: 51.03, z: -2.52
 | 
			
		||||
@ -555,7 +555,7 @@ async function addHotPoint(data) {
 | 
			
		||||
        //    };
 | 
			
		||||
        //});
 | 
			
		||||
    //}
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    //function onSpriteHovering(event) {
 | 
			
		||||
    //    const targetDbId = event.dbId;
 | 
			
		||||
 | 
			
		||||
@ -565,12 +565,13 @@ async function addHotPoint(data) {
 | 
			
		||||
    //            console.log(`Sprite clicked: ${event.dbId}`);
 | 
			
		||||
    //            openHotspotModal();
 | 
			
		||||
    //        }
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
    //        console.log(`The mouse hovers over ${targetDbId}`);
 | 
			
		||||
    //    } else {
 | 
			
		||||
    //        console.log(`The mouse hovers off ${targetDbId}`);
 | 
			
		||||
    //    }
 | 
			
		||||
    //}
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
//------------------- end --------------
 | 
			
		||||
 | 
			
		||||
@ -622,21 +623,21 @@ function changeColorForHotspot(dbId) {
 | 
			
		||||
//    // event (e.g., update UI to a state where no selection is made).
 | 
			
		||||
//}
 | 
			
		||||
 | 
			
		||||
function onSelectionChange(event) {
 | 
			
		||||
    if (event != undefined && event != null) {
 | 
			
		||||
        const dbIds = event.dbIdArray;
 | 
			
		||||
//function onSelectionChange(event) {
 | 
			
		||||
//    if (event != undefined && event != null) {
 | 
			
		||||
//        const dbIds = event.dbIdArray;
 | 
			
		||||
 | 
			
		||||
        if (dbIds.length > 0) {
 | 
			
		||||
            // 處理已選取元件的邏輯
 | 
			
		||||
//        if (dbIds.length > 0) {
 | 
			
		||||
//            // 處理已選取元件的邏輯
 | 
			
		||||
 | 
			
		||||
            //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 {
 | 
			
		||||
            // 處理沒有選取元件的邏輯
 | 
			
		||||
            console.log("no item");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
//            //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 {
 | 
			
		||||
//            // 處理沒有選取元件的邏輯
 | 
			
		||||
//            console.log("no item");
 | 
			
		||||
//        }
 | 
			
		||||
//    }
 | 
			
		||||
//}
 | 
			
		||||
//---------------- end -----------------------------
 | 
			
		||||
 | 
			
		||||
//----------------- 開關熱點小視窗 ----------------------
 | 
			
		||||
@ -657,30 +658,6 @@ function closeHotspotModal() {
 | 
			
		||||
}
 | 
			
		||||
//------------------ end --------------------------------
 | 
			
		||||
 | 
			
		||||
//-------------- 更改燈光範圍 --------------------------
 | 
			
		||||
function setLightPower(value) {
 | 
			
		||||
    //bulbLight.intensity = (value * 10);
 | 
			
		||||
    //bulbLight.distance = value;
 | 
			
		||||
    viewer.impl.sceneUpdated(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function setLightOpenOrClose(value) {
 | 
			
		||||
    if (value)
 | 
			
		||||
        spotLight.visible = true;
 | 
			
		||||
    else {
 | 
			
		||||
        spotLight.visible = false;
 | 
			
		||||
    }
 | 
			
		||||
    viewer.impl.sceneUpdated(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function setLightTransparency(value) {
 | 
			
		||||
    bulbLight.intensity = (value * 10);
 | 
			
		||||
    //bulbLight.
 | 
			
		||||
    viewer.impl.sceneUpdated(true);
 | 
			
		||||
}
 | 
			
		||||
//------------- end -----------------------------------
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//function getPosition(nodeId) {
 | 
			
		||||
function getFragmentWorldMatrixByNodeId(nodeId, viewer) {
 | 
			
		||||
    let tree = viewer.model.getData().instanceTree;
 | 
			
		||||
@ -1058,7 +1035,7 @@ function getForgeToken(callback) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function loadHeatmaps(model) {
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
 | 
			
		||||
 | 
			
		||||
    // Given a model loaded from Forge
 | 
			
		||||
@ -1393,4 +1370,79 @@ function profile() {
 | 
			
		||||
    const lowerCutPlaneParam = this.getCutPlaneParam(lowerIdx, -1);
 | 
			
		||||
    this.viewer.setCutPlanes([upperCutPlaneParam, lowerCutPlaneParam]);
 | 
			
		||||
}
 | 
			
		||||
//----------------- end -----------------------------------------------
 | 
			
		||||
//----------------- end -----------------------------------------------
 | 
			
		||||
 | 
			
		||||
//--------------------------- 聚光燈 ----------------------------------
 | 
			
		||||
async function newLight() {
 | 
			
		||||
    //聚光燈
 | 
			
		||||
    //var spotLight;//聚光燈
 | 
			
		||||
    //color -(可選)燈光的十六進制顏色。默認值為 0xffffff(白色)。
 | 
			
		||||
    //強度 -(可選)光強度 / 強度的數值。默認值為 1。
 | 
			
		||||
    //distance - 燈光的最大範圍。默認值為 0(無限制)。
 | 
			
		||||
    //angle - 光從其上界為 Math.PI / 2 的方向散射的最大角度。
 | 
			
		||||
    //半影 - 由於半影而衰減的聚光燈錐體的百分比。取值介於 0 和 1 之間。默認值為零。
 | 
			
		||||
    //decay - 光沿光的距離變暗的量。
 | 
			
		||||
    spotLight = new THREE.SpotLight(0xffffff, 200, 20, 0.6, 0.5, 10);//0xffffff 80, 10  //15, 20 , Math.PI / 12
 | 
			
		||||
    spotLight.position.set(43.72, -15.65, -44.96); //set(-17.33, 51.03, -2.52); // -7.58, 18.20, -0.25 -44.96
 | 
			
		||||
    spotLight.castShadow = false;
 | 
			
		||||
    spotLight.visible = true;
 | 
			
		||||
    //var geom = new THREE.BoxGeometry(); //create 幾何對象 -17.33, 51.03, -4.52
 | 
			
		||||
    //var material = new THREE.MeshLambertMaterial({ color: 0xffff00 });//0xff0000
 | 
			
		||||
    //var cube = new THREE.Mesh(geom, material);
 | 
			
		||||
    //cube.position.set(43.72, -15.65, -46); //set(-17.33, 51.03, -10);//-4.52 // -7.58, 18.20, -1
 | 
			
		||||
    //cube.scale.set(0.5, 0.5, 0.5);
 | 
			
		||||
    //viewer.scene.add(cube);
 | 
			
		||||
    //spotLight.target = cube;
 | 
			
		||||
 | 
			
		||||
    spotLight.target.position.set(43.72, -15.65, -60);// -15.65 -48
 | 
			
		||||
    viewer.scene.add(spotLight.target);
 | 
			
		||||
 | 
			
		||||
    viewer.scene.add(spotLight);
 | 
			
		||||
 | 
			
		||||
    viewer.impl.sceneUpdated(true);
 | 
			
		||||
 | 
			
		||||
    //return spotLight;
 | 
			
		||||
 | 
			
		||||
    //加入點燈光
 | 
			
		||||
    //bulbLight = new THREE.PointLight(0xff0000, 50, 20, 2);//0xff0000
 | 
			
		||||
    //bulbLight.position.set(43.72, -15.65, -44.96);//17.880840301513672
 | 
			
		||||
    //bulbLight.castShadow = true;
 | 
			
		||||
    //viewer.scene.add(bulbLight);
 | 
			
		||||
    //viewer.impl.sceneUpdated(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//-------------- 更改燈光範圍 --------------------------
 | 
			
		||||
function setLightPower(value) {
 | 
			
		||||
    //bulbLight.intensity = (value * 10);
 | 
			
		||||
    //bulbLight.distance = value;
 | 
			
		||||
    viewer.impl.sceneUpdated(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function setLightValues(intensity, distance, angle, penumbra, decay) {
 | 
			
		||||
    spotLight.intensity = intensity;
 | 
			
		||||
    spotLight.distance = distance;
 | 
			
		||||
    spotLight.angle = angle;
 | 
			
		||||
    spotLight.penumbra = penumbra;
 | 
			
		||||
    spotLight.decay = decay;
 | 
			
		||||
    viewer.impl.sceneUpdated(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function setLightOpenOrClose(value, light) {
 | 
			
		||||
    if (value) {
 | 
			
		||||
        light.visible = true;
 | 
			
		||||
        //spotLight.visible = true;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        light.visible = false;
 | 
			
		||||
        //spotLight.visible = false;
 | 
			
		||||
    }
 | 
			
		||||
    viewer.impl.sceneUpdated(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function setLightTransparency(value) {
 | 
			
		||||
    bulbLight.intensity = (value * 10);
 | 
			
		||||
    //bulbLight.
 | 
			
		||||
    viewer.impl.sceneUpdated(true);
 | 
			
		||||
}
 | 
			
		||||
//------------- end -----------------------------------
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -888,5 +888,41 @@ namespace Repository.BaseRepository.Implement
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion AddOneReturnId
 | 
			
		||||
 | 
			
		||||
        #region TruncateTable (清空資料表)
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 清空資料表資料
 | 
			
		||||
        /// TRUNCATE TABLE {tableName}
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="table_name"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public virtual async Task TruncateTable(string table_name)
 | 
			
		||||
        {
 | 
			
		||||
            using (IDbConnection conn = GetDbConnection())
 | 
			
		||||
            {
 | 
			
		||||
                conn.Open();
 | 
			
		||||
                using (var trans = conn.BeginTransaction())
 | 
			
		||||
                {
 | 
			
		||||
                    try
 | 
			
		||||
                    {
 | 
			
		||||
                        var sql = $"TRUNCATE TABLE {table_name}";
 | 
			
		||||
                        await conn.ExecuteAsync(sql, null, trans);
 | 
			
		||||
 | 
			
		||||
                        trans.Commit();
 | 
			
		||||
                    }
 | 
			
		||||
                    catch (Exception exception)
 | 
			
		||||
                    {
 | 
			
		||||
                        trans.Rollback();
 | 
			
		||||
                        throw exception;
 | 
			
		||||
                    }
 | 
			
		||||
                    finally
 | 
			
		||||
                    {
 | 
			
		||||
                        conn.Close();
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        #endregion TruncateTable
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -181,5 +181,12 @@ namespace Repository.BaseRepository.Interface
 | 
			
		||||
        /// <returns>
 | 
			
		||||
        /// </returns>
 | 
			
		||||
        Task<int> AddOneByCustomTableReturnId(Dictionary<string, object> dict, string Table_name, bool returnId = true);
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 清空table資料
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="table_name">資料表名稱</param>
 | 
			
		||||
        /// <returns>
 | 
			
		||||
        /// </returns>
 | 
			
		||||
        Task TruncateTable(string table_name);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user