data.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. var wallData = [{
  2. "id": "0_0",
  3. "roomIndex": 0,
  4. "points": [{
  5. "x": 1.62,
  6. "y": 0.501
  7. }, {
  8. "x": 1.62,
  9. "y": -4.124
  10. }],
  11. "linkedLineID": ["0_6", "0_1"],
  12. "casements": [{
  13. "points": [{
  14. "x": 1.62,
  15. "y": 0.501
  16. }, {
  17. "x": 1.62,
  18. "y": -1
  19. }]
  20. }]
  21. },
  22. {
  23. "id": "0_1",
  24. "roomIndex": 0,
  25. "points": [{
  26. "x": 1.62,
  27. "y": -4.124
  28. }, {
  29. "x": 8.295,
  30. "y": -5.874
  31. }],
  32. "linkedLineID": ["0_0", "0_2"],
  33. "doors": [{
  34. "points": [{
  35. "x": 1.62,
  36. "y": -4.124
  37. }, {
  38. x: 3.845,
  39. y: -4.707333333333333
  40. }]
  41. }]
  42. },
  43. {
  44. "id": "0_2",
  45. "roomIndex": 0,
  46. "points": [{
  47. "x": 8.295,
  48. "y": -5.874
  49. }, {
  50. "x": 10.67,
  51. "y": -5.874
  52. }],
  53. "linkedLineID": ["0_1", "0_3"]
  54. },
  55. {
  56. "id": "0_3",
  57. "roomIndex": 0,
  58. "points": [{
  59. "x": 10.67,
  60. "y": -5.874
  61. }, {
  62. "x": 10.67,
  63. "y": -10.924
  64. }],
  65. "linkedLineID": ["0_2", "0_4"]
  66. },
  67. {
  68. "id": "0_4",
  69. "roomIndex": 0,
  70. "points": [{
  71. "x": 10.67,
  72. "y": -10.924
  73. }, {
  74. "x": -14.63,
  75. "y": -10.924
  76. }],
  77. "casements": [{
  78. points: [{
  79. "x": 5.67,
  80. "y": -10.924
  81. },
  82. {
  83. "x": 3.67,
  84. "y": -10.924
  85. }
  86. ]
  87. }],
  88. "linkedLineID": ["0_3", "0_5"],
  89. "doors": [{
  90. points: [{
  91. "x": 6.67,
  92. "y": -10.924
  93. },
  94. {
  95. "x": 9.67,
  96. "y": -10.924
  97. }
  98. ]
  99. }]
  100. }, {
  101. "id": "0_5",
  102. "roomIndex": 0,
  103. "points": [{
  104. "x": -14.63,
  105. "y": -10.924
  106. }, {
  107. "x": -14.63,
  108. "y": 0.501
  109. }],
  110. "linkedLineID": ["0_4", "0_6"]
  111. }, {
  112. "id": "0_6",
  113. "roomIndex": 0,
  114. "points": [{
  115. "x": -14.63,
  116. "y": 0.501
  117. }, {
  118. "x": 1.62,
  119. "y": 0.501
  120. }],
  121. "linkedLineID": ["0_5", "0_0"]
  122. }, {
  123. "id": "1_0",
  124. "roomIndex": 1,
  125. "points": [{
  126. "x": 1.17,
  127. "y": 0.501
  128. }, {
  129. "x": -12.83,
  130. "y": 0.501
  131. }],
  132. "linkedLineID": ["1_5", "1_1"]
  133. }, {
  134. "id": "1_1",
  135. "roomIndex": 1,
  136. "points": [{
  137. "x": -12.83,
  138. "y": 0.501
  139. }, {
  140. "x": -12.83,
  141. "y": 11.626
  142. }],
  143. "linkedLineID": ["1_0", "1_2"]
  144. }, {
  145. "id": "1_2",
  146. 'selected': true,
  147. "roomIndex": 1,
  148. "points": [{
  149. "x": -12.83,
  150. "y": 11.626
  151. }, {
  152. "x": 3.845,
  153. "y": 11.626
  154. }],
  155. "linkedLineID": ["1_1", "1_3"]
  156. }, {
  157. "id": "1_3",
  158. "roomIndex": 1,
  159. "points": [{
  160. "x": 3.845,
  161. "y": 11.626
  162. }, {
  163. "x": 3.845,
  164. "y": 7.026
  165. }],
  166. "linkedLineID": ["1_2", "1_4"]
  167. }, {
  168. "id": "1_4",
  169. "roomIndex": 1,
  170. "points": [{
  171. "x": 3.845,
  172. "y": 7.026
  173. }, {
  174. "x": 1.17,
  175. "y": 7.026
  176. }],
  177. "linkedLineID": ["1_3", "1_5"]
  178. }, {
  179. "id": "1_5",
  180. "roomIndex": 1,
  181. "points": [{
  182. "x": 1.17,
  183. "y": 7.026
  184. }, {
  185. "x": 1.17,
  186. "y": 0.501
  187. }],
  188. "linkedLineID": ["1_4", "1_0"]
  189. }, {
  190. "id": "2_0",
  191. "roomIndex": 2,
  192. "points": [{
  193. "x": 3.845,
  194. "y": 5.301
  195. }, {
  196. "x": 3.845,
  197. "y": 13.476
  198. }],
  199. "linkedLineID": ["2_5", "2_1"]
  200. }, {
  201. "id": "2_1",
  202. "roomIndex": 2,
  203. "points": [{
  204. "x": 3.845,
  205. "y": 13.476
  206. }, {
  207. "x": 11.97,
  208. "y": 13.476
  209. }],
  210. "linkedLineID": ["2_0", "2_2"]
  211. }, {
  212. "id": "2_2",
  213. "roomIndex": 2,
  214. "points": [{
  215. "x": 11.97,
  216. "y": 13.476
  217. }, {
  218. "x": 11.97,
  219. "y": 7.576
  220. }],
  221. "linkedLineID": ["2_1", "2_3"]
  222. }, {
  223. "id": "2_3",
  224. "roomIndex": 2,
  225. "points": [{
  226. "x": 11.97,
  227. "y": 7.576
  228. }, {
  229. "x": 13.02,
  230. "y": 7.576
  231. }],
  232. "linkedLineID": ["2_2", "2_4"]
  233. }, {
  234. "id": "2_4",
  235. "roomIndex": 2,
  236. "points": [{
  237. "x": 13.02,
  238. "y": 7.576
  239. }, {
  240. "x": 13.02,
  241. "y": 5.301
  242. }],
  243. "linkedLineID": ["2_3", "2_5"]
  244. }, {
  245. "id": "2_5",
  246. "roomIndex": 2,
  247. "points": [{
  248. "x": 13.02,
  249. "y": 5.301
  250. }, {
  251. "x": 3.845,
  252. "y": 5.301
  253. }],
  254. "linkedLineID": ["2_4", "2_0"]
  255. }, {
  256. "id": "3_0",
  257. "roomIndex": 3,
  258. "points": [{
  259. "x": 7.92,
  260. "y": 5.301
  261. }, {
  262. "x": 11.67,
  263. "y": 5.301
  264. }],
  265. "linkedLineID": ["3_3", "3_1"]
  266. }, {
  267. "id": "3_1",
  268. "roomIndex": 3,
  269. "points": [{
  270. "x": 11.67,
  271. "y": 5.301
  272. }, {
  273. "x": 11.67,
  274. "y": 0.076
  275. }],
  276. "linkedLineID": ["3_0", "3_2"]
  277. }, {
  278. "id": "3_2",
  279. "roomIndex": 3,
  280. "points": [{
  281. "x": 11.67,
  282. "y": 0.076
  283. }, {
  284. "x": 7.92,
  285. "y": 0.076
  286. }],
  287. "linkedLineID": ["3_1", "3_3"]
  288. }, {
  289. "id": "3_3",
  290. "roomIndex": 3,
  291. "points": [{
  292. "x": 7.92,
  293. "y": 0.076
  294. }, {
  295. "x": 7.92,
  296. "y": 5.301
  297. }],
  298. "linkedLineID": ["3_2", "3_0"]
  299. }, {
  300. "id": "4_0",
  301. "roomIndex": 4,
  302. "points": [{
  303. "x": 11.67,
  304. "y": 5.301
  305. }, {
  306. "x": 15.67,
  307. "y": 5.301
  308. }],
  309. "linkedLineID": ["4_3", "4_1"]
  310. }, {
  311. "id": "4_1",
  312. "roomIndex": 4,
  313. "points": [{
  314. "x": 15.67,
  315. "y": 5.301
  316. }, {
  317. "x": 15.67,
  318. "y": 2.226
  319. }],
  320. "linkedLineID": ["4_0", "4_2"]
  321. }, {
  322. "id": "4_2",
  323. "roomIndex": 4,
  324. "points": [{
  325. "x": 15.67,
  326. "y": 2.226
  327. }, {
  328. "x": 11.67,
  329. "y": 2.226
  330. }],
  331. "linkedLineID": ["4_1", "4_3"]
  332. }, {
  333. "id": "4_3",
  334. "roomIndex": 4,
  335. "points": [{
  336. "x": 11.67,
  337. "y": 2.226
  338. }, {
  339. "x": 11.67,
  340. "y": 5.301
  341. }],
  342. "linkedLineID": ["4_2", "4_0"]
  343. }, {
  344. "id": "5_0",
  345. "roomIndex": 5,
  346. "points": [{
  347. "x": 8.295,
  348. "y": 0.076
  349. }, {
  350. "x": 10.67,
  351. "y": 0.076
  352. }],
  353. "linkedLineID": ["5_3", "5_1"]
  354. }, {
  355. "id": "5_1",
  356. "roomIndex": 5,
  357. "points": [{
  358. "x": 10.67,
  359. "y": 0.076
  360. }, {
  361. "x": 10.67,
  362. "y": -5.874
  363. }],
  364. "linkedLineID": ["5_0", "5_2"]
  365. }, {
  366. "id": "5_2",
  367. "roomIndex": 5,
  368. "points": [{
  369. "x": 10.67,
  370. "y": -5.874
  371. }, {
  372. "x": 8.295,
  373. "y": -5.874
  374. }],
  375. "linkedLineID": ["5_1", "5_3"]
  376. }, {
  377. "id": "5_3",
  378. "roomIndex": 5,
  379. "points": [{
  380. "x": 8.295,
  381. "y": -5.874
  382. }, {
  383. "x": 8.295,
  384. "y": 0.076
  385. }],
  386. "linkedLineID": ["5_2", "5_0"]
  387. }
  388. ]
  389. var wallCamera = {
  390. '0': [{
  391. x: -2.0050000000000003,
  392. y: -6.375515151515152
  393. }],
  394. '1': [{
  395. x: -4.6830303030303035,
  396. y: 4.374863636363637
  397. }],
  398. '2': [{
  399. x: 8.36280303030303,
  400. y: 9.195318181818182
  401. }],
  402. '3': [{
  403. x: 9.969621212121211,
  404. y: 3.188878787878788
  405. }],
  406. '4': [{
  407. x: 13.374545454545455,
  408. y: 3.762742424242424
  409. }],
  410. '5': [{
  411. x: 9.319242424242423,
  412. y: -2.702787878787879
  413. }]
  414. }
  415. var floorJson = {
  416. "vertex": [{
  417. "x": -1.198,
  418. "y": 4.705
  419. }, {
  420. "x": 8.877,
  421. "y": 6.05
  422. }, {
  423. "x": 9.877,
  424. "y": -5.295
  425. }, {
  426. "x": -1.198,
  427. "y": -5.295
  428. }, {
  429. "x": -1.198,
  430. "y": -4.745
  431. }, {
  432. "x": -9.973,
  433. "y": -4.745
  434. }, {
  435. "x": -9.973,
  436. "y": 5.305
  437. }, {
  438. "x": -1.198,
  439. "y": 5.305
  440. }],
  441. "wall": [{
  442. "p1": 0,
  443. "p2": 1,
  444. "room": 1
  445. }, {
  446. "p1": 1,
  447. "p2": 2,
  448. "room": 1
  449. }, {
  450. "p1": 2,
  451. "p2": 3,
  452. "room": 1
  453. }, {
  454. "p1": 4,
  455. "p2": 5,
  456. "room": 2
  457. }, {
  458. "p1": 5,
  459. "p2": 6,
  460. "room": 2
  461. }, {
  462. "p1": 6,
  463. "p2": 7,
  464. "room": 2
  465. }
  466. //, {"p1":3,"p2":7}
  467. , {
  468. "p1": 3,
  469. "p2": 0,
  470. "room": 1
  471. }, {
  472. "p1": 7,
  473. "p2": 4,
  474. "room": 2
  475. }
  476. ]
  477. }
  478. var test = floorJson.wall.map((item, index) => {
  479. return {
  480. "id": item.room + "_" + index,
  481. "roomIndex": item.room,
  482. "points": [floorJson.vertex[item.p1], floorJson.vertex[item.p2]],
  483. "linkedLineID": ["0_6", "0_1"]
  484. }
  485. })
  486. test.forEach(item => {
  487. var prev = test.find(item1 => {
  488. return item.points[0] === item1.points[1]
  489. })
  490. var last = test.find(item1 => {
  491. return item.points[1] === item1.points[0]
  492. })
  493. item.linkedLineID = [prev.id, last.id]
  494. })
  495. // wallData = test
  496. // wallCamera = {}