@panoramax/web-viewer 3.0.2-develop-a8ea8e60

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 (125) hide show
  1. package/.dockerignore +6 -0
  2. package/.gitlab-ci.yml +71 -0
  3. package/CHANGELOG.md +428 -0
  4. package/CODE_OF_CONDUCT.md +134 -0
  5. package/Dockerfile +14 -0
  6. package/LICENSE +21 -0
  7. package/README.md +39 -0
  8. package/build/editor.html +1 -0
  9. package/build/index.css +36 -0
  10. package/build/index.css.map +1 -0
  11. package/build/index.html +1 -0
  12. package/build/index.js +25 -0
  13. package/build/index.js.map +1 -0
  14. package/build/map.html +1 -0
  15. package/build/viewer.html +1 -0
  16. package/config/env.js +104 -0
  17. package/config/getHttpsConfig.js +66 -0
  18. package/config/getPackageJson.js +25 -0
  19. package/config/jest/babelTransform.js +29 -0
  20. package/config/jest/cssTransform.js +14 -0
  21. package/config/jest/fileTransform.js +40 -0
  22. package/config/modules.js +134 -0
  23. package/config/paths.js +72 -0
  24. package/config/pnpTs.js +35 -0
  25. package/config/webpack/persistentCache/createEnvironmentHash.js +9 -0
  26. package/config/webpack.config.js +885 -0
  27. package/config/webpackDevServer.config.js +127 -0
  28. package/docs/01_Start.md +149 -0
  29. package/docs/02_Usage.md +828 -0
  30. package/docs/03_URL_settings.md +140 -0
  31. package/docs/04_Advanced_examples.md +214 -0
  32. package/docs/05_Compatibility.md +85 -0
  33. package/docs/09_Develop.md +62 -0
  34. package/docs/90_Releases.md +27 -0
  35. package/docs/images/class_diagram.drawio +129 -0
  36. package/docs/images/class_diagram.jpg +0 -0
  37. package/docs/images/screenshot.jpg +0 -0
  38. package/mkdocs.yml +45 -0
  39. package/package.json +254 -0
  40. package/public/editor.html +54 -0
  41. package/public/favicon.ico +0 -0
  42. package/public/index.html +59 -0
  43. package/public/map.html +53 -0
  44. package/public/viewer.html +67 -0
  45. package/scripts/build.js +217 -0
  46. package/scripts/start.js +176 -0
  47. package/scripts/test.js +52 -0
  48. package/src/Editor.css +37 -0
  49. package/src/Editor.js +359 -0
  50. package/src/StandaloneMap.js +114 -0
  51. package/src/Viewer.css +203 -0
  52. package/src/Viewer.js +1186 -0
  53. package/src/components/CoreView.css +64 -0
  54. package/src/components/CoreView.js +159 -0
  55. package/src/components/Loader.css +56 -0
  56. package/src/components/Loader.js +111 -0
  57. package/src/components/Map.css +65 -0
  58. package/src/components/Map.js +841 -0
  59. package/src/components/Photo.css +36 -0
  60. package/src/components/Photo.js +687 -0
  61. package/src/img/arrow_360.svg +14 -0
  62. package/src/img/arrow_flat.svg +11 -0
  63. package/src/img/arrow_triangle.svg +10 -0
  64. package/src/img/arrow_turn.svg +9 -0
  65. package/src/img/bg_aerial.jpg +0 -0
  66. package/src/img/bg_streets.jpg +0 -0
  67. package/src/img/loader_base.jpg +0 -0
  68. package/src/img/loader_hd.jpg +0 -0
  69. package/src/img/logo_dead.svg +91 -0
  70. package/src/img/marker.svg +17 -0
  71. package/src/img/marker_blue.svg +20 -0
  72. package/src/img/switch_big.svg +44 -0
  73. package/src/img/switch_mini.svg +48 -0
  74. package/src/index.js +10 -0
  75. package/src/translations/de.json +163 -0
  76. package/src/translations/en.json +164 -0
  77. package/src/translations/eo.json +6 -0
  78. package/src/translations/es.json +164 -0
  79. package/src/translations/fi.json +1 -0
  80. package/src/translations/fr.json +164 -0
  81. package/src/translations/hu.json +133 -0
  82. package/src/translations/nl.json +1 -0
  83. package/src/translations/zh_Hant.json +136 -0
  84. package/src/utils/API.js +709 -0
  85. package/src/utils/Exif.js +198 -0
  86. package/src/utils/I18n.js +75 -0
  87. package/src/utils/Map.js +382 -0
  88. package/src/utils/PhotoAdapter.js +45 -0
  89. package/src/utils/Utils.js +568 -0
  90. package/src/utils/Widgets.js +477 -0
  91. package/src/viewer/URLHash.js +334 -0
  92. package/src/viewer/Widgets.css +711 -0
  93. package/src/viewer/Widgets.js +1196 -0
  94. package/tests/Editor.test.js +125 -0
  95. package/tests/StandaloneMap.test.js +44 -0
  96. package/tests/Viewer.test.js +363 -0
  97. package/tests/__snapshots__/Editor.test.js.snap +300 -0
  98. package/tests/__snapshots__/StandaloneMap.test.js.snap +30 -0
  99. package/tests/__snapshots__/Viewer.test.js.snap +195 -0
  100. package/tests/components/CoreView.test.js +91 -0
  101. package/tests/components/Loader.test.js +38 -0
  102. package/tests/components/Map.test.js +230 -0
  103. package/tests/components/Photo.test.js +335 -0
  104. package/tests/components/__snapshots__/Loader.test.js.snap +15 -0
  105. package/tests/components/__snapshots__/Map.test.js.snap +767 -0
  106. package/tests/components/__snapshots__/Photo.test.js.snap +205 -0
  107. package/tests/data/Map_geocoder_ban.json +36 -0
  108. package/tests/data/Map_geocoder_nominatim.json +56 -0
  109. package/tests/data/Viewer_pictures_1.json +148 -0
  110. package/tests/setupTests.js +5 -0
  111. package/tests/utils/API.test.js +906 -0
  112. package/tests/utils/Exif.test.js +124 -0
  113. package/tests/utils/I18n.test.js +28 -0
  114. package/tests/utils/Map.test.js +105 -0
  115. package/tests/utils/Utils.test.js +300 -0
  116. package/tests/utils/Widgets.test.js +107 -0
  117. package/tests/utils/__snapshots__/API.test.js.snap +132 -0
  118. package/tests/utils/__snapshots__/Exif.test.js.snap +43 -0
  119. package/tests/utils/__snapshots__/Map.test.js.snap +48 -0
  120. package/tests/utils/__snapshots__/Utils.test.js.snap +41 -0
  121. package/tests/utils/__snapshots__/Widgets.test.js.snap +44 -0
  122. package/tests/viewer/URLHash.test.js +537 -0
  123. package/tests/viewer/Widgets.test.js +127 -0
  124. package/tests/viewer/__snapshots__/URLHash.test.js.snap +98 -0
  125. package/tests/viewer/__snapshots__/Widgets.test.js.snap +393 -0
@@ -0,0 +1,828 @@
1
+ <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
2
+
3
+ ### Table of Contents
4
+
5
+ * [CoreView][1]
6
+ * [Map][2]
7
+ * [Photo][3]
8
+ * [Editor][4]
9
+ * [StandaloneMap][5]
10
+ * [getCookie][6]
11
+ * [getUserAccount][7]
12
+ * [Viewer][8]
13
+
14
+ ## CoreView
15
+
16
+ **Extends EventTarget**
17
+
18
+ Core view is an abstract class used for setting up any of the main Panoramax view components.
19
+
20
+ It is used to prepare API, internationalization, options checks... for Viewer, StandaloneMap and Editor classes.
21
+
22
+ ### Parameters
23
+
24
+ * `container` **([string][9] | [Element][10])** The DOM element to create viewer into
25
+ * `endpoint` **[string][9]** URL to API to use (must be a [STAC API][11])
26
+ * `options` **[object][12]?** View options. (optional, default `{}`)
27
+
28
+ * `options.selectedSequence` **[string][9]?** The ID of sequence to highlight on load (defaults to none)
29
+ * `options.selectedPicture` **[string][9]?** The ID of picture to highlight on load (defaults to none)
30
+ * `options.fetchOptions` **[object][12]** Set custom options for fetch calls made against API ([same syntax as fetch options parameter][13]) (optional, default `null`)
31
+ * `options.users` **([string][9] | [Array][14]<[string][9]>)?** List of user IDs to default use for display. Defaults to all users.
32
+ * `options.style` **([string][9] | [object][12])?** The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification][15], or a URL string pointing to one. Defaults to OSMFR vector tiles.
33
+
34
+ ### Properties
35
+
36
+ * `_t` **[object][12]** The translations labels
37
+ * `_selectedSeqId` **[string][9]** The selected sequence ID
38
+ * `_selectedPicId` **[string][9]** The selected picture ID
39
+ * `_api` **API** The API handler
40
+ * `_loader` **Loader** The initial loader message
41
+ * `_options` **[object][12]** The stored options
42
+ * `container` **[Element][10]** The DOM container
43
+
44
+ ### destroy
45
+
46
+ Ends all form of life in this object.
47
+
48
+ This is useful for Single Page Applications (SPA), to remove various event listeners.
49
+
50
+ ### isWidthSmall
51
+
52
+ Is the view running in a small container (small embed or smartphone)
53
+
54
+ Returns **[boolean][16]** True if container is small
55
+
56
+ ### isHeightSmall
57
+
58
+ Is the view running in a small-height container (small embed or smartphone)
59
+
60
+ Returns **[boolean][16]** True if container height is small
61
+
62
+ ### select
63
+
64
+ Change the currently picture and/or sequence.
65
+ Calling the method without parameters unselects.
66
+
67
+ #### Parameters
68
+
69
+ * `seqId` **[string][9]?** The sequence UUID (optional, default `null`)
70
+ * `picId` **[string][9]?** The picture UUID (optional, default `null`)
71
+ * `force` **[boolean][16]** Force select even if already selected (optional, default `false`)
72
+
73
+ ### select
74
+
75
+ Event for sequence/picture selection
76
+
77
+ Type: [object][12]
78
+
79
+ #### Properties
80
+
81
+ * `detail` **[object][12]** Event information
82
+
83
+ * `detail.seqId` **[string][9]** The selected sequence ID
84
+ * `detail.picId` **[string][9]** The selected picture ID (or null if not a precise picture clicked)
85
+ * `detail.prevSeqId` **[string][9]?** The previously selected sequence ID (or null if none)
86
+ * `detail.prevPicId` **[string][9]?** The previously selected picture ID (or null if none)
87
+
88
+ ### ready
89
+
90
+ Event for viewer being ready to use (API loaded)
91
+
92
+ ### broken
93
+
94
+ Event for viewer failing to initially load
95
+
96
+ Type: [object][12]
97
+
98
+ #### Properties
99
+
100
+ * `detail` **[object][12]** Event information
101
+
102
+ * `detail.error` **[string][9]** The user-friendly error message to display
103
+
104
+ ### map:background-changed
105
+
106
+ Event for map background changes
107
+
108
+ Type: [object][12]
109
+
110
+ #### Properties
111
+
112
+ * `detail` **[object][12]** Event information
113
+
114
+ * `detail.background` **[string][9]?** The new selected background (aerial, streets)
115
+
116
+ ### map:users-changed
117
+
118
+ Event for visible users changes
119
+
120
+ Type: [object][12]
121
+
122
+ #### Properties
123
+
124
+ * `detail` **[object][12]** Event information
125
+
126
+ * `detail.usersIds` **[Array][14]<[string][9]>?** The list of newly selected users
127
+
128
+ ### map:sequence-hover
129
+
130
+ Event when a sequence on map is hovered (not selected)
131
+
132
+ Type: [object][12]
133
+
134
+ #### Properties
135
+
136
+ * `detail` **[object][12]** Event information
137
+
138
+ * `detail.seqId` **[string][9]** The hovered sequence ID
139
+
140
+ ### map:sequence-click
141
+
142
+ Event when a sequence on map is clicked
143
+
144
+ Type: [object][12]
145
+
146
+ #### Properties
147
+
148
+ * `detail` **[object][12]** Event information
149
+
150
+ * `detail.seqId` **[string][9]** The clicked sequence ID
151
+ * `detail.coordinates` **maplibregl.LngLat** The coordinates of user click
152
+
153
+ ### map:picture-click
154
+
155
+ Event when a picture on map is clicked
156
+
157
+ Type: [object][12]
158
+
159
+ #### Properties
160
+
161
+ * `detail` **[object][12]** Event information
162
+
163
+ * `detail.picId` **[string][9]** The clicked picture ID
164
+ * `detail.seqId` **[string][9]** The clicked picture's sequence ID
165
+ * `detail.feature` **[object][12]** The GeoJSON feature of the picture
166
+
167
+ ### psv:picture-loading
168
+
169
+ Event for picture starting to load
170
+
171
+ Type: [object][12]
172
+
173
+ #### Properties
174
+
175
+ * `detail` **[object][12]** Event information
176
+
177
+ * `detail.picId` **[string][9]** The picture unique identifier
178
+ * `detail.lon` **[number][17]** Longitude (WGS84)
179
+ * `detail.lat` **[number][17]** Latitude (WGS84)
180
+ * `detail.x` **[number][17]** New x position (in degrees, 0-360), corresponds to heading (0° = North, 90° = East, 180° = South, 270° = West)
181
+ * `detail.y` **[number][17]** New y position (in degrees)
182
+ * `detail.z` **[number][17]** New z position (0-100)
183
+
184
+ ### psv:picture-preview-started
185
+
186
+ Event for picture preview
187
+
188
+ Type: [object][12]
189
+
190
+ #### Properties
191
+
192
+ * `detail` **[object][12]** Event information
193
+
194
+ * `detail.picId` **[string][9]** The picture ID
195
+ * `detail.coordinates` **[Array][14]<[number][17]>** \[x,y] coordinates
196
+ * `detail.direction` **[number][17]** The theorical picture orientation
197
+
198
+ ### psv:picture-preview-stopped
199
+
200
+ Event for end of picture preview
201
+
202
+ Type: [object][12]
203
+
204
+ #### Properties
205
+
206
+ * `detail` **[object][12]** Event information
207
+
208
+ * `detail.picId` **[string][9]** The picture ID
209
+
210
+ ### psv:view-rotated
211
+
212
+ Event for viewer rotation
213
+
214
+ Type: [object][12]
215
+
216
+ #### Properties
217
+
218
+ * `detail` **[object][12]** Event information
219
+
220
+ * `detail.x` **[number][17]** New x position (in degrees, 0-360), corresponds to heading (0° = North, 90° = East, 180° = South, 270° = West)
221
+ * `detail.y` **[number][17]** New y position (in degrees)
222
+ * `detail.z` **[number][17]** New Z position (between 0 and 100)
223
+
224
+ ### psv:picture-loaded
225
+
226
+ Event for picture load (low-resolution image is loaded)
227
+
228
+ Type: [object][12]
229
+
230
+ #### Properties
231
+
232
+ * `detail` **[object][12]** Event information
233
+
234
+ * `detail.picId` **[string][9]** The picture unique identifier
235
+ * `detail.lon` **[number][17]** Longitude (WGS84)
236
+ * `detail.lat` **[number][17]** Latitude (WGS84)
237
+ * `detail.x` **[number][17]** New x position (in degrees, 0-360), corresponds to heading (0° = North, 90° = East, 180° = South, 270° = West)
238
+ * `detail.y` **[number][17]** New y position (in degrees)
239
+ * `detail.z` **[number][17]** New z position (0-100)
240
+
241
+ ### psv:picture-tiles-loaded
242
+
243
+ Event launched when all visible tiles of a picture are loaded
244
+
245
+ Type: [object][12]
246
+
247
+ #### Properties
248
+
249
+ * `detail` **[object][12]** Event information
250
+
251
+ * `detail.picId` **[string][9]** The picture unique identifier
252
+
253
+ ### psv:transition-duration-changed
254
+
255
+ Event for transition duration change
256
+
257
+ Type: [object][12]
258
+
259
+ #### Properties
260
+
261
+ * `detail` **[object][12]** Event information
262
+
263
+ * `detail.duration` **[string][9]** New duration (in milliseconds)
264
+
265
+ ## Map
266
+
267
+ **Extends maplibregl.Map**
268
+
269
+ Map is the component showing pictures and sequences geolocation.
270
+
271
+ Note that all functions of [MapLibre GL JS class Map][18] are also available.
272
+
273
+ ### Parameters
274
+
275
+ * `parent` **[CoreView][1]** The parent view
276
+ * `container` **[Element][10]** The DOM element to create into
277
+ * `options` **[object][12]?** The map options (any of [MapLibre GL settings][19] or any supplementary option defined here) (optional, default `{}`)
278
+
279
+ * `options.raster` **[object][12]?** The MapLibre raster source for aerial background. This must be a JSON object following [MapLibre raster source definition][20].
280
+ * `options.background` **[string][9]?** Choose default map background to display (streets or aerial, if raster aerial background available). Defaults to street.
281
+ * `options.geocoder` **[object][12]?** Optional geocoder settings
282
+
283
+ * `options.geocoder.engine` **[string][9]?** Set the geocoder engine to use (nominatim, ban)
284
+
285
+ ### destroy
286
+
287
+ Destroy any form of life in this component
288
+
289
+ ### reloadVectorTiles
290
+
291
+ Force refresh of vector tiles data
292
+
293
+ ### hasTwoBackgrounds
294
+
295
+ Check if map offers aerial imagery as well as streets rendering.
296
+
297
+ Returns **[boolean][16]** True if aerial imagery is available for display
298
+
299
+ ### getBackground
300
+
301
+ Get the currently selected map background
302
+
303
+ Returns **[string][9]** aerial or streets
304
+
305
+ ### setBackground
306
+
307
+ Change the shown background in map.
308
+
309
+ #### Parameters
310
+
311
+ * `bg` **[string][9]** The new background to display (aerial or streets)
312
+
313
+ ### getVisibleUsers
314
+
315
+ Get the currently visible users
316
+
317
+ Returns **[Array][14]<[string][9]>** List of visible users
318
+
319
+ ### setVisibleUsers
320
+
321
+ Make given user layers visible on map, and hide all others (if any)
322
+
323
+ #### Parameters
324
+
325
+ * `visibleIds` **([string][9] | [Array][14]<[string][9]>)** The user layers IDs to display (optional, default `[]`)
326
+
327
+ ### filterUserLayersContent
328
+
329
+ Filter the visible data content in all visible map layers
330
+
331
+ #### Parameters
332
+
333
+ * `dataType` **[string][9]** sequences or pictures
334
+ * `filter` **[object][12]** The MapLibre GL filter rule to apply
335
+
336
+ ### displayPictureMarker
337
+
338
+ Shows on map a picture position and heading.
339
+
340
+ #### Parameters
341
+
342
+ * `lon` **[number][17]** The longitude
343
+ * `lat` **[number][17]** The latitude
344
+ * `heading` **[number][17]** The heading
345
+
346
+ ### reloadLayersStyles
347
+
348
+ Forces reload of pictures/sequences layer styles.
349
+ This is useful after a map theme change.
350
+
351
+ ## Photo
352
+
353
+ **Extends PSViewer**
354
+
355
+ Photo is the component showing a single picture.
356
+ It uses Photo Sphere Viewer as a basis, and pre-configure dialog with STAC API.
357
+
358
+ Note that all functions of [PhotoSphereViewer Viewer class][21] are available as well.
359
+
360
+ ### Parameters
361
+
362
+ * `parent` **[CoreView][1]** The parent view
363
+ * `container` **[Element][10]** The DOM element to create into
364
+ * `options` **[object][12]?** The viewer options. Can be any of [Photo Sphere Viewer options][22] (optional, default `{}`)
365
+
366
+ * `options.transitionDuration` **[number][17]?** The number of milliseconds the transition animation should be.
367
+ * `options.shouldGoFast` **[function][23]?** Function returning a boolean to indicate if we may skip loading HD images.
368
+
369
+ ### getPictureMetadata
370
+
371
+ Access currently shown picture metadata
372
+
373
+ Returns **[object][12]** Picture metadata
374
+
375
+ ### goToNextPicture
376
+
377
+ Displays next picture in current sequence (if any)
378
+
379
+ ### goToPrevPicture
380
+
381
+ Displays previous picture in current sequence (if any)
382
+
383
+ ### goToPosition
384
+
385
+ Displays in viewer a picture near to given coordinates
386
+
387
+ #### Parameters
388
+
389
+ * `lat` **[number][17]** Latitude (WGS84)
390
+ * `lon` **[number][17]** Longitude (WGS84)
391
+
392
+ Returns **[Promise][24]** Resolves on picture ID if picture found, otherwise rejects
393
+
394
+ ### getXY
395
+
396
+ Get 2D position of sphere currently shown to user
397
+
398
+ Returns **[object][12]** Position in format { x: heading in degrees (0° = North, 90° = East, 180° = South, 270° = West), y: top/bottom position in degrees (-90° = bottom, 0° = front, 90° = top) }
399
+
400
+ ### getXYZ
401
+
402
+ Get 3D position of sphere currently shown to user
403
+
404
+ Returns **[object][12]** Position in format { x: heading in degrees (0° = North, 90° = East, 180° = South, 270° = West), y: top/bottom position in degrees (-90° = bottom, 0° = front, 90° = top), z: zoom (0 = wide, 100 = zoomed in) }
405
+
406
+ ### getPictureOriginalHeading
407
+
408
+ Get capture orientation of current picture, based on its GPS.
409
+
410
+ Returns **any** Picture original heading in degrees (0 to 360°)
411
+
412
+ ### getPictureRelativeHeading
413
+
414
+ Computes the relative heading of currently selected picture.
415
+ This gives the angle of capture compared to sequence path (vehicle movement).
416
+
417
+ Returns **any** Relative heading in degrees (-180 to 180)
418
+
419
+ ### clearPictureMetadataCache
420
+
421
+ Clears the Photo Sphere Viewer metadata cache.
422
+ It is useful when current picture or sequence has changed server-side after first load.
423
+
424
+ ### setXYZ
425
+
426
+ Change the shown position in picture
427
+
428
+ #### Parameters
429
+
430
+ * `x` **[number][17]** X position (in degrees)
431
+ * `y` **[number][17]** Y position (in degrees)
432
+ * `z` **[number][17]** Z position (0-100)
433
+
434
+ ### setHigherContrast
435
+
436
+ Enable or disable higher contrast on picture
437
+
438
+ #### Parameters
439
+
440
+ * `enable` **[boolean][16]** True to enable higher contrast
441
+
442
+ ### getTransitionDuration
443
+
444
+ Get the duration of stay on a picture during a sequence play.
445
+
446
+ Returns **[number][17]** The duration (in milliseconds)
447
+
448
+ ### setTransitionDuration
449
+
450
+ Changes the duration of stay on a picture during a sequence play.
451
+
452
+ #### Parameters
453
+
454
+ * `value` **[number][17]** The new duration (in milliseconds, between 100 and 3000)
455
+
456
+ ## Editor
457
+
458
+ **Extends CoreView**
459
+
460
+ Editor allows to focus on a single sequence, and preview what you edits would look like.
461
+ It shows both picture and map.
462
+
463
+ Note that you can use any of the [CoreView][25] class functions as well.
464
+
465
+ ### Parameters
466
+
467
+ * `container` **([string][9] | [Element][10])** The DOM element to create viewer into
468
+ * `endpoint` **[string][9]** URL to API to use (must be a [STAC API][11])
469
+ * `options` **[object][12]?** View options. (optional, default `{}`)
470
+
471
+ * `options.selectedSequence` **[string][9]** The ID of sequence to highlight on load. Must be always defined.
472
+ * `options.selectedPicture` **[string][9]?** The ID of picture to highlight on load (defaults to none)
473
+ * `options.fetchOptions` **[object][12]** Set custom options for fetch calls made against API ([same syntax as fetch options parameter][13]) (optional, default `null`)
474
+ * `options.raster` **[object][12]?** The MapLibre raster source for aerial background. This must be a JSON object following [MapLibre raster source definition][20].
475
+ * `options.background` **[string][9]?** Choose default map background to display (streets or aerial, if raster aerial background available). Defaults to street.
476
+ * `options.style` **([string][9] | [object][12])?** The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification][15], or a URL string pointing to one.
477
+
478
+ ### Properties
479
+
480
+ * `map` **[Map][2]** The map widget
481
+ * `psv` **[Photo][3]** The photo widget
482
+
483
+ ### previewSequenceHeadingChange
484
+
485
+ Preview on map how the new relative heading would reflect on all pictures.
486
+ This doesn't change anything on API-side, it's just a preview.
487
+
488
+ #### Parameters
489
+
490
+ * `relHeading` **[number][17]?** The new relative heading compared to sequence path. In degrees, between -180 and 180 (0 = front, -90 = left, 90 = right). Set to null to remove preview.
491
+
492
+ ## StandaloneMap
493
+
494
+ **Extends CoreView**
495
+
496
+ The standalone map viewer allows to see STAC pictures data as a map.
497
+ It only embeds a map (no 360° pictures viewer) with a minimal picture preview (thumbnail).
498
+
499
+ Note that you can use any of the [CoreView][25] class functions as well.
500
+
501
+ ### Parameters
502
+
503
+ * `container` **([string][9] | [Element][10])** The DOM element to create viewer into
504
+ * `endpoint` **[string][9]** URL to API to use (must be a [STAC API][11])
505
+ * `options` **[object][12]?** Map options. Various settings can be passed, either the ones defined here, or any of [MapLibre GL settings][19]. (optional, default `{}`)
506
+
507
+ * `options.selectedSequence` **[string][9]?** The ID of sequence to highlight on load (defaults to none)
508
+ * `options.selectedPicture` **[string][9]?** The ID of picture to highlight on load (defaults to none)
509
+ * `options.fetchOptions` **[object][12]** Set custom options for fetch calls made against API ([same syntax as fetch options parameter][13]) (optional, default `null`)
510
+ * `options.minZoom` **[number][17]** The minimum zoom level of the map (0-24). (optional, default `0`)
511
+ * `options.maxZoom` **[number][17]** The maximum zoom level of the map (0-24). (optional, default `24`)
512
+ * `options.style` **([string][9] | [object][12])?** The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification][15], or a URL string pointing to one.
513
+ * `options.center` **external:maplibre-gl.LngLatLike** The initial geographical centerpoint of the map. If `center` is not specified in the constructor options, MapLibre GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `[0, 0]` Note: MapLibre GL uses longitude, latitude coordinate order (as opposed to latitude, longitude) to match GeoJSON. (optional, default `[0,0]`)
514
+ * `options.zoom` **[number][17]** The initial zoom level of the map. If `zoom` is not specified in the constructor options, MapLibre GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`. (optional, default `0`)
515
+ * `options.bounds` **external:maplibre-gl.LngLatBoundsLike?** The initial bounds of the map. If `bounds` is specified, it overrides `center` and `zoom` constructor options.
516
+ * `options.users` **[Array][14]<[string][9]>?** The IDs of users whom data should appear on map (defaults to all)
517
+
518
+ ### Properties
519
+
520
+ * `map` **[Map][2]** The map widget
521
+
522
+ ### destroy
523
+
524
+ Ends all form of life in this object.
525
+
526
+ This is useful for Single Page Applications (SPA), to remove various event listeners.
527
+
528
+ ## getCookie
529
+
530
+ Get a cookie value
531
+
532
+ ### Parameters
533
+
534
+ * `name` **str** The cookie name
535
+
536
+ Returns **str** The cookie value, or null if not found
537
+
538
+ ## getUserAccount
539
+
540
+ Checks if an user account exists
541
+
542
+ Returns **[object][12]** Object like {"id", "name"} or null if no authenticated account
543
+
544
+ ## Viewer
545
+
546
+ **Extends CoreView**
547
+
548
+ Viewer is the main component of the library, showing pictures and map.
549
+
550
+ Note that you can use any of the [CoreView][25] class functions as well.
551
+
552
+ ### Parameters
553
+
554
+ * `container` **([string][9] | [Element][10])** The DOM element to create viewer into
555
+ * `endpoint` **[string][9]** URL to API to use (must be a [STAC API][11])
556
+ * `options` **[object][12]?** Viewer options (optional, default `{}`)
557
+
558
+ * `options.selectedPicture` **[string][9]?** Initial picture identifier to display
559
+ * `options.position` **[Array][14]<[number][17]>?** Initial position to go to (in \[lat, lon] format)
560
+ * `options.hash` **[boolean][16]** Enable URL hash settings (optional, default `true`)
561
+ * `options.lang` **[string][9]?** Override language to use (defaults to navigator language, or English if translation not available)
562
+ * `options.transition` **int** Duration of stay on a picture during sequence play (excludes loading time) (optional, default `250`)
563
+ * `options.fetchOptions` **[object][12]** Set custom options for fetch calls made against API ([same syntax as fetch options parameter][13]) (optional, default `null`)
564
+ * `options.users` **([string][9] | [Array][14]<[string][9]>)?** The IDs of users whom data should appear on map (defaults to all). Only works with API having a "user-xyz" or "user-xyz-style" endpoint.
565
+ * `options.picturesNavigation` **[string][9]?** The allowed navigation between pictures ("any": no restriction (default), "seq": only pictures in same sequence, "pic": only selected picture)
566
+ * `options.map` **([boolean][16] | [object][12])** Enable contextual map for locating pictures. Setting to true or passing an object enables the map. Various settings can be passed, either the ones defined here, or any of [MapLibre GL settings][19] (optional, default `false`)
567
+
568
+ * `options.map.startWide` **[boolean][16]?** Show the map as main element at startup (defaults to false, viewer is wider at start)
569
+ * `options.map.minZoom` **[number][17]** The minimum zoom level of the map (0-24). (optional, default `0`)
570
+ * `options.map.maxZoom` **[number][17]** The maximum zoom level of the map (0-24). (optional, default `24`)
571
+ * `options.map.raster` **[object][12]?** The MapLibre raster source for aerial background. This must be a JSON object following [MapLibre raster source definition][20].
572
+ * `options.map.center` **external:maplibre-gl.LngLatLike** The initial geographical centerpoint of the map. If `center` is not specified in the constructor options, MapLibre GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `[0, 0]` Note: MapLibre GL uses longitude, latitude coordinate order (as opposed to latitude, longitude) to match GeoJSON. (optional, default `[0,0]`)
573
+ * `options.map.zoom` **[number][17]** The initial zoom level of the map. If `zoom` is not specified in the constructor options, MapLibre GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`. (optional, default `0`)
574
+ * `options.map.bounds` **external:maplibre-gl.LngLatBoundsLike?** The initial bounds of the map. If `bounds` is specified, it overrides `center` and `zoom` constructor options.
575
+ * `options.map.geocoder` **[object][12]?** Optional geocoder settings
576
+
577
+ * `options.map.geocoder.engine` **[string][9]?** Set the geocoder engine to use (nominatim, ban)
578
+ * `options.map.background` **[string][9]?** Choose default map background to display (streets or aerial, if raster aerial background available). Defaults to street.
579
+ * `options.map.theme` **[string][9]** The colouring scheme to use for pictures and sequences on map (default, age, type) (optional, default `default`)
580
+ * `options.style` **([string][9] | [object][12])?** The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification][15], or a URL string pointing to one.
581
+ * `options.widgets` **[object][12]?** Settings related to viewer buttons and widgets
582
+
583
+ * `options.widgets.editIdUrl` **[string][9]?** URL to the OpenStreetMap iD editor (defaults to OSM.org iD instance)
584
+ * `options.widgets.customWidget` **([string][9] | [Element][10])?** A user-defined widget to add (will be shown over "Share" button)
585
+ * `options.widgets.mapAttribution` **[string][9]?** Override the default map attribution (read from MapLibre style)
586
+ * `options.widgets.iframeBaseURL` **[string][9]?** Set a custom base URL for the "Share as iframe" menu (defaults to current page)
587
+
588
+ ### Properties
589
+
590
+ * `map` **[Map][2]** The map widget
591
+ * `psv` **[Photo][3]** The photo widget
592
+
593
+ ### destroy
594
+
595
+ Ends all form of life in this object.
596
+
597
+ This is useful for Single Page Applications (SPA), to remove various event listeners.
598
+
599
+ ### refreshPSV
600
+
601
+ Force reload of texture and tiles in Photo Sphere Viewer.
602
+
603
+ ### setPopup
604
+
605
+ Change full-page popup visibility and content
606
+
607
+ #### Parameters
608
+
609
+ * `visible` **[boolean][16]** True to make it appear
610
+ * `content` **([string][9] | [Array][14]<[Element][10]>)?** The new popup content (optional, default `null`)
611
+
612
+ ### playSequence
613
+
614
+ Goes continuously to next picture in sequence as long as possible
615
+
616
+ ### stopSequence
617
+
618
+ Stops playing current sequence
619
+
620
+ ### isSequencePlaying
621
+
622
+ Is there any sequence being played right now ?
623
+
624
+ Returns **[boolean][16]** True if sequence is playing
625
+
626
+ ### toggleSequencePlaying
627
+
628
+ Starts/stops the reading of pictures in a sequence
629
+
630
+ ### moveCenter
631
+
632
+ Move the view of main component to its center.
633
+ For map, center view on selected picture.
634
+ For picture, center view on image center.
635
+
636
+ ### moveLeft
637
+
638
+ Moves the view of main component slightly to the left.
639
+
640
+ ### moveRight
641
+
642
+ Moves the view of main component slightly to the right.
643
+
644
+ ### moveUp
645
+
646
+ Moves the view of main component slightly to the top.
647
+
648
+ ### moveDown
649
+
650
+ Moves the view of main component slightly to the bottom.
651
+
652
+ ### isMapWide
653
+
654
+ Is the map shown as main element instead of viewer (wide map mode) ?
655
+
656
+ Returns **[boolean][16]** True if map is wider than viewer
657
+
658
+ ### getPicturesNavigation
659
+
660
+ Get current pictures navigation mode.
661
+
662
+ Returns **[string][9]** The picture navigation mode ("any": no restriction, "seq": only pictures in same sequence, "pic": only selected picture)
663
+
664
+ ### setPicturesNavigation
665
+
666
+ Switch the allowed navigation between pictures.
667
+
668
+ #### Parameters
669
+
670
+ * `pn` **[string][9]** The picture navigation mode ("any": no restriction, "seq": only pictures in same sequence, "pic": only selected picture)
671
+
672
+ ### toggleJOSMLive
673
+
674
+ Enable or disable JOSM live editing using [Remote][26]
675
+
676
+ #### Parameters
677
+
678
+ * `enabled` **[boolean][16]** Set to true to enable JOSM live
679
+
680
+ Returns **[Promise][24]** Resolves on JOSM live being enabled or disabled
681
+
682
+ ### setFocus
683
+
684
+ Change the viewer focus (either on picture or map)
685
+
686
+ #### Parameters
687
+
688
+ * `focus` **[string][9]** The object to focus on (map, pic)
689
+ * `skipEvent` **[boolean][16]** True to not send focus-changed event (optional, default `false`)
690
+
691
+ ### toggleFocus
692
+
693
+ Toggle the viewer focus (either on picture or map)
694
+
695
+ ### setUnfocusedVisible
696
+
697
+ Change the visibility of reduced component (picture or map)
698
+
699
+ #### Parameters
700
+
701
+ * `visible` **[boolean][16]** True to make reduced component visible
702
+
703
+ ### toggleUnfocusedVisible
704
+
705
+ Toggle the visibility of reduced component (picture or map)
706
+
707
+ ### setFilters
708
+
709
+ Change the map filters
710
+
711
+ #### Parameters
712
+
713
+ * `filters` **[object][12]** Filtering values
714
+
715
+ * `filters.minDate` **[string][9]?** Start date for pictures (format YYYY-MM-DD)
716
+ * `filters.maxDate` **[string][9]?** End date for pictures (format YYYY-MM-DD)
717
+ * `filters.type` **[string][9]?** Type of picture to keep (flat, equirectangular)
718
+ * `filters.camera` **[string][9]?** Camera make and model to keep
719
+ * `filters.theme` **[string][9]?** Map theme to use
720
+ * `skipZoomIn` **[boolean][16]** If true, doesn't force zoom in to map level >= 7 (optional, default `false`)
721
+
722
+ ### sequence-playing
723
+
724
+ Event for sequence starting to play
725
+
726
+ ### sequence-stopped
727
+
728
+ Event for sequence stopped playing
729
+
730
+ ### pictures-navigation-changed
731
+
732
+ Event for pictures navigation mode change
733
+
734
+ Type: [object][12]
735
+
736
+ #### Properties
737
+
738
+ * `detail` **[object][12]** Event information
739
+
740
+ * `detail.value` **[string][9]** New mode (any, pic, seq)
741
+
742
+ ### josm-live-enabled
743
+
744
+ Event for JOSM live enabled
745
+
746
+ ### josm-live-disabled
747
+
748
+ Event for JOSM live disabled
749
+
750
+ ### focus-changed
751
+
752
+ Event for focus change (either map or picture is shown wide)
753
+
754
+ Type: [object][12]
755
+
756
+ #### Properties
757
+
758
+ * `detail` **[object][12]** Event information
759
+
760
+ * `detail.focus` **[string][9]** Component now focused on (map, pic)
761
+
762
+ ### filters-changed
763
+
764
+ Event for filters changes
765
+
766
+ Type: [object][12]
767
+
768
+ #### Properties
769
+
770
+ * `detail` **[object][12]** Event information
771
+
772
+ * `detail.minDate` **[string][9]?** The minimum date in time range (ISO format)
773
+ * `detail.maxDate` **[string][9]?** The maximum date in time range (ISO format)
774
+ * `detail.type` **[string][9]?** Camera type (equirectangular, flat, null/empty string for both)
775
+ * `detail.camera` **[string][9]?** Camera make and model
776
+ * `detail.theme` **[string][9]?** Map theme
777
+
778
+ [1]: #coreview
779
+
780
+ [2]: #map
781
+
782
+ [3]: #photo
783
+
784
+ [4]: #editor
785
+
786
+ [5]: #standalonemap
787
+
788
+ [6]: #getcookie
789
+
790
+ [7]: #getuseraccount
791
+
792
+ [8]: #viewer
793
+
794
+ [9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
795
+
796
+ [10]: https://developer.mozilla.org/docs/Web/API/Element
797
+
798
+ [11]: https://github.com/radiantearth/stac-api-spec/blob/main/overview.md
799
+
800
+ [12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
801
+
802
+ [13]: https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters
803
+
804
+ [14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
805
+
806
+ [15]: https://maplibre.org/maplibre-gl-js-docs/style-spec/
807
+
808
+ [16]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
809
+
810
+ [17]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
811
+
812
+ [18]: https://maplibre.org/maplibre-gl-js/docs/API/classes/Map/
813
+
814
+ [19]: https://maplibre.org/maplibre-gl-js-docs/api/map/#map-parameters
815
+
816
+ [20]: https://maplibre.org/maplibre-style-spec/sources/#raster
817
+
818
+ [21]: https://photo-sphere-viewer.js.org/api/classes/core.viewer
819
+
820
+ [22]: https://photo-sphere-viewer.js.org/guide/config.html#standard-options
821
+
822
+ [23]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
823
+
824
+ [24]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
825
+
826
+ [25]: #CoreView
827
+
828
+ [26]: https://josm.openstreetmap.de/wiki/Help/RemoteControlCommands