广西东盟项目.js 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321
  1. // 创建app
  2. var app = new THING.App({
  3. url: '/api/scene/00c8b14766e1616e3bf14604',
  4. // url: '/api/scene/e1137071cd763730846f50ba',//常福医院
  5. background: '/uploads/wechat/163607/file/广西东盟项目/Image/op0.png'
  6. });
  7. app.camera.xAngleLimitRange = [0, 90];// 限制摄像机不看到场景地面以下
  8. $("#div3d").css("cursor", "pointer");// 设置鼠标箭头样式
  9. var miniMapCtrl = null; // 小地图控件
  10. var panel;//面板控件
  11. var panel_;//多选面板控制
  12. var ui;//设备数据展示面板
  13. var uis = [] //存放面板数据
  14. var uis_array = []//存放面板数据
  15. var uis_list = [] //存放面板数据
  16. var uis_name = {} //存放物体类型数据
  17. var floorID;//楼层id存放
  18. var ev_name = "";
  19. var floorName = '';
  20. var floorName1 = '';
  21. var truck = null;
  22. var panelArr = []; //设备信息存放
  23. var webSocket;//webSocket
  24. var tileLayer1 = null; // 加入地图背景后选用的图层
  25. var box = null; // 鼠标点击第一人称行走按钮时,红色盒子提示
  26. var fpsCtrl = null; // 第一人称行走控件
  27. var cameraInitPos = null; // 进入第一人称行走前摄像机位置
  28. var fullScreenState = false; // 全屏
  29. var skyBox = null; // 天空盒
  30. var hiddenControlTimer = null; // 隐藏控制按钮计时器
  31. var showControlTimer = null; // 显示控制按钮计时器
  32. var cameraDistace = [];
  33. var building = null; // 建筑
  34. var mainPanle;
  35. var restartTime = 5000; // 自动旋转停止后重启时间间隔
  36. var rotateTimer = null; // 自动旋转计时器
  37. var sidebar = {
  38. znyg: false,
  39. znjk: false,
  40. znsx: false,
  41. enterBuilding: false,
  42. expandBuilding: false,
  43. deviceShow: false,
  44. electricalFire: false,
  45. equipment: false,
  46. device_add: false
  47. };//设置侧边栏是否选中
  48. var stateArray = [] //记录每次闪烁设备状态参数
  49. // 创建多选按钮数据对象
  50. var dataObj = {
  51. checkbox: {},
  52. };
  53. var device = null;// 创建设备
  54. var dome;//设备编辑器面板
  55. var ev_object;//设备信息存储
  56. var position;//记录离地高度初始值
  57. var baseURL = "https://s3.ax1x.com/2021/01/28/";
  58. var iconUrl = "/uploads/wechat/163607/file/广西东盟项目/iconfont/";
  59. var filePath = '/uploads/wechat/5oiR5pyJ5pyA6ZW/55qE572R5ZCN5LiN5L+h5L2g5pWw5pWw/file/ScenePreview/';
  60. var api = 'http://121.40.217.77:8081';
  61. // 需要用到的外部文件
  62. var fileArr = [
  63. "https://www.layuicdn.com/layui/layui.js",
  64. 'https://www.layuicdn.com/layui/css/layui.css',
  65. filePath + 'assets/css/index.css', // 功能按钮样式文件
  66. filePath + 'assets/font-awesome-4.7.0/css/font-awesome.min.css', // 功能按钮字体样式
  67. filePath + 'assets/css/myAlert.css', // 弹出框样式
  68. filePath + 'assets/css/sweetalert2.min.css', // 弹出框样式
  69. filePath + 'assets/js/sweetalert2.all.min.js', // 弹出框脚本
  70. filePath + 'assets/js/myAlert.js', // 弹出框脚本
  71. filePath + 'assets/js/posTransform.js', // 不同坐标系经纬度互相转换的脚本文件
  72. filePath + 'assets/js/expandFloor.js', // 楼层展开脚本
  73. '/guide/lib/echarts.min.js',
  74. '/uploads/wechat/163607/file/广西东盟项目/JS/Character.js',//创建人物走动
  75. '/uploads/wechat/163607/file/广西东盟项目/JS/UIAnchor.js',//UI界面脚本
  76. '/uploads/wechat/163607/file/广西东盟项目/JS/FloorClick.js',//创建切换楼层脚本
  77. '/uploads/wechat/163607/file/广西东盟项目/JS/CreateHtml.js',//创建页面元素脚本
  78. // '/uploads/wechat/163607/file/广西东盟项目/JS/MainPanel.js',//公共工具功能脚本
  79. '/uploads/wechat/163607/file/广西东盟项目/JS/RegisterEvent.js',//公共注册事件脚本
  80. ];
  81. /**
  82. * 说明:加载外部文件
  83. */
  84. THING.Utils.dynamicLoad(fileArr, function () {
  85. app.on('load', function (ev) {
  86. // $(".processcontainer").css("display", "none")
  87. var campus = ev.campus;
  88. skyBox = app.skyBox; // 获取天空盒
  89. app.level.change(ev.campus); // 切换至园区层级
  90. ev.campus.azimuth = '180';
  91. mainPanle = new MainPanel(app);// 界面的类
  92. mainPanle.createToolsPanel();
  93. creatFloorChoose();
  94. // setupNavpanel();
  95. // 获取园区在CampusBuilder编辑时保存的地理位置
  96. let tjsLnglat = app.root.defaultCampus.extraData;
  97. if (tjsLnglat != undefined && tjsLnglat != null) {
  98. tjsLnglat = tjsLnglat.coordinates;
  99. if (tjsLnglat != undefined && tjsLnglat != null) {
  100. tjsLnglat = tjsLnglat.split(",");
  101. }
  102. } else {
  103. ev.campus.extraData = { coordinates: "116.4641,39.98606" } // 园区绑定默认经纬度,地图才生效
  104. }
  105. createHtml(); // 创建html
  106. restarRotate(); // 自动旋转
  107. });
  108. });
  109. /**
  110. * 查询设备模型列表
  111. */
  112. function select_device(){
  113. var url = ""
  114. var type = ""
  115. var bool;
  116. $.ajax({
  117. type: "POST",
  118. url: api + '/thingjs/thingjsDeviceQuery',
  119. dataType: "json",
  120. data:{thingjsFloorId:floorID},
  121. async: false,
  122. success: function (object) {
  123. var data = object.data
  124. for(let i=0;i<data.length;i++){
  125. if(data[i].bool === "true"){
  126. bool = true
  127. }else{
  128. bool = false
  129. }
  130. if (data[i].deviceType === 'IPC') {
  131. url = 'https://model.3dmomoda.com/models/2DBD1DCD7B5F49BDA43CC6444FC5CBD0/0/gltf'
  132. type = "摄像头"
  133. }
  134. var abc = app.query('#' + floorID)[0]
  135. var deviceUuid = app.query('#' + data[i].deviceUuid)[0]
  136. if(deviceUuid != undefined){
  137. deviceUuid.destroy();
  138. }
  139. var device_array = app.create({
  140. name: data[i].name,
  141. id: data[i].deviceUuid,
  142. type: 'Thing',
  143. url: url,
  144. position: [parseFloat(data[i].position.split(',')[0]),parseFloat(data[i].position.split(',')[1]),parseFloat(data[i].position.split(',')[2])],
  145. angle: parseFloat(data[i].angle.split(',')[1]),
  146. parent: abc,
  147. scale: [parseFloat(data[i].scale.split(',')[0]),parseFloat(data[i].scale.split(',')[1]),parseFloat(data[i].scale.split(',')[2])],
  148. complete:function(ev){
  149. ev.object.userData.bool = bool;
  150. ev.object.userData.物体类型 = type;
  151. }
  152. })
  153. }
  154. }
  155. })
  156. }
  157. /*
  158. 点击按钮创建设备
  159. */
  160. function btnadd_device(type, name, id) {
  161. var url = ""
  162. if (type === '摄像头') {
  163. url = 'https://model.3dmomoda.com/models/2DBD1DCD7B5F49BDA43CC6444FC5CBD0/0/gltf'
  164. }
  165. var abc = app.query('#' + floorID)[0]
  166. device = app.create({
  167. name: name,
  168. id: id,
  169. type: 'Thing',
  170. url: url,
  171. position: [0, 0, 0],
  172. angle: 180,
  173. parent: abc,
  174. scale: [1.7, 1.7, 1.7],
  175. complete:function(ev){
  176. ev.object.userData.bool = true;
  177. ev.object.userData.物体类型 = type;
  178. }
  179. });
  180. }
  181. //创建设备选择器 --- 创建模型 (按钮)
  182. function equipment(key) {
  183. if (key === "设备选择器") {
  184. if (sidebar.device_add == true) {
  185. sidebar.device_add = false
  186. panel_.destroy();
  187. }
  188. } else if (key === "模型创建") {
  189. if (sidebar.equipment == true) {
  190. sidebar.equipment = false
  191. panel_.destroy();
  192. }
  193. }
  194. // 界面组件
  195. panel_ = new THING.widget.Panel({
  196. titleText: key, // 可通过font标签设置标题颜色 例如:'<font color="red">我是红色标题</font>'
  197. closeIcon: false, // 是否有关闭按钮
  198. dragable: true, // 是否可拖拽
  199. retractable: true, // 是否可收缩
  200. opacity: 1, // 设置透明度
  201. hasTitle: true, // 设置标题
  202. zIndex: 999 // 设置层级
  203. });
  204. // 面板定位
  205. // 左上角——TL/topleft,左下角——BL/bottomleft
  206. // 右上角——TR/topright,右下角——BR/bottomright
  207. panel_.position = [0, '40%'];
  208. $('head').append($(`
  209. <style>
  210. .ThingJS_wrap .panel{
  211. border: 1px solid rgb(24 118 208 / 55%);
  212. box-shadow: 0px 2px 21px 0px rgb(24 118 208 / 55%);
  213. background: rgba(2,17,50,0.9);
  214. }
  215. .ThingJS_wrap .panel .title{
  216. background: rgba(27,57,130,1);
  217. border-bottom:none;
  218. text-align: center;
  219. }
  220. .ThingJS_wrap .panel .title .text{
  221. padding-left: 0px;
  222. }
  223. .ThingJS_wrap .panel .main{
  224. border: none;
  225. }
  226. .ThingJS_wrap .panel .dv-input .dv33{
  227. border-top:none;
  228. }
  229. </style>
  230. `));
  231. if (key === "设备选择器") {
  232. // 加载复选框组件 //.caption({ "设备2": "设备2aaa" })可以修改复选框命名
  233. if (JSON.stringify(dataObj.checkbox) != "{}") {
  234. var check = panel_.addCheckbox(dataObj, 'checkbox');
  235. // 复选框需逐个添加change事件
  236. for (let i = 0; i < check.length; i++) {
  237. check[i].on('change', function (ev) {
  238. app.query("#" + floorID)[0].query('["userData/物体类型"="' + check[i].property + '"]').forEach(function (obj, index) {
  239. if (ev) {
  240. var myElement = document.getElementById(obj.name);
  241. if (!myElement) {
  242. equipment_ajax(obj);
  243. }
  244. } else {
  245. if (ev_name == null || ev_name == "") {
  246. equipment_ajax(obj);
  247. } else {
  248. for (let i = 0; i < uis_list.length; i++) {
  249. if (ev_name === uis_list[i].name) {
  250. var box = document.getElementById(uis_list[i].name);
  251. box.remove();
  252. var box1 = document.getElementById(uis_list[i].name);
  253. box1.remove();
  254. uis_array.splice(i, 1)
  255. uis.splice(i, 1)
  256. uis_list.splice(i, 1)
  257. uis_name[obj.userData.物体类型]++
  258. }
  259. }
  260. }
  261. }
  262. })
  263. });
  264. }
  265. }
  266. } else if (key === "模型创建") {
  267. var html;
  268. var type;
  269. var templaet = `
  270. <div id="flex_content" style="display:flex;margin-bottom: 15px;flex-wrap:wrap;">
  271. </div>
  272. `
  273. $('.ThingJS_UI').append($(templaet));
  274. $.ajax({
  275. type: "POST",
  276. url: api + '/thingjs/queryLocalDevice',
  277. dataType: "json",
  278. data: { thingjsFloorId: floorID },
  279. async: false,
  280. success: function (obj) {
  281. var data = obj.data
  282. if (data.length > 0) {
  283. for (let i = 0; i < data.length; i++) {
  284. if (data[i].deviceType === 'IPC') {
  285. type = '摄像头'
  286. }
  287. html = `
  288. <button class="custom-btn btn-3" onclick="btnadd_device('${type}','${data[i].deviceName}','${data[i].uuid}')">
  289. <span>${data[i].deviceName}</span>
  290. </button>
  291. `
  292. $('#flex_content').append($(html));
  293. }
  294. } else {
  295. html = `
  296. <div style="width: 100%;color: #fff;text-align: center;margin-top: 1rem;">暂无数据</div>
  297. `
  298. $('#flex_content').append($(html));
  299. }
  300. }
  301. });
  302. $('head').append($(`
  303. <style>
  304. .custom-btn {
  305. width: 130px;
  306. height: 40px;
  307. color: #fff;
  308. border-radius: 5px;
  309. padding: 10px 25px;
  310. font-family: "Lato", sans-serif;
  311. font-weight: 500;
  312. background: transparent;
  313. cursor: pointer;
  314. transition: all 0.3s ease;
  315. position: relative;
  316. display: inline-block;
  317. }
  318. /* 3 */
  319. .btn-3 {
  320. background: #4368ca;
  321. width: 130px;
  322. height: 40px;
  323. line-height: 42px;
  324. padding: 0;
  325. border: none;
  326. margin: 0 auto;
  327. margin-top: 15px;
  328. overflow: hidden;
  329. }
  330. .btn-3 span {
  331. position: relative;
  332. display: block;
  333. width: 100%;
  334. height: 100%;
  335. }
  336. .btn-3:before,
  337. .btn-3:after {
  338. position: absolute;
  339. content: "";
  340. right: 0;
  341. top: 0;
  342. background: rgba(2, 126, 251, 1);
  343. transition: all 0.3s ease;
  344. }
  345. .btn-3:before {
  346. height: 0%;
  347. width: 2px;
  348. }
  349. .btn-3:after {
  350. width: 0%;
  351. height: 2px;
  352. }
  353. .btn-3:hover {
  354. background: transparent;
  355. box-shadow: none;
  356. }
  357. .btn-3:hover:before {
  358. height: 100%;
  359. }
  360. .btn-3:hover:after {
  361. width: 100%;
  362. }
  363. .btn-3 span:hover {
  364. color: rgba(2, 126, 251, 1);
  365. }
  366. .btn-3 span:before,
  367. .btn-3 span:after {
  368. position: absolute;
  369. content: "";
  370. left: 0;
  371. bottom: 0;
  372. background: rgba(2, 126, 251, 1);
  373. transition: all 0.3s ease;
  374. }
  375. .btn-3 span:before {
  376. width: 2px;
  377. height: 0%;
  378. }
  379. .btn-3 span:after {
  380. width: 0%;
  381. height: 2px;
  382. }
  383. .btn-3 span:hover:before {
  384. height: 100%;
  385. }
  386. .btn-3 span:hover:after {
  387. width: 100%;
  388. }
  389. </style>
  390. `));
  391. }
  392. }
  393. // 单击模型创建面板
  394. app.on(THING.EventType.SingleClick, function (ev) {
  395. if (ev.picked) {
  396. if (ev.object.type === "Thing") {
  397. if (position == undefined) {
  398. position = ev.object.position[1]
  399. }
  400. ev.pickedPosition[1] = 0
  401. ev_object = "";
  402. ev_object = ev
  403. add_dome(ev);//创建设备编辑器
  404. ev_name = ev.object.name
  405. if (dataObj.checkbox[ev.object.userData.物体类型] == true) {
  406. dataObj.checkbox[ev.object.userData.物体类型] = false
  407. } else {
  408. equipment_ajax(ev.object)
  409. }
  410. }
  411. }
  412. });
  413. /*
  414. 创建设备编辑器dome
  415. */
  416. function add_dome(ev) {
  417. dome = document.getElementsByClassName('widget')
  418. var userData = ev.object.userData
  419. if ('bool' in userData) {
  420. if (userData.bool == true) {
  421. var object = ev_object.object
  422. //删除设备编辑器
  423. delete_dome();
  424. var widget =
  425. `
  426. <div class="widget">
  427. <div class="widget_title">设备编辑器</div>
  428. <div class="widget_content">
  429. <ul style="width: 20%;text-align: center;">
  430. <li class="content_li">设备类别:</li>
  431. <li class="content_li">设备编号:</li>
  432. <li class="content_li">设备位置:</li>
  433. <li class="content_li">设备方向:</li>
  434. <li class="content_li">设备大小:</li>
  435. </ul>
  436. <ul style="width: 80%;text-align: center;">
  437. <li class="content_li">
  438. <input id="userData" class="content_input" type="text"
  439. value="${object.userData.物体类型}" disabled="disabled">
  440. </li>
  441. <li class="content_li">
  442. <input id="device_id" class="content_input" type="text"
  443. value="${object.id}" disabled="disabled">
  444. </li>
  445. <li class="content_li" style="display:flex;">
  446. <input id="position_1" class="content_input"
  447. type="text" value="${object.position[0]}"
  448. style="width:40%;" onchange="change_dome()"
  449. onkeyup="if(isNaN(value))execCommand('undo')"
  450. onafterpaste="if(isNaN(value))execCommand('undo')">
  451. <input id="position_2" class="content_input"
  452. type="text" value="${ev.pickedPosition[1]}"
  453. style="width:20%;" onchange="change_dome()"
  454. onkeyup="if(isNaN(value))execCommand('undo')"
  455. onafterpaste="if(isNaN(value))execCommand('undo')">
  456. <input id="position_3" class="content_input" type="text"
  457. value="${object.position[2]}"
  458. style="width:40%;" onchange="change_dome()"
  459. onkeyup="if(isNaN(value))execCommand('undo')"
  460. onafterpaste="if(isNaN(value))execCommand('undo')">
  461. </li>
  462. <li class="content_li">
  463. <input id="angles" class="content_input" type="text"
  464. value="${object.angles[1]}"
  465. onchange="change_dome()"
  466. onkeyup="if(isNaN(value))execCommand('undo')"
  467. onafterpaste="if(isNaN(value))execCommand('undo')">
  468. </li>
  469. <li class="content_li">
  470. <input id="scale" class="content_input"
  471. type="text" value="${object.scale[0]}"
  472. onchange="change_dome()"
  473. onkeyup="if(isNaN(value))execCommand('undo')"
  474. onafterpaste="if(isNaN(value))execCommand('undo')">
  475. </li>
  476. </ul>
  477. </div>
  478. <div class="widget_header">
  479. <div>
  480. <button class="btn_1" onclick="insert_dome()">保存</button>
  481. </div>
  482. <div>
  483. <button class="btn_2" onclick="delete_dome()">取消</button>
  484. </div>
  485. <div>
  486. <button class="btn_3" onclick="delete_device()">删除</button>
  487. </div>
  488. </div>
  489. </div>
  490. `
  491. $('#div2d').append($(widget));
  492. $('head').append($(`
  493. <style>
  494. .widget{
  495. width: 35rem;
  496. position: fixed;
  497. border-radius: 5px;
  498. bottom: 5.5rem;
  499. right: 10px;
  500. color: #fff;
  501. }
  502. .widget_title{
  503. width: 100%;
  504. text-align: center;
  505. padding: 10px;
  506. background: rgba(27,57,130,1);
  507. border-radius: 5px 5px 0px 0px;
  508. }
  509. .widget_content{
  510. width: 100%;
  511. background: rgba(2,17,50,0.9);
  512. display: flex;
  513. }
  514. .content_li{
  515. margin-top: 1rem;
  516. margin-bottom: 1rem;
  517. }
  518. .content_input{
  519. width: 98%;
  520. padding-left: 10px;
  521. border: 1px solid #3486da;
  522. background: rgba(27,31,81,0.60);
  523. color: #fff;
  524. margin-right: 10px;
  525. }
  526. .widget_header{
  527. width: 100%;
  528. display:flex;
  529. background: rgba(2,17,50,0.9);
  530. border-radius: 0px 0px 5px 5px;
  531. padding-bottom: 1rem;
  532. }
  533. .widget_header div{
  534. width: 33.33%;
  535. text-align: center;
  536. }
  537. .widget_header div button{
  538. width: 78px;
  539. height: 32px;
  540. color: #ffff;
  541. cursor: pointer;
  542. }
  543. .btn_1{
  544. opacity: 1;
  545. background: #2f52ae;
  546. border-radius: 6px;
  547. border: 0px;
  548. }
  549. .btn_2{
  550. background: transparent;
  551. border-radius: 6px;
  552. border: 1px solid #dadada;
  553. }
  554. .btn_3{
  555. border: 1px solid #ff4848;
  556. color: #ff4848 !important;
  557. border-radius: 7px;
  558. background: transparent;
  559. }
  560. </style>
  561. `));
  562. }
  563. } else {
  564. //删除设备编辑器
  565. delete_dome();
  566. }
  567. }
  568. /**
  569. * 将设备编辑器数据保存至数据库
  570. */
  571. function insert_dome(){
  572. var object=ev_object.object
  573. var type = "";
  574. if(object.userData.物体类型 === '摄像头'){
  575. type = 'IPC'
  576. }
  577. $.ajax({
  578. type: "POST",
  579. url: api + '/thingjs/thingjsDeviceRegister',
  580. dataType: "json",
  581. data:{
  582. deviceUuid:object.id,
  583. name:object.name,
  584. deviceType:type,
  585. angle:""+object.angles[0]+","+object.angles[1]+","+object.angles[2]+"",
  586. bool:object.userData.bool,
  587. position:""+object.position[0]+","+object.position[1]+","+object.position[2]+"",
  588. scale:""+object.scale[0]+","+object.scale[1]+","+object.scale[2]+"",
  589. del:0
  590. },
  591. async: false,
  592. success: function (data) {
  593. object.destroy();
  594. delete_dome();
  595. select_device();
  596. }
  597. })
  598. }
  599. function delete_device(){
  600. var object=ev_object.object
  601. var type = "";
  602. if(object.userData.物体类型 === '摄像头'){
  603. type = 'IPC'
  604. }
  605. $.ajax({
  606. type: "POST",
  607. url: api + '/thingjs/thingjsDeviceRegister',
  608. dataType: "json",
  609. data:{
  610. deviceUuid:object.id,
  611. name:object.name,
  612. deviceType:type,
  613. angle:""+object.angles[0]+","+object.angles[1]+","+object.angles[2]+"",
  614. bool:object.userData.bool,
  615. position:""+object.position[0]+","+object.position[1]+","+object.position[2]+"",
  616. scale:""+object.scale[0]+","+object.scale[1]+","+object.scale[2]+"",
  617. del:1
  618. },
  619. async: false,
  620. success: function (data) {
  621. object.destroy();
  622. delete_dome();
  623. select_device();
  624. }
  625. })
  626. }
  627. /*
  628. input输入框change事件
  629. */
  630. function change_dome() {
  631. var userData_dome = document.getElementById('userData')
  632. var angles = document.getElementById('angles')
  633. var scale = document.getElementById('scale')
  634. var position_1 = document.getElementById('position_1')
  635. var position_2 = document.getElementById('position_2')
  636. var position_3 = document.getElementById('position_3')
  637. if (userData_dome != null && userData_dome != '') {
  638. angles.value != null && angles.value != "" ? angles = angles.value : angles = 0;//方向
  639. ev_object.object.angles = [0, angles, 0];//方向
  640. scale.value != null && scale.value != "" ? scale = scale.value : scale = 1;//大小
  641. ev_object.object.scale = [scale, scale, scale];//大小
  642. position_1.value != null && position_1.value != "" ? position_1 = position_1.value : position_1 = 0;//坐标
  643. //坐标
  644. if (position_2.value != null && position_2.value != "") {
  645. ev_object.pickedPosition[1] = position_2.value
  646. position_2 = position + parseInt(position_2.value)
  647. } else {
  648. ev_object.pickedPosition[1] = 0
  649. position_2 = position
  650. }
  651. position_3.value != null && position_3.value != "" ? position_3 = position_3.value : position_3 = 0;//坐标
  652. ev_object.object.position = [position_1, position_2, position_3]
  653. }
  654. add_dome(ev_object);//创建设备编辑器
  655. }
  656. /*
  657. 删除设备编辑器
  658. */
  659. function delete_dome() {
  660. if (dome != undefined) {
  661. if (dome.length > 0) {
  662. dome[0].remove()
  663. }
  664. }
  665. }
  666. //面板数据调用
  667. function equipment_ajax(object) {
  668. var myElement = document.getElementById(object.name);
  669. if (myElement) {
  670. for (let i = 0; i < uis_list.length; i++) {
  671. if (object.name === uis_list[i].name) {
  672. var box = document.getElementById(object.name);
  673. box.remove();
  674. var box1 = document.getElementById(object.name);
  675. box1.remove();
  676. uis_array.splice(i, 1)
  677. uis.splice(i, 1)
  678. uis_list.splice(i, 1)
  679. uis_name[object.userData.物体类型]++
  680. }
  681. }
  682. } else {
  683. $.ajax({
  684. type: "GET",
  685. url: '/uploads/wechat/163607/file/广西东盟项目/测试.json',
  686. dataType: "json",
  687. async: false,
  688. success: function (data) {
  689. for (let i = 0; i < data.length; i++) {
  690. if (data[i].deviceid === object.id && data[i].devicetype === object.userData.物体类型) {
  691. init(object, data[i]);
  692. }
  693. }
  694. }
  695. });
  696. }
  697. }
  698. //删除所有已有的面板
  699. function delete_ui() {
  700. for (let i = 0; i < uis_array.length;) {
  701. equipment_ajax(uis_array[i])
  702. }
  703. }
  704. /*
  705. 查询楼层类型设备
  706. */
  707. function click_userData() {
  708. var userData = []
  709. var user_array = {}
  710. uis_name = {}
  711. dataObj.checkbox = {}
  712. //双击查找当前楼层
  713. app.query("#" + floorID)[0].query('["userData/物体类型"]').forEach(function (obj) {
  714. userData.push(obj.userData.物体类型)
  715. var array = app.query("#" + floorID)[0].query('["userData/物体类型"="' + obj.userData.物体类型 + '"]').length
  716. uis_name[obj.userData.物体类型] = array
  717. })
  718. //数组去重
  719. for (var i = 0; i < userData.length; i++) {
  720. for (var j = i + 1; j < userData.length;) {
  721. userData[i] == userData[j] ? userData.splice(j, 1) : j++;
  722. }
  723. }
  724. userData.forEach(function (obj, index) {
  725. dataObj.checkbox[obj] = false;
  726. })
  727. }
  728. window.addEventListener("message", (event) => {
  729. var that = this;
  730. // 监听父窗口发送过来的数据向服务器发送post请求
  731. var name = event.data.name;
  732. var state = event.data.state;
  733. if (name === '17楼监控2' || name === '17楼监控1') {
  734. // app.query(name).forEach(function (obj) {
  735. // app.camera.flyTo({
  736. // object: obj,
  737. // xAngle: 0, // 绕物体自身X轴旋转角度
  738. // yAngle: 0, // 绕物体自身Y轴旋转角度
  739. // radiusFactor: 5, // 物体包围盒半径的倍数
  740. // time: 2 * 1000,
  741. // complete: function () {
  742. // console.log("飞行结束");
  743. // }
  744. // });
  745. // app.level.change(car);
  746. // });
  747. } else {
  748. stateArray.push(state)
  749. if (stateArray.length > 1) {
  750. for (let i = 0; i < stateArray.length; i++) {
  751. if (stateArray[i - 1] === stateArray[i]) {
  752. if (sidebar.deviceShow == true) {
  753. sidebar.deviceShow = false
  754. } else {
  755. sidebar.deviceShow = true
  756. }
  757. stateArray = [];
  758. }
  759. }
  760. } else {
  761. sidebar.deviceShow = true
  762. }
  763. var devList = []
  764. var deviceArray = app.query('["userData/物体类型"="' + name + '"]');
  765. devList.push(deviceArray)
  766. flash(devList, state);
  767. }
  768. }, false);
  769. /**
  770. * 向父窗体(用户主页面)发送消息
  771. */
  772. function deviceIcon_click(id, name) {
  773. let funcName = "icon_click";
  774. var data = { id, name }
  775. var message = {
  776. 'funcName': funcName, // 所要调用父页面里的函数名
  777. 'param': data
  778. }
  779. // 向父窗体(用户主页面)发送消息
  780. // 第一个参数是具体的信息内容,
  781. // 第二个参数是接收消息的窗口的源(origin),即"协议 + 域名 + 端口"。也可以设为*,表示不限制域名,向所有窗口发送
  782. window.parent.postMessage(message, '*');
  783. }
  784. // var floorsign =
  785. // `
  786. // <div class="processcontainer" style="z-index: 2021;">
  787. // <iframe src="/uploads/wechat/163607/file/广西东盟项目/index.html"></iframe>
  788. // </div>
  789. // `;
  790. // $('#div2d').append($(floorsign));
  791. // $('head').append($(`
  792. // <style>
  793. // .processcontainer{
  794. // position: fixed;
  795. // bottom: 3rem;
  796. // right: 0;
  797. // left: 0;
  798. // width: 500px;
  799. // border:1px solid #3486da;
  800. // height: 16px;
  801. // margin: 0 auto;
  802. // padding: 4px;
  803. // }
  804. // .processcontainer iframe{
  805. // position: fixed;
  806. // width:100%;
  807. // height: 100%;
  808. // right: 0;
  809. // left: 0;
  810. // bottom: 0;
  811. // top:0;
  812. // border: 0px;
  813. // }
  814. // </style>
  815. // `));
  816. //====设备闪烁提示====
  817. function flash(objArray, state) {
  818. var color = ''
  819. var opacity;
  820. objArray.forEach(function (obj, index) {
  821. obj.on('update', function () {
  822. if (state === 'total') {
  823. color = sidebar.deviceShow == true ? '#008000' : '#F8F8FF'
  824. } else if (state === 'error') {
  825. color = sidebar.deviceShow == true ? '#FFF000' : '#F8F8FF'
  826. } else if (state === "none") {
  827. color = '#F8F8FF'
  828. }
  829. opacity = sidebar.deviceShow == true ? 0.5 + 0.5 * Math.sin(2 * app.elapsedTime / 500) : 1
  830. obj.style.alwaysOnTop = true
  831. obj.style.color = color
  832. obj.style.opacity = opacity
  833. }, '每帧改变透明度');
  834. })
  835. }
  836. function queryDeviceStatus(evt) {
  837. // debugger
  838. objArray = evt.data;
  839. // objArray.forEach(function (deviceobj) {
  840. // obj = app.query("#" + deviceobj.ownerCode)[0];
  841. // obj.on('update', function () {
  842. // obj.style.color = '#FF0000'
  843. // obj.style.opacity = 0.5 + 0.5 * Math.sin(2 * app.elapsedTime / 500);
  844. // }, '每帧改变透明度');
  845. // })
  846. obj = app.query("#" + objArray)[0];
  847. obj.on('update', function () {
  848. obj.style.color = '#FF0000'
  849. obj.style.opacity = 0.5 + 0.5 * Math.sin(2 * app.elapsedTime / 500);
  850. }, '每帧改变透明度');
  851. }
  852. function reset(objArray) {
  853. objArray.forEach(function (obj) {
  854. obj.style.opacity = 1.0;
  855. obj.style.color = null;
  856. obj.off('update', null, '每帧改变透明度');
  857. })
  858. }
  859. // 当前停车位状态
  860. // function showParkingInfo() {
  861. // var parkingTotalNum = 16;
  862. // var emptyNum = 3;
  863. // var parkOption = {
  864. // title: { text: '测试图表', x: 'center', textStyle: { color: '#cccccc' } },
  865. // tooltip: {
  866. // trigger: 'item',
  867. // formatter: "{a} <br/>{b} : {c} ({d}%)"
  868. // },
  869. // legend: {
  870. // orient: 'vertical',
  871. // top: 60,
  872. // x: 'left',
  873. // data: ['测试', '测试'],
  874. // textStyle: {
  875. // color: '#cccccc'
  876. // }
  877. // },
  878. // calculable: true,
  879. // series: [
  880. // {
  881. // name: '车位', type: 'pie', radius: '55%', center: ['50%', '60%'],
  882. // data: [
  883. // { value: parkingTotalNum - emptyNum, name: '测试', itemStyle: { color: "#ff6c00" } },
  884. // { value: emptyNum, name: '测试', itemStyle: { color: "#4a8cff" } }
  885. // ]
  886. // }
  887. // ]
  888. // };
  889. // createChart(parkOption, "车位状态");
  890. // }
  891. var timer = null;
  892. // 创建图表
  893. function createChart(option, type) {
  894. var bottomBackground = document.createElement('div');// 创建背景 div
  895. bottomBackground.setAttribute('id', 'bottomBackground');
  896. var bottomDom = document.createElement('div');// 图表 div
  897. // 设置背景div和图表div的样式
  898. if (type == "车位状态") {
  899. var backgroundStyle = 'position: absolute;top:3px;right:3px;height:300px;width:380px;background: rgba(22,24,63,0.3); border-radius:3px';
  900. var chartsStyle = 'position: absolute;top:10px;right:0px;width:360px;height:250px;margin:0 10px;';
  901. }
  902. bottomBackground.setAttribute('style', backgroundStyle);
  903. bottomDom.setAttribute('style', chartsStyle);
  904. // echarts 初始化
  905. var bottomCharts = window.echarts.init(bottomDom);
  906. bottomCharts.setOption(option);
  907. // 图表交互 当点击图图表时触发,params是点击位置信息参数
  908. bottomCharts.on('click', function (params) {
  909. clearTimeout(timer);
  910. // 清除上次点击事件产生的场景变化
  911. cancelOutline();
  912. reset();
  913. clearUIAnchorArr();
  914. // 根据鼠标点击时的参数,控制场景中物体变化
  915. if (params.name == "测试") {
  916. app.query("测试======").style.outlineColor = "#4a8cff"
  917. }
  918. // 场景中信息显示5s后消失
  919. timer = setTimeout(function () {
  920. cancelOutline();
  921. reset();
  922. clearUIAnchorArr();
  923. }, 5000)
  924. });
  925. bottomBackground.appendChild(bottomDom);
  926. app.domElement.appendChild(bottomBackground);// 添加到app dom下
  927. }
  928. function getTabledata(d) {
  929. var ygArray = [];
  930. d.forEach(function (d) {
  931. var deviceInfo = {
  932. "设备编号": d.ownerCode,
  933. "设备名称": d.ownerName,
  934. "安装位置": d.unitinfo,
  935. };
  936. ygArray.push(deviceInfo)
  937. })
  938. // 表格数据//创建对象 book
  939. var tableData = {
  940. // 列标题
  941. props: ['设备编号', '设备名称', '安装位置'],
  942. // 列数据
  943. items: ygArray
  944. };
  945. return tableData;
  946. }
  947. function createPerson(name, age, family) {
  948. var o = new Object();
  949. o.name = name;
  950. o.age = age;
  951. o.family = family;
  952. o.say = function () {
  953. alert(this.name);
  954. }
  955. return o;
  956. }
  957. //创建监控列表
  958. function createmonitorlist() {
  959. mycreat();
  960. function mycreat() {
  961. let sign1 =
  962. `
  963. <div id="mymonitor" style='position: absolute;top:50px;left:3px;height:330px;width:400px;background: rgba(255,255,255,1); border-radius:0px; margin-top:0px'>
  964. <div style="">监控设备</div>
  965. <div id="deviceListTable1" lay-filter="test" ></div>
  966. </div>
  967. `;
  968. $('#div2d').append($(sign1));
  969. };
  970. }
  971. function destroyMonitor() {
  972. var mymonitor = document.getElementById('mymonitor')
  973. mymonitor.remove();
  974. }
  975. function destroyPanel() {
  976. var mydiv = document.getElementById('mydiv')
  977. mydiv.remove();
  978. }
  979. //====================
  980. // 创建设备列表
  981. function createDeviceListTable(option, type) {
  982. mycreat();
  983. function mycreat() {
  984. let sign =
  985. `
  986. <div id="mydiv" style='position: absolute;top:50px;left:3px;height:330px;width:480px;background: rgba(255,255,255,1); border-radius:0px; margin-top:0px'>
  987. <div style="">烟感设备</div>
  988. <div id="deviceListTable" lay-filter="test" ></div>
  989. </div>
  990. `;
  991. $('#div2d').append($(sign));
  992. (function () {
  993. let loginUser = {
  994. "V_LOGINNAME": "admin",
  995. "V_PASSWORD": "e10adc3949ba59abbe56e057f20f883e",
  996. }
  997. var queryData = {}
  998. queryData.queryJson = JSON.stringify(loginUser);
  999. layui.use('table', function () {
  1000. var table = layui.table;
  1001. table.render({
  1002. elem: '#deviceListTable',
  1003. size: 'sm', //小尺寸的表格
  1004. height: 300, //固定值
  1005. skin: 'nob ',
  1006. where: queryData //如果无需传递额外参数,可不加该参数
  1007. , method: 'post' //如果无需自定义HTTP类型,可不加该参数
  1008. , url: 'http://101.133.214.75:8080/Device_Manager/thingjs/queryYgList',
  1009. cols: [
  1010. [{
  1011. field: 'ownerName',
  1012. title: '设备名称',
  1013. fixed: 'left',
  1014. unresize: true,
  1015. sort: true
  1016. }, {
  1017. field: 'ownerCode',
  1018. title: '设备编号'
  1019. }, {
  1020. field: 'unitinfo',
  1021. title: '详细地址',
  1022. sort: true
  1023. }, {
  1024. field: 'ownerXh',
  1025. title: '型号'
  1026. }
  1027. ]
  1028. ]
  1029. , page: true
  1030. });
  1031. //监听行单击事件(双击事件为:rowDouble)
  1032. table.on('row(test)', function (obj) {
  1033. app.level.change(app.buildings[0]);
  1034. var ownerCode = obj.data.ownerCode;
  1035. deviceID = app.query("#" + ownerCode)[0];
  1036. // debugger
  1037. var domDiv = document.getElementById('bottomBackground');
  1038. if (domDiv) {
  1039. domDiv.remove();
  1040. }
  1041. app.camera.flyTo({
  1042. object: deviceID,
  1043. xAngle: 45, // 绕物体自身X轴旋转角度
  1044. yAngle: -45, // 绕物体自身Y轴旋转角度
  1045. radiusFactor: 4, // 物体包围盒半径的倍数
  1046. time: 2 * 1000,
  1047. complete: function () {
  1048. }
  1049. });
  1050. // debugger
  1051. // layer.alert(JSON.stringify(ownerCode), {
  1052. // title: '当前行数据:'
  1053. // });
  1054. //标注选中样式
  1055. obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
  1056. });
  1057. });
  1058. })();
  1059. };
  1060. }
  1061. function updateData(obj) {
  1062. // debugger
  1063. /** ******************* 以下为websoket数据对接 ********************/
  1064. // 对接自有websoket服务器
  1065. if (!webSocket) {
  1066. // 如果网站是 https 则对应 wss
  1067. // 如果网站是 http 则对应 ws 即可
  1068. webSocket = new WebSocket('ws://101.133.214.75:8080/Device_Manager/socket');
  1069. // 建立 websocket 连接成功触发事件
  1070. webSocket.onopen = function () {
  1071. console.log("websoket服务器连接成功...");
  1072. };
  1073. // 接收服务端数据时触发事件
  1074. webSocket.onmessage = function (evt) {
  1075. queryDeviceStatus(evt);
  1076. };
  1077. webSocket.onclose = function (evt) {
  1078. console.log("websoket关闭...");
  1079. webSocket = null;
  1080. }
  1081. }
  1082. }
  1083. class MainPanel {
  1084. constructor(app) {
  1085. this.app = app;
  1086. this.panels_znyg = [];
  1087. this.panels_znjk = [];
  1088. this.panels_znef = [];
  1089. this.toolBar = null;
  1090. this.toolImgs = {};
  1091. this.isExpandBuilding = false;
  1092. this.building = this.app.buildings[0];
  1093. }
  1094. // 创建工具面板
  1095. createToolsPanel() {
  1096. var that = this;
  1097. var baseURL = "http://47.103.74.123/ThingjsIcon/";
  1098. // this.toolBar = THING.widget.ToolBar({ width: '12%', media: true,captionPos:'hover',opacity:0.5});
  1099. this.toolBar = THING.widget.Banner({ column: 'left', width: '20px', media: true, captionPos: 'hover', opacity: 0.5 });
  1100. this.toolBar.data = sidebar
  1101. this.toolBar.setPosition({ right: 0, top: 60 });
  1102. this.toolImgs.img1 = this.toolBar.addImageBoolean(this.toolBar.data, 'znyg').name('智能烟感').imgUrl(iconUrl + '智能烟感.png');
  1103. this.toolImgs.img2 = this.toolBar.addImageBoolean(this.toolBar.data, 'znjk').name('监控').imgUrl(iconUrl + '摄像头.png');
  1104. this.toolImgs.img3 = this.toolBar.addImageBoolean(this.toolBar.data, 'enterBuilding').name('进入建筑').imgUrl(iconUrl + '建筑.png');
  1105. this.toolImgs.img4 = this.toolBar.addImageBoolean(this.toolBar.data, 'expandBuilding').name('楼层展开').imgUrl(iconUrl + '多楼层.png');
  1106. this.toolImgs.img5 = this.toolBar.addImageBoolean(this.toolBar.data, 'deviceShow').name('建筑透视').imgUrl(iconUrl + '透视.png');
  1107. this.toolImgs.img1.on('change', function (boolValue) { that.onChangeImageButton('znyg', boolValue); });
  1108. this.toolImgs.img2.on('change', function (boolValue) { that.onChangeImageButton('znjk', boolValue); });
  1109. this.toolImgs.img3.on('change', function (boolValue) { that.onChangeImageButton('enterBuilding', boolValue); });
  1110. this.toolImgs.img4.on('change', function (boolValue) { that.onChangeImageButton('expandBuilding', boolValue); });
  1111. this.toolImgs.img5.on('change', function (boolValue) { that.onChangeImageButton('deviceShow', boolValue); });
  1112. }
  1113. addButton(name) {
  1114. var that = this;
  1115. if (this.toolImgs.img6) {
  1116. this.toolImgs.img6.remove()
  1117. }
  1118. if (this.toolImgs.img7) {
  1119. this.toolImgs.img7.remove()
  1120. }
  1121. this.toolImgs.img6 = this.toolBar.addImageBoolean(this.toolBar.data, 'equipment').name('设备选择器').imgUrl(iconUrl + '设备.png');
  1122. this.toolImgs.img6.on('change', function (boolValue) { that.onChangeImageButton('equipment', boolValue); });
  1123. this.toolImgs.img7 = this.toolBar.addImageBoolean(this.toolBar.data, 'device_add').name('模型创建').imgUrl(iconUrl + '设备.png');
  1124. this.toolImgs.img7.on('change', function (boolValue) { that.onChangeImageButton('device_add', boolValue); });
  1125. if (name != "Floor") {
  1126. this.toolImgs.img6.remove();
  1127. this.toolImgs.img7.remove();
  1128. }
  1129. }
  1130. // 处理工具条按钮
  1131. onChangeImageButton(key, boolValue) {
  1132. var that = this;
  1133. if (key == "enterBuilding") { // 进入建筑/室外
  1134. this.goinBuild(boolValue, key);
  1135. } else if (key == "deviceShow") {//展示全部设备隐藏楼层
  1136. var devicList = [];
  1137. var build = app.buildings[0]
  1138. var opacity = build.style.opacity;// 0 为全透明 ,1 为不透明
  1139. build.style.opacity = (opacity > 0.8) ? 0.1 : 1.0;
  1140. if (boolValue) {
  1141. this.goinBuild(boolValue);
  1142. // updateData();
  1143. }
  1144. else {
  1145. flash(devicList, "none");
  1146. reset(devicList);
  1147. }
  1148. }
  1149. else if (key == "expandBuilding") { // 楼层横向展开
  1150. this.app.level.change(app.buildings[0]); // 进入建筑
  1151. if ($(this).hasClass('active')) {
  1152. horizontalExpand(building, 'close');
  1153. verticalExpand(building, 'close');
  1154. }
  1155. if (boolValue) {
  1156. coordinate = [24.7179997, 111.99999690000001, -3.2360001];
  1157. coordinate_1 = [37.5919984, 111.99999690000001, -3.2140001000000002];
  1158. coordinate_2 = [37.6669991, 111.99999690000001, -10.439000400000001];
  1159. coordinate_3 = [24.8049996, 111.99999690000001, -10.434000300000001];
  1160. this.personclick(coordinate, coordinate_1, coordinate_2, coordinate_3)
  1161. this.building.expandFloors({
  1162. 'time': 1000,
  1163. 'length': 4,
  1164. 'horzMode': false,
  1165. 'hideRoof': true,
  1166. 'complete': function () {
  1167. that.isExpandBuilding = true;
  1168. }
  1169. })
  1170. } else {
  1171. coordinate = [24.7179997, 59.9999969, -3.2360001];
  1172. coordinate_1 = [37.5919984, 59.9999969, -3.2140001000000002];
  1173. coordinate_2 = [37.6669991, 59.9999969, -10.439000400000001];
  1174. coordinate_3 = [24.8049996, 59.9999969, -10.434000300000001];
  1175. this.personclick(coordinate, coordinate_1, coordinate_2, coordinate_3)
  1176. this.building.unexpandFloors({
  1177. 'time': 500,
  1178. 'complete': function () { that.isExpandBuilding = false; }
  1179. })
  1180. }
  1181. } else if (key == "znyg") {
  1182. if (boolValue) {//智能烟感
  1183. createDeviceListTable();
  1184. } else {
  1185. destroyPanel();
  1186. }
  1187. } else if (key == "equipment") {
  1188. boolValue ? equipment("设备选择器") : panel_.destroy(); //设备选择器
  1189. } else if (key == "device_add") {
  1190. //模型创建
  1191. if (boolValue) {
  1192. equipment("模型创建")
  1193. } else {
  1194. panel_.destroy()
  1195. }
  1196. deviceIcon_click("iframe", "iframe");
  1197. } else {
  1198. if (key == "znjk") { //监控
  1199. // came(boolValue)
  1200. if (boolValue) {
  1201. createmonitorlist();
  1202. } else {
  1203. destroyMonitor();
  1204. }
  1205. }
  1206. }
  1207. }
  1208. personclick(coordinate, coordinate_1, coordinate_2, coordinate_3) {
  1209. var car = app.query(new_name)[0];
  1210. if (car != null && car != "") {
  1211. person.playAnimation({ name: new_animationNames, loopType: 'repeat' });
  1212. var path = [coordinate, coordinate_1, coordinate_2, coordinate_3, coordinate];
  1213. car.movePath({
  1214. orientToPath: true, // 物体移动时沿向路径方向
  1215. path: path, // 路径坐标点数组
  1216. time: 50 * 1000, // 路径总时间 毫秒
  1217. delayTime: 1000, // 延时 1s 执行
  1218. lerpType: null, // 插值类型(默认为线性插值)此处设置为不插值
  1219. // 循环类型
  1220. // THING.LoopType.Repeat 不断循环
  1221. // THING.LoopType.PingPong 往复循环
  1222. loopType: THING.LoopType.Repeat,
  1223. })
  1224. }
  1225. }
  1226. // 展开的楼层收回去
  1227. resetExpand() {
  1228. var that = this;
  1229. if (this.isExpandBuilding) {
  1230. this.toolBar.data.expandBuilding = false;
  1231. this.building.unexpandFloors({
  1232. 'time': 500,
  1233. 'complete': function () { that.isExpandBuilding = false; }
  1234. })
  1235. }
  1236. }
  1237. goinBuild(boolValue) {
  1238. this.resetExpand();
  1239. var name = boolValue ? '返回室外' : '进入建筑';
  1240. this.toolImgs.img3.name(name);
  1241. if (boolValue) {
  1242. this.app.level.change(app.buildings[0]);
  1243. var domDiv = document.getElementById('bottomBackground');
  1244. if (domDiv) {
  1245. domDiv.remove();
  1246. }
  1247. }
  1248. else {
  1249. this.app.level.change(app.root.campuses[0]);
  1250. // showParkingInfo();
  1251. }
  1252. }
  1253. }