杨浦.js 23 KB

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