data.js 8.0 KB

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