@panoramax/web-viewer 4.0.3-develop-e6749fd4 → 4.0.3-develop-39c77140
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.
- package/CHANGELOG.md +5 -0
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/docs/reference/components/ui/Map.md +12 -0
- package/docs/reference/components/ui/MapMore.md +1 -0
- package/package.json +1 -1
- package/src/components/ui/Map.js +3 -0
- package/src/components/ui/MapMore.js +61 -25
- package/src/components/ui/Photo.js +1 -1
- package/tests/components/ui/__snapshots__/Map.test.js.snap +164 -0
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
* [.displayPictureMarker(lon, lat, heading, [skipCenter])](#Panoramax.components.ui.Map+displayPictureMarker)
|
|
21
21
|
* [.reloadLayersStyles()](#Panoramax.components.ui.Map+reloadLayersStyles)
|
|
22
22
|
* [.addEventListener(type, listener)](#Panoramax.components.ui.Map+addEventListener)
|
|
23
|
+
* [.setVisibleUsers(visibleIds)](#Panoramax.components.ui.Map+setVisibleUsers)
|
|
23
24
|
* ["ready"](#Panoramax.components.ui.Map+event_ready)
|
|
24
25
|
* ["background-changed"](#Panoramax.components.ui.Map+event_background-changed)
|
|
25
26
|
* ["users-changed"](#Panoramax.components.ui.Map+event_users-changed)
|
|
@@ -180,6 +181,17 @@ This is a binder to [`on`](https://maplibre.org/maplibre-gl-js/docs/API/classes/
|
|
|
180
181
|
| listener | <code>function</code> | | The event handler |
|
|
181
182
|
| [options.once] | <code>boolean</code> | <code>false</code> | Set to true to only listen to first event. |
|
|
182
183
|
|
|
184
|
+
<a name="Panoramax.components.ui.Map+setVisibleUsers"></a>
|
|
185
|
+
|
|
186
|
+
### map.setVisibleUsers(visibleIds)
|
|
187
|
+
Make given user layers visible on map, and hide all others (if any)
|
|
188
|
+
|
|
189
|
+
**Kind**: instance method of [<code>Map</code>](#Panoramax.components.ui.Map)
|
|
190
|
+
|
|
191
|
+
| Param | Type | Description |
|
|
192
|
+
| --- | --- | --- |
|
|
193
|
+
| visibleIds | <code>string</code> \| <code>Array.<string></code> | The user layers IDs to display |
|
|
194
|
+
|
|
183
195
|
<a name="Panoramax.components.ui.Map+event_ready"></a>
|
|
184
196
|
|
|
185
197
|
### "ready"
|
|
@@ -128,6 +128,7 @@ Wait for a given map layer to be really available.
|
|
|
128
128
|
Make given user layers visible on map, and hide all others (if any)
|
|
129
129
|
|
|
130
130
|
**Kind**: instance method of [<code>MapMore</code>](#Panoramax.components.ui.MapMore)
|
|
131
|
+
**Overrides**: [<code>setVisibleUsers</code>](Map.md/#Panoramax.components.ui.Map+setVisibleUsers)
|
|
131
132
|
|
|
132
133
|
| Param | Type | Description |
|
|
133
134
|
| --- | --- | --- |
|
package/package.json
CHANGED
package/src/components/ui/Map.js
CHANGED
|
@@ -198,32 +198,21 @@ export default class MapMore extends Map {
|
|
|
198
198
|
return s;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
/**
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
* @param {string} [filters.minDate] Start date for pictures (format YYYY-MM-DD)
|
|
205
|
-
* @param {string} [filters.maxDate] End date for pictures (format YYYY-MM-DD)
|
|
206
|
-
* @param {string} [filters.pic_type] Type of picture to keep (flat, equirectangular)
|
|
207
|
-
* @param {string} [filters.camera] Camera make and model to keep
|
|
208
|
-
* @param {string} [filters.theme] Map theme to use
|
|
209
|
-
* @param {number[]} [filters.qualityscore] QualityScore values, as a list of 1 to 5 grades
|
|
210
|
-
* @param {boolean} [skipZoomIn=false] If true, doesn't force zoom in to map level >= 7
|
|
211
|
-
* @memberof Panoramax.components.core.MapMore#
|
|
212
|
-
*/
|
|
213
|
-
setFilters(filters, skipZoomIn = false) {
|
|
201
|
+
/** @private */
|
|
202
|
+
_mapFiltersToLayersFilters(filters) {
|
|
203
|
+
let mapFilters = {};
|
|
214
204
|
let mapSeqFilters = [];
|
|
215
205
|
let mapPicFilters = [];
|
|
216
206
|
let reloadMapStyle = false;
|
|
217
|
-
this._mapFilters = {};
|
|
218
207
|
|
|
219
208
|
if(filters.minDate && filters.minDate !== "") {
|
|
220
|
-
|
|
209
|
+
mapFilters.minDate = filters.minDate;
|
|
221
210
|
mapSeqFilters.push([">=", ["get", "date"], filters.minDate]);
|
|
222
211
|
mapPicFilters.push([">=", ["get", "ts"], filters.minDate]);
|
|
223
212
|
}
|
|
224
213
|
|
|
225
214
|
if(filters.maxDate && filters.maxDate !== "") {
|
|
226
|
-
|
|
215
|
+
mapFilters.maxDate = filters.maxDate;
|
|
227
216
|
mapSeqFilters.push(["<=", ["get", "date"], filters.maxDate]);
|
|
228
217
|
|
|
229
218
|
// Get tomorrow date for pictures filtering
|
|
@@ -235,16 +224,16 @@ export default class MapMore extends Map {
|
|
|
235
224
|
}
|
|
236
225
|
|
|
237
226
|
if(filters.pic_type && filters.pic_type !== "") {
|
|
238
|
-
|
|
239
|
-
mapSeqFilters.push(["==", ["get", "type"],
|
|
240
|
-
mapPicFilters.push(["==", ["get", "type"],
|
|
227
|
+
mapFilters.pic_type = filters.pic_type === "flat" ? "flat" : "equirectangular";
|
|
228
|
+
mapSeqFilters.push(["==", ["get", "type"], mapFilters.pic_type]);
|
|
229
|
+
mapPicFilters.push(["==", ["get", "type"], mapFilters.pic_type]);
|
|
241
230
|
}
|
|
242
231
|
if(this._hasGridStats()) {
|
|
243
232
|
reloadMapStyle = true;
|
|
244
233
|
}
|
|
245
234
|
|
|
246
235
|
if(filters.camera && filters.camera !== "") {
|
|
247
|
-
|
|
236
|
+
mapFilters.camera = filters.camera;
|
|
248
237
|
// low/high model hack : to enable fuzzy filtering of camera make and model
|
|
249
238
|
const lowModel = filters.camera.toLowerCase().trim() + " ";
|
|
250
239
|
const highModel = filters.camera.toLowerCase().trim() + "zzzzzzzzzzzzzzzzzzzz";
|
|
@@ -256,13 +245,13 @@ export default class MapMore extends Map {
|
|
|
256
245
|
}
|
|
257
246
|
|
|
258
247
|
if(filters.qualityscore && filters.qualityscore.length > 0) {
|
|
259
|
-
|
|
260
|
-
mapSeqFilters.push(["in", MAP_EXPR_QUALITYSCORE, ["literal",
|
|
261
|
-
mapPicFilters.push(["in", MAP_EXPR_QUALITYSCORE, ["literal",
|
|
248
|
+
mapFilters.qualityscore = filters.qualityscore;
|
|
249
|
+
mapSeqFilters.push(["in", MAP_EXPR_QUALITYSCORE, ["literal", mapFilters.qualityscore]]);
|
|
250
|
+
mapPicFilters.push(["in", MAP_EXPR_QUALITYSCORE, ["literal", mapFilters.qualityscore]]);
|
|
262
251
|
}
|
|
263
252
|
|
|
264
253
|
if(filters.theme && Object.values(MAP_THEMES).includes(filters.theme)) {
|
|
265
|
-
|
|
254
|
+
mapFilters.theme = filters.theme;
|
|
266
255
|
reloadMapStyle = true;
|
|
267
256
|
}
|
|
268
257
|
|
|
@@ -280,6 +269,25 @@ export default class MapMore extends Map {
|
|
|
280
269
|
];
|
|
281
270
|
}
|
|
282
271
|
|
|
272
|
+
return { mapFilters, mapSeqFilters, mapPicFilters, reloadMapStyle };
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Change the map filters
|
|
277
|
+
* @param {object} filters Filtering values
|
|
278
|
+
* @param {string} [filters.minDate] Start date for pictures (format YYYY-MM-DD)
|
|
279
|
+
* @param {string} [filters.maxDate] End date for pictures (format YYYY-MM-DD)
|
|
280
|
+
* @param {string} [filters.pic_type] Type of picture to keep (flat, equirectangular)
|
|
281
|
+
* @param {string} [filters.camera] Camera make and model to keep
|
|
282
|
+
* @param {string} [filters.theme] Map theme to use
|
|
283
|
+
* @param {number[]} [filters.qualityscore] QualityScore values, as a list of 1 to 5 grades
|
|
284
|
+
* @param {boolean} [skipZoomIn=false] If true, doesn't force zoom in to map level >= 7
|
|
285
|
+
* @memberof Panoramax.components.core.MapMore#
|
|
286
|
+
*/
|
|
287
|
+
setFilters(filters, skipZoomIn = false) {
|
|
288
|
+
let { mapFilters, mapSeqFilters, mapPicFilters, reloadMapStyle } = this._mapFiltersToLayersFilters(filters);
|
|
289
|
+
|
|
290
|
+
this._mapFilters = mapFilters;
|
|
283
291
|
if(reloadMapStyle) {
|
|
284
292
|
this.reloadLayersStyles();
|
|
285
293
|
}
|
|
@@ -291,9 +299,10 @@ export default class MapMore extends Map {
|
|
|
291
299
|
7, mapSeqFilters
|
|
292
300
|
];
|
|
293
301
|
}
|
|
294
|
-
|
|
302
|
+
|
|
295
303
|
this.filterUserLayersContent("sequences", mapSeqFilters);
|
|
296
304
|
this.filterUserLayersContent("pictures", mapPicFilters);
|
|
305
|
+
|
|
297
306
|
if(
|
|
298
307
|
!skipZoomIn
|
|
299
308
|
&& (
|
|
@@ -321,4 +330,31 @@ export default class MapMore extends Map {
|
|
|
321
330
|
*/
|
|
322
331
|
this.fire("filters-changed", Object.assign({}, this._mapFilters));
|
|
323
332
|
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Make given user layers visible on map, and hide all others (if any)
|
|
336
|
+
* @memberof Panoramax.components.ui.Map#
|
|
337
|
+
* @param {string|string[]} visibleIds The user layers IDs to display
|
|
338
|
+
*/
|
|
339
|
+
async setVisibleUsers(visibleIds = []) {
|
|
340
|
+
await super.setVisibleUsers(visibleIds);
|
|
341
|
+
|
|
342
|
+
// Force reload of styles & filters
|
|
343
|
+
let { mapSeqFilters, mapPicFilters, reloadMapStyle } = this._mapFiltersToLayersFilters(this._mapFilters);
|
|
344
|
+
|
|
345
|
+
if(reloadMapStyle) {
|
|
346
|
+
this.reloadLayersStyles();
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const allUsers = visibleIds.includes("geovisio");
|
|
350
|
+
if(mapSeqFilters && allUsers) {
|
|
351
|
+
mapSeqFilters = ["step", ["zoom"],
|
|
352
|
+
true,
|
|
353
|
+
7, mapSeqFilters
|
|
354
|
+
];
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
this.filterUserLayersContent("sequences", mapSeqFilters);
|
|
358
|
+
this.filterUserLayersContent("pictures", mapPicFilters);
|
|
359
|
+
}
|
|
324
360
|
}
|
|
@@ -953,7 +953,7 @@ export default class Photo extends PSViewer {
|
|
|
953
953
|
if(!visible) { this._myMarkers.clearMarkers(); }
|
|
954
954
|
else {
|
|
955
955
|
let annotations = meta.properties.annotations;
|
|
956
|
-
if(annotations
|
|
956
|
+
if(annotations?.length === 0) { console.warn("No annotation available on picture", meta.id); }
|
|
957
957
|
|
|
958
958
|
const picBData = this.state.textureData.panoData?.baseData;
|
|
959
959
|
|
|
@@ -736,5 +736,169 @@ Array [
|
|
|
736
736
|
"visibility",
|
|
737
737
|
"none",
|
|
738
738
|
],
|
|
739
|
+
Array [
|
|
740
|
+
"geovisio_blabla_pictures",
|
|
741
|
+
"circle-sort-key",
|
|
742
|
+
Array [
|
|
743
|
+
"case",
|
|
744
|
+
Array [
|
|
745
|
+
"==",
|
|
746
|
+
Array [
|
|
747
|
+
"get",
|
|
748
|
+
"hidden",
|
|
749
|
+
],
|
|
750
|
+
true,
|
|
751
|
+
],
|
|
752
|
+
90,
|
|
753
|
+
10,
|
|
754
|
+
],
|
|
755
|
+
],
|
|
756
|
+
Array [
|
|
757
|
+
"geovisio_pictures",
|
|
758
|
+
"circle-sort-key",
|
|
759
|
+
Array [
|
|
760
|
+
"case",
|
|
761
|
+
Array [
|
|
762
|
+
"==",
|
|
763
|
+
Array [
|
|
764
|
+
"get",
|
|
765
|
+
"hidden",
|
|
766
|
+
],
|
|
767
|
+
true,
|
|
768
|
+
],
|
|
769
|
+
90,
|
|
770
|
+
10,
|
|
771
|
+
],
|
|
772
|
+
],
|
|
773
|
+
Array [
|
|
774
|
+
"geovisio_blabla_pictures_symbols",
|
|
775
|
+
"icon-image",
|
|
776
|
+
Array [
|
|
777
|
+
"case",
|
|
778
|
+
Array [
|
|
779
|
+
"==",
|
|
780
|
+
Array [
|
|
781
|
+
"get",
|
|
782
|
+
"id",
|
|
783
|
+
],
|
|
784
|
+
undefined,
|
|
785
|
+
],
|
|
786
|
+
"",
|
|
787
|
+
Array [
|
|
788
|
+
"==",
|
|
789
|
+
Array [
|
|
790
|
+
"get",
|
|
791
|
+
"type",
|
|
792
|
+
],
|
|
793
|
+
"equirectangular",
|
|
794
|
+
],
|
|
795
|
+
"pnx-arrow-360",
|
|
796
|
+
"pnx-arrow-flat",
|
|
797
|
+
],
|
|
798
|
+
],
|
|
799
|
+
Array [
|
|
800
|
+
"geovisio_blabla_pictures_symbols",
|
|
801
|
+
"symbol-sort-key",
|
|
802
|
+
Array [
|
|
803
|
+
"case",
|
|
804
|
+
Array [
|
|
805
|
+
"==",
|
|
806
|
+
Array [
|
|
807
|
+
"get",
|
|
808
|
+
"hidden",
|
|
809
|
+
],
|
|
810
|
+
true,
|
|
811
|
+
],
|
|
812
|
+
90,
|
|
813
|
+
10,
|
|
814
|
+
],
|
|
815
|
+
],
|
|
816
|
+
Array [
|
|
817
|
+
"geovisio_pictures_symbols",
|
|
818
|
+
"icon-image",
|
|
819
|
+
Array [
|
|
820
|
+
"case",
|
|
821
|
+
Array [
|
|
822
|
+
"==",
|
|
823
|
+
Array [
|
|
824
|
+
"get",
|
|
825
|
+
"id",
|
|
826
|
+
],
|
|
827
|
+
undefined,
|
|
828
|
+
],
|
|
829
|
+
"",
|
|
830
|
+
Array [
|
|
831
|
+
"==",
|
|
832
|
+
Array [
|
|
833
|
+
"get",
|
|
834
|
+
"type",
|
|
835
|
+
],
|
|
836
|
+
"equirectangular",
|
|
837
|
+
],
|
|
838
|
+
"pnx-arrow-360",
|
|
839
|
+
"pnx-arrow-flat",
|
|
840
|
+
],
|
|
841
|
+
],
|
|
842
|
+
Array [
|
|
843
|
+
"geovisio_pictures_symbols",
|
|
844
|
+
"symbol-sort-key",
|
|
845
|
+
Array [
|
|
846
|
+
"case",
|
|
847
|
+
Array [
|
|
848
|
+
"==",
|
|
849
|
+
Array [
|
|
850
|
+
"get",
|
|
851
|
+
"hidden",
|
|
852
|
+
],
|
|
853
|
+
true,
|
|
854
|
+
],
|
|
855
|
+
90,
|
|
856
|
+
10,
|
|
857
|
+
],
|
|
858
|
+
],
|
|
859
|
+
Array [
|
|
860
|
+
"geovisio_blabla_sequences",
|
|
861
|
+
"line-sort-key",
|
|
862
|
+
Array [
|
|
863
|
+
"case",
|
|
864
|
+
Array [
|
|
865
|
+
"==",
|
|
866
|
+
Array [
|
|
867
|
+
"get",
|
|
868
|
+
"hidden",
|
|
869
|
+
],
|
|
870
|
+
true,
|
|
871
|
+
],
|
|
872
|
+
90,
|
|
873
|
+
10,
|
|
874
|
+
],
|
|
875
|
+
],
|
|
876
|
+
Array [
|
|
877
|
+
"geovisio_blabla_sequences",
|
|
878
|
+
"line-cap",
|
|
879
|
+
"square",
|
|
880
|
+
],
|
|
881
|
+
Array [
|
|
882
|
+
"geovisio_sequences",
|
|
883
|
+
"line-sort-key",
|
|
884
|
+
Array [
|
|
885
|
+
"case",
|
|
886
|
+
Array [
|
|
887
|
+
"==",
|
|
888
|
+
Array [
|
|
889
|
+
"get",
|
|
890
|
+
"hidden",
|
|
891
|
+
],
|
|
892
|
+
true,
|
|
893
|
+
],
|
|
894
|
+
90,
|
|
895
|
+
10,
|
|
896
|
+
],
|
|
897
|
+
],
|
|
898
|
+
Array [
|
|
899
|
+
"geovisio_sequences",
|
|
900
|
+
"line-cap",
|
|
901
|
+
"square",
|
|
902
|
+
],
|
|
739
903
|
]
|
|
740
904
|
`;
|