@panoramax/web-viewer 4.1.0-develop-6d60695e → 4.1.0-develop-2b222b1c
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 +3 -0
- package/build/index.js +11 -9
- package/build/index.js.map +1 -1
- package/build/photoviewer.css +36 -0
- package/build/photoviewer.css.map +1 -0
- package/build/photoviewer.js +2257 -0
- package/build/photoviewer.js.map +1 -0
- package/config/paths.js +1 -0
- package/config/webpack.config.js +44 -165
- package/docs/index.md +14 -3
- package/package.json +1 -1
- package/src/components/core/Basic.js +2 -2
- package/src/components/core/Viewer.js +2 -30
- package/src/components/index.js +2 -2
- package/src/components/index_photoviewer.js +8 -0
- package/src/components/menus/MapFilters.js +17 -1
- package/src/components/menus/index_photoviewer.js +11 -0
- package/src/components/ui/MapMore.js +3 -84
- package/src/components/ui/index.js +1 -1
- package/src/components/ui/index_photoviewer.js +22 -0
- package/src/components/ui/widgets/MapFiltersButton.js +1 -1
- package/src/components/ui/widgets/MapLayersButton.js +1 -1
- package/src/components/ui/widgets/Zoom.js +1 -1
- package/src/components/ui/widgets/index_photoviewer.js +9 -0
- package/src/index.js +2 -2
- package/src/index_photoviewer.js +6 -0
- package/src/utils/API.js +3 -1
- package/src/utils/InitParameters.js +26 -5
- package/src/utils/geocoder.js +2 -5
- package/src/utils/index_photoviewer.js +15 -0
- package/src/utils/map.js +123 -1
- package/src/utils/services.js +8 -0
- package/tests/utils/__snapshots__/geocoder.test.js.snap +8 -8
package/config/paths.js
CHANGED
|
@@ -56,6 +56,7 @@ module.exports = {
|
|
|
56
56
|
appHtmlPhotoViewer: resolveApp('public/photo.html'),
|
|
57
57
|
appHtmlWidgets: resolveApp('public/widgets.html'),
|
|
58
58
|
appLibIndexJs: resolveModule(resolveApp, 'src/index'),
|
|
59
|
+
appLibPhotoViewerJs: resolveModule(resolveApp, 'src/index_photoviewer'),
|
|
59
60
|
appPackageJson: resolveApp('package.json'),
|
|
60
61
|
appSrc: resolveApp('src'),
|
|
61
62
|
appSrcLib: resolveApp('src'),
|
package/config/webpack.config.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
1
2
|
const fs = require('fs');
|
|
2
3
|
const path = require('path');
|
|
3
4
|
const webpack = require('webpack');
|
|
@@ -211,6 +212,34 @@ module.exports = function (webpackEnv) {
|
|
|
211
212
|
return loaders;
|
|
212
213
|
};
|
|
213
214
|
|
|
215
|
+
const getHtmlPlugin = (filename, template) => new HtmlWebpackPlugin(
|
|
216
|
+
Object.assign(
|
|
217
|
+
{},
|
|
218
|
+
{
|
|
219
|
+
inject: true,
|
|
220
|
+
filename: filename,
|
|
221
|
+
template: template,
|
|
222
|
+
chunks: ["index"],
|
|
223
|
+
},
|
|
224
|
+
isEnvProduction
|
|
225
|
+
? {
|
|
226
|
+
minify: {
|
|
227
|
+
removeComments: true,
|
|
228
|
+
collapseWhitespace: true,
|
|
229
|
+
removeRedundantAttributes: true,
|
|
230
|
+
useShortDoctype: true,
|
|
231
|
+
removeEmptyAttributes: true,
|
|
232
|
+
removeStyleLinkTypeAttributes: true,
|
|
233
|
+
keepClosingSlash: true,
|
|
234
|
+
minifyJS: true,
|
|
235
|
+
minifyCSS: true,
|
|
236
|
+
minifyURLs: true,
|
|
237
|
+
},
|
|
238
|
+
}
|
|
239
|
+
: undefined
|
|
240
|
+
)
|
|
241
|
+
);
|
|
242
|
+
|
|
214
243
|
return {
|
|
215
244
|
target: ['browserslist'],
|
|
216
245
|
mode: isEnvProduction ? 'production' : isEnvDevelopment && 'development',
|
|
@@ -223,7 +252,10 @@ module.exports = function (webpackEnv) {
|
|
|
223
252
|
: isEnvDevelopment && 'cheap-module-source-map',
|
|
224
253
|
// These are the "entry points" to our application.
|
|
225
254
|
// This means they will be the "root" imports that are included in JS bundle.
|
|
226
|
-
entry:
|
|
255
|
+
entry: Object.assign(
|
|
256
|
+
{ index: paths.appLibIndexJs },
|
|
257
|
+
isEnvProduction ? { photoviewer: paths.appLibPhotoViewerJs } : {},
|
|
258
|
+
),
|
|
227
259
|
output: {
|
|
228
260
|
globalObject: 'this',
|
|
229
261
|
// The build folder.
|
|
@@ -233,7 +265,7 @@ module.exports = function (webpackEnv) {
|
|
|
233
265
|
// There will be one main bundle, and one file per asynchronous chunk.
|
|
234
266
|
// In development, it does not produce real files.
|
|
235
267
|
filename: isEnvProduction
|
|
236
|
-
? '
|
|
268
|
+
? '[name].js'
|
|
237
269
|
: isEnvDevelopment && 'static/js/bundle.js',
|
|
238
270
|
// There are also additional JS chunk files if you use code splitting.
|
|
239
271
|
chunkFilename: isEnvProduction
|
|
@@ -608,168 +640,15 @@ module.exports = function (webpackEnv) {
|
|
|
608
640
|
new webpack.DefinePlugin({
|
|
609
641
|
__COMMIT_HASH__: JSON.stringify(commitHash)
|
|
610
642
|
}),
|
|
611
|
-
|
|
612
|
-
//
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
isEnvProduction
|
|
621
|
-
? {
|
|
622
|
-
minify: {
|
|
623
|
-
removeComments: true,
|
|
624
|
-
collapseWhitespace: true,
|
|
625
|
-
removeRedundantAttributes: true,
|
|
626
|
-
useShortDoctype: true,
|
|
627
|
-
removeEmptyAttributes: true,
|
|
628
|
-
removeStyleLinkTypeAttributes: true,
|
|
629
|
-
keepClosingSlash: true,
|
|
630
|
-
minifyJS: true,
|
|
631
|
-
minifyCSS: true,
|
|
632
|
-
minifyURLs: true,
|
|
633
|
-
},
|
|
634
|
-
}
|
|
635
|
-
: undefined
|
|
636
|
-
)
|
|
637
|
-
),
|
|
638
|
-
// isEnvDevelopment &&
|
|
639
|
-
// Generates a `map.html` file with the <script> injected.
|
|
640
|
-
new HtmlWebpackPlugin(
|
|
641
|
-
Object.assign(
|
|
642
|
-
{},
|
|
643
|
-
{
|
|
644
|
-
inject: true,
|
|
645
|
-
filename: "map.html",
|
|
646
|
-
template: paths.appHtmlMap,
|
|
647
|
-
},
|
|
648
|
-
isEnvProduction
|
|
649
|
-
? {
|
|
650
|
-
minify: {
|
|
651
|
-
removeComments: true,
|
|
652
|
-
collapseWhitespace: true,
|
|
653
|
-
removeRedundantAttributes: true,
|
|
654
|
-
useShortDoctype: true,
|
|
655
|
-
removeEmptyAttributes: true,
|
|
656
|
-
removeStyleLinkTypeAttributes: true,
|
|
657
|
-
keepClosingSlash: true,
|
|
658
|
-
minifyJS: true,
|
|
659
|
-
minifyCSS: true,
|
|
660
|
-
minifyURLs: true,
|
|
661
|
-
},
|
|
662
|
-
}
|
|
663
|
-
: undefined
|
|
664
|
-
)
|
|
665
|
-
),
|
|
666
|
-
// isEnvDevelopment &&
|
|
667
|
-
// Generates a `map.html` file with the <script> injected.
|
|
668
|
-
new HtmlWebpackPlugin(
|
|
669
|
-
Object.assign(
|
|
670
|
-
{},
|
|
671
|
-
{
|
|
672
|
-
inject: true,
|
|
673
|
-
filename: "editor.html",
|
|
674
|
-
template: paths.appHtmlEditor,
|
|
675
|
-
},
|
|
676
|
-
isEnvProduction
|
|
677
|
-
? {
|
|
678
|
-
minify: {
|
|
679
|
-
removeComments: true,
|
|
680
|
-
collapseWhitespace: true,
|
|
681
|
-
removeRedundantAttributes: true,
|
|
682
|
-
useShortDoctype: true,
|
|
683
|
-
removeEmptyAttributes: true,
|
|
684
|
-
removeStyleLinkTypeAttributes: true,
|
|
685
|
-
keepClosingSlash: true,
|
|
686
|
-
minifyJS: true,
|
|
687
|
-
minifyCSS: true,
|
|
688
|
-
minifyURLs: true,
|
|
689
|
-
},
|
|
690
|
-
}
|
|
691
|
-
: undefined
|
|
692
|
-
)
|
|
693
|
-
),
|
|
694
|
-
// isEnvDevelopment &&
|
|
695
|
-
new HtmlWebpackPlugin(
|
|
696
|
-
Object.assign(
|
|
697
|
-
{},
|
|
698
|
-
{
|
|
699
|
-
inject: true,
|
|
700
|
-
filename: "viewer.html",
|
|
701
|
-
template: paths.appHtmlViewer,
|
|
702
|
-
},
|
|
703
|
-
isEnvProduction
|
|
704
|
-
? {
|
|
705
|
-
minify: {
|
|
706
|
-
removeComments: true,
|
|
707
|
-
collapseWhitespace: true,
|
|
708
|
-
removeRedundantAttributes: true,
|
|
709
|
-
useShortDoctype: true,
|
|
710
|
-
removeEmptyAttributes: true,
|
|
711
|
-
removeStyleLinkTypeAttributes: true,
|
|
712
|
-
keepClosingSlash: true,
|
|
713
|
-
minifyJS: true,
|
|
714
|
-
minifyCSS: true,
|
|
715
|
-
minifyURLs: true,
|
|
716
|
-
},
|
|
717
|
-
}
|
|
718
|
-
: undefined
|
|
719
|
-
)
|
|
720
|
-
),
|
|
721
|
-
new HtmlWebpackPlugin(
|
|
722
|
-
Object.assign(
|
|
723
|
-
{},
|
|
724
|
-
{
|
|
725
|
-
inject: true,
|
|
726
|
-
filename: "widgets.html",
|
|
727
|
-
template: paths.appHtmlWidgets,
|
|
728
|
-
},
|
|
729
|
-
isEnvProduction
|
|
730
|
-
? {
|
|
731
|
-
minify: {
|
|
732
|
-
removeComments: true,
|
|
733
|
-
collapseWhitespace: true,
|
|
734
|
-
removeRedundantAttributes: true,
|
|
735
|
-
useShortDoctype: true,
|
|
736
|
-
removeEmptyAttributes: true,
|
|
737
|
-
removeStyleLinkTypeAttributes: true,
|
|
738
|
-
keepClosingSlash: true,
|
|
739
|
-
minifyJS: true,
|
|
740
|
-
minifyCSS: true,
|
|
741
|
-
minifyURLs: true,
|
|
742
|
-
},
|
|
743
|
-
}
|
|
744
|
-
: undefined
|
|
745
|
-
)
|
|
746
|
-
),
|
|
747
|
-
new HtmlWebpackPlugin(
|
|
748
|
-
Object.assign(
|
|
749
|
-
{},
|
|
750
|
-
{
|
|
751
|
-
inject: true,
|
|
752
|
-
filename: "photo.html",
|
|
753
|
-
template: paths.appHtmlPhotoViewer,
|
|
754
|
-
},
|
|
755
|
-
isEnvProduction
|
|
756
|
-
? {
|
|
757
|
-
minify: {
|
|
758
|
-
removeComments: true,
|
|
759
|
-
collapseWhitespace: true,
|
|
760
|
-
removeRedundantAttributes: true,
|
|
761
|
-
useShortDoctype: true,
|
|
762
|
-
removeEmptyAttributes: true,
|
|
763
|
-
removeStyleLinkTypeAttributes: true,
|
|
764
|
-
keepClosingSlash: true,
|
|
765
|
-
minifyJS: true,
|
|
766
|
-
minifyCSS: true,
|
|
767
|
-
minifyURLs: true,
|
|
768
|
-
},
|
|
769
|
-
}
|
|
770
|
-
: undefined
|
|
771
|
-
)
|
|
772
|
-
),
|
|
643
|
+
|
|
644
|
+
// HTML demo pages
|
|
645
|
+
getHtmlPlugin("index.html", paths.appHtml),
|
|
646
|
+
getHtmlPlugin("map.html", paths.appHtmlMap),
|
|
647
|
+
getHtmlPlugin("editor.html", paths.appHtmlEditor),
|
|
648
|
+
getHtmlPlugin("viewer.html", paths.appHtmlViewer),
|
|
649
|
+
getHtmlPlugin("photo.html", paths.appHtmlPhotoViewer),
|
|
650
|
+
getHtmlPlugin("widgets.html", paths.appHtmlWidgets),
|
|
651
|
+
|
|
773
652
|
// Inlines the webpack runtime script. This script is too small to warrant
|
|
774
653
|
// a network request.
|
|
775
654
|
// https://github.com/facebook/create-react-app/issues/5358
|
|
@@ -807,7 +686,7 @@ module.exports = function (webpackEnv) {
|
|
|
807
686
|
new MiniCssExtractPlugin({
|
|
808
687
|
// Options similar to the same options in webpackOptions.output
|
|
809
688
|
// both options are optional
|
|
810
|
-
filename: '
|
|
689
|
+
filename: '[name].css',
|
|
811
690
|
chunkFilename: 'index.[contenthash:8].chunk.css',
|
|
812
691
|
}),
|
|
813
692
|
// Generate an asset manifest file with the following content:
|
package/docs/index.md
CHANGED
|
@@ -31,9 +31,9 @@ Many options are available for installing the viewer.
|
|
|
31
31
|
You can rely on various providers offering hosted NPM packages, for example JSDelivr.
|
|
32
32
|
|
|
33
33
|
```html
|
|
34
|
-
<!-- You may use another version than 4.
|
|
35
|
-
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@panoramax/web-viewer@4.
|
|
36
|
-
<script src="https://cdn.jsdelivr.net/npm/@panoramax/web-viewer@4.
|
|
34
|
+
<!-- You may use another version than 4.1.0, just change the release in URL -->
|
|
35
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@panoramax/web-viewer@4.1.0/build/index.css" />
|
|
36
|
+
<script src="https://cdn.jsdelivr.net/npm/@panoramax/web-viewer@4.1.0/build/index.js"></script>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
=== ":material-code-tags: Source code"
|
|
@@ -62,6 +62,10 @@ First, you need to import Panoramax code:
|
|
|
62
62
|
<!-- Change the actual path depending of where you installed the library -->
|
|
63
63
|
<link rel="stylesheet" type="text/css" href="web-viewer/build/index.css" />
|
|
64
64
|
<script src="web-viewer/build/index.js"></script>
|
|
65
|
+
|
|
66
|
+
<!-- You can use the lightweight version with only PhotoViewer as well -->
|
|
67
|
+
<link rel="stylesheet" type="text/css" href="web-viewer/build/photoviewer.css" />
|
|
68
|
+
<script src="web-viewer/build/photoviewer.js"></script>
|
|
65
69
|
```
|
|
66
70
|
|
|
67
71
|
=== ":fontawesome-brands-node-js: New-style JS"
|
|
@@ -73,6 +77,13 @@ First, you need to import Panoramax code:
|
|
|
73
77
|
import '@panoramax/web-viewer/build/index.css';
|
|
74
78
|
```
|
|
75
79
|
|
|
80
|
+
If you prefer the lightweight version, only containing PhotoViewer component:
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
import Panoramax from '@panoramax/web-viewer/build/photoviewer';
|
|
84
|
+
import '@panoramax/web-viewer/build/photoviewer.css';
|
|
85
|
+
```
|
|
86
|
+
|
|
76
87
|
Once ready, you can create for example a viewer. We use web components to do so, you can create it in HTML or in other web components:
|
|
77
88
|
|
|
78
89
|
```html
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LitElement, html } from "lit";
|
|
2
2
|
import API from "../../utils/API";
|
|
3
3
|
import { getTranslations } from "../../utils/i18n";
|
|
4
|
-
import {
|
|
4
|
+
import { MapTiles } from "../../utils/services";
|
|
5
5
|
import { createWebComp } from "../../utils/widgets";
|
|
6
6
|
import { isInIframe, isInternetFast } from "../../utils/utils";
|
|
7
7
|
import JSON5 from "json5";
|
|
@@ -57,7 +57,7 @@ export default class Basic extends LitElement {
|
|
|
57
57
|
|
|
58
58
|
// Some defaults
|
|
59
59
|
this.users = ["geovisio"];
|
|
60
|
-
this.mapstyle = this.getAttribute("mapstyle") ||
|
|
60
|
+
this.mapstyle = this.getAttribute("mapstyle") || MapTiles();
|
|
61
61
|
this.lang = this.getAttribute("lang") || null;
|
|
62
62
|
this.endpoint = this.getAttribute("endpoint") || null; // No default
|
|
63
63
|
this.picture = this.getAttribute("picture") || null;
|
|
@@ -4,7 +4,7 @@ import "./Viewer.css";
|
|
|
4
4
|
import { linkMapAndPhoto, saveMapParamsToLocalStorage, getMapParamsFromLocalStorage } from "../../utils/map";
|
|
5
5
|
import PhotoViewer, {KEYBOARD_SKIP_FOCUS_WIDGETS} from "./PhotoViewer";
|
|
6
6
|
import MapMore from "../ui/MapMore";
|
|
7
|
-
import { initMapKeyboardHandler } from "../../utils/map";
|
|
7
|
+
import { initMapKeyboardHandler, mapFiltersFormValues } from "../../utils/map";
|
|
8
8
|
import { isNullId, isInIframe } from "../../utils/utils";
|
|
9
9
|
import { createWebComp } from "../../utils/widgets";
|
|
10
10
|
import { fa } from "../../utils/widgets";
|
|
@@ -14,7 +14,6 @@ import { querySelectorDeep } from "query-selector-shadow-dom";
|
|
|
14
14
|
import { default as InitParameters, alterMapState, alterViewerState } from "../../utils/InitParameters";
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
export const PSV_ZOOM_DELTA = 20;
|
|
18
17
|
const MAP_MOVE_DELTA = 100;
|
|
19
18
|
|
|
20
19
|
|
|
@@ -569,35 +568,8 @@ export default class Viewer extends PhotoViewer {
|
|
|
569
568
|
*/
|
|
570
569
|
_onMapFiltersChange() {
|
|
571
570
|
const mapFiltersMenu = querySelectorDeep("#pnx-map-filters-menu");
|
|
572
|
-
const fMinDate = mapFiltersMenu?.shadowRoot.getElementById("pnx-filter-date-from");
|
|
573
|
-
const fMaxDate = mapFiltersMenu?.shadowRoot.getElementById("pnx-filter-date-end");
|
|
574
|
-
const fTypes = mapFiltersMenu?.shadowRoot.querySelectorAll("input[name='pnx-filter-type']");
|
|
575
571
|
const fMapTheme = querySelectorDeep("#pnx-map-theme");
|
|
576
|
-
|
|
577
|
-
let type = "";
|
|
578
|
-
for(let fTypeId = 0 ; fTypeId < fTypes.length; fTypeId++) {
|
|
579
|
-
const fType = fTypes[fTypeId];
|
|
580
|
-
if(fType.checked) {
|
|
581
|
-
type = fType.value;
|
|
582
|
-
break;
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
let qualityscore = [];
|
|
587
|
-
if(this.map?._hasQualityScore()) {
|
|
588
|
-
const fScore = mapFiltersMenu?.shadowRoot.getElementById("pnx-filter-qualityscore");
|
|
589
|
-
qualityscore = (fScore?.grade || "").split(",").map(v => parseInt(v)).filter(v => !isNaN(v));
|
|
590
|
-
if(qualityscore.length == 5) { qualityscore = []; }
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
const values = {
|
|
594
|
-
minDate: fMinDate?.value,
|
|
595
|
-
maxDate: fMaxDate?.value,
|
|
596
|
-
pic_type: type,
|
|
597
|
-
theme: fMapTheme?.value,
|
|
598
|
-
qualityscore,
|
|
599
|
-
};
|
|
600
|
-
|
|
572
|
+
const values = mapFiltersFormValues(mapFiltersMenu, fMapTheme, this.map?._hasQualityScore());
|
|
601
573
|
this.map.setFilters(values);
|
|
602
574
|
}
|
|
603
575
|
}
|
package/src/components/index.js
CHANGED
|
@@ -284,6 +284,20 @@ export default class MapFilters extends LitElement {
|
|
|
284
284
|
|
|
285
285
|
if(dateToField) { dateToField.value = ""; }
|
|
286
286
|
}
|
|
287
|
+
|
|
288
|
+
/** @private */
|
|
289
|
+
_onMeUserSearch() {
|
|
290
|
+
const userAccount = getUserAccount();
|
|
291
|
+
if(!userAccount) { return; }
|
|
292
|
+
|
|
293
|
+
const userField = this.shadowRoot.getElementById("pnx-filter-search-user");
|
|
294
|
+
if(!this._parent?.map.getVisibleUsers().includes(userAccount.id)) {
|
|
295
|
+
userField?._onResultClick({title: userAccount.name, data: {id: userAccount.id }});
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
userField?._onResultClick();
|
|
299
|
+
}
|
|
300
|
+
}
|
|
287
301
|
|
|
288
302
|
/** @private */
|
|
289
303
|
render() {
|
|
@@ -386,7 +400,9 @@ export default class MapFilters extends LitElement {
|
|
|
386
400
|
<h4>${fa(faUser)} ${this._parent?._t.pnx.filter_user}</h4>
|
|
387
401
|
${userAccount ? html`
|
|
388
402
|
<div class="pnx-input-shortcuts">
|
|
389
|
-
<button
|
|
403
|
+
<button @click=${this._onMeUserSearch}>
|
|
404
|
+
${this._parent?._t.pnx.filter_user_mypics}
|
|
405
|
+
</button>
|
|
390
406
|
</div>
|
|
391
407
|
` : nothing}
|
|
392
408
|
<pnx-search-bar
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* eslint-disable import/no-unused-modules */
|
|
2
|
+
|
|
3
|
+
// Lightweight export for PhotoViewer
|
|
4
|
+
export {default as AnnotationsList} from "./AnnotationsList";
|
|
5
|
+
export {default as PictureLegend} from "./PictureLegend";
|
|
6
|
+
export {default as PictureMetadata} from "./PictureMetadata";
|
|
7
|
+
export {default as PlayerOptions} from "./PlayerOptions";
|
|
8
|
+
export {default as QualityScoreDoc} from "./QualityScoreDoc";
|
|
9
|
+
export {default as ReportForm} from "./ReportForm";
|
|
10
|
+
export {default as SemanticsMetadata} from "./SemanticsMetadata";
|
|
11
|
+
export {default as Share} from "./Share";
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import Map from "./Map";
|
|
2
2
|
import { COLORS, QUALITYSCORE_VALUES } from "../../utils/utils";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const MAP_THEMES = {
|
|
6
|
-
DEFAULT: "default",
|
|
7
|
-
AGE: "age",
|
|
8
|
-
TYPE: "type",
|
|
9
|
-
SCORE: "score",
|
|
10
|
-
};
|
|
3
|
+
import { MAP_EXPR_QUALITYSCORE, switchCoefValue, MAP_THEMES, mapFiltersToLayersFilters } from "../../utils/map";
|
|
11
4
|
|
|
12
5
|
export const MAP_FILTERS = [ "minDate", "maxDate", "pic_type", "camera", "theme", "qualityscore"];
|
|
13
6
|
|
|
@@ -198,80 +191,6 @@ export default class MapMore extends Map {
|
|
|
198
191
|
return s;
|
|
199
192
|
}
|
|
200
193
|
|
|
201
|
-
/** @private */
|
|
202
|
-
_mapFiltersToLayersFilters(filters) {
|
|
203
|
-
let mapFilters = {};
|
|
204
|
-
let mapSeqFilters = [];
|
|
205
|
-
let mapPicFilters = [];
|
|
206
|
-
let reloadMapStyle = false;
|
|
207
|
-
|
|
208
|
-
if(filters.minDate && filters.minDate !== "") {
|
|
209
|
-
mapFilters.minDate = filters.minDate;
|
|
210
|
-
mapSeqFilters.push([">=", ["get", "date"], filters.minDate]);
|
|
211
|
-
mapPicFilters.push([">=", ["get", "ts"], filters.minDate]);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if(filters.maxDate && filters.maxDate !== "") {
|
|
215
|
-
mapFilters.maxDate = filters.maxDate;
|
|
216
|
-
mapSeqFilters.push(["<=", ["get", "date"], filters.maxDate]);
|
|
217
|
-
|
|
218
|
-
// Get tomorrow date for pictures filtering
|
|
219
|
-
// (because ts is date+time, so comparing date only string would fail otherwise)
|
|
220
|
-
let d = new Date(filters.maxDate);
|
|
221
|
-
d.setDate(d.getDate() + 1);
|
|
222
|
-
d = d.toISOString().split("T")[0];
|
|
223
|
-
mapPicFilters.push(["<=", ["get", "ts"], d]);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
if(filters.pic_type && filters.pic_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]);
|
|
230
|
-
}
|
|
231
|
-
if(this._hasGridStats()) {
|
|
232
|
-
reloadMapStyle = true;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if(filters.camera && filters.camera !== "") {
|
|
236
|
-
mapFilters.camera = filters.camera;
|
|
237
|
-
// low/high model hack : to enable fuzzy filtering of camera make and model
|
|
238
|
-
const lowModel = filters.camera.toLowerCase().trim() + " ";
|
|
239
|
-
const highModel = filters.camera.toLowerCase().trim() + "zzzzzzzzzzzzzzzzzzzz";
|
|
240
|
-
const collator = ["collator", { "case-sensitive": false, "diacritic-sensitive": false } ];
|
|
241
|
-
mapSeqFilters.push([">=", ["get", "model"], lowModel, collator]);
|
|
242
|
-
mapSeqFilters.push(["<=", ["get", "model"], highModel, collator]);
|
|
243
|
-
mapPicFilters.push([">=", ["get", "model"], lowModel, collator]);
|
|
244
|
-
mapPicFilters.push(["<=", ["get", "model"], highModel, collator]);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
if(filters.qualityscore && filters.qualityscore.length > 0) {
|
|
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]]);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
if(filters.theme && Object.values(MAP_THEMES).includes(filters.theme)) {
|
|
254
|
-
mapFilters.theme = filters.theme;
|
|
255
|
-
reloadMapStyle = true;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
if(mapSeqFilters.length == 0) { mapSeqFilters = null; }
|
|
259
|
-
else {
|
|
260
|
-
mapSeqFilters.unshift("all");
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
if(mapPicFilters.length == 0) { mapPicFilters = null; }
|
|
264
|
-
else {
|
|
265
|
-
mapPicFilters.unshift("all");
|
|
266
|
-
mapPicFilters = ["step", ["zoom"],
|
|
267
|
-
true,
|
|
268
|
-
TILES_PICTURES_ZOOM, mapPicFilters
|
|
269
|
-
];
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
return { mapFilters, mapSeqFilters, mapPicFilters, reloadMapStyle };
|
|
273
|
-
}
|
|
274
|
-
|
|
275
194
|
/**
|
|
276
195
|
* Change the map filters
|
|
277
196
|
* @param {object} filters Filtering values
|
|
@@ -285,7 +204,7 @@ export default class MapMore extends Map {
|
|
|
285
204
|
* @memberof Panoramax.components.core.MapMore#
|
|
286
205
|
*/
|
|
287
206
|
setFilters(filters, skipZoomIn = false) {
|
|
288
|
-
let { mapFilters, mapSeqFilters, mapPicFilters, reloadMapStyle } = this.
|
|
207
|
+
let { mapFilters, mapSeqFilters, mapPicFilters, reloadMapStyle } = mapFiltersToLayersFilters(filters, this._hasGridStats());
|
|
289
208
|
|
|
290
209
|
this._mapFilters = mapFilters;
|
|
291
210
|
if(reloadMapStyle) {
|
|
@@ -340,7 +259,7 @@ export default class MapMore extends Map {
|
|
|
340
259
|
await super.setVisibleUsers(visibleIds);
|
|
341
260
|
|
|
342
261
|
// Force reload of styles & filters
|
|
343
|
-
let { mapSeqFilters, mapPicFilters, reloadMapStyle } = this.
|
|
262
|
+
let { mapSeqFilters, mapPicFilters, reloadMapStyle } = mapFiltersToLayersFilters(this._mapFilters, this._hasGridStats());
|
|
344
263
|
|
|
345
264
|
if(reloadMapStyle) {
|
|
346
265
|
this.reloadLayersStyles();
|
|
@@ -22,5 +22,5 @@ export {default as SearchBar} from "./SearchBar";
|
|
|
22
22
|
export {default as SemanticsEditor} from "./SemanticsEditor";
|
|
23
23
|
export {default as SemanticsTable} from "./SemanticsTable";
|
|
24
24
|
export {default as TogglableGroup} from "./TogglableGroup";
|
|
25
|
-
import * as widgets from "./widgets";
|
|
25
|
+
import * as widgets from "./widgets/index";
|
|
26
26
|
export {widgets};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* eslint-disable import/no-unused-modules */
|
|
2
|
+
|
|
3
|
+
// Lightweight export for PhotoViewer
|
|
4
|
+
export {default as ButtonGroup} from "./ButtonGroup";
|
|
5
|
+
export {default as Button} from "./Button";
|
|
6
|
+
export {default as CopyButton} from "./CopyButton";
|
|
7
|
+
export {default as Grade} from "./Grade";
|
|
8
|
+
export {default as AnnotationsSwitch} from "./AnnotationsSwitch";
|
|
9
|
+
export {default as LinkButton} from "./LinkButton";
|
|
10
|
+
export {default as ListGroup} from "./ListGroup";
|
|
11
|
+
export {default as ListItem} from "./ListItem";
|
|
12
|
+
export {default as Loader} from "./Loader";
|
|
13
|
+
export {default as Photo} from "./Photo";
|
|
14
|
+
export {default as Popup} from "./Popup";
|
|
15
|
+
export {default as ProgressBar} from "./ProgressBar";
|
|
16
|
+
export {default as QualityScore} from "./QualityScore";
|
|
17
|
+
export {default as SearchBar} from "./SearchBar";
|
|
18
|
+
export {default as SemanticsEditor} from "./SemanticsEditor";
|
|
19
|
+
export {default as SemanticsTable} from "./SemanticsTable";
|
|
20
|
+
export {default as TogglableGroup} from "./TogglableGroup";
|
|
21
|
+
import * as widgets from "./widgets/index_photoviewer";
|
|
22
|
+
export {widgets};
|
|
@@ -70,7 +70,7 @@ export default class MapFiltersButton extends LitElement {
|
|
|
70
70
|
/** @private */
|
|
71
71
|
render() {
|
|
72
72
|
const isSmall = this._parent?.isWidthSmall();
|
|
73
|
-
const resetIcon = fa(faXmark);
|
|
73
|
+
const resetIcon = fa(faXmark, {styles: {"pointer-events": "auto"}});
|
|
74
74
|
resetIcon.addEventListener("click", e => {
|
|
75
75
|
e.stopPropagation();
|
|
76
76
|
this.shadowRoot.querySelector("pnx-map-filters-menu")._onReset();
|
|
@@ -46,7 +46,7 @@ export default class MapLayersButton extends LitElement {
|
|
|
46
46
|
/** @private */
|
|
47
47
|
render() {
|
|
48
48
|
const isSmall = this._parent?.isWidthSmall();
|
|
49
|
-
const resetIcon = fa(faXmark);
|
|
49
|
+
const resetIcon = fa(faXmark, {styles: {"pointer-events": "auto"}});
|
|
50
50
|
resetIcon.addEventListener("click", e => {
|
|
51
51
|
e.stopPropagation();
|
|
52
52
|
const menu = this.shadowRoot.querySelector("pnx-map-layers-menu");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement, html } from "lit";
|
|
2
2
|
import { PSV_DEFAULT_ZOOM, PSV_ANIM_DURATION } from "../Photo";
|
|
3
|
-
import { PSV_ZOOM_DELTA } from "../../core/
|
|
3
|
+
import { PSV_ZOOM_DELTA } from "../../core/PhotoViewer";
|
|
4
4
|
import { fa, onceParentAvailable } from "../../../utils/widgets";
|
|
5
5
|
import { faPlus } from "@fortawesome/free-solid-svg-icons/faPlus";
|
|
6
6
|
import { faMinus } from "@fortawesome/free-solid-svg-icons/faMinus";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* eslint-disable import/no-unused-modules */
|
|
2
|
+
|
|
3
|
+
// Lightweight export for PhotoViewer
|
|
4
|
+
export {default as CopyCoordinates} from "./CopyCoordinates";
|
|
5
|
+
export {default as Legend} from "./Legend";
|
|
6
|
+
export {default as OSMEditors} from "./OSMEditors";
|
|
7
|
+
export {default as PictureLegendActions} from "./PictureLegendActions";
|
|
8
|
+
export {default as Player} from "./Player";
|
|
9
|
+
export {default as Zoom} from "./Zoom";
|
package/src/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable import/no-unused-modules */
|
|
2
2
|
|
|
3
|
-
export * as components from "./components";
|
|
4
|
-
export * as utils from "./utils";
|
|
3
|
+
export * as components from "./components/index";
|
|
4
|
+
export * as utils from "./utils/index";
|
|
5
5
|
export {default as Viewer} from "./components/core/Viewer";
|
|
6
6
|
export {default as CoverageMap} from "./components/core/CoverageMap";
|
|
7
7
|
export {default as Editor} from "./components/core/Editor";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/* eslint-disable import/no-unused-modules */
|
|
2
|
+
|
|
3
|
+
// Lightweight export for PhotoViewer
|
|
4
|
+
export * as components from "./components/index_photoviewer";
|
|
5
|
+
export * as utils from "./utils/index_photoviewer";
|
|
6
|
+
export {default as PhotoViewer} from "./components/core/PhotoViewer";
|
package/src/utils/API.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { TILES_PICTURES_ZOOM } from "./map";
|
|
2
1
|
import { isNullId } from "./utils";
|
|
3
2
|
|
|
3
|
+
// Do not use ./map import to avoid bundling Maplibre for PhotoViewer
|
|
4
|
+
const TILES_PICTURES_ZOOM = 15;
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* API contains various utility functions to communicate with Panoramax/STAC API
|
|
6
8
|
*
|