杨浦16.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. var filePath = '/uploads/wechat/5oiR5pyJ5pyA6ZW/55qE572R5ZCN5LiN5L+h5L2g5pWw5pWw/file/ScenePreview/';
  2. // 需要用到的外部文件
  3. var fileArr = [
  4. "https://www.layuicdn.com/layui/layui.js",
  5. 'https://www.layuicdn.com/layui/css/layui.css',
  6. filePath + 'assets/css/index.css', // 功能按钮样式文件
  7. filePath + 'assets/font-awesome-4.7.0/css/font-awesome.min.css', // 功能按钮字体样式
  8. filePath + 'assets/css/myAlert.css', // 弹出框样式
  9. filePath + 'assets/css/sweetalert2.min.css', // 弹出框样式
  10. filePath + 'assets/js/sweetalert2.all.min.js', // 弹出框脚本
  11. filePath + 'assets/js/myAlert.js', // 弹出框脚本
  12. filePath + 'assets/js/posTransform.js', // 不同坐标系经纬度互相转换的脚本文件
  13. filePath + 'assets/js/expandFloor.js', // 楼层展开脚本
  14. '/guide/lib/echarts.min.js',
  15. '/uploads/wechat/163607/file/杨浦16/js/removeMark.js',//清除标注脚本
  16. '/uploads/wechat/163607/file/杨浦16/js/UIAnchor.js',//UI界面脚本
  17. '/uploads/wechat/163607/file/杨浦16/js/FloorClick.js',//创建切换楼层脚本
  18. '/uploads/wechat/163607/file/杨浦16/js/MainPanel.js',//公共工具功能脚本
  19. '/uploads/wechat/163607/file/杨浦16/js/CreateHtml.js',//创建页面元素脚本
  20. '/uploads/wechat/163607/file/杨浦16/js/public.js',//公共场景功能脚本
  21. '/uploads/wechat/163607/file/杨浦16/js/ChangeScene.js',//场景切换脚本
  22. ];
  23. /**
  24. * 说明:加载外部文件
  25. */
  26. THING.Utils.dynamicLoad(fileArr, function () {});
  27. // 创建app
  28. var app = new THING.App({
  29. url: '/api/scene/0b75dc5f4460f22c329afd96',
  30. // url: '/api/scene/a8fba28ea8b1c077d74d801e',//城科大楼
  31. // url: '/api/scene/8fe9eaf0118f74c71010bc19',//宝钢又一村31号
  32. // url: '/api/scene/ab93bd9640a9db05a4937351',
  33. // url: '/api/scene/e1137071cd763730846f50ba',//常福医院
  34. background: 'https://www.thingjs.com/static/images/background_img_03.png'
  35. });
  36. //设备列表
  37. var buildingStore;
  38. // $.ajax({
  39. // type: "GET",
  40. // url:'/uploads/wechat/163607/file/杨浦16/buildingStore.json',
  41. // dataType: "json",
  42. // async: false,
  43. // success: function (data) {
  44. // buildingStore = data.buildingStore
  45. // }
  46. // });
  47. app.camera.xAngleLimitRange = [0, 90];
  48. var truck;
  49. var campusUrl;//场景列表
  50. var dataObj = { progress: 0 }; // 场景加载进度条数据对象
  51. var loadingPanel; // 进度条界面组件
  52. var curCampus;//存放园区url路径
  53. var company_code;
  54. var buildingStore;
  55. var miniMapCtrl = null; // 小地图控件
  56. var webSocket;//webSocket
  57. var tileLayer1 = null; // 加入地图背景后选用的图层
  58. var box = null; // 鼠标点击第一人称行走按钮时,红色盒子提示
  59. var fpsCtrl = null; // 第一人称行走控件
  60. var cameraInitPos = null; // 进入第一人称行走前摄像机位置
  61. var fullScreenState = false; // 全屏
  62. var skyBox = null; // 天空盒
  63. var hiddenControlTimer = null; // 隐藏控制按钮计时器
  64. var showControlTimer = null; // 显示控制按钮计时器
  65. var cameraDistace = [];
  66. var building = null, mainPanle; // 建筑
  67. var restartTime = 5000; // 自动旋转停止后重启时间间隔
  68. var rotateTimer = null; // 自动旋转计时器
  69. //var baseURL = "http://47.103.74.123/ThingjsIcon/";
  70. // var baseURL = "https://s3.ax1x.com/2021/01/28/";
  71. var baseURL = "/uploads/wechat/163607/file/杨浦16/icons/";
  72. app.on('load', function (ev) {
  73. curCampus = ev.campus;
  74. skyBox = app.skyBox; // 获取天空盒
  75. app.level.change(ev.campus); // 切换至园区层级
  76. ev.campus.azimuth = '180';
  77. // setupNavpanel();
  78. // creatFloorChoose(); //======================================本地数据测试===============================================
  79. // 获取园区在CampusBuilder编辑时保存的地理位置
  80. let tjsLnglat = app.root.defaultCampus.extraData;
  81. if (tjsLnglat != undefined && tjsLnglat != null) {
  82. tjsLnglat = tjsLnglat.coordinates;
  83. if (tjsLnglat != undefined && tjsLnglat != null) {
  84. tjsLnglat = tjsLnglat.split(",");
  85. }
  86. } else {
  87. ev.campus.extraData = { coordinates: "116.4641,39.98606" } // 园区绑定默认经纬度,地图才生效
  88. }
  89. });
  90. // 监听建筑层级的 LeaveLevel 事件
  91. app.on(THING.EventType.LeaveLevel, ".Building", function (ev) {
  92. // 要进入的层级对象
  93. var current = ev.current;
  94. // 上一层级对象(退出的层级)
  95. var preObject = ev.previous;
  96. if (current.parent === preObject) {
  97. removeMark();
  98. }
  99. else {
  100. removeMark();
  101. }
  102. })
  103. /**
  104. * 说明:注册事件
  105. */
  106. function registerEvent() {
  107. var _this = this
  108. // 楼层横向展开按钮的点击事件,楼层展开只在建筑有2层或2层以上的楼层才会生效
  109. $('#horizontalExpansion').on('click', function () {
  110. stopRotate();
  111. checkBtnActives(['#mapBg', '#sceneSetting']);
  112. let expandState = building.getAttribute('expandState');
  113. if ($(this).hasClass('active')) {
  114. // 楼层横向展开关闭
  115. if (expandState == 'horizontal') {
  116. $(this).removeClass('active');
  117. horizontalExpand(building, 'close');
  118. }
  119. } else {
  120. // 楼层横向展开前应判断楼层是否处于垂直展开状态,是,则应先关闭垂直展开,然后横向展开
  121. if (expandState != 'moving') {
  122. $(this).addClass('active');
  123. $('#verticalExpansion').removeClass('active');
  124. if (expandState == 'vertical') {
  125. verticalToHorizontal(building);
  126. } else {
  127. horizontalExpand(building, 'horizontal');
  128. }
  129. }
  130. }
  131. restarRotate();
  132. });
  133. // 楼层垂直展开按钮的点击事件,楼层展开只在建筑有2层或2层以上的楼层才会生效
  134. $('#verticalExpansion').on('click', function () {
  135. stopRotate();
  136. checkBtnActives(['#mapBg', '#sceneSetting']);
  137. let expandState = building.getAttribute('expandState');
  138. if ($(this).hasClass('active')) {
  139. // 楼层垂直展开关闭
  140. if (expandState == 'vertical') {
  141. $(this).removeClass('active');
  142. verticalExpand(building, 'close');
  143. }
  144. } else {
  145. // 楼层垂直展开前应判断楼层是否处于横向展开状态,是,则应先关闭横向展开,然后垂直展开
  146. if (expandState != 'moving') {
  147. $(this).addClass('active');
  148. $('#horizontalExpansion').removeClass('active');
  149. if (expandState == 'horizontal') {
  150. horizontalToVertical(building);
  151. } else {
  152. verticalExpand(building, 'vertical');
  153. }
  154. }
  155. }
  156. restarRotate();
  157. });
  158. // 设置按钮点击事件,按钮的tip与功能面板的互相切换
  159. $('#sceneSetting').on('click', function () {
  160. checkBtnActives(['#mapBg']);
  161. if ($(this).hasClass('active')) {
  162. $(this).removeClass('active');
  163. $(this).children('.control-menu').removeClass('actives');
  164. $(this).find('.tooltiptext').css({ "visibility": "visible" });
  165. } else {
  166. $(this).addClass('active');
  167. $(this).children('.control-menu').addClass('actives');
  168. $(this).find('.tooltiptext').css({ "visibility": "hidden" });
  169. }
  170. }).hover(function () {
  171. if (!$(this).hasClass('active')) {
  172. $(this).find('.tooltiptext').css({ "visibility": "visible" });
  173. }
  174. }, function () {
  175. $(this).find('.tooltiptext').css({ "visibility": "hidden" });
  176. });
  177. // 设置li标签添加点击事件
  178. $('#sceneSetting .control-menu-pane li').on('click', function (ev) {
  179. //ev.stopPropagation();
  180. if ($(this).hasClass('selected')) {
  181. stopRotate();
  182. $(this).removeClass('selected');
  183. } else {
  184. $(this).addClass('selected');
  185. restarRotate();
  186. }
  187. });
  188. // 小地图的开启/关闭按钮的鼠标点击事件
  189. $('#miniMap').on('click', function () {
  190. if ($(this).hasClass('active')) {
  191. $(this).removeClass('active');
  192. destoryMiniMap();
  193. } else {
  194. $(this).addClass('active');
  195. createMiniMap();
  196. }
  197. checkBtnActives(['#mapBg', '#sceneSetting']);
  198. });
  199. // 地图背景的开启/关闭按钮的鼠标点击事件,按钮的tip与功能面板的互相切换
  200. $('#mapBg').on('click', function () {
  201. checkBtnActives(['#sceneSetting']);
  202. if ($(this).hasClass('active')) {
  203. $(this).removeClass('active');
  204. $(this).children('.control-menu').removeClass('actives');
  205. $(this).find('.tooltiptext').css({ "visibility": "visible" });
  206. } else {
  207. $(this).addClass('active');
  208. $(this).children('.control-menu').addClass('actives');
  209. $(this).find('.tooltiptext').css({ "visibility": "hidden" });
  210. }
  211. }).hover(function () {
  212. if (!$(this).hasClass('active')) {
  213. $(this).find('.tooltiptext').css({ "visibility": "visible" });
  214. }
  215. }, function () {
  216. $(this).find('.tooltiptext').css({ "visibility": "hidden" });
  217. });
  218. // 进入层级事件
  219. app.on(THING.EventType.EnterLevel, function (ev) {
  220. app.background = 'https://www.thingjs.com/static/images/background_img_03.png'
  221. stopRotate();
  222. // 进入建筑层级
  223. if (ev.object.type == 'Building') {
  224. var id = document.getElementById("rightSideSwitch")
  225. if(id == null){
  226. creatFloorChoose();//创建楼层选择器
  227. }
  228. //清除设备列表和面板
  229. _this.delMydiv();
  230. _this.destroy_ui();
  231. let floors = ev.object.floors;
  232. if (floors.length > 1) {
  233. building = ev.object;
  234. addFloorPos(building);
  235. let expandState = building.getAttribute('expandState');
  236. if (expandState == null) {
  237. building.setAttribute('expandState', 'close');
  238. }
  239. $('#horizontalExpansion').css({ 'display': 'block' });
  240. $('#verticalExpansion').css({ 'display': 'block' });
  241. }
  242. } else {
  243. $('#horizontalExpansion').css({ 'display': 'none' });
  244. $('#verticalExpansion').css({ 'display': 'none' });
  245. // 进入园区层级
  246. if (ev.object.type == 'Campus') {
  247. if (building != null) {
  248. exitBuildingCloseFloor(building);
  249. $('#horizontalExpansion').removeClass('active');
  250. $('#verticalExpansion').removeClass('active');
  251. building = null;
  252. }
  253. }
  254. }
  255. if (skyBox != null) {
  256. app.skyBox = skyBox;
  257. }
  258. // 重新创建小地图
  259. if ($('#miniMap').hasClass('active')) {
  260. destoryMiniMap();
  261. createMiniMap();
  262. }
  263. });
  264. // 行走按钮的鼠标点击事件
  265. $('#moveByFps').on('click', function () {
  266. stopRotate();
  267. if ($(this).hasClass('active')) {
  268. $(this).removeClass('active');
  269. if (box != null) {
  270. // 恢复默认双击进入层级事件
  271. app.resumeEvent(THING.EventType.DBLClick, '*', THING.EventTag.LevelEnterOperation);
  272. // 恢复默认右键退出层级事件
  273. app.resumeEvent(THING.EventType.Click, '*', THING.EventTag.LevelBackOperation);
  274. box.destroy();
  275. box = null;
  276. }
  277. if (fpsCtrl != null) {
  278. exitFps();
  279. }
  280. } else {
  281. $(this).addClass('active');
  282. // 禁用默认双击进入层级事件
  283. app.pauseEvent(THING.EventType.DBLClick, '*', THING.EventTag.LevelEnterOperation);
  284. // 禁用默认右键退出层级事件
  285. app.pauseEvent(THING.EventType.Click, '*', THING.EventTag.LevelBackOperation);
  286. // 记录摄像机当前位置
  287. cameraInitPos = [app.camera.position, app.camera.target];
  288. createBox();
  289. }
  290. checkBtnActives(['#mapBg', '#sceneSetting']);
  291. });
  292. // 全屏按钮的鼠标抬起事件
  293. $('#fullScreen').mouseup(function () {
  294. if (!fullScreenState) {
  295. $('.btn-full-screen').css('display', 'none');
  296. $('.btn-narrow').css('display', 'block');
  297. $('#fullScreen span').text('退出全屏');
  298. fullScreen();
  299. fullScreenState = true;
  300. } else {
  301. $('.btn-full-screen').css('display', 'block');
  302. $('.btn-narrow').css('display', 'none');
  303. $('#fullScreen span').text('全屏');
  304. exitFullScreen();
  305. fullScreenState = false;
  306. if ($('#mapBg').hasClass('active')) {
  307. destoryMiniMap();
  308. createMiniMap();
  309. }
  310. }
  311. checkBtnActives(['#mapBg', '#sceneSetting']);
  312. });
  313. // 鼠标键按下事件,功能按钮隐藏
  314. app.on(THING.EventType.MouseDown, function () {
  315. app.pauseEvent(THING.EventType.CameraZoom, null, '摄像机前后滚动,功能图片隐藏');
  316. if (showControlTimer != null) {
  317. clearTimeout(showControlTimer);
  318. showControlTimer = null;
  319. }
  320. stopRotate();
  321. if (hiddenControlTimer == null) {
  322. clearTimeout(showControlTimer);
  323. hiddenControlTimer = setTimeout(function () {
  324. $('#all-controls').css('display', 'none');
  325. clearTimeout(hiddenControlTimer);
  326. hiddenControlTimer = null;
  327. }, 300);
  328. }
  329. });
  330. // 鼠标键抬起事件,功能按钮显示
  331. app.on(THING.EventType.MouseUp, function () {
  332. app.resumeEvent(THING.EventType.CameraZoom, null, '摄像机前后滚动,功能图片隐藏');
  333. if (hiddenControlTimer != null) {
  334. clearTimeout(hiddenControlTimer);
  335. hiddenControlTimer = null;
  336. }
  337. if (showControlTimer == null) {
  338. showControlTimer = setTimeout(function () {
  339. $('#all-controls').css('display', 'block');
  340. clearTimeout(showControlTimer);
  341. showControlTimer = null;
  342. restarRotate();
  343. }, 300);
  344. }
  345. });
  346. let count = 0;
  347. // 鼠标滑轮滚动
  348. app.on(THING.EventType.CameraZoom, function () {
  349. if (showControlTimer != null) {
  350. count = 0;
  351. return;
  352. }
  353. stopRotate();
  354. if (showControlTimer == null) {
  355. $('#all-controls').css('display', 'none');
  356. showControlTimer = setInterval(function () {
  357. count++;
  358. if (count >= 2) {
  359. $('#all-controls').css('display', 'block');
  360. restarRotate();
  361. clearInterval(showControlTimer);
  362. showControlTimer = null;
  363. }
  364. }, 300);
  365. }
  366. }, '摄像机前后滚动,功能图片隐藏');
  367. // 鼠标移动事件,已创建的红色胶囊跟随鼠标移动
  368. app.on(THING.EventType.MouseMove, function (ev) {
  369. if (box != null) {
  370. if (ev.picked) {
  371. box.position = ev.pickedPosition;
  372. }
  373. }
  374. });
  375. // 摄像机位置改变结束事件,记录当前摄像机位置与目标点x,y,z的差
  376. app.on(THING.EventType.CameraChangeEnd, function () {
  377. if (cameraDistace.length > 0) {
  378. let caPos = app.camera.position;
  379. let scePos = app.root.defaultCampus.position;
  380. cameraDistace = [caPos[0] - scePos[0], caPos[1] - scePos[1], caPos[2] - scePos[2]];
  381. }
  382. restarRotate();
  383. });
  384. // 点击事件,放置红色胶囊,进入第一人称行走
  385. app.on(THING.EventType.Click, function (ev) {
  386. stopRotate();
  387. if (ev.button == 0 && box != null) {
  388. let pos = box.position;
  389. box.destroy();
  390. box = null;
  391. app.camera.flyTo(pos);
  392. enterFps([pos[0], pos[1] + 2, pos[2]]);
  393. }
  394. checkBtnActives(['#mapBg', '#sceneSetting']);
  395. });
  396. // 进入层级事件,退出第一人称行走
  397. app.on(THING.EventType.EnterLevel, function () {
  398. if (fpsCtrl != null) {
  399. exitFps();
  400. }
  401. });
  402. // 离开层级事件,停止旋转
  403. app.on(THING.EventType.LeaveLevel, function () {
  404. stopRotate();
  405. })
  406. // 鼠标滑轮事件,停止旋转
  407. app.on(THING.EventType.MouseWheel, function () {
  408. stopRotate();
  409. })
  410. // 场景添加键盘按下事件,当进入第一人称行走时,按下esc键退出第一人称行走
  411. app.on(THING.EventType.KeyDown, function (ev) {
  412. if (ev.code == 'Escape') {
  413. if (box != null) {
  414. app.resumeEvent(THING.EventType.DBLClick, '*', THING.EventTag.LevelEnterOperation);
  415. app.resumeEvent(THING.EventType.Click, '*', THING.EventTag.LevelBackOperation);
  416. box.destroy();
  417. box = null;
  418. $('#moveByFps').removeClass('active');
  419. restarRotate();
  420. }
  421. if (fpsCtrl != null) {
  422. exitFps();
  423. restarRotate();
  424. }
  425. checkBtnActives(['#mapBg', '#sceneSetting']);
  426. }
  427. });
  428. window.onresize = function () {
  429. if (!checkFull()) {
  430. //要执行的动作
  431. if (fullScreenState == true) {
  432. $('.btn-full-screen').css('display', 'block');
  433. $('.btn-narrow').css('display', 'none');
  434. $('#fullScreen span').text('全屏');
  435. fullScreenState = false;
  436. }
  437. }
  438. }
  439. }
  440. //====设备闪烁提示====
  441. function flash(objArray) {
  442. objArray.forEach(function (obj) {
  443. obj.on('update', function () {
  444. obj.style.color = '#FFF000'
  445. obj.style.opacity = 0.5 + 0.5 * Math.sin(2 * app.elapsedTime / 500);
  446. }, '每帧改变透明度');
  447. })
  448. }
  449. function queryDeviceStatus(evt) {
  450. objArray = evt.data;
  451. // objArray.forEach(function (deviceobj) {
  452. // obj = app.query("#" + deviceobj.ownerCode)[0];
  453. // obj.on('update', function () {
  454. // obj.style.color = '#FF0000'
  455. // obj.style.opacity = 0.5 + 0.5 * Math.sin(2 * app.elapsedTime / 500);
  456. // }, '每帧改变透明度');
  457. // })
  458. obj = app.query("#" + objArray)[0];
  459. obj.on('update', function () {
  460. obj.style.color = '#FF0000'
  461. obj.style.opacity = 0.5 + 0.5 * Math.sin(2 * app.elapsedTime / 500);
  462. }, '每帧改变透明度');
  463. }
  464. function reset(objArray) {
  465. objArray.forEach(function (obj) {
  466. obj.style.opacity = 1.0;
  467. obj.style.color = null;
  468. obj.off('update', null, '每帧改变透明度');
  469. })
  470. }
  471. var timer = null;
  472. function getTabledata(d) {
  473. var ygArray = [];
  474. d.forEach(function (d) {
  475. var deviceInfo = {
  476. "设备编号": d.ownerCode,
  477. "设备名称": d.ownerName,
  478. "安装位置": d.unitinfo,
  479. };
  480. ygArray.push(deviceInfo)
  481. })
  482. // 表格数据//创建对象 book
  483. var tableData = {
  484. // 列标题
  485. props: ['设备编号', '设备名称', '安装位置'],
  486. // 列数据
  487. items: ygArray
  488. };
  489. return tableData;
  490. }
  491. function createPerson(name, age, family) {
  492. var o = new Object();
  493. o.name = name;
  494. o.age = age;
  495. o.family = family;
  496. o.say = function () {
  497. alert(this.name);
  498. }
  499. return o;
  500. }
  501. function destroyPanel() {
  502. var mydiv = document.getElementById('mydiv')
  503. mydiv.remove();
  504. }
  505. //====================
  506. function updateData(obj) {
  507. /** ******************* 以下为websoket数据对接 ********************/
  508. // 对接自有websoket服务器
  509. if (!webSocket) {
  510. // 如果网站是 https 则对应 wss
  511. // 如果网站是 http 则对应 ws 即可
  512. webSocket = new WebSocket('ws://101.133.214.75:8080/Device_Manager/socket');
  513. // 建立 websocket 连接成功触发事件
  514. webSocket.onopen = function () {
  515. };
  516. // 接收服务端数据时触发事件
  517. webSocket.onmessage = function (evt) {
  518. queryDeviceStatus(evt);
  519. };
  520. webSocket.onclose = function (evt) {
  521. webSocket = null;
  522. }
  523. }
  524. }
  525. //接收父级页面数据
  526. function userListener(data) {
  527. buildingStore = data.data;
  528. }
  529. // 监听用户页面传回的数据 并调用 ThingJS 页面方法
  530. window.addEventListener('message', function (e) {
  531. var _this=this;
  532. var array;
  533. var data = e.data;
  534. // console.log(JSON.stringify(data))
  535. var funcName = data.funcName;
  536. var param = data.param;
  537. var company_code = e.data.param.company_code
  538. // 调用 ThingJS 页面方法
  539. window[funcName](param);
  540. //请求场景url的json文件
  541. $.ajax({
  542. type: "GET",
  543. url:'/uploads/wechat/163607/file/杨浦16/park.json',
  544. dataType: "json",
  545. success: function (data) {
  546. for(let i = 0; i < data.array.length; i++){
  547. if(company_code === data.array[i].id){
  548. campusUrl = data.array[i]
  549. _this.changeScene(campusUrl);
  550. _this.createWidgets();
  551. }
  552. }
  553. }
  554. });
  555. });
  556. //父级页面数据处理
  557. function cleanObj(arr, key) {
  558. var map = {},
  559. dest = [];
  560. for (var i = 0; i < arr.length; i++) {
  561. var ai = arr[i];
  562. if (!map[ai.min_level]) {
  563. dest.push({
  564. min_level: ai.min_level,
  565. item: [ai]
  566. });
  567. map[ai.min_level] = ai;
  568. } else {
  569. for (var j = 0; j < dest.length; j++) {
  570. var dj = dest[j];
  571. if (dj.min_level == ai.min_level) {
  572. dj.item.push(ai);
  573. break;
  574. }
  575. }
  576. }
  577. }
  578. return dest;
  579. }
  580. function uniq(array) {
  581. var temp = []; //一个新的临时数组
  582. for (var i = 0; i < array.length; i++) {
  583. if (temp.indexOf(array[i]) == -1) {
  584. temp.push(array[i]);
  585. }
  586. }
  587. return temp;
  588. }
  589. //设备点位标识
  590. // function createDeviceElement(deviceType, floorNum) {
  591. // removeMark();
  592. // let data = cleanObj(buildingStore);
  593. // for (var i = 0; i < data.length; i++) {
  594. // if (data[i].min_level == floorNum) {
  595. // let arry = data[i].item;
  596. // for (var q = 0; q < arry.length; q++) {
  597. // if (arry[q].dwtype == deviceType) {
  598. // let devicename = arry[q].device_name;
  599. // let dwtype = arry[q].dwtype;
  600. // var ownercode = arry[q].owner_code
  601. // var textAndPictureMarkerHtml =
  602. // `<div class="textAndPictureMarker" onclick="deviceIcon_click('${dwtype}','${floorNum}','${ownercode}')" style="position: absolute;">
  603. // <div class="text" style="color: #FF0000;font-size: 12px;text-shadow: white 0px 2px, white 2px 0px, white -2px 0px, white 0px -2px, white -1.4px -1.4px, white 1.4px 1.4px, white 1.4px -1.4px, white -1.4px 1.4px;margin-bottom: 5px;">
  604. // `+ devicename + `
  605. // </div>
  606. // <div class="picture" style="height: 30px;width: 30px;margin: auto;">
  607. // <img src="/guide/examples/images/navigation/pointer.png" style="height: 100%;width: 100%;">
  608. // </div>
  609. // </div>`;
  610. // $('#div3d').append($(textAndPictureMarkerHtml));
  611. // createUIAnchor(floorNum);
  612. // }
  613. // }
  614. // }
  615. // }
  616. // }