@panoramax/web-viewer 4.4.0-develop-3839b5a4 → 4.4.0-develop-f91f6758

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (341) hide show
  1. package/{src → build}/components/core/Basic.js +22 -16
  2. package/{src → build}/components/core/CoverageMap.js +19 -14
  3. package/{src → build}/components/core/Editor.js +16 -16
  4. package/{src → build}/components/core/PhotoViewer.js +30 -29
  5. package/{src → build}/components/core/Viewer.js +21 -20
  6. package/build/components/core/index.js +10 -0
  7. package/build/components/index.js +11 -0
  8. package/build/components/index_photoviewer.js +6 -0
  9. package/{src → build}/components/layout/BottomDrawer.js +4 -4
  10. package/{src → build}/components/layout/CorneredGrid.js +1 -1
  11. package/{src → build}/components/layout/Mini.js +5 -4
  12. package/{src → build}/components/layout/Tabs.js +1 -1
  13. package/build/components/layout/index.js +9 -0
  14. package/{src → build}/components/menus/LocationPrecisionDoc.js +4 -6
  15. package/{src → build}/components/menus/MapBackground.js +4 -6
  16. package/{src → build}/components/menus/MapFilters.js +16 -21
  17. package/{src → build}/components/menus/MapLayers.js +20 -24
  18. package/{src → build}/components/menus/MapLegend.js +3 -4
  19. package/{src → build}/components/menus/MiniPictureLegend.js +3 -4
  20. package/{src → build}/components/menus/PictureLegend.js +10 -15
  21. package/{src → build}/components/menus/PictureMetadata.js +12 -19
  22. package/{src → build}/components/menus/PlayerOptions.js +5 -7
  23. package/{src → build}/components/menus/QualityScoreDoc.js +3 -4
  24. package/{src → build}/components/menus/ReportForm.js +8 -9
  25. package/{src → build}/components/menus/SemanticsDoc.js +3 -4
  26. package/{src → build}/components/menus/SemanticsDownload.js +3 -3
  27. package/{src → build}/components/menus/SemanticsFilters.js +7 -8
  28. package/{src → build}/components/menus/SemanticsList.js +11 -18
  29. package/{src → build}/components/menus/SemanticsMetadata.js +8 -11
  30. package/{src → build}/components/menus/Share.js +6 -7
  31. package/build/components/menus/index.js +22 -0
  32. package/build/components/menus/index_photoviewer.js +11 -0
  33. package/{src → build}/components/styles.js +0 -2
  34. package/{src → build}/components/ui/AnnotationsSwitch.js +6 -8
  35. package/{src → build}/components/ui/Button.js +1 -1
  36. package/{src → build}/components/ui/ButtonGroup.js +2 -1
  37. package/{src → build}/components/ui/CopyButton.js +4 -6
  38. package/{src → build}/components/ui/Grade.js +5 -5
  39. package/{src → build}/components/ui/GradeFilter.js +3 -3
  40. package/{src → build}/components/ui/IconSwitch.js +1 -1
  41. package/{src → build}/components/ui/LinkButton.js +1 -1
  42. package/{src → build}/components/ui/ListGroup.js +3 -3
  43. package/{src → build}/components/ui/ListItem.js +1 -1
  44. package/{src → build}/components/ui/Loader.js +8 -7
  45. package/{src → build}/components/ui/Map.js +38 -26
  46. package/{src → build}/components/ui/MapMore.js +7 -7
  47. package/{src → build}/components/ui/Photo.js +29 -27
  48. package/{src → build}/components/ui/Popup.js +4 -4
  49. package/{src → build}/components/ui/QualityScore.js +4 -4
  50. package/{src → build}/components/ui/SearchBar.js +6 -7
  51. package/{src → build}/components/ui/SemanticsEditor.js +14 -15
  52. package/{src → build}/components/ui/SemanticsTable.js +4 -5
  53. package/{src → build}/components/ui/Switch.js +1 -1
  54. package/{src → build}/components/ui/TogglableGroup.js +4 -4
  55. package/build/components/ui/index.js +29 -0
  56. package/build/components/ui/index_photoviewer.js +21 -0
  57. package/{src → build}/components/ui/widgets/CopyCoordinates.js +5 -5
  58. package/{src → build}/components/ui/widgets/GeoSearch.js +10 -10
  59. package/{src → build}/components/ui/widgets/Legend.js +9 -8
  60. package/{src → build}/components/ui/widgets/LevelSelect.js +9 -7
  61. package/{src → build}/components/ui/widgets/MapFiltersButton.js +5 -5
  62. package/{src → build}/components/ui/widgets/MapLayersButton.js +5 -5
  63. package/{src → build}/components/ui/widgets/OSMEditors.js +8 -8
  64. package/{src → build}/components/ui/widgets/PictureLegendActions.js +4 -4
  65. package/{src → build}/components/ui/widgets/Player.js +6 -7
  66. package/{src → build}/components/ui/widgets/SemanticsFiltersButton.js +6 -7
  67. package/{src → build}/components/ui/widgets/Zoom.js +6 -6
  68. package/build/components/ui/widgets/index.js +16 -0
  69. package/build/components/ui/widgets/index_photoviewer.js +7 -0
  70. package/build/editor.html +94 -10
  71. package/{src → build}/img/arrow_triangle.svg +0 -1
  72. package/{src → build}/img/arrow_turn.svg +0 -1
  73. package/build/index.html +111 -1
  74. package/build/index.js +6 -95
  75. package/build/index_photoviewer.js +4 -0
  76. package/build/map.html +97 -1
  77. package/build/package.json +141 -0
  78. package/build/photo.html +85 -1
  79. package/build/servers.js +3 -4
  80. package/{src → build}/utils/API.js +33 -33
  81. package/{src → build}/utils/InitParameters.js +11 -9
  82. package/{src → build}/utils/MapStyleComposer.js +39 -37
  83. package/{src → build}/utils/PhotoAdapter.js +1 -0
  84. package/{src → build}/utils/PresetsManager.js +4 -4
  85. package/{src → build}/utils/SemanticsMapProtocol.js +3 -4
  86. package/{src → build}/utils/URLHandler.js +16 -14
  87. package/{src → build}/utils/geocoder.js +5 -5
  88. package/{src → build}/utils/i18n.js +21 -20
  89. package/build/utils/index.js +17 -0
  90. package/build/utils/index_photoviewer.js +14 -0
  91. package/{src → build}/utils/indoor.js +9 -5
  92. package/{src → build}/utils/map.js +15 -11
  93. package/{src → build}/utils/picture.js +22 -17
  94. package/{src → build}/utils/semantics.js +9 -5
  95. package/{src → build}/utils/utils.js +8 -4
  96. package/{src → build}/utils/widgets.js +2 -2
  97. package/build/viewer.html +120 -35
  98. package/build/viewer_indoor.html +90 -8
  99. package/build/widgets.html +410 -1
  100. package/package.json +81 -204
  101. package/.dockerignore +0 -7
  102. package/.gitlab-ci.yml +0 -78
  103. package/CHANGELOG.md +0 -853
  104. package/CODE_OF_CONDUCT.md +0 -134
  105. package/Dockerfile +0 -14
  106. package/build/index.css +0 -36
  107. package/build/index.css.map +0 -1
  108. package/build/index.js.map +0 -1
  109. package/build/photoviewer.css +0 -36
  110. package/build/photoviewer.css.map +0 -1
  111. package/build/photoviewer.js +0 -86
  112. package/build/photoviewer.js.map +0 -1
  113. package/build/static/media/atkinson-hyperlegible-next-latin-400-normal..woff +0 -0
  114. package/build/static/media/atkinson-hyperlegible-next-latin-400-normal..woff2 +0 -0
  115. package/build/static/media/atkinson-hyperlegible-next-latin-ext-400-normal..woff +0 -0
  116. package/build/static/media/atkinson-hyperlegible-next-latin-ext-400-normal..woff2 +0 -0
  117. package/config/env.js +0 -104
  118. package/config/getHttpsConfig.js +0 -69
  119. package/config/getPackageJson.js +0 -25
  120. package/config/jest/babelTransform.js +0 -29
  121. package/config/jest/cssTransform.js +0 -14
  122. package/config/jest/fileTransform.js +0 -40
  123. package/config/jest/mocks.js +0 -230
  124. package/config/modules.js +0 -134
  125. package/config/paths.js +0 -76
  126. package/config/pnpTs.js +0 -35
  127. package/config/webpack/persistentCache/createEnvironmentHash.js +0 -9
  128. package/config/webpack.config.js +0 -825
  129. package/config/webpackDevServer.config.js +0 -131
  130. package/docs/03_URL_settings.md +0 -218
  131. package/docs/05_Compatibility.md +0 -83
  132. package/docs/09_Develop.md +0 -141
  133. package/docs/90_Releases.md +0 -27
  134. package/docs/images/class_diagram.drawio +0 -144
  135. package/docs/images/class_diagram.jpg +0 -0
  136. package/docs/images/comparative_3drender.jpg +0 -0
  137. package/docs/images/indoor_level.png +0 -0
  138. package/docs/images/screenshot.jpg +0 -0
  139. package/docs/index.md +0 -159
  140. package/docs/reference/components/core/Basic.md +0 -211
  141. package/docs/reference/components/core/CoverageMap.md +0 -220
  142. package/docs/reference/components/core/Editor.md +0 -252
  143. package/docs/reference/components/core/PhotoViewer.md +0 -320
  144. package/docs/reference/components/core/Viewer.md +0 -398
  145. package/docs/reference/components/layout/BottomDrawer.md +0 -35
  146. package/docs/reference/components/layout/CorneredGrid.md +0 -29
  147. package/docs/reference/components/layout/Mini.md +0 -45
  148. package/docs/reference/components/layout/Tabs.md +0 -46
  149. package/docs/reference/components/menus/LocationPrecisionDoc.md +0 -15
  150. package/docs/reference/components/menus/MapBackground.md +0 -32
  151. package/docs/reference/components/menus/MapFilters.md +0 -37
  152. package/docs/reference/components/menus/MapLayers.md +0 -15
  153. package/docs/reference/components/menus/MapLegend.md +0 -32
  154. package/docs/reference/components/menus/MiniPictureLegend.md +0 -15
  155. package/docs/reference/components/menus/PictureLegend.md +0 -45
  156. package/docs/reference/components/menus/PictureMetadata.md +0 -32
  157. package/docs/reference/components/menus/PlayerOptions.md +0 -15
  158. package/docs/reference/components/menus/QualityScoreDoc.md +0 -15
  159. package/docs/reference/components/menus/ReportForm.md +0 -15
  160. package/docs/reference/components/menus/SemanticsDoc.md +0 -15
  161. package/docs/reference/components/menus/SemanticsDownload.md +0 -15
  162. package/docs/reference/components/menus/SemanticsFilters.md +0 -33
  163. package/docs/reference/components/menus/SemanticsList.md +0 -97
  164. package/docs/reference/components/menus/SemanticsMetadata.md +0 -15
  165. package/docs/reference/components/menus/ShareMenu.md +0 -32
  166. package/docs/reference/components/ui/AnnotationsSwitch.md +0 -32
  167. package/docs/reference/components/ui/Button.md +0 -40
  168. package/docs/reference/components/ui/ButtonGroup.md +0 -36
  169. package/docs/reference/components/ui/CopyButton.md +0 -41
  170. package/docs/reference/components/ui/Grade.md +0 -32
  171. package/docs/reference/components/ui/GradeFilter.md +0 -42
  172. package/docs/reference/components/ui/IconSwitch.md +0 -53
  173. package/docs/reference/components/ui/LinkButton.md +0 -45
  174. package/docs/reference/components/ui/ListGroup.md +0 -22
  175. package/docs/reference/components/ui/ListItem.md +0 -39
  176. package/docs/reference/components/ui/Loader.md +0 -56
  177. package/docs/reference/components/ui/Map.md +0 -150
  178. package/docs/reference/components/ui/MapMore.md +0 -150
  179. package/docs/reference/components/ui/Photo.md +0 -495
  180. package/docs/reference/components/ui/Popup.md +0 -56
  181. package/docs/reference/components/ui/ProgressBar.md +0 -32
  182. package/docs/reference/components/ui/QualityScore.md +0 -45
  183. package/docs/reference/components/ui/SearchBar.md +0 -63
  184. package/docs/reference/components/ui/SemanticsEditor.md +0 -113
  185. package/docs/reference/components/ui/SemanticsTable.md +0 -32
  186. package/docs/reference/components/ui/Switch.md +0 -49
  187. package/docs/reference/components/ui/TogglableGroup.md +0 -39
  188. package/docs/reference/components/ui/widgets/CopyCoordinates.md +0 -32
  189. package/docs/reference/components/ui/widgets/GeoSearch.md +0 -36
  190. package/docs/reference/components/ui/widgets/Legend.md +0 -58
  191. package/docs/reference/components/ui/widgets/LevelSelect.md +0 -16
  192. package/docs/reference/components/ui/widgets/MapFiltersButton.md +0 -37
  193. package/docs/reference/components/ui/widgets/MapLayersButton.md +0 -15
  194. package/docs/reference/components/ui/widgets/OSMEditors.md +0 -15
  195. package/docs/reference/components/ui/widgets/PictureLegendActions.md +0 -32
  196. package/docs/reference/components/ui/widgets/Player.md +0 -34
  197. package/docs/reference/components/ui/widgets/SemanticsFiltersButton.md +0 -15
  198. package/docs/reference/components/ui/widgets/Zoom.md +0 -15
  199. package/docs/reference/utils/API.md +0 -389
  200. package/docs/reference/utils/InitParameters.md +0 -68
  201. package/docs/reference/utils/MapStyleComposer.md +0 -408
  202. package/docs/reference/utils/PanoraMapProtocol.md +0 -28
  203. package/docs/reference/utils/PresetsManager.md +0 -43
  204. package/docs/reference/utils/SemanticsMapProtocol.md +0 -43
  205. package/docs/reference/utils/URLHandler.md +0 -114
  206. package/docs/reference.md +0 -99
  207. package/docs/shortcuts.md +0 -11
  208. package/docs/tutorials/aerial_imagery.md +0 -21
  209. package/docs/tutorials/authentication.md +0 -10
  210. package/docs/tutorials/custom_widgets.md +0 -59
  211. package/docs/tutorials/indoor_maps.md +0 -50
  212. package/docs/tutorials/map_style.md +0 -83
  213. package/docs/tutorials/migrate_v4.md +0 -153
  214. package/docs/tutorials/migrate_v5.md +0 -103
  215. package/docs/tutorials/semantics_overlays.md +0 -74
  216. package/docs/tutorials/synced_coverage.md +0 -43
  217. package/mkdocs.yml +0 -131
  218. package/public/editor.html +0 -53
  219. package/public/index.html +0 -70
  220. package/public/map.html +0 -55
  221. package/public/photo.html +0 -43
  222. package/public/servers.js +0 -15
  223. package/public/viewer.html +0 -79
  224. package/public/viewer_indoor.html +0 -48
  225. package/public/widgets.html +0 -366
  226. package/scripts/build.js +0 -217
  227. package/scripts/doc.js +0 -79
  228. package/scripts/start.js +0 -172
  229. package/scripts/test.js +0 -52
  230. package/src/components/core/index.js +0 -12
  231. package/src/components/index.js +0 -13
  232. package/src/components/index_photoviewer.js +0 -8
  233. package/src/components/layout/index.js +0 -9
  234. package/src/components/menus/index.js +0 -22
  235. package/src/components/menus/index_photoviewer.js +0 -13
  236. package/src/components/ui/index.js +0 -29
  237. package/src/components/ui/index_photoviewer.js +0 -23
  238. package/src/components/ui/widgets/index.js +0 -16
  239. package/src/components/ui/widgets/index_photoviewer.js +0 -9
  240. package/src/index.js +0 -8
  241. package/src/index_photoviewer.js +0 -6
  242. package/src/utils/index.js +0 -17
  243. package/src/utils/index_photoviewer.js +0 -16
  244. package/tests/components/core/Basic.test.js +0 -168
  245. package/tests/components/core/BasicMock.js +0 -25
  246. package/tests/components/core/CoverageMap.test.js +0 -20
  247. package/tests/components/core/Editor.test.js +0 -20
  248. package/tests/components/core/PhotoViewer.test.js +0 -57
  249. package/tests/components/core/Viewer.test.js +0 -85
  250. package/tests/components/core/__snapshots__/PhotoViewer.test.js.snap +0 -96
  251. package/tests/components/core/__snapshots__/Viewer.test.js.snap +0 -188
  252. package/tests/components/ui/CopyButton.test.js +0 -52
  253. package/tests/components/ui/Loader.test.js +0 -55
  254. package/tests/components/ui/Map.test.js +0 -145
  255. package/tests/components/ui/Photo.test.js +0 -437
  256. package/tests/components/ui/Popup.test.js +0 -26
  257. package/tests/components/ui/QualityScore.test.js +0 -18
  258. package/tests/components/ui/SearchBar.test.js +0 -110
  259. package/tests/components/ui/__snapshots__/CopyButton.test.js.snap +0 -33
  260. package/tests/components/ui/__snapshots__/Loader.test.js.snap +0 -56
  261. package/tests/components/ui/__snapshots__/Map.test.js.snap +0 -16
  262. package/tests/components/ui/__snapshots__/Photo.test.js.snap +0 -263
  263. package/tests/components/ui/__snapshots__/Popup.test.js.snap +0 -29
  264. package/tests/components/ui/__snapshots__/QualityScore.test.js.snap +0 -11
  265. package/tests/components/ui/__snapshots__/SearchBar.test.js.snap +0 -65
  266. package/tests/data/Map_geocoder_ban.json +0 -36
  267. package/tests/data/Map_geocoder_nominatim.json +0 -41
  268. package/tests/data/Viewer_pictures_1.json +0 -148
  269. package/tests/setupTests.js +0 -5
  270. package/tests/utils/API.test.js +0 -752
  271. package/tests/utils/InitParameters.test.js +0 -599
  272. package/tests/utils/MapStyleComposer.test.js +0 -697
  273. package/tests/utils/PresetsManager.test.js +0 -123
  274. package/tests/utils/URLHandler.test.js +0 -587
  275. package/tests/utils/__snapshots__/API.test.js.snap +0 -40
  276. package/tests/utils/__snapshots__/MapStyleComposer.test.js.snap +0 -767
  277. package/tests/utils/__snapshots__/URLHandler.test.js.snap +0 -21
  278. package/tests/utils/__snapshots__/geocoder.test.js.snap +0 -37
  279. package/tests/utils/__snapshots__/map.test.js.snap +0 -1249
  280. package/tests/utils/__snapshots__/picture.test.js.snap +0 -327
  281. package/tests/utils/__snapshots__/widgets.test.js.snap +0 -19
  282. package/tests/utils/geocoder.test.js +0 -37
  283. package/tests/utils/i18n.test.js +0 -111
  284. package/tests/utils/map.test.js +0 -200
  285. package/tests/utils/picture.test.js +0 -745
  286. package/tests/utils/semantics.test.js +0 -174
  287. package/tests/utils/utils.test.js +0 -358
  288. package/tests/utils/widgets.test.js +0 -31
  289. /package/{src → build}/components/core/Basic.css +0 -0
  290. /package/{src → build}/components/core/CoverageMap.css +0 -0
  291. /package/{src → build}/components/core/Editor.css +0 -0
  292. /package/{src → build}/components/core/PhotoViewer.css +0 -0
  293. /package/{src → build}/components/core/Viewer.css +0 -0
  294. /package/{src → build}/components/ui/ButtonGroup.css +0 -0
  295. /package/{src → build}/components/ui/Map.css +0 -0
  296. /package/{src → build}/components/ui/Photo.css +0 -0
  297. /package/{src → build}/components/ui/ProgressBar.js +0 -0
  298. /package/{src → build}/components/ui/widgets/GeoSearch.css +0 -0
  299. /package/{src → build}/components/ui/widgets/LevelSelect.css +0 -0
  300. /package/{src → build}/components/ui/widgets/Player.css +0 -0
  301. /package/{public → build}/favicon.ico +0 -0
  302. /package/{src → build}/img/arrow_360.svg +0 -0
  303. /package/{src → build}/img/arrow_flat.svg +0 -0
  304. /package/{src → build}/img/bg_aerial.jpg +0 -0
  305. /package/{src → build}/img/bg_streets.jpg +0 -0
  306. /package/{src → build}/img/loader_base.jpg +0 -0
  307. /package/{src → build}/img/logo_dead.svg +0 -0
  308. /package/{src → build}/img/marker.svg +0 -0
  309. /package/{src → build}/img/marker_blue.svg +0 -0
  310. /package/{src → build}/img/osm.svg +0 -0
  311. /package/{src → build}/img/panoramax.svg +0 -0
  312. /package/{src → build}/img/switch_big.svg +0 -0
  313. /package/{src → build}/img/switch_mini.svg +0 -0
  314. /package/{src → build}/img/wd.svg +0 -0
  315. /package/{src → build}/translations/ar.json +0 -0
  316. /package/{src → build}/translations/be.json +0 -0
  317. /package/{src → build}/translations/br.json +0 -0
  318. /package/{src → build}/translations/cy.json +0 -0
  319. /package/{src → build}/translations/da.json +0 -0
  320. /package/{src → build}/translations/de.json +0 -0
  321. /package/{src → build}/translations/en.json +0 -0
  322. /package/{src → build}/translations/eo.json +0 -0
  323. /package/{src → build}/translations/es.json +0 -0
  324. /package/{src → build}/translations/fi.json +0 -0
  325. /package/{src → build}/translations/fr.json +0 -0
  326. /package/{src → build}/translations/hu.json +0 -0
  327. /package/{src → build}/translations/it.json +0 -0
  328. /package/{src → build}/translations/ja.json +0 -0
  329. /package/{src → build}/translations/ko.json +0 -0
  330. /package/{src → build}/translations/nl.json +0 -0
  331. /package/{src → build}/translations/nn.json +0 -0
  332. /package/{src → build}/translations/pl.json +0 -0
  333. /package/{src → build}/translations/pt.json +0 -0
  334. /package/{src → build}/translations/pt_BR.json +0 -0
  335. /package/{src → build}/translations/sv.json +0 -0
  336. /package/{src → build}/translations/ti.json +0 -0
  337. /package/{src → build}/translations/tr.json +0 -0
  338. /package/{src → build}/translations/uk.json +0 -0
  339. /package/{src → build}/translations/zh_Hant.json +0 -0
  340. /package/{src → build}/utils/PanoraMapProtocol.js +0 -0
  341. /package/{src → build}/utils/services.js +0 -0
@@ -1,174 +0,0 @@
1
- import {
2
- decodeKey, decodeBasicTag, computeDiffTags, groupByPrefix
3
- } from "../../src/utils/semantics";
4
-
5
- describe("decodeBasicTag", () => {
6
- it("should return null if no equal sign is present", () => {
7
- expect(decodeBasicTag("key")).toBeNull();
8
- });
9
-
10
- it("should correctly decode a tag with an equal sign", () => {
11
- expect(decodeBasicTag("key=value")).toEqual({
12
- key: { key: "key", prefix: "", subkey: "key", qualifies: null },
13
- value: "value"
14
- });
15
- });
16
-
17
- it("should correctly decode a tag with a prefix", () => {
18
- expect(decodeBasicTag("osm|key=value")).toEqual({
19
- key: { key: "osm|key", prefix: "osm", subkey: "key", qualifies: null },
20
- value: "value"
21
- });
22
- });
23
- });
24
-
25
- describe("decodeKey", () => {
26
- it("should return default structure if key does not match regex", () => {
27
- expect(decodeKey("panoKey")).toEqual({
28
- key: "panoKey",
29
- prefix: "",
30
- subkey: "panoKey",
31
- qualifies: null
32
- });
33
- });
34
-
35
- it("should correctly decode a key with a prefix", () => {
36
- expect(decodeKey("osm|traffic_sign")).toEqual({
37
- key: "osm|traffic_sign",
38
- prefix: "osm",
39
- subkey: "traffic_sign",
40
- qualifies: null
41
- });
42
- });
43
-
44
- it("should correctly decode a key with qualifiers", () => {
45
- expect(decodeKey("detection_model[camera_mount=pole]")).toEqual({
46
- key: "detection_model[camera_mount=pole]",
47
- prefix: "",
48
- subkey: "detection_model",
49
- qualifies: { key: { key: "camera_mount", prefix: "", subkey: "camera_mount", qualifies: null }, value: "pole" }
50
- });
51
- });
52
-
53
- it("should correctly decode a key with a prefix and qualifiers", () => {
54
- expect(decodeKey("osm|source[osm|traffic_sign=stop]")).toEqual({
55
- key: "osm|source[osm|traffic_sign=stop]",
56
- prefix: "osm",
57
- subkey: "source",
58
- qualifies: { key: { key: "osm|traffic_sign", prefix: "osm", subkey: "traffic_sign", qualifies: null }, value: "stop" }
59
- });
60
- });
61
- });
62
-
63
- describe("computeDiffTags", () => {
64
- it("should return new set of tags when no tag is missing in next", () => {
65
- const prev = [{key: "tag1", value: "value1"}, {key: "tag2", value: "value2"}];
66
- const next = [{key: "tag1", value: "value1"}, {key: "tag2", value: "value2"}, {key: "tag3", value: "value3"}];
67
-
68
- expect(computeDiffTags(prev, next)).toEqual([{key: "tag3", value: "value3", action: "add"}]);
69
- });
70
-
71
- it("should return new set of tags with missing tags marked as delete when some tag is missing in next", () => {
72
- const prev = [{key: "tag1", value: "value1"}, {key: "tag2", value: "value2"}];
73
- const next = [{key: "tag1", value: "value1"}];
74
-
75
- expect(computeDiffTags(prev, next)).toEqual([{key: "tag2", value: "value2", action: "delete"}]);
76
- });
77
-
78
- it("should return new set of tags with all tags marked as delete when all tags are missing in next", () => {
79
- const prev = [{key: "tag1", value: "value1"}, {key: "tag2", value: "value2"}];
80
- const next = [];
81
-
82
- expect(computeDiffTags(prev, next)).toEqual([{key: "tag1", value: "value1", action: "delete"}, {key: "tag2", value: "value2", action: "delete"}]);
83
- });
84
- });
85
-
86
- describe("groupByPrefix", () => {
87
- it("should group tags by prefix", () => {
88
- const tags = [
89
- { key: "osm|highway", value: "residential" },
90
- { key: "wd|P31", value: "Q5" },
91
- { key: "exif|model", value: "CameraModel" }
92
- ];
93
-
94
- const expected = [
95
- {
96
- prefix: "osm",
97
- title: "OpenStreetMap",
98
- tags: [{ key: "highway", value: "residential" }],
99
- key_transform: expect.any(Function),
100
- logo: "osm.svg",
101
- value_transform: expect.any(Function)
102
- },
103
- {
104
- prefix: "wd",
105
- title: "Wikidata",
106
- tags: [{ key: "P31", value: "Q5" }],
107
- key_transform: expect.any(Function),
108
- logo: "wd.svg",
109
- value_transform: expect.any(Function)
110
- },
111
- {
112
- prefix: "exif",
113
- title: "EXIF",
114
- tags: [{ key: "model", value: "CameraModel" }]
115
- }
116
- ];
117
-
118
- expect(groupByPrefix(tags)).toEqual(expected);
119
- });
120
-
121
- it("should handle qualifiers without prefix correctly", () => {
122
- const tags = [
123
- { key: "transport", value: "bike" },
124
- { key: "source[transport=bike]", value: "author" }
125
- ];
126
-
127
- const expected = [{
128
- prefix: "",
129
- title: "Panoramax",
130
- tags: [{
131
- key: "transport",
132
- value: "bike",
133
- qualifiers: [{ key: "source[transport=bike]", prefix: "", subkey: "source", value: "author" }]
134
- }],
135
- value_transform: expect.any(Function)
136
- }];
137
-
138
- expect(groupByPrefix(tags)).toEqual(expected);
139
- });
140
-
141
- it("should handle qualifiers with prefix correctly", () => {
142
- const tags = [
143
- { key: "osm|highway", value: "residential" },
144
- { key: "osm|source[osm|highway=residential]", value: "opendata" }
145
- ];
146
-
147
- const expected = [{
148
- prefix: "osm",
149
- title: "OpenStreetMap",
150
- tags: [{
151
- key: "highway",
152
- value: "residential",
153
- qualifiers: [{ key: "osm|source[osm|highway=residential]", prefix: "osm", subkey: "source", value: "opendata" }]
154
- }],
155
- key_transform: expect.any(Function),
156
- logo: "osm.svg",
157
- value_transform: expect.any(Function)
158
- }];
159
-
160
- expect(groupByPrefix(tags)).toEqual(expected);
161
- });
162
-
163
- it("should handle unknown prefixes", () => {
164
- const tags = [ { key: "unknown|key", value: "value" } ];
165
-
166
- const expected = [{
167
- prefix: "unknown",
168
- title: "unknown",
169
- tags: [{ key: "key", value: "value" }]
170
- }];
171
-
172
- expect(groupByPrefix(tags)).toEqual(expected);
173
- });
174
- });
@@ -1,358 +0,0 @@
1
- import * as utils from "../../src/utils/utils";
2
-
3
- jest.mock("../../src/utils/map", () => ({
4
- COLORS_HEX: {
5
- SELECTED: 0x0000ff,
6
- }
7
- }));
8
-
9
- describe("getGrade", () => {
10
- it("works with null-like", () => {
11
- expect(utils.getGrade(utils.QUALITYSCORE_RES_FLAT_VALUES, null)).toBeNull();
12
- expect(utils.getGrade(utils.QUALITYSCORE_RES_FLAT_VALUES, undefined)).toBeNull();
13
- expect(utils.getGrade(utils.QUALITYSCORE_RES_FLAT_VALUES, "")).toBeNull();
14
- });
15
-
16
- it("works with grade values", () => {
17
- expect(utils.getGrade(utils.QUALITYSCORE_RES_FLAT_VALUES, 0)).toBe(1);
18
- expect(utils.getGrade(utils.QUALITYSCORE_RES_FLAT_VALUES, 5)).toBe(1);
19
- expect(utils.getGrade(utils.QUALITYSCORE_RES_FLAT_VALUES, 12)).toBe(2);
20
- expect(utils.getGrade(utils.QUALITYSCORE_RES_FLAT_VALUES, 25)).toBe(3);
21
- expect(utils.getGrade(utils.QUALITYSCORE_RES_FLAT_VALUES, 40)).toBe(4);
22
- });
23
- });
24
-
25
- describe("getDistance", () => {
26
- it("works", () => {
27
- const p1 = [1,1];
28
- const p2 = [2,2];
29
- const res = utils.getDistance(p1, p2);
30
- expect(res).toBe(Math.sqrt(2));
31
- });
32
- });
33
-
34
- describe("svgToPSVLink", () => {
35
- it("works", () => {
36
- const base64Svg = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnPjxjaXJjbGUgY3g9JzUnIGN5PSc1JyByPSc1JyBmaWxsPScjMDAwJy8+PC9zdmc+";
37
- const fillColor = "red";
38
- const result = utils.svgToPSVLink(base64Svg, fillColor);
39
-
40
- expect(result).toBeInstanceOf(HTMLButtonElement);
41
- expect(result.classList.contains("pnx-psv-tour-arrows")).toBe(true);
42
- expect(result.style.color).toBe(fillColor);
43
- expect(result.querySelector("svg")).not.toBeNull();
44
- });
45
-
46
- it("works with invalid input", () => {
47
- const invalidBase64Svg = "http://test.net/invalid_string";
48
- const result = utils.svgToPSVLink(invalidBase64Svg, "blue");
49
-
50
- expect(result).toBeInstanceOf(HTMLImageElement);
51
- expect(result.src).toBe(invalidBase64Svg);
52
- expect(result.alt).toBe("");
53
- });
54
- });
55
-
56
- describe("getAzimuth", () => {
57
- it("works with 0 + NE", () => {
58
- const pointDepart = [0, 0];
59
- const pointArrivee = [1, 1];
60
- const azimuth = utils.getAzimuth(pointDepart, pointArrivee);
61
- expect(azimuth).toBe(45);
62
- });
63
-
64
- it("works with 0 + SE", () => {
65
- const pointDepart = [0, 0];
66
- const pointArrivee = [1, -1];
67
- const azimuth = utils.getAzimuth(pointDepart, pointArrivee);
68
- expect(azimuth).toBe(135);
69
- });
70
-
71
- it("works with 0 + N", () => {
72
- const pointDepart = [0, 0];
73
- const pointArrivee = [0, 1];
74
- const azimuth = utils.getAzimuth(pointDepart, pointArrivee);
75
- expect(azimuth).toBe(0);
76
- });
77
-
78
- it("works with 0 + S", () => {
79
- const pointDepart = [0, 0];
80
- const pointArrivee = [0, -1];
81
- const azimuth = utils.getAzimuth(pointDepart, pointArrivee);
82
- expect(azimuth).toBe(180);
83
- });
84
- });
85
-
86
- describe("getRoadAbsoluteHeading", () => {
87
- it("works with single picture", () => {
88
- const pm = {
89
- gps: [0, 0]
90
- };
91
- expect(utils.getRoadAbsoluteHeading(pm)).toEqual(0);
92
- });
93
-
94
- it("works with first picture", () => {
95
- const pm = {
96
- sequence: { nextPic: "nextPictureId" },
97
- links: [
98
- { nodeId: "nextPictureId", gps: [0, 2] }
99
- ],
100
- gps: [1, 1]
101
- };
102
- expect(utils.getRoadAbsoluteHeading(pm)).toEqual(315);
103
- });
104
-
105
- it("works with last picture", () => {
106
- const pm = {
107
- sequence: { prevPic: "prevPictureId" },
108
- links: [
109
- { nodeId: "prevPictureId", gps: [0, 0] }
110
- ],
111
- gps: [0, -1]
112
- };
113
- expect(utils.getRoadAbsoluteHeading(pm)).toEqual(180);
114
- });
115
-
116
- it("works with middle picture", () => {
117
- const pm = {
118
- sequence: { prevPic: "prevPictureId", nextPic: "nextPictureId" },
119
- links: [
120
- { nodeId: "prevPictureId", gps: [0, 0] },
121
- { nodeId: "nextPictureId", gps: [2, 2] }
122
- ],
123
- gps: [1, 1]
124
- };
125
- expect(utils.getRoadAbsoluteHeading(pm)).toEqual(45);
126
- });
127
- });
128
-
129
- describe("getRelativeHeading", () => {
130
- it("should throw an error if no picture selected", () => {
131
- expect(() => utils.getRelativeHeading()).toThrow("No picture selected");
132
- });
133
-
134
- it("should calculate relative heading correctly", () => {
135
- const pictureMetadata = {
136
- properties: { "view:azimuth": 30 },
137
- sequence: { prevPic: "prevPictureId", nextPic: "nextPictureId" },
138
- links: [
139
- { nodeId: "prevPictureId", gps: [0, 0] },
140
- { nodeId: "nextPictureId", gps: [2, 2] }
141
- ],
142
- gps: [1, 1]
143
- };
144
-
145
- expect(utils.getRelativeHeading(pictureMetadata)).toBe(-15);
146
- });
147
-
148
- it("works looking behind", () => {
149
- const pictureMetadata = {
150
- properties: { "view:azimuth": 226 },
151
- sequence: { prevPic: "prevPictureId", nextPic: "nextPictureId" },
152
- links: [
153
- { nodeId: "prevPictureId", gps: [0, 0] },
154
- { nodeId: "nextPictureId", gps: [2, 2] }
155
- ],
156
- gps: [1, 1]
157
- };
158
-
159
- expect(utils.getRelativeHeading(pictureMetadata)).toBe(-179);
160
- });
161
-
162
- it("works with distorted path", () => {
163
- const pictureMetadata = {
164
- properties: { "view:azimuth": 100 },
165
- sequence: { prevPic: "prevPictureId", nextPic: "nextPictureId" },
166
- links: [
167
- { nodeId: "prevPictureId", gps: [0, 0] },
168
- { nodeId: "nextPictureId", gps: [2, 1] }
169
- ],
170
- gps: [1, 0]
171
- };
172
-
173
- expect(utils.getRelativeHeading(pictureMetadata)).toBe(10);
174
- });
175
-
176
- it("works without previous link", () => {
177
- const pictureMetadata = {
178
- properties: { "view:azimuth": 100 },
179
- sequence: { nextPic: "nextPictureId" },
180
- links: [
181
- { nodeId: "nextPictureId", gps: [2, 1] }
182
- ],
183
- gps: [1, 1]
184
- };
185
-
186
- expect(utils.getRelativeHeading(pictureMetadata)).toBe(10);
187
- });
188
-
189
- it("should handle missing prevPic or nextPic", () => {
190
- const metadataWithoutPrevNext = {
191
- properties: { "view:azimuth": 30 },
192
- gps: [0, 0]
193
- };
194
- expect(utils.getRelativeHeading(metadataWithoutPrevNext)).toBe(0);
195
- });
196
- });
197
-
198
- describe("getSimplifiedAngle", () => {
199
- it("returns \"N\"", () => {
200
- expect(utils.getSimplifiedAngle([0, 0], [0, 1])).toBe("N");
201
- });
202
-
203
- it("returns \"ENE\"", () => {
204
- expect(utils.getSimplifiedAngle([0, 0], [1, 1])).toBe("ENE");
205
- });
206
-
207
- it("returns \"ESE\"", () => {
208
- expect(utils.getSimplifiedAngle([0, 0], [1, -1])).toBe("ESE");
209
- });
210
-
211
- it("returns \"S\"", () => {
212
- expect(utils.getSimplifiedAngle([0, 0], [0, -1])).toBe("S");
213
- });
214
-
215
- it("returns \"WNW\"", () => {
216
- expect(utils.getSimplifiedAngle([0, 0], [-1, 1])).toBe("WNW");
217
- });
218
-
219
- it("returns \"WSW\"", () => {
220
- expect(utils.getSimplifiedAngle([0, 0], [-1, -1])).toBe("WSW");
221
- });
222
- });
223
-
224
- describe("positionToXYZ", () => {
225
- it("works with xy", () => {
226
- const r = utils.positionToXYZ({ pitch: 10, yaw: -5 });
227
- expect(r).toEqual({ x: -286.4788975654116, y: 572.9577951308232 });
228
- });
229
-
230
- it("works with xyz", () => {
231
- const r = utils.positionToXYZ({ pitch: 10, yaw: -5 }, 15);
232
- expect(r).toEqual({ x: -286.4788975654116, y: 572.9577951308232, z: 15 });
233
- });
234
- });
235
-
236
- describe("xyzToPosition", () => {
237
- it("works with xyz", () => {
238
- const r = utils.xyzToPosition(-286.4788975654116, 572.9577951308232, 15);
239
- expect(r).toEqual({ pitch: 10, yaw: -5, zoom: 15 });
240
- });
241
- });
242
-
243
- describe("degToDms", () => {
244
- it("converts positive decimal degrees to DMS correctly", () => {
245
- const result = utils.degToDms(45.7896541);
246
- expect(result).toEqual({ d: 45, m: 47, s: 22.755 });
247
- });
248
-
249
- it("converts negative decimal degrees to DMS correctly 1", () => {
250
- const result = utils.degToDms(-12.751234);
251
- expect(result).toEqual({ d: -12, m: 45, s: 4.442 });
252
- });
253
-
254
- it("converts negative decimal degrees to DMS correctly 2", () => {
255
- const result = utils.degToDms(-21.007598);
256
- expect(result).toEqual({ d: -21, m: 0, s: 27.353 });
257
- });
258
-
259
- it("converts zero degrees to DMS correctly", () => {
260
- const result = utils.degToDms(0);
261
- expect(result).toEqual({ d: 0, m: 0, s: 0 });
262
- });
263
-
264
- it("handles integer degrees correctly", () => {
265
- const result = utils.degToDms(90);
266
- expect(result).toEqual({ d: 90, m: 0, s: 0 });
267
- });
268
- });
269
-
270
- describe("josmBboxParameters", () => {
271
- it("works with null-like", () => {
272
- expect(utils.josmBboxParameters(null)).toBeNull();
273
- expect(utils.josmBboxParameters(undefined)).toBeNull();
274
- });
275
-
276
- it("works without azimuth", () => {
277
- const meta = { gps: [2.3522, 48.8566] };
278
- const result = utils.josmBboxParameters(meta);
279
- expect(result).toBe("left=2.3522&right=2.3522&top=48.8566&bottom=48.8566&changeset_source=Panoramax");
280
- });
281
-
282
- it("works with azimuth = 0", () => {
283
- const meta = { gps: [2.3522, 48.8566], properties: { "view:azimuth": 0 } };
284
- const result = utils.josmBboxParameters(meta);
285
- expect(result).toBe("left=2.3522&right=2.3524&top=48.8568&bottom=48.8566&changeset_source=Panoramax");
286
- });
287
-
288
- it("works with azimuth = 180", () => {
289
- const meta = { gps: [2.3522, 48.8566], properties: { "view:azimuth": 180 } };
290
- const result = utils.josmBboxParameters(meta);
291
- expect(result).toBe("left=2.352&right=2.3524&top=48.8566&bottom=48.8564&changeset_source=Panoramax");
292
- });
293
-
294
- it("works with azimuth = 90", () => {
295
- const meta = { gps: [2.3522, 48.8566], properties: { "view:azimuth": 90 } };
296
- const result = utils.josmBboxParameters(meta);
297
- expect(result).toBe("left=2.3522&right=2.3524&top=48.8568&bottom=48.8564&changeset_source=Panoramax");
298
- });
299
-
300
- it("works with azimuth = 270", () => {
301
- const meta = { gps: [2.3522, 48.8566], properties: { "view:azimuth": 270 } };
302
- const result = utils.josmBboxParameters(meta);
303
- expect(result).toBe("left=2.352&right=2.3522&top=48.8568&bottom=48.8564&changeset_source=Panoramax");
304
- });
305
- });
306
-
307
- describe("getCookie", () => {
308
- it("should return the value of the specified cookie", () => {
309
- jest.spyOn(document, "cookie", "get").mockReturnValueOnce("session=abc123");
310
- expect(utils.getCookie("session")).toBe("abc123");
311
- });
312
-
313
- it("should return null if the cookie is not found", () => {
314
- jest.spyOn(document, "cookie", "get").mockReturnValueOnce("session=abc123");
315
- expect(utils.getCookie("user_id")).toBeUndefined();
316
- });
317
-
318
- it("should return the correct value when multiple cookies are set", () => {
319
- jest.spyOn(document, "cookie", "get").mockReturnValueOnce("session=abc123; user_id=789; user_name=John");
320
- expect(utils.getCookie("user_id")).toBe("789");
321
- });
322
-
323
- it("should return null if cookie with the specified name has no value", () => {
324
- jest.spyOn(document, "cookie", "get").mockReturnValueOnce("session=; user_id=789");
325
- expect(utils.getCookie("session")).toBe("");
326
- });
327
-
328
- it("should return the correct value when the cookie contains =", () => {
329
- jest.spyOn(document, "cookie", "get").mockReturnValueOnce("custom_cookie=abc=123");
330
- expect(utils.getCookie("custom_cookie")).toBe("abc=123");
331
- });
332
- });
333
-
334
- describe("getUserAccount", () => {
335
- it("should return an object with user id and name when all cookies are present", () => {
336
- jest.spyOn(document, "cookie", "get").mockReturnValue("session=abc123; user_id=789; user_name=John");
337
- expect(utils.getUserAccount()).toEqual({ id: "789", name: "John" });
338
- });
339
-
340
- it("should return null if session cookie is missing", () => {
341
- jest.spyOn(document, "cookie", "get").mockReturnValue("user_id=789; user_name=John");
342
- expect(utils.getUserAccount()).toBeNull();
343
- });
344
-
345
- it("should return null if user_id cookie is missing", () => {
346
- jest.spyOn(document, "cookie", "get").mockReturnValue("session=abc123; user_name=John");
347
- expect(utils.getUserAccount()).toBeNull();
348
- });
349
-
350
- it("should return null if user_name cookie is missing", () => {
351
- jest.spyOn(document, "cookie", "get").mockReturnValue("session=abc123; user_id=789");
352
- expect(utils.getUserAccount()).toBeNull();
353
- });
354
-
355
- it("should return null if all cookies are missing", () => {
356
- expect(utils.getUserAccount()).toBeNull();
357
- });
358
- });
@@ -1,31 +0,0 @@
1
- import { faChevronDown } from "@fortawesome/free-solid-svg-icons/faChevronDown";
2
- import * as widgets from "../../src/utils/widgets";
3
-
4
- describe("fa", () => {
5
- it("works", () => {
6
- const res = widgets.fa(faChevronDown);
7
- expect(res).toMatchSnapshot();
8
- });
9
- });
10
-
11
- describe("createWebComp", () => {
12
- it("works", () => {
13
- const tag = "custom-element";
14
- const props = {
15
- id: "test-id",
16
- class: "test-class",
17
- _customProp: "secret",
18
- fnDoSomething: jest.fn(),
19
- onClick: jest.fn(),
20
- };
21
-
22
- const wc = widgets.createWebComp(tag, props);
23
-
24
- expect(wc).toBeInstanceOf(HTMLElement);
25
- expect(wc.tagName.toLowerCase()).toBe(tag);
26
- expect(wc.getAttribute("id")).toBe(props.id);
27
- expect(wc.getAttribute("class")).toBe(props.class);
28
- expect(wc._customProp).toBe(props._customProp);
29
- expect(wc.DoSomething).toBe(props.fnDoSomething);
30
- });
31
- });
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes