@panoramax/web-viewer 3.2.3-develop-d7e5a16d → 3.2.3-develop-6257391e
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/.gitlab-ci.yml +3 -0
- package/CHANGELOG.md +19 -0
- package/CODE_OF_CONDUCT.md +1 -1
- package/README.md +1 -1
- package/build/editor.html +10 -1
- package/build/index.css +2 -2
- package/build/index.css.map +1 -1
- package/build/index.html +1 -1
- package/build/index.js +1682 -5
- package/build/index.js.map +1 -1
- package/build/map.html +1 -1
- package/build/viewer.html +10 -1
- package/build/widgets.html +1 -0
- package/config/jest/mocks.js +172 -0
- package/config/paths.js +1 -0
- package/config/webpack.config.js +26 -0
- package/docs/03_URL_settings.md +3 -11
- package/docs/05_Compatibility.md +59 -76
- package/docs/09_Develop.md +30 -11
- package/docs/90_Releases.md +2 -2
- package/docs/images/class_diagram.drawio +28 -28
- package/docs/images/class_diagram.jpg +0 -0
- package/docs/index.md +112 -0
- package/docs/reference/components/core/Basic.md +153 -0
- package/docs/reference/components/core/CoverageMap.md +160 -0
- package/docs/reference/components/core/Editor.md +172 -0
- package/docs/reference/components/core/Viewer.md +288 -0
- package/docs/reference/components/layout/CorneredGrid.md +29 -0
- package/docs/reference/components/layout/Mini.md +45 -0
- package/docs/reference/components/menus/MapBackground.md +32 -0
- package/docs/reference/components/menus/MapFilters.md +15 -0
- package/docs/reference/components/menus/MapLayers.md +15 -0
- package/docs/reference/components/menus/MapLegend.md +15 -0
- package/docs/reference/components/menus/PictureLegend.md +15 -0
- package/docs/reference/components/menus/PictureMetadata.md +15 -0
- package/docs/reference/components/menus/PlayerOptions.md +15 -0
- package/docs/reference/components/menus/QualityScoreDoc.md +15 -0
- package/docs/reference/components/menus/ReportForm.md +15 -0
- package/docs/reference/components/menus/ShareMenu.md +15 -0
- package/docs/reference/components/ui/Button.md +39 -0
- package/docs/reference/components/ui/ButtonGroup.md +36 -0
- package/docs/reference/components/ui/CopyButton.md +35 -0
- package/docs/reference/components/ui/Grade.md +32 -0
- package/docs/reference/components/ui/LinkButton.md +44 -0
- package/docs/reference/components/ui/Loader.md +54 -0
- package/docs/reference/components/ui/Map.md +214 -0
- package/docs/reference/components/ui/MapMore.md +233 -0
- package/docs/reference/components/ui/Photo.md +369 -0
- package/docs/reference/components/ui/Popup.md +56 -0
- package/docs/reference/components/ui/QualityScore.md +45 -0
- package/docs/reference/components/ui/SearchBar.md +63 -0
- package/docs/reference/components/ui/TogglableGroup.md +39 -0
- package/docs/reference/components/ui/widgets/GeoSearch.md +32 -0
- package/docs/reference/components/ui/widgets/Legend.md +32 -0
- package/docs/reference/components/ui/widgets/MapFiltersButton.md +33 -0
- package/docs/reference/components/ui/widgets/MapLayersButton.md +15 -0
- package/docs/reference/components/ui/widgets/Player.md +32 -0
- package/docs/reference/components/ui/widgets/Share.md +15 -0
- package/docs/reference/components/ui/widgets/Zoom.md +15 -0
- package/docs/reference/utils/API.md +311 -0
- package/docs/reference/utils/InitParameters.md +67 -0
- package/docs/reference/utils/URLHandler.md +102 -0
- package/docs/reference.md +73 -0
- package/docs/shortcuts.md +11 -0
- package/docs/tutorials/aerial_imagery.md +19 -0
- package/docs/tutorials/authentication.md +10 -0
- package/docs/tutorials/custom_widgets.md +64 -0
- package/docs/tutorials/map_style.md +27 -0
- package/docs/tutorials/migrate_v4.md +122 -0
- package/docs/tutorials/synced_coverage.md +42 -0
- package/mkdocs.yml +60 -5
- package/package.json +10 -7
- package/public/editor.html +21 -29
- package/public/index.html +3 -3
- package/public/map.html +19 -18
- package/public/viewer.html +18 -24
- package/public/widgets.html +265 -0
- package/scripts/doc.js +77 -0
- package/src/components/core/Basic.css +44 -0
- package/src/components/core/Basic.js +258 -0
- package/src/components/core/CoverageMap.css +9 -0
- package/src/components/core/CoverageMap.js +105 -0
- package/src/components/core/Editor.css +23 -0
- package/src/components/core/Editor.js +354 -0
- package/src/components/core/Viewer.css +109 -0
- package/src/components/core/Viewer.js +707 -0
- package/src/components/core/index.js +11 -0
- package/src/components/index.js +13 -0
- package/src/components/layout/CorneredGrid.js +109 -0
- package/src/components/layout/Mini.js +117 -0
- package/src/components/layout/index.js +7 -0
- package/src/components/menus/MapBackground.js +106 -0
- package/src/components/menus/MapFilters.js +386 -0
- package/src/components/menus/MapLayers.js +143 -0
- package/src/components/menus/MapLegend.js +54 -0
- package/src/components/menus/PictureLegend.js +103 -0
- package/src/components/menus/PictureMetadata.js +188 -0
- package/src/components/menus/PlayerOptions.js +96 -0
- package/src/components/menus/QualityScoreDoc.js +36 -0
- package/src/components/menus/ReportForm.js +133 -0
- package/src/components/menus/Share.js +228 -0
- package/src/components/menus/index.js +15 -0
- package/src/components/styles.js +365 -0
- package/src/components/ui/Button.js +75 -0
- package/src/components/ui/ButtonGroup.css +49 -0
- package/src/components/ui/ButtonGroup.js +68 -0
- package/src/components/ui/CopyButton.js +71 -0
- package/src/components/ui/Grade.js +54 -0
- package/src/components/ui/LinkButton.js +68 -0
- package/src/components/ui/Loader.js +188 -0
- package/src/components/{Map.css → ui/Map.css} +5 -17
- package/src/components/{Map.js → ui/Map.js} +114 -138
- package/src/components/ui/MapMore.js +324 -0
- package/src/components/{Photo.css → ui/Photo.css} +6 -6
- package/src/components/{Photo.js → ui/Photo.js} +279 -90
- package/src/components/ui/Popup.js +145 -0
- package/src/components/ui/QualityScore.js +152 -0
- package/src/components/ui/SearchBar.js +363 -0
- package/src/components/ui/TogglableGroup.js +162 -0
- package/src/components/ui/index.js +20 -0
- package/src/components/ui/widgets/GeoSearch.css +21 -0
- package/src/components/ui/widgets/GeoSearch.js +139 -0
- package/src/components/ui/widgets/Legend.js +51 -0
- package/src/components/ui/widgets/MapFiltersButton.js +104 -0
- package/src/components/ui/widgets/MapLayersButton.js +79 -0
- package/src/components/ui/widgets/Player.css +7 -0
- package/src/components/ui/widgets/Player.js +148 -0
- package/src/components/ui/widgets/Share.js +30 -0
- package/src/components/ui/widgets/Zoom.js +82 -0
- package/src/components/ui/widgets/index.js +12 -0
- package/src/img/panoramax.svg +13 -0
- package/src/img/switch_big.svg +20 -10
- package/src/index.js +6 -9
- package/src/translations/da.json +1 -1
- package/src/translations/de.json +1 -1
- package/src/translations/en.json +5 -3
- package/src/translations/eo.json +1 -1
- package/src/translations/es.json +1 -1
- package/src/translations/fr.json +5 -3
- package/src/translations/hu.json +1 -1
- package/src/translations/it.json +1 -1
- package/src/translations/ja.json +1 -1
- package/src/translations/nl.json +1 -1
- package/src/translations/pl.json +1 -1
- package/src/translations/sv.json +1 -1
- package/src/translations/zh_Hant.json +1 -1
- package/src/utils/API.js +74 -42
- package/src/utils/InitParameters.js +354 -0
- package/src/utils/URLHandler.js +364 -0
- package/src/utils/geocoder.js +116 -0
- package/src/utils/{I18n.js → i18n.js} +3 -1
- package/src/utils/index.js +11 -0
- package/src/utils/{Map.js → map.js} +216 -80
- package/src/utils/picture.js +433 -0
- package/src/utils/utils.js +315 -0
- package/src/utils/widgets.js +93 -0
- package/tests/components/ui/CopyButton.test.js +52 -0
- package/tests/components/ui/Loader.test.js +54 -0
- package/tests/components/{Map.test.js → ui/Map.test.js} +19 -61
- package/tests/components/{Photo.test.js → ui/Photo.test.js} +89 -57
- package/tests/components/ui/Popup.test.js +24 -0
- package/tests/components/ui/QualityScore.test.js +17 -0
- package/tests/components/ui/SearchBar.test.js +107 -0
- package/tests/components/ui/__snapshots__/CopyButton.test.js.snap +34 -0
- package/tests/components/ui/__snapshots__/Loader.test.js.snap +56 -0
- package/tests/components/{__snapshots__ → ui/__snapshots__}/Map.test.js.snap +11 -38
- package/tests/components/{__snapshots__ → ui/__snapshots__}/Photo.test.js.snap +57 -4
- package/tests/components/ui/__snapshots__/Popup.test.js.snap +29 -0
- package/tests/components/ui/__snapshots__/QualityScore.test.js.snap +11 -0
- package/tests/components/ui/__snapshots__/SearchBar.test.js.snap +65 -0
- package/tests/utils/API.test.js +1 -14
- package/tests/utils/InitParameters.test.js +485 -0
- package/tests/utils/URLHandler.test.js +350 -0
- package/tests/utils/__snapshots__/URLHandler.test.js.snap +21 -0
- package/tests/utils/__snapshots__/picture.test.js.snap +315 -0
- package/tests/utils/__snapshots__/widgets.test.js.snap +19 -0
- package/tests/utils/geocoder.test.js +37 -0
- package/tests/utils/{I18n.test.js → i18n.test.js} +1 -1
- package/tests/utils/map.test.js +67 -0
- package/tests/utils/picture.test.js +745 -0
- package/tests/utils/utils.test.js +288 -0
- package/tests/utils/widgets.test.js +90 -0
- package/docs/01_Start.md +0 -149
- package/docs/02_Usage.md +0 -831
- package/docs/04_Advanced_examples.md +0 -216
- package/src/Editor.css +0 -37
- package/src/Editor.js +0 -361
- package/src/StandaloneMap.js +0 -114
- package/src/Viewer.css +0 -203
- package/src/Viewer.js +0 -1246
- package/src/components/CoreView.css +0 -70
- package/src/components/CoreView.js +0 -175
- package/src/components/Loader.css +0 -74
- package/src/components/Loader.js +0 -120
- package/src/utils/Exif.js +0 -193
- package/src/utils/Utils.js +0 -631
- package/src/utils/Widgets.js +0 -562
- package/src/viewer/URLHash.js +0 -469
- package/src/viewer/Widgets.css +0 -880
- package/src/viewer/Widgets.js +0 -1470
- package/tests/Editor.test.js +0 -126
- package/tests/StandaloneMap.test.js +0 -45
- package/tests/Viewer.test.js +0 -366
- package/tests/__snapshots__/Editor.test.js.snap +0 -298
- package/tests/__snapshots__/StandaloneMap.test.js.snap +0 -30
- package/tests/__snapshots__/Viewer.test.js.snap +0 -195
- package/tests/components/CoreView.test.js +0 -92
- package/tests/components/Loader.test.js +0 -38
- package/tests/components/__snapshots__/Loader.test.js.snap +0 -15
- package/tests/utils/Exif.test.js +0 -124
- package/tests/utils/Map.test.js +0 -113
- package/tests/utils/Utils.test.js +0 -300
- package/tests/utils/Widgets.test.js +0 -107
- package/tests/utils/__snapshots__/Exif.test.js.snap +0 -43
- package/tests/utils/__snapshots__/Utils.test.js.snap +0 -41
- package/tests/utils/__snapshots__/Widgets.test.js.snap +0 -44
- package/tests/viewer/URLHash.test.js +0 -559
- package/tests/viewer/Widgets.test.js +0 -127
- package/tests/viewer/__snapshots__/URLHash.test.js.snap +0 -108
- package/tests/viewer/__snapshots__/Widgets.test.js.snap +0 -403
- /package/tests/utils/__snapshots__/{Map.test.js.snap → geocoder.test.js.snap} +0 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import Map from "./Map";
|
|
2
|
+
import { COLORS, QUALITYSCORE_VALUES } from "../../utils/utils";
|
|
3
|
+
import { TILES_PICTURES_ZOOM, MAP_EXPR_QUALITYSCORE, switchCoefValue } from "../../utils/map";
|
|
4
|
+
|
|
5
|
+
const MAP_THEMES = {
|
|
6
|
+
DEFAULT: "default",
|
|
7
|
+
AGE: "age",
|
|
8
|
+
TYPE: "type",
|
|
9
|
+
SCORE: "score",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const MAP_FILTERS = [ "minDate", "maxDate", "pic_type", "camera", "theme", "qualityscore"];
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* MapMore is a more complete version of [Map UI component](#Panoramax.components.ui.Map).
|
|
17
|
+
*
|
|
18
|
+
* It offers advanced features like themes, filters and more.
|
|
19
|
+
*
|
|
20
|
+
* Note that all functions of [MapLibre GL JS class Map](https://maplibre.org/maplibre-gl-js/docs/API/classes/Map/) are also available.
|
|
21
|
+
*
|
|
22
|
+
* ⚠️ This class doesn't inherit from [EventTarget](https://developer.mozilla.org/fr/docs/Web/API/EventTarget), so it doesn't have `addEventListener` and `dispatchEvent` functions.
|
|
23
|
+
* It uses instead [`on`](https://maplibre.org/maplibre-gl-js/docs/API/classes/Map/#on) and `fire` functions from MapLibre Map class.
|
|
24
|
+
* `fire` function doesn't take directly [`Event`](https://developer.mozilla.org/fr/docs/Web/API/Event) objects, but a string and object data.
|
|
25
|
+
* @class Panoramax.components.ui.MapMore
|
|
26
|
+
* @extends Panoramax.components.ui.Map
|
|
27
|
+
* @param {Panoramax.components.core.Basic} parent The parent view
|
|
28
|
+
* @param {Element} container The DOM element to create into
|
|
29
|
+
* @param {object} [options] The map options (any of [MapLibre GL settings](https://maplibre.org/maplibre-gl-js-docs/api/map/#map-parameters) or any supplementary option defined here)
|
|
30
|
+
* @param {object} [options.raster] The MapLibre raster source for aerial background. This must be a JSON object following [MapLibre raster source definition](https://maplibre.org/maplibre-style-spec/sources/#raster).
|
|
31
|
+
* @param {string} [options.background=streets] Choose default map background to display (streets or aerial, if raster aerial background available). Defaults to streets.
|
|
32
|
+
* @param {string} [options.theme=default] The map theme (default, age, score, type)
|
|
33
|
+
* @fires Panoramax.components.ui.Map#background-changed
|
|
34
|
+
* @fires Panoramax.components.ui.Map#users-changed
|
|
35
|
+
* @fires Panoramax.components.ui.Map#sequence-hover
|
|
36
|
+
* @fires Panoramax.components.ui.Map#sequence-click
|
|
37
|
+
* @fires Panoramax.components.ui.Map#picture-click
|
|
38
|
+
* @fires Panoramax.components.ui.MapMore#filters-changed
|
|
39
|
+
* @example
|
|
40
|
+
* const map = new Panoramax.components.ui.MapMore(viewer, mapNode, {center: {lat: 48.7, lng: -1.7}});
|
|
41
|
+
*/
|
|
42
|
+
export default class MapMore extends Map {
|
|
43
|
+
constructor(parent, container, options = {}) {
|
|
44
|
+
super(parent, container, options);
|
|
45
|
+
|
|
46
|
+
// Map theme
|
|
47
|
+
this._mapFilters = {};
|
|
48
|
+
if(this._options.theme) { this._mapFilters = { theme: this._options.theme }; }
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
reloadLayersStyles() {
|
|
52
|
+
super.reloadLayersStyles();
|
|
53
|
+
|
|
54
|
+
// Also handle the grid stats
|
|
55
|
+
if(this._hasGridStats()) {
|
|
56
|
+
let newType = "coef";
|
|
57
|
+
if(this._mapFilters.pic_type) {
|
|
58
|
+
newType = this._mapFilters.pic_type == "flat" ? "coef_flat_pictures" : "coef_360_pictures";
|
|
59
|
+
}
|
|
60
|
+
this.getStyle().layers
|
|
61
|
+
.filter(l => l.id.endsWith("_grid"))
|
|
62
|
+
.forEach(l => {
|
|
63
|
+
const newl = switchCoefValue(l, newType);
|
|
64
|
+
for(let p in newl.layout) {
|
|
65
|
+
this.setLayoutProperty(l.id, p, newl.layout[p]);
|
|
66
|
+
}
|
|
67
|
+
for(let p in newl.paint) {
|
|
68
|
+
this.setPaintProperty(l.id, p, newl.paint[p]);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Computes dates to use for map theme by picture/sequence age
|
|
76
|
+
* @private
|
|
77
|
+
*/
|
|
78
|
+
_getDatesForLayerColors() {
|
|
79
|
+
const oneDay = 24 * 60 * 60 * 1000;
|
|
80
|
+
const d0 = Date.now();
|
|
81
|
+
const d1 = d0 - 30 * oneDay;
|
|
82
|
+
const d2 = d0 - 365 * oneDay;
|
|
83
|
+
const d3 = d0 - 2 * 365 * oneDay;
|
|
84
|
+
return [d1, d2, d3].map(d => new Date(d).toISOString().split("T")[0]);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Retrieve map layer color scheme according to selected theme.
|
|
89
|
+
* @private
|
|
90
|
+
*/
|
|
91
|
+
_getLayerColorStyle(layer) {
|
|
92
|
+
// Hidden style
|
|
93
|
+
const s = ["case",
|
|
94
|
+
["==", ["get", "hidden"], true], COLORS.HIDDEN
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
// Selected sequence style
|
|
98
|
+
const picId = this._parent.psv?._myVTour?.state?.loadingNode || this._parent.psv?._myVTour?.state?.currentNode?.id;
|
|
99
|
+
const seqId = picId ? this._parent.psv?._picturesSequences[picId] : null;
|
|
100
|
+
if(layer == "sequences" && seqId) {
|
|
101
|
+
s.push(["==", ["get", "id"], seqId], COLORS.SELECTED);
|
|
102
|
+
}
|
|
103
|
+
else if(layer == "pictures" && seqId) {
|
|
104
|
+
s.push(["in", seqId, ["get", "sequences"]], COLORS.SELECTED);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Themes styles
|
|
108
|
+
if(this._mapFilters.theme == MAP_THEMES.AGE) {
|
|
109
|
+
const prop = layer == "sequences" ? "date" : "ts";
|
|
110
|
+
const dt = this._getDatesForLayerColors();
|
|
111
|
+
|
|
112
|
+
s.push(
|
|
113
|
+
["!", ["has", prop]], COLORS.BASE,
|
|
114
|
+
[">=", ["get", prop], dt[0]], COLORS.PALETTE_4,
|
|
115
|
+
[">=", ["get", prop], dt[1]], COLORS.PALETTE_3,
|
|
116
|
+
[">=", ["get", prop], dt[2]], COLORS.PALETTE_2,
|
|
117
|
+
COLORS.PALETTE_1
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
else if(this._mapFilters.theme == MAP_THEMES.TYPE) {
|
|
121
|
+
s.push(
|
|
122
|
+
["!", ["has", "type"]], COLORS.BASE,
|
|
123
|
+
["==", ["get", "type"], "equirectangular"], COLORS.QUALI_1,
|
|
124
|
+
COLORS.QUALI_2
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
else if(this._mapFilters.theme == MAP_THEMES.SCORE) {
|
|
128
|
+
s.push(
|
|
129
|
+
["==", MAP_EXPR_QUALITYSCORE, 5], QUALITYSCORE_VALUES[0].color,
|
|
130
|
+
["==", MAP_EXPR_QUALITYSCORE, 4], QUALITYSCORE_VALUES[1].color,
|
|
131
|
+
["==", MAP_EXPR_QUALITYSCORE, 3], QUALITYSCORE_VALUES[2].color,
|
|
132
|
+
["==", MAP_EXPR_QUALITYSCORE, 2], QUALITYSCORE_VALUES[3].color,
|
|
133
|
+
QUALITYSCORE_VALUES[4].color,
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
s.push(COLORS.BASE);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return s;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Retrieve map sort key according to selected theme.
|
|
145
|
+
* @private
|
|
146
|
+
*/
|
|
147
|
+
_getLayerSortStyle(layer) {
|
|
148
|
+
// Values
|
|
149
|
+
// - 100 : on top / selected feature
|
|
150
|
+
// - 90 : hidden feature
|
|
151
|
+
// - 20-80 : custom ranges
|
|
152
|
+
// - 10 : basic feature
|
|
153
|
+
// - 0 : on bottom / feature with undefined property
|
|
154
|
+
|
|
155
|
+
// Hidden style
|
|
156
|
+
const s = ["case",
|
|
157
|
+
["==", ["get", "hidden"], true], 90
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
// Selected sequence style
|
|
161
|
+
const picId = this._parent.psv?._myVTour?.state?.loadingNode || this._parent.psv?._myVTour?.state?.currentNode?.id;
|
|
162
|
+
const seqId = picId ? this._parent.psv?._picturesSequences[picId] : null;
|
|
163
|
+
if(layer == "sequences" && seqId) {
|
|
164
|
+
s.push(["==", ["get", "id"], seqId], 100);
|
|
165
|
+
}
|
|
166
|
+
else if(layer == "pictures" && seqId) {
|
|
167
|
+
s.push(["in", seqId, ["get", "sequences"]], 100);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Themes styles
|
|
171
|
+
if(this._mapFilters.theme == MAP_THEMES.AGE) {
|
|
172
|
+
const prop = layer == "sequences" ? "date" : "ts";
|
|
173
|
+
const dt = this._getDatesForLayerColors();
|
|
174
|
+
s.push(
|
|
175
|
+
["!", ["has", prop]], 0,
|
|
176
|
+
[">=", ["get", prop], dt[0]], 50,
|
|
177
|
+
[">=", ["get", prop], dt[1]], 49,
|
|
178
|
+
[">=", ["get", prop], dt[2]], 48,
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
else if(this._mapFilters.theme == MAP_THEMES.TYPE) {
|
|
182
|
+
s.push(
|
|
183
|
+
["!", ["has", "type"]], 0,
|
|
184
|
+
["==", ["get", "type"], "equirectangular"], 50,
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
else if(this._mapFilters.theme == MAP_THEMES.SCORE) {
|
|
188
|
+
s.push(
|
|
189
|
+
["==", MAP_EXPR_QUALITYSCORE, 5], 80,
|
|
190
|
+
["==", MAP_EXPR_QUALITYSCORE, 4], 65,
|
|
191
|
+
["==", MAP_EXPR_QUALITYSCORE, 3], 50,
|
|
192
|
+
["==", MAP_EXPR_QUALITYSCORE, 2], 35,
|
|
193
|
+
["==", MAP_EXPR_QUALITYSCORE, 1], 20,
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
s.push(10);
|
|
198
|
+
return s;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Change the map filters
|
|
203
|
+
* @param {object} filters Filtering values
|
|
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) {
|
|
214
|
+
let mapSeqFilters = [];
|
|
215
|
+
let mapPicFilters = [];
|
|
216
|
+
let reloadMapStyle = false;
|
|
217
|
+
this._mapFilters = {};
|
|
218
|
+
|
|
219
|
+
if(filters.minDate && filters.minDate !== "") {
|
|
220
|
+
this._mapFilters.minDate = filters.minDate;
|
|
221
|
+
mapSeqFilters.push([">=", ["get", "date"], filters.minDate]);
|
|
222
|
+
mapPicFilters.push([">=", ["get", "ts"], filters.minDate]);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if(filters.maxDate && filters.maxDate !== "") {
|
|
226
|
+
this._mapFilters.maxDate = filters.maxDate;
|
|
227
|
+
mapSeqFilters.push(["<=", ["get", "date"], filters.maxDate]);
|
|
228
|
+
|
|
229
|
+
// Get tomorrow date for pictures filtering
|
|
230
|
+
// (because ts is date+time, so comparing date only string would fail otherwise)
|
|
231
|
+
let d = new Date(filters.maxDate);
|
|
232
|
+
d.setDate(d.getDate() + 1);
|
|
233
|
+
d = d.toISOString().split("T")[0];
|
|
234
|
+
mapPicFilters.push(["<=", ["get", "ts"], d]);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if(filters.pic_type && filters.pic_type !== "") {
|
|
238
|
+
this._mapFilters.pic_type = filters.pic_type;
|
|
239
|
+
mapSeqFilters.push(["==", ["get", "type"], filters.pic_type]);
|
|
240
|
+
mapPicFilters.push(["==", ["get", "type"], filters.pic_type]);
|
|
241
|
+
}
|
|
242
|
+
if(this._hasGridStats()) {
|
|
243
|
+
reloadMapStyle = true;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if(filters.camera && filters.camera !== "") {
|
|
247
|
+
this._mapFilters.camera = filters.camera;
|
|
248
|
+
// low/high model hack : to enable fuzzy filtering of camera make and model
|
|
249
|
+
const lowModel = filters.camera.toLowerCase().trim() + " ";
|
|
250
|
+
const highModel = filters.camera.toLowerCase().trim() + "zzzzzzzzzzzzzzzzzzzz";
|
|
251
|
+
const collator = ["collator", { "case-sensitive": false, "diacritic-sensitive": false } ];
|
|
252
|
+
mapSeqFilters.push([">=", ["get", "model"], lowModel, collator]);
|
|
253
|
+
mapSeqFilters.push(["<=", ["get", "model"], highModel, collator]);
|
|
254
|
+
mapPicFilters.push([">=", ["get", "model"], lowModel, collator]);
|
|
255
|
+
mapPicFilters.push(["<=", ["get", "model"], highModel, collator]);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if(filters.qualityscore && filters.qualityscore.length > 0) {
|
|
259
|
+
this._mapFilters.qualityscore = filters.qualityscore;
|
|
260
|
+
mapSeqFilters.push(["in", MAP_EXPR_QUALITYSCORE, ["literal", this._mapFilters.qualityscore]]);
|
|
261
|
+
mapPicFilters.push(["in", MAP_EXPR_QUALITYSCORE, ["literal", this._mapFilters.qualityscore]]);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if(filters.theme && Object.values(MAP_THEMES).includes(filters.theme)) {
|
|
265
|
+
this._mapFilters.theme = filters.theme;
|
|
266
|
+
reloadMapStyle = true;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if(mapSeqFilters.length == 0) { mapSeqFilters = null; }
|
|
270
|
+
else {
|
|
271
|
+
mapSeqFilters.unshift("all");
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if(mapPicFilters.length == 0) { mapPicFilters = null; }
|
|
275
|
+
else {
|
|
276
|
+
mapPicFilters.unshift("all");
|
|
277
|
+
mapPicFilters = ["step", ["zoom"],
|
|
278
|
+
true,
|
|
279
|
+
TILES_PICTURES_ZOOM, mapPicFilters
|
|
280
|
+
];
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
if(reloadMapStyle) {
|
|
284
|
+
this.reloadLayersStyles();
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const allUsers = this.getVisibleUsers().includes("geovisio");
|
|
288
|
+
if(mapSeqFilters && allUsers) {
|
|
289
|
+
mapSeqFilters = ["step", ["zoom"],
|
|
290
|
+
true,
|
|
291
|
+
7, mapSeqFilters
|
|
292
|
+
];
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
this.filterUserLayersContent("sequences", mapSeqFilters);
|
|
296
|
+
this.filterUserLayersContent("pictures", mapPicFilters);
|
|
297
|
+
if(
|
|
298
|
+
!skipZoomIn
|
|
299
|
+
&& (
|
|
300
|
+
mapSeqFilters !== null
|
|
301
|
+
|| mapPicFilters !== null
|
|
302
|
+
|| (this._mapFilters.theme !== null && this._mapFilters.theme !== MAP_THEMES.DEFAULT)
|
|
303
|
+
)
|
|
304
|
+
&& allUsers
|
|
305
|
+
&& this.getZoom() < 7
|
|
306
|
+
&& !this._hasGridStats()
|
|
307
|
+
) {
|
|
308
|
+
this.easeTo({ zoom: 7 });
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Event for filters changes
|
|
313
|
+
* @event Panoramax.components.ui.MapMore#filters-changed
|
|
314
|
+
* @type {maplibregl.util.evented.Event}
|
|
315
|
+
* @property {string} [minDate] The minimum date in time range (ISO format)
|
|
316
|
+
* @property {string} [maxDate] The maximum date in time range (ISO format)
|
|
317
|
+
* @property {string} [pic_type] Camera type (equirectangular, flat, null/empty string for both)
|
|
318
|
+
* @property {string} [camera] Camera make and model
|
|
319
|
+
* @property {string} [theme] Map theme
|
|
320
|
+
* @property {number[]} [qualityscore] QualityScore values, as a list of 1 to 5 grades
|
|
321
|
+
*/
|
|
322
|
+
this.fire("filters-changed", Object.assign({}, this._mapFilters));
|
|
323
|
+
}
|
|
324
|
+
}
|
|
@@ -13,29 +13,29 @@
|
|
|
13
13
|
|
|
14
14
|
/* Resize canvas for print */
|
|
15
15
|
@media print {
|
|
16
|
-
.
|
|
16
|
+
.pnx-psv canvas {
|
|
17
17
|
width: 100% !important;
|
|
18
18
|
height: unset !important;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/* Virtual Tour SVG arrows */
|
|
23
|
-
.
|
|
23
|
+
.pnx-psv-tour-arrows {
|
|
24
24
|
background: none;
|
|
25
25
|
border: none;
|
|
26
26
|
|
|
27
27
|
}
|
|
28
|
-
.
|
|
29
|
-
.
|
|
28
|
+
.pnx-psv-tour-arrows:active svg,
|
|
29
|
+
.pnx-psv-tour-arrows.pnx-clicked svg {
|
|
30
30
|
opacity: 0.4;
|
|
31
31
|
transition: opacity 0.2s ease;
|
|
32
32
|
}
|
|
33
|
-
.
|
|
33
|
+
.pnx-psv-tour-arrows svg {
|
|
34
34
|
width: 100%;
|
|
35
35
|
height: auto;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/* No virtual tour arrows if photo is reduced */
|
|
39
|
-
|
|
39
|
+
pnx-mini .psv-virtual-tour-arrows {
|
|
40
40
|
display: none;
|
|
41
41
|
}
|