data.js 6.5 KB

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