@panoramax/web-viewer 5.0.0-develop-d26305dd → 5.0.0-develop-be5ba1a7

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 (153) hide show
  1. package/build/cjs/index.js +1 -1
  2. package/build/cjs/index_photoviewer.js +1 -1
  3. package/build/esm/components/core/Basic.js +1 -1
  4. package/build/esm/translations/el.json +92 -1
  5. package/package.json +1 -1
  6. package/build/bundle.cjs +0 -3399
  7. package/build/bundle.cjs.map +0 -1
  8. package/build/bundle_photoviewer.cjs +0 -2510
  9. package/build/bundle_photoviewer.cjs.map +0 -1
  10. package/build/components/core/Basic.css +0 -56
  11. package/build/components/core/Basic.js +0 -378
  12. package/build/components/core/CoverageMap.css +0 -10
  13. package/build/components/core/CoverageMap.js +0 -169
  14. package/build/components/core/Editor.css +0 -33
  15. package/build/components/core/Editor.js +0 -398
  16. package/build/components/core/PhotoViewer.css +0 -70
  17. package/build/components/core/PhotoViewer.js +0 -650
  18. package/build/components/core/Viewer.css +0 -130
  19. package/build/components/core/Viewer.js +0 -711
  20. package/build/components/core/index.js +0 -10
  21. package/build/components/index.js +0 -11
  22. package/build/components/index_photoviewer.js +0 -6
  23. package/build/components/layout/BottomDrawer.js +0 -258
  24. package/build/components/layout/CorneredGrid.js +0 -143
  25. package/build/components/layout/Mini.js +0 -121
  26. package/build/components/layout/Tabs.js +0 -140
  27. package/build/components/layout/index.js +0 -9
  28. package/build/components/menus/LocationPrecisionDoc.js +0 -42
  29. package/build/components/menus/MapBackground.js +0 -110
  30. package/build/components/menus/MapFilters.js +0 -567
  31. package/build/components/menus/MapLayers.js +0 -238
  32. package/build/components/menus/MapLegend.js +0 -68
  33. package/build/components/menus/MiniPictureLegend.js +0 -73
  34. package/build/components/menus/PictureLegend.js +0 -379
  35. package/build/components/menus/PictureMetadata.js +0 -380
  36. package/build/components/menus/PlayerOptions.js +0 -93
  37. package/build/components/menus/QualityScoreDoc.js +0 -42
  38. package/build/components/menus/ReportForm.js +0 -132
  39. package/build/components/menus/SemanticsDoc.js +0 -38
  40. package/build/components/menus/SemanticsDownload.js +0 -33
  41. package/build/components/menus/SemanticsFilters.js +0 -153
  42. package/build/components/menus/SemanticsList.js +0 -413
  43. package/build/components/menus/SemanticsMetadata.js +0 -368
  44. package/build/components/menus/Share.js +0 -105
  45. package/build/components/menus/index.js +0 -22
  46. package/build/components/menus/index_photoviewer.js +0 -11
  47. package/build/components/styles.js +0 -557
  48. package/build/components/ui/AnnotationsSwitch.js +0 -159
  49. package/build/components/ui/Button.js +0 -77
  50. package/build/components/ui/ButtonGroup.css +0 -59
  51. package/build/components/ui/ButtonGroup.js +0 -69
  52. package/build/components/ui/CopyButton.js +0 -110
  53. package/build/components/ui/Grade.js +0 -54
  54. package/build/components/ui/GradeFilter.js +0 -122
  55. package/build/components/ui/IconSwitch.js +0 -193
  56. package/build/components/ui/LinkButton.js +0 -67
  57. package/build/components/ui/ListGroup.js +0 -66
  58. package/build/components/ui/ListItem.js +0 -90
  59. package/build/components/ui/Loader.js +0 -203
  60. package/build/components/ui/Map.css +0 -63
  61. package/build/components/ui/Map.js +0 -853
  62. package/build/components/ui/MapMore.js +0 -175
  63. package/build/components/ui/Photo.css +0 -50
  64. package/build/components/ui/Photo.js +0 -1502
  65. package/build/components/ui/Popup.js +0 -145
  66. package/build/components/ui/ProgressBar.js +0 -104
  67. package/build/components/ui/QualityScore.js +0 -147
  68. package/build/components/ui/SearchBar.js +0 -374
  69. package/build/components/ui/SemanticsEditor.js +0 -191
  70. package/build/components/ui/SemanticsTable.js +0 -88
  71. package/build/components/ui/Switch.js +0 -139
  72. package/build/components/ui/TogglableGroup.js +0 -157
  73. package/build/components/ui/index.js +0 -29
  74. package/build/components/ui/index_photoviewer.js +0 -21
  75. package/build/components/ui/widgets/CopyCoordinates.js +0 -75
  76. package/build/components/ui/widgets/GeoSearch.css +0 -21
  77. package/build/components/ui/widgets/GeoSearch.js +0 -150
  78. package/build/components/ui/widgets/Legend.js +0 -190
  79. package/build/components/ui/widgets/LevelSelect.css +0 -51
  80. package/build/components/ui/widgets/LevelSelect.js +0 -143
  81. package/build/components/ui/widgets/MapFiltersButton.js +0 -114
  82. package/build/components/ui/widgets/MapLayersButton.js +0 -79
  83. package/build/components/ui/widgets/OSMEditors.js +0 -155
  84. package/build/components/ui/widgets/PictureLegendActions.js +0 -99
  85. package/build/components/ui/widgets/Player.css +0 -7
  86. package/build/components/ui/widgets/Player.js +0 -154
  87. package/build/components/ui/widgets/SemanticsFiltersButton.js +0 -65
  88. package/build/components/ui/widgets/Zoom.js +0 -84
  89. package/build/components/ui/widgets/index.js +0 -16
  90. package/build/components/ui/widgets/index_photoviewer.js +0 -7
  91. package/build/img/arrow_360.svg +0 -14
  92. package/build/img/arrow_flat.svg +0 -11
  93. package/build/img/arrow_triangle.svg +0 -9
  94. package/build/img/arrow_turn.svg +0 -8
  95. package/build/img/bg_aerial.jpg +0 -0
  96. package/build/img/bg_streets.jpg +0 -0
  97. package/build/img/loader_base.jpg +0 -0
  98. package/build/img/logo_dead.svg +0 -91
  99. package/build/img/marker.svg +0 -17
  100. package/build/img/marker_blue.svg +0 -20
  101. package/build/img/osm.svg +0 -49
  102. package/build/img/panoramax.svg +0 -13
  103. package/build/img/switch_big.svg +0 -54
  104. package/build/img/switch_mini.svg +0 -48
  105. package/build/img/wd.svg +0 -1
  106. package/build/index_photoviewer.js +0 -4
  107. package/build/package.json +0 -148
  108. package/build/servers.js +0 -14
  109. package/build/translations/ar.json +0 -1
  110. package/build/translations/be.json +0 -257
  111. package/build/translations/br.json +0 -81
  112. package/build/translations/cy.json +0 -117
  113. package/build/translations/da.json +0 -300
  114. package/build/translations/de.json +0 -309
  115. package/build/translations/en.json +0 -294
  116. package/build/translations/eo.json +0 -235
  117. package/build/translations/es.json +0 -292
  118. package/build/translations/fi.json +0 -1
  119. package/build/translations/fr.json +0 -294
  120. package/build/translations/hr.json +0 -294
  121. package/build/translations/hu.json +0 -294
  122. package/build/translations/it.json +0 -306
  123. package/build/translations/ja.json +0 -182
  124. package/build/translations/ko.json +0 -1
  125. package/build/translations/nl.json +0 -305
  126. package/build/translations/nn.json +0 -1
  127. package/build/translations/pl.json +0 -169
  128. package/build/translations/pt.json +0 -296
  129. package/build/translations/pt_BR.json +0 -304
  130. package/build/translations/sv.json +0 -182
  131. package/build/translations/ti.json +0 -9
  132. package/build/translations/tr.json +0 -297
  133. package/build/translations/uk.json +0 -268
  134. package/build/translations/zh_Hant.json +0 -309
  135. package/build/utils/API.js +0 -928
  136. package/build/utils/InitParameters.js +0 -521
  137. package/build/utils/MapStyleComposer.js +0 -889
  138. package/build/utils/PanoraMapProtocol.js +0 -49
  139. package/build/utils/PhotoAdapter.js +0 -49
  140. package/build/utils/PresetsManager.js +0 -148
  141. package/build/utils/SemanticsMapProtocol.js +0 -144
  142. package/build/utils/URLHandler.js +0 -426
  143. package/build/utils/geocoder.js +0 -203
  144. package/build/utils/i18n.js +0 -128
  145. package/build/utils/index.js +0 -17
  146. package/build/utils/index_photoviewer.js +0 -14
  147. package/build/utils/indoor.js +0 -200
  148. package/build/utils/map.js +0 -788
  149. package/build/utils/picture.js +0 -507
  150. package/build/utils/semantics.js +0 -321
  151. package/build/utils/services.js +0 -148
  152. package/build/utils/utils.js +0 -433
  153. package/build/utils/widgets.js +0 -110
@@ -1,56 +0,0 @@
1
- /* Colors */
2
- :root, :host {
3
- --white: #ffffff;
4
- --black: #181818;
5
- --black-pale: #1b1a17;
6
- --red: #f70000;
7
- --red-transparent: rgba(247, 0, 0, 0.3);
8
- --red-pale: #ff726f;
9
- --grey: #f5f5f5;
10
- --grey-pale: #cfd2cf;
11
- --grey-semi-dark: #808080;
12
- --grey-dark: #3e3e3e;
13
- --blue: #2954e9;
14
- --blue-dark: #0a1f69;
15
- --blue-semi: #d7dffc;
16
- --blue-pale: #f2f5ff;
17
- --blue-geovisio: #34495e;
18
- --beige: #f5f3ec;
19
- --yellow: #fec868;
20
- --orange: #ff6f00;
21
- --orange-transparent: rgba(255,111,0,0.3);
22
- --orange-pale: #fffafa;
23
- --green: #7ec636;
24
- --green-pale: #f0ffee;
25
- --widget-bg: var(--white);
26
- --widget-bg-hover: var(--grey);
27
- --widget-bg-active: var(--blue);
28
- --widget-bg-inactive: var(--grey-pale);
29
- --widget-bg-primary: var(--blue-semi);
30
- --widget-bg-primary-hover: #e0e7ff;
31
- --widget-bg-warn: #FFECB3;
32
- --widget-bg-success: #C8E6C9;
33
- --widget-border-div: var(--grey-pale);
34
- --widget-border-btn: var(--blue);
35
- --widget-font: var(--grey-dark);
36
- --widget-font-active: var(--white);
37
- --widget-font-direct: var(--blue);
38
- --widget-font-warn: #BF360C;
39
- --widget-font-success: #1B5E20;
40
- --font-family: "Atkinson Hyperlegible Next", sans-serif;
41
- --widget-option-left: #6A1B9A;
42
- --widget-option-right: #0D47A1;
43
- overscroll-behavior-y: contain;
44
- }
45
-
46
- .pnx-hidden { display: none !important; }
47
-
48
- /* Hidden elements on mobile */
49
- @container (max-width: 576px) {
50
- .pnx-mobile-hidden { display: none !important; }
51
- }
52
-
53
- /* Hidden elements on print */
54
- @media print {
55
- .pnx-print-hidden { display: none !important; }
56
- }
@@ -1,378 +0,0 @@
1
- import { LitElement, html } from "lit";
2
- import API from "../../utils/API.js";
3
- import { getTranslations } from "../../utils/i18n.js";
4
- import { createWebComp } from "../../utils/widgets.js";
5
- import { isInIframe, isInternetFast } from "../../utils/utils.js";
6
- import JSON5 from "json5";
7
- import PACKAGE_JSON from "../../../package.json" with { type: "json" };
8
- import AtkinsonStyles from "@fontsource/atkinson-hyperlegible-next/index.css" with { type: "css" };
9
- import BasicStyles from "./Basic.css" with { type: "css" };
10
- document.adoptedStyleSheets.push(AtkinsonStyles);
11
- document.adoptedStyleSheets.push(BasicStyles);
12
-
13
- const __COMMIT_HASH__ = "84355bd";
14
-
15
- /**
16
- * Event for overlaying menu opening
17
- * @event Panoramax.components.core.Basic#menu-opened
18
- * @type {CustomEvent}
19
- * @property {Element} detail.menu The opened menu
20
- */
21
-
22
- /**
23
- * Basic core component is a basic container for common functions through all core components.
24
- * It is not intended to be used directly, it's only to be extended by other core components.
25
- * @class Panoramax.components.core.Basic
26
- * @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
27
- * @fires Panoramax.components.core.Basic#select
28
- * @fires Panoramax.components.core.Basic#ready
29
- * @fires Panoramax.components.core.Basic#broken
30
- * @fires Panoramax.components.core.Basic#menu-opened
31
- * @property {Panoramax.components.ui.Loader} loader The loader screen
32
- * @property {Panoramax.utils.API} api The API manager
33
- */
34
- export default class Basic extends LitElement {
35
- /**
36
- * Component properties.
37
- * @memberof Panoramax.components.core.Basic#
38
- * @type {Object}
39
- * @mixin
40
- * @property {string} endpoint URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md))
41
- * @property {string} [picture] The picture ID to display
42
- * @property {string} [sequence] The sequence ID of the picture displayed
43
- * @property {object} [fetch-options] Set custom options for fetch calls made against API ([same syntax as fetch options parameter](https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters))
44
- * @property {string} [lang] To override language used for labels. Defaults to using user's preferred languages.
45
- */
46
- static properties = {
47
- picture: {type: String, reflect: true},
48
- sequence: {type: String, reflect: true},
49
- "fetch-options": {converter: Basic.GetJSONConverter()},
50
- lang: {type: String},
51
- endpoint: {type: String},
52
- };
53
-
54
- constructor(testing = false) {
55
- super();
56
-
57
- // Some defaults
58
- this.lang = this.getAttribute("lang") || null;
59
- this.endpoint = this.getAttribute("endpoint") || null; // No default
60
- this.picture = this.getAttribute("picture") || null;
61
- this.sequence = this.getAttribute("sequence") || null;
62
-
63
- // Display version in logs
64
- console.info(`📷 Panoramax ${this.getClassName()} - Version ${PACKAGE_JSON.version} (${__COMMIT_HASH__})
65
-
66
- 🆘 Issues can be reported at ${PACKAGE_JSON.repository.url}`);
67
-
68
- if(testing) { return; }
69
-
70
- // Internet speed check
71
- this._isInternetFast = null;
72
- isInternetFast().then(isFast => this._isInternetFast = isFast);
73
- }
74
-
75
- connectedCallback() {
76
- super.connectedCallback();
77
-
78
- // Translations
79
- this._t = getTranslations(this.lang);
80
-
81
- // Show loader
82
- this.loader = createWebComp("pnx-loader", {_parent: this, "no-label": isInIframe() });
83
-
84
- if(
85
- !(this._loadsAPI && this.endpoint && this._loadsAPI === this.endpoint)
86
- && !(this.api && this.api._endpoint === this.endpoint)
87
- && this.endpoint
88
- ) {
89
- if(this._loadsAPI || this.api) {
90
- delete this.api;
91
- delete this._loadsAPI;
92
- }
93
- this._setupAPI();
94
- }
95
-
96
- // Warn for outdate attributes
97
- Object
98
- .entries({ map: "map-options", psv: "psv-options", fetchOptions: "fetch-options", mapstyle: "map-style"})
99
- .forEach(([k, v]) => {
100
- if(this.getAttribute(k)) {
101
- console.error(`Component attribute "${k}" has been renamed into "${v}". Old attribute "${k}" is ignored.`);
102
- }
103
- });
104
-
105
- if(isInIframe()) { this.classList.add("pnx-iframed"); }
106
- }
107
-
108
- /**
109
- * Creates API and wait for initial loading
110
- * @private
111
- */
112
- _setupAPI() {
113
- // Loader init
114
- this.loader = this.loader || createWebComp("pnx-loader", {_parent: this});
115
-
116
- if(!this.endpoint) {
117
- console.warn("No endpoint is defined");
118
- return;
119
- }
120
-
121
- this._loadsAPI = this.endpoint;
122
- let myLoadAPI = this.endpoint;
123
-
124
- // API init
125
- try {
126
- this.api = new API(this.endpoint, {
127
- fetch: this["fetch-options"],
128
- });
129
- this.api.onceReady()
130
- .then(() => {
131
- if(myLoadAPI !== this._loadsAPI || !this.api) { return; }
132
-
133
- let unavailable = this.api.getUnavailableFeatures();
134
- let available = this.api.getAvailableFeatures();
135
- available = unavailable.length === 0 ? "✅ All features available" : "✅ Available features: "+available.join(", ");
136
- unavailable = unavailable.length === 0 ? "" : "🚫 Unavailable features: "+unavailable.join(", ");
137
- console.info(`🌐 Connected to API "${this.api._metadata.name}" (${this.api._endpoint})
138
- ℹ️ API runs STAC ${this.api._metadata.stac_version} ${this.api._metadata.geovisio_version ? "& GeoVisio "+this.api._metadata.geovisio_version : ""}
139
- ${available}
140
- ${unavailable}
141
- `.trim());
142
- })
143
- .catch(e => this.loader?.dismiss?.(e, this._t?.pnx.error_api))
144
- .finally(() => delete this._loadsAPI);
145
- }
146
- catch(e) {
147
- delete this._loadsAPI;
148
- if(this.loader?.dismiss) {
149
- this.loader.dismiss(e, this._t.pnx.error_api);
150
- }
151
- else {
152
- console.error(e);
153
- }
154
- }
155
- }
156
-
157
- /**
158
- * Waits for component to have its first loading done.
159
- *
160
- * Each inheriting class must override this method.
161
- * @memberof Panoramax.components.core.Basic#
162
- * @returns {Promise}
163
- * @fulfil {null} When initialization is complete.
164
- * @reject {string} Error message
165
- */
166
- // eslint-disable-next-line class-methods-use-this
167
- onceReady() {
168
- throw new Error("You must override this method on sub-class");
169
- }
170
-
171
- /**
172
- * Waits for initial API setup.
173
- * @memberof Panoramax.components.core.Basic#
174
- * @returns {Promise}
175
- * @fulfil {null} When API is ready.
176
- * @reject {string} Error message
177
- */
178
- onceAPIReady() {
179
- if(this.api) {
180
- return this.api.onceReady();
181
- }
182
- else {
183
- return new Promise(resolve => setTimeout(resolve, 250)).then(this.onceAPIReady.bind(this));
184
- }
185
- }
186
-
187
- /** @private */
188
- createRenderRoot() {
189
- return this;
190
- }
191
-
192
- /** @private */
193
- attributeChangedCallback(name, _old, value) {
194
- super.attributeChangedCallback(name, _old, value);
195
-
196
- if(name === "endpoint") {
197
- if(
198
- !(this._loadsAPI && value && this._loadsAPI === value)
199
- && !(this.api && this.api._endpoint === value)
200
- && value
201
- ) {
202
- if(this._loadsAPI || this.api) {
203
- delete this.api;
204
- delete this._loadsAPI;
205
- }
206
- this._setupAPI();
207
- }
208
- }
209
- if(["picture", "sequence"].includes(name)) {
210
- let seqId, picId, prevSeqId, prevPicId;
211
-
212
- if(name === "picture") {
213
- seqId = this.sequence;
214
- prevSeqId = this.sequence;
215
- picId = value;
216
- prevPicId = _old;
217
- }
218
- else {
219
- seqId = value;
220
- prevSeqId = _old;
221
- picId = this.picture;
222
- prevPicId = this.picture;
223
- }
224
-
225
- /**
226
- * Event for sequence/picture selection
227
- * @event Panoramax.components.core.Basic#select
228
- * @type {CustomEvent}
229
- * @property {string} detail.seqId The selected sequence ID
230
- * @property {string} detail.picId The selected picture ID (or null if not a precise picture clicked)
231
- * @property {string} [detail.prevSeqId] The previously selected sequence ID (or null if none)
232
- * @property {string} [detail.prevPicId] The previously selected picture ID (or null if none)
233
- */
234
- this.dispatchEvent(new CustomEvent("select", {
235
- bubbles: true,
236
- composed: true,
237
- detail: {
238
- seqId,
239
- picId,
240
- prevSeqId,
241
- prevPicId,
242
- }
243
- }));
244
- }
245
- }
246
-
247
- /**
248
- * This allows to retrieve an always correct class name.
249
- * This is crap, but avoids issues with Webpack & so on.
250
- *
251
- * Each inheriting class must override this method.
252
- * @returns {string} The class name (for example "Basic")
253
- * @memberof Panoramax.components.core.Basic#
254
- */
255
- // eslint-disable-next-line class-methods-use-this
256
- getClassName() {
257
- return "Basic";
258
- }
259
-
260
- /**
261
- * Change the currently picture and/or sequence.
262
- * Calling the method without parameters unselects.
263
- * @param {string} [seqId] The sequence UUID
264
- * @param {string} [picId] The picture UUID
265
- * @param {boolean} [force=false] Force select even if already selected
266
- * @memberof Panoramax.components.core.Basic#
267
- */
268
- select(seqId = null, picId = null, force = false) {
269
- if(force) {
270
- this.picture = null;
271
- this.sequence = null;
272
- }
273
- this.picture = picId;
274
- this.sequence = seqId;
275
- }
276
-
277
- /**
278
- * Is the view running in a small container (small embed or smartphone)
279
- * @returns {boolean} True if container is small
280
- * @memberof Panoramax.components.core.Basic#
281
- */
282
- isWidthSmall() {
283
- return this?.offsetWidth < 576;
284
- }
285
-
286
- /**
287
- * Is the view running in a medium container (576-768px)
288
- * @returns {boolean} True if container is medium
289
- * @memberof Panoramax.components.core.Basic#
290
- */
291
- isWidthMedium() {
292
- return this?.offsetWidth >= 576 && this?.offsetWidth < 768;
293
- }
294
-
295
- /**
296
- * Is the view running in a small-height container (small embed or smartphone)
297
- * @returns {boolean} True if container height is small
298
- * @memberof Panoramax.components.core.Basic#
299
- */
300
- isHeightSmall() {
301
- return this?.offsetHeight < 400;
302
- }
303
-
304
- /** @private */
305
- // eslint-disable-next-line class-methods-use-this
306
- render() {
307
- return html`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`;
308
- }
309
-
310
- /**
311
- * List names of sub-components (like loader, api, map, psv) available in this component.
312
- * @returns {string[]} Sub-components names.
313
- * @memberof Panoramax.components.core.Basic#
314
- */
315
- // eslint-disable-next-line class-methods-use-this
316
- getSubComponentsNames() {
317
- return ["loader", "api"];
318
- }
319
-
320
- /**
321
- * Returns the API manager.
322
- * Useful for some subclasses if you want to toggle between many API providers.
323
- * @returns {API} The API manager
324
- */
325
- getAPI() {
326
- return this.api;
327
- }
328
-
329
- /**
330
- * Listen to events from this components or one of its sub-components.
331
- *
332
- * For example, you can listen to `map` events using prefix `map:`.
333
- *
334
- * ```js
335
- * me.addEventListener("map:move", doSomething);
336
- * ```
337
- * @param {string} type The event type to listen for
338
- * @param {function} listener The event handler
339
- * @param {object} [options] [Any original addEventListener available options](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#options)
340
- * @memberof Panoramax.components.core.Basic#
341
- */
342
- addEventListener(type, listener, options) {
343
- // Check if listener is for sub-component
344
- let prefix = type.split(":").shift();
345
- if(prefix && this.getSubComponentsNames().includes(prefix)) {
346
- const subType = type.substring(prefix.length+1);
347
-
348
- // Add directly if available
349
- if(this[prefix]?.addEventListener) {
350
- this[prefix].addEventListener(subType, listener, options);
351
- }
352
- // Wait for addEventListener to be available
353
- else {
354
- setTimeout(() => this.addEventListener(type, listener, options), 50);
355
- }
356
- }
357
- // Otherwise, reuse classic function
358
- else {
359
- super.addEventListener(type, listener, options);
360
- }
361
- }
362
-
363
- /** @private */
364
- static GetJSONConverter() {
365
- return {
366
- fromAttribute: (value) => {
367
- if(value === null || value === undefined || value === "") { return null; }
368
- else if(typeof value === "object" || Array.isArray(value)) { return value; }
369
- else { return JSON5.parse(value); }
370
- },
371
- toAttribute: (value) => {
372
- if(value === null || value === undefined || value === "") { return ""; }
373
- else if(typeof value === "string") { return value; }
374
- else { return JSON5.stringify(value); }
375
- }
376
- };
377
- }
378
- }
@@ -1,10 +0,0 @@
1
- pnx-coverage-map {
2
- display: block;
3
- position: relative;
4
- }
5
-
6
- pnx-coverage-map .maplibregl-map {
7
- position: absolute;
8
- inset: 0;
9
- background-color: white;
10
- }
@@ -1,169 +0,0 @@
1
- import Basic from "./Basic.js";
2
- import Map from "../ui/Map.js";
3
- import "maplibre-gl";
4
- import { default as InitParameters, alterMapState } from "../../utils/InitParameters.js";
5
- import { MapTiles } from "../../utils/services.js";
6
- import MapStyleComposer from "../../utils/MapStyleComposer.js";
7
- import CoverageMapStyles from "./CoverageMap.css" with { type: "css" };
8
- document.adoptedStyleSheets.push(CoverageMapStyles);
9
-
10
- /**
11
- * Coverage Map is a basic map showing Panoramax coverage.
12
- *
13
- * Make sure to set width/height through CSS for proper display.
14
- * @class Panoramax.components.core.CoverageMap
15
- * @element pnx-coverage-map
16
- * @extends Panoramax.components.core.Basic
17
- * @fires Panoramax.components.core.Basic#select
18
- * @fires Panoramax.components.core.Basic#ready
19
- * @fires Panoramax.components.core.Basic#broken
20
- * @property {Panoramax.components.ui.Loader} loader The loader screen
21
- * @property {Panoramax.utils.API} api The API manager
22
- * @property {Panoramax.components.ui.Map} map The MapLibre GL map itself
23
- * @property {Panoramax.utils.MapStyleComposer} mapStyleComposer The map style helper
24
- * @example
25
- * ```html
26
- * <pnx-coverage-map
27
- * endpoint="https://panoramax.openstreetmap.fr/"
28
- * map-options='{"bounds": [[-73.9876, 40.7661], [-73.9397, 40.8002]]}'
29
- * style="width: 300px; height: 250px"
30
- * />
31
- * ```
32
- */
33
- export default class CoverageMap extends Basic {
34
- /**
35
- * Component properties.
36
- * @memberof Panoramax.components.core.CoverageMap#
37
- * @type {Object}
38
- * @mixes Panoramax.components.core.Basic#properties
39
- * @property {string} endpoint URL to API to use (must be a [STAC API](https://github.com/radiantearth/stac-api-spec/blob/main/overview.md))
40
- * @property {string} [picture] The picture ID to display
41
- * @property {string} [sequence] The sequence ID of the picture displayed
42
- * @property {object} [fetch-options] Set custom options for fetch calls made against API ([same syntax as fetch options parameter](https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters))
43
- * @property {string|object} [map-style] The map's MapLibre style. This can be an a JSON object conforming to the schema described in the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/), or a URL string pointing to one. Defaults to OSM vector tiles.
44
- * @property {string} [lang] To override language used for labels. Defaults to using user's preferred languages.
45
- * @property {object} [map-options] [Any map option available in Map class](#Panoramax.components.ui.Map).<br />Example: `map-options='{"bounds": [[-73.9876, 40.7661], [-73.9397, 40.8002]]}'`
46
- * @property {string} [user] To filter on a specific user UUID
47
- */
48
- static properties = {
49
- "map-options": {converter: Basic.GetJSONConverter()},
50
- "map-style": {type: String},
51
- user: {type: String},
52
- ...Basic.properties
53
- };
54
-
55
- constructor() {
56
- super();
57
-
58
- this["map-style"] = this.getAttribute("map-style") || MapTiles();
59
-
60
- // Check if mapstyle is not a unparsed JSON
61
- try {
62
- this["map-style"] = JSON.parse(this["map-style"]);
63
- } catch(e) { /* Empty */ }
64
-
65
- // Setup map styles and sources
66
- this.mapStyleComposer = new MapStyleComposer(this);
67
- this.mapStyleComposer.addBasemap("streets", this["map-style"], true);
68
-
69
- this._mapContainer = document.createElement("div");
70
- this.onceAPIReady().then(() => {
71
- this.loader.setAttribute("value", 30);
72
- this._initParams = new InitParameters(InitParameters.GetComponentProperties(CoverageMap, this));
73
- // eslint-disable-next-line eqeqeq
74
- const singleUser = this.user && this.user != "";
75
- this.mapStyleComposer._createPanoramaxEndpointFromAPI("default", this.api, !singleUser);
76
- if(singleUser) {
77
- this.mapStyleComposer._createPanoramaxEndpointForUser(this.user);
78
- }
79
- this._initMap();
80
- });
81
- }
82
-
83
- /** @private */
84
- attributeChangedCallback(name, _old, value) {
85
- super.attributeChangedCallback(name, _old, value);
86
-
87
- if(name === "user" && this.api?._isReady === 1) {
88
- // eslint-disable-next-line eqeqeq
89
- if(value && value != "") {
90
- this.mapStyleComposer._createPanoramaxEndpointForUser(value);
91
- }
92
- else {
93
- this.mapStyleComposer.switchPanoramaxEndpoint("default");
94
- }
95
- }
96
- }
97
-
98
- /** @private */
99
- disconnectedCallback() {
100
- super.disconnectedCallback();
101
- this.map?.destroy();
102
- }
103
-
104
- // eslint-disable-next-line class-methods-use-this
105
- getClassName() {
106
- return "CoverageMap";
107
- }
108
-
109
- onceReady() {
110
- if(this.map && this.map.waitForEnoughMapLoaded) {
111
- return this.map.waitForEnoughMapLoaded();
112
- }
113
- else {
114
- return new Promise(resolve => setTimeout(resolve, 100)).then(this.onceReady.bind(this));
115
- }
116
- }
117
-
118
- /** @private */
119
- render() {
120
- return [this.loader, this._mapContainer];
121
- }
122
-
123
- getSubComponentsNames() {
124
- return super.getSubComponentsNames().concat(["map", "mapStyleComposer"]);
125
- }
126
-
127
- /**
128
- * Creates map object
129
- * @private
130
- */
131
- _initMap() {
132
- this.map = new Map(this, this._mapContainer, Object.assign({}, this._initParams.getMapInit(), { hash: true }));
133
- // eslint-disable-next-line no-undef
134
- this.map.addControl(new maplibregl.NavigationControl({ showCompass: false }));
135
- this.loader.setAttribute("value", 70);
136
-
137
- this.addEventListener("select", this._onSelect.bind(this));
138
- this.map.on("picture-click", e => this.select(e.seqId, e.picId));
139
- this.map.on("sequence-click", e => this.select(e.seqId));
140
-
141
- this.map.waitForEnoughMapLoaded().then(() => {
142
- alterMapState(this.map, this._initParams.getMapPostInit());
143
- this.loader.dismiss();
144
- });
145
- }
146
-
147
- /**
148
- * Select event handler
149
- * @private
150
- * @param {object} e Event details
151
- */
152
- _onSelect(e) {
153
- // Move thumbnail to match selected element
154
- if(e.detail.picId || e.detail.seqId) {
155
- const layer = this.map.getLayersOrder().find(lid => lid.endsWith(e.detail.picId ? "pictures" : "sequences"));
156
- const features = this.map.queryRenderedFeatures({
157
- layers: [layer],
158
- filter: ["==", ["get", "id"], e.detail.picId || e.detail.seqId]
159
- });
160
-
161
- // eslint-disable-next-line eqeqeq
162
- if(features.length >= 0 && features[0] != null) {
163
- this.map._attachPreviewToPictures({ features }, layer);
164
- }
165
- }
166
- }
167
- }
168
-
169
- customElements.define("pnx-coverage-map", CoverageMap);
@@ -1,33 +0,0 @@
1
- /* General layout */
2
- pnx-editor {
3
- display: flex;
4
- flex-direction: column;
5
- position: relative;
6
- }
7
-
8
- pnx-editor .pnx-map,
9
- pnx-editor .pnx-psv {
10
- height: 50%;
11
- }
12
-
13
- /* Map background widget */
14
- pnx-editor pnx-map-background {
15
- position: absolute;
16
- padding: 7px;
17
- z-index: 120;
18
- border-radius: 10px;
19
- border: 1px solid var(--widget-border-div);
20
- background-color: var(--widget-bg);
21
- color: var(--widget-font);
22
- bottom: 10px;
23
- left: 10px;
24
- font-family: var(--font-family);
25
- }
26
-
27
- /* Player widget */
28
- pnx-editor pnx-widget-player {
29
- margin-top: 10px;
30
- }
31
- pnx-editor pnx-widget-player #pnx-player-play {
32
- display: none;
33
- }