@geogirafe/lib-geoportal 1.2.0-dev.2800201562 → 1.2.0-dev.2816732111
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/api/apicontext.d.ts +4 -0
- package/api/apicontext.js +8 -0
- package/api/apigeogirafeapp.js +7 -5
- package/api/style.css +18 -1
- package/components/drawing/component.d.ts +9 -2
- package/components/drawing/component.js +27 -10
- package/components/drawing-toolbar/component.js +2 -2
- package/components/extlayers/component.d.ts +0 -1
- package/components/extlayers/component.js +1 -6
- package/components/main.d.ts +3 -1
- package/components/main.js +3 -1
- package/components/{map → map-2d}/component.d.ts +9 -24
- package/components/{map → map-2d}/component.js +28 -260
- package/components/map-2d/deprecatedmapcomponent.d.ts +15 -0
- package/components/map-2d/deprecatedmapcomponent.js +24 -0
- package/components/{map → map-2d}/style.css +0 -30
- package/components/{map → map-2d}/tools/swipemanager.d.ts +1 -1
- package/components/map-3d/component.d.ts +50 -0
- package/components/map-3d/component.js +139 -0
- package/components/map-3d/style.css +34 -0
- package/components/map-3d/tools/globe.d.ts +42 -0
- package/components/map-3d/tools/globe.js +198 -0
- package/components/selectiontool/component.d.ts +2 -2
- package/components/selectiontool/component.js +2 -2
- package/package.json +1 -1
- package/styles/iframe.css +18 -1
- package/styles/index.css +18 -1
- package/styles/mobile.css +18 -1
- package/templates/iframe.html +4 -1
- package/templates/index.html +4 -1
- package/templates/mobile.html +4 -1
- package/templates/public/about.json +1 -1
- package/templates/vite.config.js +43 -25
- package/tools/app/geogirafeapp-mobile.js +7 -2
- package/tools/app/geogirafeapp.js +7 -2
- package/tools/context/context.d.ts +4 -0
- package/tools/context/context.js +8 -0
- package/tools/context/icontext.d.ts +5 -0
- package/tools/drawing/cesiumDrawing.d.ts +9 -5
- package/tools/drawing/cesiumDrawing.js +8 -8
- package/tools/drawing/olDrawing.d.ts +2 -2
- package/tools/drawing/olDrawing.js +1 -1
- package/tools/main.d.ts +2 -0
- package/tools/main.js +2 -0
- package/tools/selection/selectionmanager.d.ts +19 -0
- package/tools/selection/selectionmanager.js +80 -0
- package/tools/state/componentManager.d.ts +1 -1
- package/tools/tests/mockcontext.d.ts +4 -0
- package/tools/tests/mockcontext.js +8 -0
- package/{components/map/tools → tools/wmts}/wmtsmanager.d.ts +4 -7
- package/{components/map/tools → tools/wmts}/wmtsmanager.js +7 -10
- /package/components/{map → map-2d}/tools/cogmanager.d.ts +0 -0
- /package/components/{map → map-2d}/tools/cogmanager.js +0 -0
- /package/components/{map → map-2d}/tools/contextmenu.d.ts +0 -0
- /package/components/{map → map-2d}/tools/contextmenu.js +0 -0
- /package/components/{map → map-2d}/tools/drawingmanager.d.ts +0 -0
- /package/components/{map → map-2d}/tools/drawingmanager.js +0 -0
- /package/components/{map → map-2d}/tools/focusfeature.d.ts +0 -0
- /package/components/{map → map-2d}/tools/focusfeature.js +0 -0
- /package/components/{map → map-2d}/tools/osmmanager.d.ts +0 -0
- /package/components/{map → map-2d}/tools/osmmanager.js +0 -0
- /package/components/{map → map-2d}/tools/swipemanager.js +0 -0
- /package/components/{map → map-2d}/tools/vectortilesmanager.d.ts +0 -0
- /package/components/{map → map-2d}/tools/vectortilesmanager.js +0 -0
- /package/components/{map → map-2d}/tools/viewmanager.d.ts +0 -0
- /package/components/{map → map-2d}/tools/viewmanager.js +0 -0
- /package/components/{map → map-2d}/tools/xyzmanager.d.ts +0 -0
- /package/components/{map → map-2d}/tools/xyzmanager.js +0 -0
- /package/components/{map → map-3d}/tools/wmsmanager3d.d.ts +0 -0
- /package/components/{map → map-3d}/tools/wmsmanager3d.js +0 -0
package/templates/vite.config.js
CHANGED
|
@@ -74,31 +74,49 @@ export default defineConfig(({ command, mode }) => {
|
|
|
74
74
|
api: resolve(__dirname, 'api.html')
|
|
75
75
|
},
|
|
76
76
|
output: {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
77
|
+
codeSplitting: {
|
|
78
|
+
groups: [
|
|
79
|
+
// Dependencies that the application needs on startup and on which Cesium also depends
|
|
80
|
+
// (OpenLayers and dompurify). They need their own chunk, otherwise they end up in the
|
|
81
|
+
// (huge) cesium chunk, which would then have to be loaded on startup and would defeat
|
|
82
|
+
// the lazy loading of Cesium below.
|
|
83
|
+
// minSize: 0 prevents the group from being merged back into another chunk.
|
|
84
|
+
{
|
|
85
|
+
name: 'shared',
|
|
86
|
+
test: (id) => ['dompurify', 'ol'].some((dep) => id.includes(`node_modules/${dep}/`)),
|
|
87
|
+
priority: 30,
|
|
88
|
+
minSize: 0
|
|
89
|
+
},
|
|
90
|
+
// lazy loading for cesium dependencies
|
|
91
|
+
{
|
|
92
|
+
name: 'cesium',
|
|
93
|
+
test: (id) => ['cesium', 'olcs/OLCesium'].some((dep) => id.includes(`node_modules/${dep}`)),
|
|
94
|
+
priority: 20,
|
|
95
|
+
minSize: 0
|
|
96
|
+
},
|
|
97
|
+
// lazy loading for not priritary libraries
|
|
98
|
+
{
|
|
99
|
+
name: 'lazy',
|
|
100
|
+
test: (id) =>
|
|
101
|
+
[
|
|
102
|
+
'@geoblocks/mapfishprint',
|
|
103
|
+
'@geoblocks/print',
|
|
104
|
+
'buffer',
|
|
105
|
+
'd3',
|
|
106
|
+
'error-stack-parser',
|
|
107
|
+
'file-saver',
|
|
108
|
+
'tabulator-tables',
|
|
109
|
+
'lz-string',
|
|
110
|
+
'qr-code-styling',
|
|
111
|
+
'source-map-js',
|
|
112
|
+
'tippy.js',
|
|
113
|
+
'vanilla-picker',
|
|
114
|
+
'driver.js'
|
|
115
|
+
].some((dep) => id.includes(`node_modules/${dep}`)),
|
|
116
|
+
priority: 10,
|
|
117
|
+
minSize: 0
|
|
118
|
+
}
|
|
119
|
+
]
|
|
102
120
|
},
|
|
103
121
|
entryFileNames: (chunkInfo) => {
|
|
104
122
|
if (chunkInfo.name === 'api') {
|
|
@@ -8,7 +8,9 @@ import DrawingContainerMobile from '../../components/drawing-container-mobile/co
|
|
|
8
8
|
import DrawingComponentMobile from '../../components/drawing/component-mobile.js';
|
|
9
9
|
import GeolocationMobile from '../../components/geolocation-mobile/component.js';
|
|
10
10
|
import InfoboxComponent from '../../components/infobox/component.js';
|
|
11
|
-
import
|
|
11
|
+
import Map2dComponent from '../../components/map-2d/component.js';
|
|
12
|
+
import DeprecatedMapComponent from '../../components/map-2d/deprecatedmapcomponent.js';
|
|
13
|
+
import Map3dComponent from '../../components/map-3d/component.js';
|
|
12
14
|
import MenuMobile3dButton from '../../components/menu-buttons-mobile/MenuMobile3dButton.js';
|
|
13
15
|
import MenuMobileDrawingButton from '../../components/menu-buttons-mobile/MenuMobileDrawingButton.js';
|
|
14
16
|
import MenuMobileOfflineButton from '../../components/menu-buttons-mobile/MenuMobileOfflineButton.js';
|
|
@@ -44,7 +46,10 @@ export default class GeoGirafeAppMobile extends GeoGirafeApp {
|
|
|
44
46
|
}
|
|
45
47
|
defineCoreComponents() {
|
|
46
48
|
customElements.define('girafe-infobox', InfoboxComponent);
|
|
47
|
-
customElements.define('girafe-map',
|
|
49
|
+
customElements.define('girafe-map-2d', Map2dComponent);
|
|
50
|
+
customElements.define('girafe-map-3d', Map3dComponent);
|
|
51
|
+
// Deprecated alias of <girafe-map-2d>, kept for the applications that were not migrated yet.
|
|
52
|
+
customElements.define('girafe-map', DeprecatedMapComponent);
|
|
48
53
|
customElements.define('girafe-search', MobileSearchComponent);
|
|
49
54
|
customElements.define('girafe-offline', OfflineComponent);
|
|
50
55
|
customElements.define('girafe-theme-select', MobileThemeComponent);
|
|
@@ -17,7 +17,9 @@ import InfoboxComponent from '../../components/infobox/component.js';
|
|
|
17
17
|
import InfoWindowComponent from '../../components/infowindow/component.js';
|
|
18
18
|
import LayoutComponent from '../../components/layout/component.js';
|
|
19
19
|
import LRPanelComponent from '../../components/lr-panel/component.js';
|
|
20
|
-
import
|
|
20
|
+
import Map2dComponent from '../../components/map-2d/component.js';
|
|
21
|
+
import DeprecatedMapComponent from '../../components/map-2d/deprecatedmapcomponent.js';
|
|
22
|
+
import Map3dComponent from '../../components/map-3d/component.js';
|
|
21
23
|
import MenuButtonComponent from '../../components/menubutton/component.js';
|
|
22
24
|
import ModalsComponent from '../../components/modals/component.js';
|
|
23
25
|
import NavigationComponent from '../../components/navigation/component.js';
|
|
@@ -116,7 +118,10 @@ export default class GeoGirafeApp {
|
|
|
116
118
|
customElements.define('girafe-cross-section-settings', CrossSectionSettingsComponent);
|
|
117
119
|
customElements.define('girafe-cross-section-view', CrossSectionViewComponent);
|
|
118
120
|
customElements.define('girafe-lr-panel', LRPanelComponent);
|
|
119
|
-
customElements.define('girafe-map',
|
|
121
|
+
customElements.define('girafe-map-2d', Map2dComponent);
|
|
122
|
+
customElements.define('girafe-map-3d', Map3dComponent);
|
|
123
|
+
// Deprecated alias of <girafe-map-2d>, kept for the applications that were not migrated yet.
|
|
124
|
+
customElements.define('girafe-map', DeprecatedMapComponent);
|
|
120
125
|
customElements.define('girafe-menu-button', MenuButtonComponent);
|
|
121
126
|
customElements.define('girafe-modals', ModalsComponent);
|
|
122
127
|
customElements.define('girafe-nav-history', NavigationComponent);
|
|
@@ -29,6 +29,8 @@ import UrlManager from '../url/urlmanager.js';
|
|
|
29
29
|
import UserDataManager from '../userdata/userdatamanager.js';
|
|
30
30
|
import WfsManager from '../wfs/wfsmanager.js';
|
|
31
31
|
import WmsManager from '../wms/wmsmanager.js';
|
|
32
|
+
import WmtsManager from '../wmts/wmtsmanager.js';
|
|
33
|
+
import SelectionManager from '../selection/selectionmanager.js';
|
|
32
34
|
import IGirafeContext from './icontext.js';
|
|
33
35
|
import ThemeFavoritesManager from '../themes/themefavoritesmanager.js';
|
|
34
36
|
import SearchManager from '../search/searchmanager.js';
|
|
@@ -62,6 +64,8 @@ export default class GirafeContext implements IGirafeContext {
|
|
|
62
64
|
readonly orderingManager: OrderingManager;
|
|
63
65
|
readonly userLayerManager: UserLayerManager;
|
|
64
66
|
readonly wmsManager: WmsManager;
|
|
67
|
+
readonly wmtsManager: WmtsManager;
|
|
68
|
+
readonly selectionManager: SelectionManager;
|
|
65
69
|
readonly ogcApiFeaturesManager: OgcApiFeaturesManager;
|
|
66
70
|
readonly localFileManager: LocalFileManager;
|
|
67
71
|
readonly onBoardingManager: OnBoardingManager;
|
package/tools/context/context.js
CHANGED
|
@@ -30,6 +30,8 @@ import UrlManager from '../url/urlmanager.js';
|
|
|
30
30
|
import UserDataManager from '../userdata/userdatamanager.js';
|
|
31
31
|
import WfsManager from '../wfs/wfsmanager.js';
|
|
32
32
|
import WmsManager from '../wms/wmsmanager.js';
|
|
33
|
+
import WmtsManager from '../wmts/wmtsmanager.js';
|
|
34
|
+
import SelectionManager from '../selection/selectionmanager.js';
|
|
33
35
|
import ThemeFavoritesManager from '../themes/themefavoritesmanager.js';
|
|
34
36
|
import SearchManager from '../search/searchmanager.js';
|
|
35
37
|
import FeedbackManager from '../feedback/feedbackmanager.js';
|
|
@@ -62,6 +64,8 @@ export default class GirafeContext {
|
|
|
62
64
|
orderingManager;
|
|
63
65
|
userLayerManager;
|
|
64
66
|
wmsManager;
|
|
67
|
+
wmtsManager;
|
|
68
|
+
selectionManager;
|
|
65
69
|
ogcApiFeaturesManager;
|
|
66
70
|
localFileManager;
|
|
67
71
|
onBoardingManager;
|
|
@@ -97,6 +101,8 @@ export default class GirafeContext {
|
|
|
97
101
|
this.customThemesManager = new CustomThemesManager(this);
|
|
98
102
|
this.themesManager = new ThemesManager(this);
|
|
99
103
|
this.wmsManager = new WmsManager(this);
|
|
104
|
+
this.wmtsManager = new WmtsManager(this);
|
|
105
|
+
this.selectionManager = new SelectionManager(this);
|
|
100
106
|
this.localFileManager = new LocalFileManager(this);
|
|
101
107
|
this.ogcApiFeaturesManager = new OgcApiFeaturesManager(this);
|
|
102
108
|
this.onBoardingManager = new OnBoardingManager(this);
|
|
@@ -136,7 +142,9 @@ export default class GirafeContext {
|
|
|
136
142
|
this.customThemesManager.initializeSingleton();
|
|
137
143
|
this.themesManager.initializeSingleton();
|
|
138
144
|
this.wmsManager.initializeSingleton();
|
|
145
|
+
this.wmtsManager.initializeSingleton();
|
|
139
146
|
this.localFileManager.initializeSingleton();
|
|
147
|
+
this.selectionManager.initializeSingleton();
|
|
140
148
|
this.ogcApiFeaturesManager.initializeSingleton();
|
|
141
149
|
this.onBoardingManager.initializeSingleton();
|
|
142
150
|
this.themeFavoritesManager.initializeSingleton();
|
|
@@ -29,6 +29,8 @@ import UrlManager from '../url/urlmanager.js';
|
|
|
29
29
|
import UserDataManager from '../userdata/userdatamanager.js';
|
|
30
30
|
import WfsManager from '../wfs/wfsmanager.js';
|
|
31
31
|
import WmsManager from '../wms/wmsmanager.js';
|
|
32
|
+
import WmtsManager from '../wmts/wmtsmanager.js';
|
|
33
|
+
import SelectionManager from '../selection/selectionmanager.js';
|
|
32
34
|
import ThemeFavoritesManager from '../themes/themefavoritesmanager.js';
|
|
33
35
|
import SearchManager from '../search/searchmanager.js';
|
|
34
36
|
import FeedbackManager from '../feedback/feedbackmanager.js';
|
|
@@ -61,11 +63,14 @@ export default interface IGirafeContext {
|
|
|
61
63
|
readonly orderingManager: OrderingManager;
|
|
62
64
|
readonly userLayerManager: UserLayerManager;
|
|
63
65
|
readonly wmsManager: WmsManager;
|
|
66
|
+
readonly wmtsManager: WmtsManager;
|
|
67
|
+
readonly selectionManager: SelectionManager;
|
|
64
68
|
readonly ogcApiFeaturesManager: OgcApiFeaturesManager;
|
|
65
69
|
readonly localFileManager: LocalFileManager;
|
|
66
70
|
readonly onBoardingManager: OnBoardingManager;
|
|
67
71
|
readonly themeFavoritesManager: ThemeFavoritesManager;
|
|
68
72
|
readonly searchManager: SearchManager;
|
|
69
73
|
readonly feedbackManager: FeedbackManager;
|
|
74
|
+
extendedContext?: unknown;
|
|
70
75
|
initialize(): Promise<void>;
|
|
71
76
|
}
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Map3dComponent from '../../components/map-3d/component.js';
|
|
2
2
|
import IGirafeContext from '../context/icontext.js';
|
|
3
3
|
export default class CesiumDrawing {
|
|
4
4
|
private readonly stateLocation;
|
|
5
5
|
private activeShapePoints;
|
|
6
6
|
private activeShapes;
|
|
7
7
|
private floatingPoint;
|
|
8
|
-
private scene;
|
|
9
|
-
private handler;
|
|
10
|
-
private entities;
|
|
8
|
+
private readonly scene;
|
|
9
|
+
private readonly handler;
|
|
10
|
+
private readonly entities;
|
|
11
11
|
private fixedLineLength;
|
|
12
12
|
private drawingText;
|
|
13
13
|
private readonly context;
|
|
14
14
|
private get state();
|
|
15
15
|
private get drawingState();
|
|
16
16
|
private get config();
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* The 3D Map has to be loaded before creating a CesiumDrawing.
|
|
19
|
+
* This class is loaded on demand, so that Cesium stays out of the initial bundle.
|
|
20
|
+
*/
|
|
21
|
+
constructor(map: Map3dComponent, stateLocation: string, context: IGirafeContext);
|
|
18
22
|
setFixedLineLength(length: number): void;
|
|
19
23
|
setDrawingText(text: string): void;
|
|
20
24
|
/**
|
|
@@ -26,17 +26,17 @@ export default class CesiumDrawing {
|
|
|
26
26
|
get config() {
|
|
27
27
|
return this.context.configManager.Config;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* The 3D Map has to be loaded before creating a CesiumDrawing.
|
|
31
|
+
* This class is loaded on demand, so that Cesium stays out of the initial bundle.
|
|
32
|
+
*/
|
|
29
33
|
constructor(map, stateLocation, context) {
|
|
30
34
|
this.stateLocation = stateLocation;
|
|
31
35
|
this.context = context;
|
|
32
|
-
map.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.entities = map.map3d.getDataSourceDisplay().defaultDataSource.entities;
|
|
37
|
-
map.subscribe(`extendedState.${this.stateLocation}.activeTool`, (_oldTool, newTool) => newTool === null ? this.deactivateTool() : this.activateTool(newTool));
|
|
38
|
-
}
|
|
39
|
-
});
|
|
36
|
+
this.scene = map.map3d.getCesiumScene();
|
|
37
|
+
this.handler = new Cesium.ScreenSpaceEventHandler(this.scene.canvas);
|
|
38
|
+
this.entities = map.map3d.getDataSourceDisplay().defaultDataSource.entities;
|
|
39
|
+
map.subscribe(`extendedState.${this.stateLocation}.activeTool`, (_oldTool, newTool) => newTool === null ? this.deactivateTool() : this.activateTool(newTool));
|
|
40
40
|
}
|
|
41
41
|
setFixedLineLength(length) {
|
|
42
42
|
this.fixedLineLength = Number.isNaN(length) ? 0 : length;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import DrawingFeature from './drawingFeature.js';
|
|
2
|
-
import
|
|
2
|
+
import Map2dComponent from '../../components/map-2d/component.js';
|
|
3
3
|
import { Feature } from 'ol';
|
|
4
4
|
import { Geometry } from 'ol/geom.js';
|
|
5
5
|
import VectorSource from 'ol/source/Vector.js';
|
|
@@ -36,7 +36,7 @@ export default class OlDrawing {
|
|
|
36
36
|
private get state();
|
|
37
37
|
private get drawingState();
|
|
38
38
|
private get config();
|
|
39
|
-
constructor(mapComponent:
|
|
39
|
+
constructor(mapComponent: Map2dComponent, stateLocation: string, context: IGirafeContext, deleteHandler: (featureId: string) => void);
|
|
40
40
|
private addModifyInteraction;
|
|
41
41
|
private addSnapInteraction;
|
|
42
42
|
private addTranslateInteraction;
|
|
@@ -11,7 +11,7 @@ import { getPointResolution } from 'ol/proj.js';
|
|
|
11
11
|
import { always, never, platformModifierKeyOnly, primaryAction } from 'ol/events/condition.js';
|
|
12
12
|
import { unByKey } from 'ol/Observable.js';
|
|
13
13
|
import { ensurePolygonIsProperlyClosed, getAreaOfPolygon, getDistance, getHalfPoint, getLabelStyle, getLengthAsMetricText, getRadiusDataForCircle, unByKeyAll } from '../utils/olutils.js';
|
|
14
|
-
import { ContextMenu, EntryInteractionType } from '../../components/map/tools/contextmenu.js';
|
|
14
|
+
import { ContextMenu, EntryInteractionType } from '../../components/map-2d/tools/contextmenu.js';
|
|
15
15
|
import { formatCoordinates } from '../geometrytools.js';
|
|
16
16
|
import { v4 as uuidv4 } from 'uuid';
|
|
17
17
|
import { isAlternateMouseClick, isPrimaryPointerAction } from '../state/userinteractionevent.js';
|
package/tools/main.d.ts
CHANGED
|
@@ -65,6 +65,7 @@ export type { GmfSearchConfig } from './search/gmfsearchclient.js';
|
|
|
65
65
|
export { default as GmfSearchClient } from './search/gmfsearchclient.js';
|
|
66
66
|
export type { SearchProviderConfig } from './search/searchmanager.js';
|
|
67
67
|
export { default as SearchManager } from './search/searchmanager.js';
|
|
68
|
+
export { default as SelectionManager } from './selection/selectionmanager.js';
|
|
68
69
|
export type { default as ISessionManager } from './share/isessionmanager.js';
|
|
69
70
|
export type { UrlShortenerResponse, IUrlShortener } from './share/iurlshortener.js';
|
|
70
71
|
export { default as ActiveBasemapsSerializer } from './share/serializers/activebasemapsserializer.js';
|
|
@@ -148,3 +149,4 @@ export { default as WfsParser } from './wfs/wfsparser.js';
|
|
|
148
149
|
export { default as WmsClient, WmsClientQgis, WmsClientMapServer, WmsClientDefault, WmsClientGeoServer } from './wms/wmsclient.js';
|
|
149
150
|
export { default as WmsLegendHelper } from './wms/wmslegendhelper.js';
|
|
150
151
|
export { default as WmsManager } from './wms/wmsmanager.js';
|
|
152
|
+
export { default as WmtsManager } from './wmts/wmtsmanager.js';
|
package/tools/main.js
CHANGED
|
@@ -52,6 +52,7 @@ export { default as AbstractSearchClient, SEARCH_PROVIDER_DEFAULT, SEARCH_GROUP_
|
|
|
52
52
|
export { default as GeoAdminChSearchClient } from './search/geoadminchsearchclient.js';
|
|
53
53
|
export { default as GmfSearchClient } from './search/gmfsearchclient.js';
|
|
54
54
|
export { default as SearchManager } from './search/searchmanager.js';
|
|
55
|
+
export { default as SelectionManager } from './selection/selectionmanager.js';
|
|
55
56
|
export { default as ActiveBasemapsSerializer } from './share/serializers/activebasemapsserializer.js';
|
|
56
57
|
export { default as CustomLayersSerializer } from './share/serializers/customlayersserializer.js';
|
|
57
58
|
export { default as GlobeSerializer } from './share/serializers/globeserializer.js';
|
|
@@ -113,3 +114,4 @@ export { default as WfsParser } from './wfs/wfsparser.js';
|
|
|
113
114
|
export { default as WmsClient, WmsClientQgis, WmsClientMapServer, WmsClientDefault, WmsClientGeoServer } from './wms/wmsclient.js';
|
|
114
115
|
export { default as WmsLegendHelper } from './wms/wmslegendhelper.js';
|
|
115
116
|
export { default as WmsManager } from './wms/wmsmanager.js';
|
|
117
|
+
export { default as WmtsManager } from './wmts/wmtsmanager.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import GirafeSingleton from '../../base/GirafeSingleton.js';
|
|
2
|
+
/**
|
|
3
|
+
* Handles the feature selection, independently from the map (2D or 3D) the selection was triggered from.
|
|
4
|
+
* The selection is done in two steps:
|
|
5
|
+
* 1. `select()` asks every layer manager to add its own <code>SelectionParam</code> to the state.
|
|
6
|
+
* 2. The change of <code>selection.selectionParameters</code> triggers the effective query
|
|
7
|
+
* (WMS GetFeatureInfo and WFS GetFeature) and writes the resulting features into the state.
|
|
8
|
+
*/
|
|
9
|
+
export default class SelectionManager extends GirafeSingleton {
|
|
10
|
+
private get state();
|
|
11
|
+
initializeSingleton(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Selects all the features of the queryable layers that are inside the given extent.
|
|
14
|
+
* Layers selectable today are WMS, WMTS (with wms layer) and Local files.
|
|
15
|
+
*/
|
|
16
|
+
select(extent: number[]): void;
|
|
17
|
+
selectNone(): void;
|
|
18
|
+
private onSelectFeatures;
|
|
19
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import GirafeSingleton from '../../base/GirafeSingleton.js';
|
|
3
|
+
import { SelectionMode } from '../../models/selection.js';
|
|
4
|
+
import { applyFeaturesToSelection } from '../utils/utils.js';
|
|
5
|
+
/**
|
|
6
|
+
* Handles the feature selection, independently from the map (2D or 3D) the selection was triggered from.
|
|
7
|
+
* The selection is done in two steps:
|
|
8
|
+
* 1. `select()` asks every layer manager to add its own <code>SelectionParam</code> to the state.
|
|
9
|
+
* 2. The change of <code>selection.selectionParameters</code> triggers the effective query
|
|
10
|
+
* (WMS GetFeatureInfo and WFS GetFeature) and writes the resulting features into the state.
|
|
11
|
+
*/
|
|
12
|
+
export default class SelectionManager extends GirafeSingleton {
|
|
13
|
+
get state() {
|
|
14
|
+
return this.context.stateManager.state;
|
|
15
|
+
}
|
|
16
|
+
initializeSingleton() {
|
|
17
|
+
this.context.stateManager.subscribe('selection.selectionParameters', (_, newParams) => {
|
|
18
|
+
// The querying is asynchronous and nobody awaits it here,
|
|
19
|
+
// so a failing request must not end up in an unhandled rejection.
|
|
20
|
+
this.onSelectFeatures(newParams).catch((error) => console.error('Could not select the features.', error));
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Selects all the features of the queryable layers that are inside the given extent.
|
|
25
|
+
* Layers selectable today are WMS, WMTS (with wms layer) and Local files.
|
|
26
|
+
*/
|
|
27
|
+
select(extent) {
|
|
28
|
+
// Reset current selection if SelectionMode is Replace
|
|
29
|
+
if (this.state.selection.selectionMode === SelectionMode.Replace) {
|
|
30
|
+
this.selectNone();
|
|
31
|
+
}
|
|
32
|
+
else if (this.state.selection.selectionMode === SelectionMode.Add) {
|
|
33
|
+
this.state.selection.selectionParameters = [];
|
|
34
|
+
}
|
|
35
|
+
// Use batch for changes to prevent multiple selection of objects
|
|
36
|
+
this.context.stateManager.batchChanges(() => {
|
|
37
|
+
this.context.wmsManager.selectFeatures(extent);
|
|
38
|
+
this.context.wmtsManager.selectFeatures(extent);
|
|
39
|
+
this.context.localFileManager.selectFeatures(extent);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
selectNone() {
|
|
43
|
+
this.state.selection.selectedFeatures = [];
|
|
44
|
+
this.state.selection.selectionParameters = [];
|
|
45
|
+
this.state.selection.highlightedFeatures = [];
|
|
46
|
+
}
|
|
47
|
+
async onSelectFeatures(selectionParams) {
|
|
48
|
+
if (selectionParams.length === 0) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.state.loading = true;
|
|
52
|
+
try {
|
|
53
|
+
// WMS GetFeatureInfo
|
|
54
|
+
const wmsPromises = selectionParams.map((param) => {
|
|
55
|
+
const wmsGetFeatureInfoSelectionParam = param.clone((l) => l.queryable && l.wmsQueryableOnly);
|
|
56
|
+
const client = this.context.wmsManager.getClient(wmsGetFeatureInfoSelectionParam.ogcServer);
|
|
57
|
+
return client.getFeatureInfo(wmsGetFeatureInfoSelectionParam);
|
|
58
|
+
});
|
|
59
|
+
// WFS GetFeature
|
|
60
|
+
const wfsPromises = selectionParams.map((param) => {
|
|
61
|
+
const wfsGetFeatureInfoSelectionParam = param.clone((l) => l.wfsQueryable);
|
|
62
|
+
const client = this.context.wfsManager.getClient(wfsGetFeatureInfoSelectionParam.ogcServer);
|
|
63
|
+
const features = client.getFeature(wfsGetFeatureInfoSelectionParam);
|
|
64
|
+
return features;
|
|
65
|
+
});
|
|
66
|
+
const wmsGmlFeatures = (await Promise.all(wmsPromises)).flat();
|
|
67
|
+
const wfsGmlFeatures = (await Promise.all(wfsPromises)).flat();
|
|
68
|
+
const gmlFeatures = [...wmsGmlFeatures, ...wfsGmlFeatures];
|
|
69
|
+
if (gmlFeatures.length === 0 && this.state.selection.selectedFeatures.length === 0) {
|
|
70
|
+
this.state.interface.selectionComponentVisible = false;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
applyFeaturesToSelection(gmlFeatures, this.state);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
finally {
|
|
77
|
+
this.state.loading = false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import GirafeHTMLElement from '../../base/GirafeHTMLElement.js';
|
|
2
2
|
import GirafeSingleton from '../../base/GirafeSingleton.js';
|
|
3
3
|
type Callback = (elem: GirafeHTMLElement) => unknown;
|
|
4
|
-
type Constructor<T> = new (...args:
|
|
4
|
+
type Constructor<T> = new (...args: never[]) => T;
|
|
5
5
|
export default class ComponentManager extends GirafeSingleton {
|
|
6
6
|
private readonly components;
|
|
7
7
|
private readonly registeredCallbacks;
|
|
@@ -29,6 +29,8 @@ import UrlManager from '../url/urlmanager';
|
|
|
29
29
|
import UserDataManager from '../userdata/userdatamanager';
|
|
30
30
|
import WfsManager from '../wfs/wfsmanager';
|
|
31
31
|
import WmsManager from '../wms/wmsmanager';
|
|
32
|
+
import WmtsManager from '../wmts/wmtsmanager';
|
|
33
|
+
import SelectionManager from '../selection/selectionmanager';
|
|
32
34
|
import OnBoardingManager from '../onboarding/onboardingmanager';
|
|
33
35
|
import ThemeFavoritesManager from '../themes/themefavoritesmanager';
|
|
34
36
|
import SearchManager from '../search/searchmanager';
|
|
@@ -62,6 +64,8 @@ export default class MockGirafeContext implements IGirafeContext {
|
|
|
62
64
|
readonly orderingManager: OrderingManager;
|
|
63
65
|
readonly userLayerManager: UserLayerManager;
|
|
64
66
|
readonly wmsManager: WmsManager;
|
|
67
|
+
readonly wmtsManager: WmtsManager;
|
|
68
|
+
readonly selectionManager: SelectionManager;
|
|
65
69
|
readonly ogcApiFeaturesManager: OgcApiFeaturesManager;
|
|
66
70
|
readonly localFileManager: LocalFileManager;
|
|
67
71
|
readonly onBoardingManager: OnBoardingManager;
|
|
@@ -30,6 +30,8 @@ import UrlManager from '../url/urlmanager';
|
|
|
30
30
|
import UserDataManager from '../userdata/userdatamanager';
|
|
31
31
|
import WfsManager from '../wfs/wfsmanager';
|
|
32
32
|
import WmsManager from '../wms/wmsmanager';
|
|
33
|
+
import WmtsManager from '../wmts/wmtsmanager';
|
|
34
|
+
import SelectionManager from '../selection/selectionmanager';
|
|
33
35
|
import { MockConfig } from './mockconfig';
|
|
34
36
|
import OnBoardingManager from '../onboarding/onboardingmanager';
|
|
35
37
|
import ThemeFavoritesManager from '../themes/themefavoritesmanager';
|
|
@@ -64,6 +66,8 @@ export default class MockGirafeContext {
|
|
|
64
66
|
orderingManager;
|
|
65
67
|
userLayerManager;
|
|
66
68
|
wmsManager;
|
|
69
|
+
wmtsManager;
|
|
70
|
+
selectionManager;
|
|
67
71
|
ogcApiFeaturesManager;
|
|
68
72
|
localFileManager;
|
|
69
73
|
onBoardingManager;
|
|
@@ -99,6 +103,8 @@ export default class MockGirafeContext {
|
|
|
99
103
|
this.customThemesManager = new CustomThemesManager(this);
|
|
100
104
|
this.themesManager = new ThemesManager(this);
|
|
101
105
|
this.wmsManager = new WmsManager(this);
|
|
106
|
+
this.wmtsManager = new WmtsManager(this);
|
|
107
|
+
this.selectionManager = new SelectionManager(this);
|
|
102
108
|
this.localFileManager = new LocalFileManager(this);
|
|
103
109
|
this.ogcApiFeaturesManager = new OgcApiFeaturesManager(this);
|
|
104
110
|
this.onBoardingManager = new OnBoardingManager(this);
|
|
@@ -143,7 +149,9 @@ export default class MockGirafeContext {
|
|
|
143
149
|
this.customThemesManager.initializeSingleton();
|
|
144
150
|
this.themesManager.initializeSingleton();
|
|
145
151
|
this.wmsManager.initializeSingleton();
|
|
152
|
+
this.wmtsManager.initializeSingleton();
|
|
146
153
|
this.localFileManager.initializeSingleton();
|
|
154
|
+
this.selectionManager.initializeSingleton();
|
|
147
155
|
this.ogcApiFeaturesManager.initializeSingleton();
|
|
148
156
|
this.onBoardingManager.initializeSingleton();
|
|
149
157
|
this.themeFavoritesManager.initializeSingleton();
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import WMTS from 'ol/source/WMTS.js';
|
|
2
2
|
import TileLayer from 'ol/layer/Tile.js';
|
|
3
|
-
import type { Map as olMap } from 'ol';
|
|
4
3
|
import type { Layer as OLayer } from 'ol/layer.js';
|
|
5
|
-
import type LayerWmts from '
|
|
6
|
-
import
|
|
7
|
-
declare class WmtsManager {
|
|
8
|
-
map: olMap;
|
|
9
|
-
private readonly stateManager;
|
|
4
|
+
import type LayerWmts from '../../models/layers/layerwmts.js';
|
|
5
|
+
import GirafeSingleton from '../../base/GirafeSingleton.js';
|
|
6
|
+
declare class WmtsManager extends GirafeSingleton {
|
|
10
7
|
wmtsCapabilitiesByServer: Record<string, Record<string, unknown>>;
|
|
11
8
|
wmtsPromisesByServer: Record<string, Promise<Record<string, unknown>>>;
|
|
12
9
|
wmtsAbortsByLayer: Record<string, AbortController>;
|
|
@@ -19,7 +16,7 @@ declare class WmtsManager {
|
|
|
19
16
|
layerWmts: LayerWmts;
|
|
20
17
|
}>;
|
|
21
18
|
private get state();
|
|
22
|
-
|
|
19
|
+
private get map();
|
|
23
20
|
removeAllBasemapLayers(): void;
|
|
24
21
|
addLayer(layer: LayerWmts): Promise<void>;
|
|
25
22
|
addBasemapLayer(basemap: LayerWmts): void;
|
|
@@ -2,25 +2,22 @@
|
|
|
2
2
|
import WMTS, { optionsFromCapabilities } from 'ol/source/WMTS.js';
|
|
3
3
|
import WMTSCapabilities from 'ol/format/WMTSCapabilities.js';
|
|
4
4
|
import TileLayer from 'ol/layer/Tile.js';
|
|
5
|
-
import SelectionParam from '
|
|
6
|
-
import LayerWms from '
|
|
5
|
+
import SelectionParam from '../../models/selectionparam.js';
|
|
6
|
+
import LayerWms from '../../models/layers/layerwms.js';
|
|
7
7
|
import ImageWMS from 'ol/source/ImageWMS.js';
|
|
8
8
|
import ImageLayer from 'ol/layer/Image.js';
|
|
9
|
-
|
|
10
|
-
class WmtsManager {
|
|
11
|
-
map;
|
|
12
|
-
stateManager;
|
|
9
|
+
import GirafeSingleton from '../../base/GirafeSingleton.js';
|
|
10
|
+
class WmtsManager extends GirafeSingleton {
|
|
13
11
|
wmtsCapabilitiesByServer = {};
|
|
14
12
|
wmtsPromisesByServer = {};
|
|
15
13
|
wmtsAbortsByLayer = {};
|
|
16
14
|
wmtsLayers = {};
|
|
17
15
|
basemapLayers = {};
|
|
18
16
|
get state() {
|
|
19
|
-
return this.stateManager.state;
|
|
17
|
+
return this.context.stateManager.state;
|
|
20
18
|
}
|
|
21
|
-
|
|
22
|
-
this.
|
|
23
|
-
this.stateManager = stateManager;
|
|
19
|
+
get map() {
|
|
20
|
+
return this.context.mapManager.getMap();
|
|
24
21
|
}
|
|
25
22
|
removeAllBasemapLayers() {
|
|
26
23
|
Object.values(this.basemapLayers).forEach((basemap) => {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|