@masterportal/masterportalapi 2.3.0 → 2.5.1
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/.eslintrc +1 -1
- package/CHANGELOG.md +43 -0
- package/example/config/portal.json +1 -1
- package/example/config/services.json +180 -42
- package/example/index.js +3 -1
- package/package.json +63 -62
- package/src/defaults.js +1 -1
- package/src/layer/entities.js +11 -2
- package/src/layer/vectorTile.js +3 -4
- package/src/maps/olcs/3dUtils/wmsRasterSynchronizer.js +12 -0
- package/src/maps/olcs/olcsMap.js +69 -42
- package/test/layer/vectorTile.test.js +2 -2
- package/test/map.test.js +34 -1
package/.eslintrc
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,49 @@
|
|
|
3
3
|
|
|
4
4
|
The [Semantic Versioning](https://semver.org/spec/v2.0.0.html) is used.
|
|
5
5
|
|
|
6
|
+
## 2.5.1 - 2022-08-05
|
|
7
|
+
### Fixed
|
|
8
|
+
- Remove import of `defaultResolutions` for the vectorStyle layer
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 2.5.0 - 2022-08-05
|
|
13
|
+
### Added
|
|
14
|
+
- The following packages have been installed:
|
|
15
|
+
- jest-environment-jsdom: 28.1.3
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- The following packages have been updated:
|
|
19
|
+
- dependencies:
|
|
20
|
+
- core-js: 3.16.1 to 3.24.0
|
|
21
|
+
- ol: 6.14.1 to 6.15.1 (This also raised ol-mapbox-style from 7 to version 8)
|
|
22
|
+
- proj4: 2.7.5 to 2.8.0
|
|
23
|
+
- devDependencies:
|
|
24
|
+
- @babel/core: 7.16.7 to 7.18.9
|
|
25
|
+
- @babel/plugin-transform-modules-commonjs: 7.16.8 to 7.18.6
|
|
26
|
+
- @parcel/transformer-sass: 2.2.0 to 2.6.2
|
|
27
|
+
- canvas: 2.8.0 to 2.9.3
|
|
28
|
+
- eslint: 7.32.0 to 8.20.0
|
|
29
|
+
- husky: 7.0.1 to 8.0.1
|
|
30
|
+
- jest: 27.4.0 to 28.1.3
|
|
31
|
+
- jest-canvas-mock: 2.3.1 to 2.4.0
|
|
32
|
+
- jsdoc: 3.6.7 to 3.6.11
|
|
33
|
+
- parcel: 2.2.0 to 2.6.2
|
|
34
|
+
- sass: 1.37.5 to 1.54.0
|
|
35
|
+
- peerDependencies:
|
|
36
|
+
- cesium: 1.88.0 to 1.95.0
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 2.4.0 - 2022-07-06
|
|
41
|
+
### Added
|
|
42
|
+
- Issue 776: Add 3D mode for WMTS layers.
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
- 3D: Handling of camera parameters at olcsmap are adapted.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
6
49
|
## 2.3.0 - 2022-05-27
|
|
7
50
|
### Added
|
|
8
51
|
- Add a new layer type WMTS.
|
|
@@ -62,6 +62,43 @@
|
|
|
62
62
|
"maximumScreenSpaceError": 6
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
|
+
{
|
|
66
|
+
"id": "4003",
|
|
67
|
+
"name": "EntitiesLayer",
|
|
68
|
+
"typ": "Entities3D",
|
|
69
|
+
"entities": [
|
|
70
|
+
{
|
|
71
|
+
"url": "https://daten-hamburg.de/gdi3d/datasource-data/Simple_Building.glb",
|
|
72
|
+
"attributes": {
|
|
73
|
+
"name": "einfaches Haus in Planten und Blomen"
|
|
74
|
+
},
|
|
75
|
+
"latitude": 53.5631,
|
|
76
|
+
"longitude": 9.9800,
|
|
77
|
+
"height": 16,
|
|
78
|
+
"heading": 0,
|
|
79
|
+
"pitch": 0,
|
|
80
|
+
"roll": 0,
|
|
81
|
+
"scale": 5,
|
|
82
|
+
"allowPicking": true,
|
|
83
|
+
"show": true
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"url": "https://daten-hamburg.de/gdi3d/datasource-data/Simple_Building.glb",
|
|
87
|
+
"attributes": {
|
|
88
|
+
"name": "einfaches Haus im See"
|
|
89
|
+
},
|
|
90
|
+
"latitude": 53.5622,
|
|
91
|
+
"longitude": 9.9808,
|
|
92
|
+
"height": 16,
|
|
93
|
+
"heading": 0,
|
|
94
|
+
"pitch": 0,
|
|
95
|
+
"roll": 0,
|
|
96
|
+
"scale": 2,
|
|
97
|
+
"allowPicking": true,
|
|
98
|
+
"show": true
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
},
|
|
65
102
|
{
|
|
66
103
|
"id": "5001",
|
|
67
104
|
"name": "Schulen",
|
|
@@ -107,53 +144,154 @@
|
|
|
107
144
|
},
|
|
108
145
|
{
|
|
109
146
|
"id": "7001",
|
|
110
|
-
"name": "
|
|
147
|
+
"name": "TopPlusOpen",
|
|
111
148
|
"capabilitiesUrl": "https://sgx.geodatenzentrum.de/wmts_topplus_open/1.0.0/WMTSCapabilities.xml",
|
|
149
|
+
"optionsFromCapabilities": true,
|
|
150
|
+
"typ": "WMTS",
|
|
151
|
+
"layers": "web"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"id": "7002",
|
|
155
|
+
"name": "EOC Basemap",
|
|
156
|
+
"capabilitiesUrl": "https://tiles.geoservice.dlr.de/service/wmts?SERVICE=WMTS&REQUEST=GetCapabilities",
|
|
112
157
|
"typ": "WMTS",
|
|
113
158
|
"optionsFromCapabilities": true,
|
|
114
|
-
"layers": "
|
|
115
|
-
"visibility": true,
|
|
116
|
-
"maxScale": "5000000",
|
|
117
|
-
"tileMatrixSet": "EU_EPSG_25832_TOPPLUS"
|
|
159
|
+
"layers": "eoc:basemap"
|
|
118
160
|
},
|
|
119
161
|
{
|
|
120
|
-
"id": "
|
|
121
|
-
"name": "
|
|
122
|
-
"
|
|
123
|
-
|
|
124
|
-
{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
"latitude": 53.5631,
|
|
130
|
-
"longitude": 9.9800,
|
|
131
|
-
"height": 16,
|
|
132
|
-
"heading": 0,
|
|
133
|
-
"pitch": 0,
|
|
134
|
-
"roll": 0,
|
|
135
|
-
"scale": 5,
|
|
136
|
-
"allowPicking": true,
|
|
137
|
-
"show": true
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
"url": "https://daten-hamburg.de/gdi3d/datasource-data/Simple_Building.glb",
|
|
141
|
-
"attributes": {
|
|
142
|
-
"name": "einfaches Haus im See"
|
|
143
|
-
},
|
|
144
|
-
"latitude": 53.5622,
|
|
145
|
-
"longitude": 9.9808,
|
|
146
|
-
"height": 16,
|
|
147
|
-
"heading": 0,
|
|
148
|
-
"pitch": 0,
|
|
149
|
-
"roll": 0,
|
|
150
|
-
"scale": 2,
|
|
151
|
-
"allowPicking": true,
|
|
152
|
-
"show": true
|
|
153
|
-
}
|
|
162
|
+
"id": "7003",
|
|
163
|
+
"name": "Geoland Basemap",
|
|
164
|
+
"urls": [
|
|
165
|
+
"https://maps1.wien.gv.at/basemap/geolandbasemap/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",
|
|
166
|
+
"https://maps2.wien.gv.at/basemap/geolandbasemap/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",
|
|
167
|
+
"https://maps3.wien.gv.at/basemap/geolandbasemap/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",
|
|
168
|
+
"https://maps4.wien.gv.at/basemap/geolandbasemap/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",
|
|
169
|
+
"https://maps.wien.gv.at/basemap/geolandbasemap/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png"
|
|
154
170
|
],
|
|
155
|
-
"
|
|
156
|
-
|
|
157
|
-
|
|
171
|
+
"typ": "WMTS",
|
|
172
|
+
"layer": "geolandbasemap",
|
|
173
|
+
"version": "1.0.0",
|
|
174
|
+
"format": "image/png",
|
|
175
|
+
"style": "normal",
|
|
176
|
+
"transparent": false,
|
|
177
|
+
"tileSize": "256",
|
|
178
|
+
"minScale": "0",
|
|
179
|
+
"maxScale": "2500000",
|
|
180
|
+
"tileMatrixSet": "google3857",
|
|
181
|
+
"matrixSizes": [
|
|
182
|
+
[
|
|
183
|
+
1,
|
|
184
|
+
1
|
|
185
|
+
],
|
|
186
|
+
[
|
|
187
|
+
2,
|
|
188
|
+
2
|
|
189
|
+
],
|
|
190
|
+
[
|
|
191
|
+
4,
|
|
192
|
+
4
|
|
193
|
+
],
|
|
194
|
+
[
|
|
195
|
+
8,
|
|
196
|
+
8
|
|
197
|
+
],
|
|
198
|
+
[
|
|
199
|
+
16,
|
|
200
|
+
16
|
|
201
|
+
],
|
|
202
|
+
[
|
|
203
|
+
32,
|
|
204
|
+
32
|
|
205
|
+
],
|
|
206
|
+
[
|
|
207
|
+
64,
|
|
208
|
+
64
|
|
209
|
+
],
|
|
210
|
+
[
|
|
211
|
+
128,
|
|
212
|
+
128
|
|
213
|
+
],
|
|
214
|
+
[
|
|
215
|
+
256,
|
|
216
|
+
256
|
|
217
|
+
],
|
|
218
|
+
[
|
|
219
|
+
512,
|
|
220
|
+
512
|
|
221
|
+
],
|
|
222
|
+
[
|
|
223
|
+
1024,
|
|
224
|
+
1024
|
|
225
|
+
],
|
|
226
|
+
[
|
|
227
|
+
2048,
|
|
228
|
+
2048
|
|
229
|
+
],
|
|
230
|
+
[
|
|
231
|
+
4096,
|
|
232
|
+
4096
|
|
233
|
+
],
|
|
234
|
+
[
|
|
235
|
+
8192,
|
|
236
|
+
8192
|
|
237
|
+
],
|
|
238
|
+
[
|
|
239
|
+
16384,
|
|
240
|
+
16384
|
|
241
|
+
],
|
|
242
|
+
[
|
|
243
|
+
32768,
|
|
244
|
+
32768
|
|
245
|
+
],
|
|
246
|
+
[
|
|
247
|
+
65536,
|
|
248
|
+
65536
|
|
249
|
+
],
|
|
250
|
+
[
|
|
251
|
+
131072,
|
|
252
|
+
131072
|
|
253
|
+
],
|
|
254
|
+
[
|
|
255
|
+
262144,
|
|
256
|
+
262144
|
|
257
|
+
],
|
|
258
|
+
[
|
|
259
|
+
524288,
|
|
260
|
+
524288
|
|
261
|
+
]
|
|
262
|
+
],
|
|
263
|
+
"coordinateSystem": "EPSG:3857",
|
|
264
|
+
"layerAttribution": "nicht vorhanden",
|
|
265
|
+
"legend": false,
|
|
266
|
+
"cache": true,
|
|
267
|
+
"wrapX": true,
|
|
268
|
+
"origin": [
|
|
269
|
+
-20037508.3428,
|
|
270
|
+
20037508.3428
|
|
271
|
+
],
|
|
272
|
+
"scales": [
|
|
273
|
+
559082264.029,
|
|
274
|
+
279541132.015,
|
|
275
|
+
139770566.007,
|
|
276
|
+
69885283.0036,
|
|
277
|
+
34942641.5018,
|
|
278
|
+
17471320.7509,
|
|
279
|
+
8735660.37545,
|
|
280
|
+
4367830.18773,
|
|
281
|
+
2183915.09386,
|
|
282
|
+
1091957.54693,
|
|
283
|
+
45978.773466,
|
|
284
|
+
272989.386733,
|
|
285
|
+
136494.693366,
|
|
286
|
+
68247.3466832,
|
|
287
|
+
34123.6733416,
|
|
288
|
+
17061.8366708,
|
|
289
|
+
8530.91833540,
|
|
290
|
+
4265.45916770,
|
|
291
|
+
2132.72958385,
|
|
292
|
+
1066.36479193
|
|
293
|
+
],
|
|
294
|
+
"resLength": "20",
|
|
295
|
+
"requestEncoding": "REST"
|
|
158
296
|
}
|
|
159
297
|
]
|
package/example/index.js
CHANGED
|
@@ -47,7 +47,7 @@ document.getElementById("enable").addEventListener("click", function () {
|
|
|
47
47
|
document.getElementById("layer-visibility").style.display = "none";
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
|
-
const lib = portalConfig.cesiumLib ? portalConfig.cesiumLib : "https://geoportal-hamburg.de/mastercode/cesium/
|
|
50
|
+
const lib = portalConfig.cesiumLib ? portalConfig.cesiumLib : "https://geoportal-hamburg.de/mastercode/cesium/1_95/index.js";
|
|
51
51
|
|
|
52
52
|
document.getElementById("layer-visibility").style.display = "block";
|
|
53
53
|
|
|
@@ -220,4 +220,6 @@ map2D.getLayers().forEach(layer => {
|
|
|
220
220
|
map2D.removeLayer(layer);
|
|
221
221
|
});
|
|
222
222
|
window.mpapi.map.addLayer("7001");
|
|
223
|
+
window.mpapi.map.addLayer("7002");
|
|
224
|
+
window.mpapi.map.addLayer("7003");
|
|
223
225
|
// */
|
package/package.json
CHANGED
|
@@ -1,62 +1,63 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@masterportal/masterportalapi",
|
|
3
|
-
"author": "Implementierungspartnerschaft Masterportal <info@masterportal.org> (https://www.masterportal.org)",
|
|
4
|
-
"version": "2.
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"description": "Basic functions of the Masterportal as api",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://bitbucket.org/geowerkstatt-hamburg/masterportalapi.git"
|
|
10
|
-
},
|
|
11
|
-
"main": "src/index.js",
|
|
12
|
-
"scripts": {
|
|
13
|
-
"test": "jest .test.js --config ./jest.config.js --collectCoverage",
|
|
14
|
-
"test:trace": "node --trace-warnings node_modules/jest/bin/jest.js ./test/layer/wfs.test.js --config ./jest.config.js",
|
|
15
|
-
"test:watch": "jest .test.js --config ./jest.config.js --watch",
|
|
16
|
-
"example": "parcel example/index.html",
|
|
17
|
-
"generate-jsdoc": "jsdoc ./src -r -d ./docs/ -R ./README.md -c jsdoc.json",
|
|
18
|
-
"prePushHook": "eslint --max-warnings 0 \"./**/*.js\" && npm run test",
|
|
19
|
-
"prepare": "husky install"
|
|
20
|
-
},
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"core-js": "^3.
|
|
23
|
-
"ol": "6.
|
|
24
|
-
"olcs": "^2.13.0",
|
|
25
|
-
"proj4": "^2.
|
|
26
|
-
"xml2js": "^0.4.23"
|
|
27
|
-
},
|
|
28
|
-
"devDependencies": {
|
|
29
|
-
"@babel/core": "^7.
|
|
30
|
-
"@babel/plugin-transform-modules-commonjs": "^7.
|
|
31
|
-
"@parcel/transformer-sass": "^2.2
|
|
32
|
-
"buffer": "^6.0.3",
|
|
33
|
-
"canvas": "^2.
|
|
34
|
-
"eslint": "^
|
|
35
|
-
"events": "^3.3.0",
|
|
36
|
-
"husky": "^
|
|
37
|
-
"jest": "^
|
|
38
|
-
"jest-canvas-mock": "^2.
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"sass": "^1.
|
|
44
|
-
"stream-browserify": "^3.0.0",
|
|
45
|
-
"timers-browserify": "^2.0.12"
|
|
46
|
-
},
|
|
47
|
-
"peerDependencies": {
|
|
48
|
-
"cesium": "^1.
|
|
49
|
-
},
|
|
50
|
-
"engines": {
|
|
51
|
-
"node": "^16.13.2",
|
|
52
|
-
"npm": "^8.1.2"
|
|
53
|
-
},
|
|
54
|
-
"homepage": "https://bitbucket.org/geowerkstatt-hamburg/masterportalapi#readme",
|
|
55
|
-
"directories": {
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@masterportal/masterportalapi",
|
|
3
|
+
"author": "Implementierungspartnerschaft Masterportal <info@masterportal.org> (https://www.masterportal.org)",
|
|
4
|
+
"version": "2.5.1",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"description": "Basic functions of the Masterportal as api",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://bitbucket.org/geowerkstatt-hamburg/masterportalapi.git"
|
|
10
|
+
},
|
|
11
|
+
"main": "src/index.js",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"test": "jest .test.js --config ./jest.config.js --collectCoverage",
|
|
14
|
+
"test:trace": "node --trace-warnings node_modules/jest/bin/jest.js ./test/layer/wfs.test.js --config ./jest.config.js",
|
|
15
|
+
"test:watch": "jest .test.js --config ./jest.config.js --watch",
|
|
16
|
+
"example": "parcel example/index.html",
|
|
17
|
+
"generate-jsdoc": "jsdoc ./src -r -d ./docs/ -R ./README.md -c jsdoc.json",
|
|
18
|
+
"prePushHook": "eslint --max-warnings 0 \"./**/*.js\" && npm run test",
|
|
19
|
+
"prepare": "husky install"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"core-js": "^3.24.0",
|
|
23
|
+
"ol": "6.15.1",
|
|
24
|
+
"olcs": "^2.13.0",
|
|
25
|
+
"proj4": "^2.8.0",
|
|
26
|
+
"xml2js": "^0.4.23"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@babel/core": "^7.18.9",
|
|
30
|
+
"@babel/plugin-transform-modules-commonjs": "^7.18.6",
|
|
31
|
+
"@parcel/transformer-sass": "^2.6.2",
|
|
32
|
+
"buffer": "^6.0.3",
|
|
33
|
+
"canvas": "^2.9.3",
|
|
34
|
+
"eslint": "^8.20.0",
|
|
35
|
+
"events": "^3.3.0",
|
|
36
|
+
"husky": "^8.0.1",
|
|
37
|
+
"jest": "^28.1.3",
|
|
38
|
+
"jest-canvas-mock": "^2.4.0",
|
|
39
|
+
"jest-environment-jsdom": "^28.1.3",
|
|
40
|
+
"jsdoc": "^3.6.11",
|
|
41
|
+
"parcel": "^2.6.2",
|
|
42
|
+
"process": "^0.11.10",
|
|
43
|
+
"sass": "^1.54.0",
|
|
44
|
+
"stream-browserify": "^3.0.0",
|
|
45
|
+
"timers-browserify": "^2.0.12"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"cesium": "^1.95.0"
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": "^16.13.2",
|
|
52
|
+
"npm": "^8.1.2"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://bitbucket.org/geowerkstatt-hamburg/masterportalapi#readme",
|
|
55
|
+
"directories": {
|
|
56
|
+
"doc": "docs",
|
|
57
|
+
"example": "example",
|
|
58
|
+
"test": "test"
|
|
59
|
+
},
|
|
60
|
+
"bugs": {
|
|
61
|
+
"url": "https://bitbucket.org/geowerkstatt-hamburg/masterportalapi/issues"
|
|
62
|
+
}
|
|
63
|
+
}
|
package/src/defaults.js
CHANGED
|
@@ -19,7 +19,7 @@ export default {
|
|
|
19
19
|
{resolution: 1.3229159522920524, scale: 5000, zoomLevel: 6},
|
|
20
20
|
{resolution: 0.6614579761460262, scale: 2500, zoomLevel: 7},
|
|
21
21
|
{resolution: 0.2645831904584105, scale: 1000, zoomLevel: 8},
|
|
22
|
-
{resolution: 0.
|
|
22
|
+
{resolution: 0.1322915952292052, scale: 500, zoomLevel: 9}
|
|
23
23
|
],
|
|
24
24
|
namedProjections: [
|
|
25
25
|
["EPSG:25832", "+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"]
|
package/src/layer/entities.js
CHANGED
|
@@ -114,9 +114,10 @@ function addEntities (rawLayer, dataSource) {
|
|
|
114
114
|
* @param {string} [rawLayer.id] the id of the layer
|
|
115
115
|
* @param {string} [rawLayer.entities] array of entities to add
|
|
116
116
|
* @param {OLCesium} map ol cesium map
|
|
117
|
-
* @
|
|
117
|
+
* @param {function} callback to execute after datasource is added to map and entities are added
|
|
118
|
+
* @returns {*} null or the return-value of the callback
|
|
118
119
|
*/
|
|
119
|
-
export function createDataSource (rawLayer, map) {
|
|
120
|
+
export function createDataSource (rawLayer, map, callback) {
|
|
120
121
|
if (!rawLayer) {
|
|
121
122
|
console.warn("Cannot add entities to rawLayer which is null!");
|
|
122
123
|
}
|
|
@@ -128,12 +129,20 @@ export function createDataSource (rawLayer, map) {
|
|
|
128
129
|
dataSource = new Cesium.CustomDataSource(rawLayer.id);
|
|
129
130
|
dataSources.add(dataSource).then(function (addedDataSource) {
|
|
130
131
|
addEntities(rawLayer, addedDataSource, map);
|
|
132
|
+
if (callback) {
|
|
133
|
+
return callback();
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
131
136
|
});
|
|
132
137
|
}
|
|
133
138
|
else {
|
|
134
139
|
addEntities(rawLayer, dataSource, map);
|
|
140
|
+
if (callback) {
|
|
141
|
+
return callback();
|
|
142
|
+
}
|
|
135
143
|
}
|
|
136
144
|
}
|
|
145
|
+
return null;
|
|
137
146
|
}
|
|
138
147
|
|
|
139
148
|
|
package/src/layer/vectorTile.js
CHANGED
|
@@ -4,8 +4,7 @@ import VectorTileSource from "ol/source/VectorTile";
|
|
|
4
4
|
import OpenLayersTileGrid from "ol/tilegrid/TileGrid";
|
|
5
5
|
import {extentFromProjection} from "ol/tilegrid";
|
|
6
6
|
|
|
7
|
-
import stylefunction from "ol-mapbox-style
|
|
8
|
-
import {defaultResolutions} from "ol-mapbox-style/dist/util";
|
|
7
|
+
import {stylefunction} from "ol-mapbox-style";
|
|
9
8
|
|
|
10
9
|
import defaults from "../defaults";
|
|
11
10
|
|
|
@@ -167,8 +166,8 @@ export function createLayer (rawLayer = {}, {layerParams = {}, options = {}} = {
|
|
|
167
166
|
export function setStyle (layer, glStyle, {options = {}} = {}) {
|
|
168
167
|
stylefunction(layer, glStyle,
|
|
169
168
|
options.sourceId ? options.sourceId : Object.keys(glStyle.sources)[0],
|
|
170
|
-
options.resolutions
|
|
169
|
+
options.resolutions,
|
|
171
170
|
options.spriteData,
|
|
172
171
|
options.spriteImageUrl,
|
|
173
172
|
options.getFonts);
|
|
174
|
-
}
|
|
173
|
+
}
|
|
@@ -5,6 +5,7 @@ import olLayerGroup from "ol/layer/Group.js";
|
|
|
5
5
|
import {getUid} from "olcs/util.js";
|
|
6
6
|
import TileWMS from "ol/source/TileWMS.js";
|
|
7
7
|
import ImageWMS from "ol/source/ImageWMS.js";
|
|
8
|
+
import WMTS from "ol/source/WMTS.js";
|
|
8
9
|
import olcsAbstractSynchronizer from "olcs/AbstractSynchronizer.js";
|
|
9
10
|
import olcsCore from "olcs/core.js";
|
|
10
11
|
import {Tile, Image as ImageLayer} from "ol/layer.js";
|
|
@@ -116,6 +117,17 @@ class WMSRasterSynchronizer extends olcsAbstractSynchronizer {
|
|
|
116
117
|
else if (source instanceof StaticImageSource) {
|
|
117
118
|
provider = this.createProviderForStaticImageSource(source);
|
|
118
119
|
}
|
|
120
|
+
else if (source instanceof WMTS) {
|
|
121
|
+
provider = new Cesium.WebMapTileServiceImageryProvider({
|
|
122
|
+
url: source.getUrls()[0],
|
|
123
|
+
format: source.getFormat(),
|
|
124
|
+
layer: source.getLayer(),
|
|
125
|
+
style: source.getStyle(),
|
|
126
|
+
tileMatrixSetID: source.getMatrixSet(),
|
|
127
|
+
tileMatrixLabels: source.getTileGrid().getMatrixIds(),
|
|
128
|
+
credit: source.getAttributions()
|
|
129
|
+
});
|
|
130
|
+
}
|
|
119
131
|
else {
|
|
120
132
|
console.warn("Sources other than TileImage are currently not supported.");
|
|
121
133
|
return null;
|
package/src/maps/olcs/olcsMap.js
CHANGED
|
@@ -20,7 +20,9 @@ export function setCesiumSceneParams (scene, params) {
|
|
|
20
20
|
|
|
21
21
|
if (typeof paramValue === "object") {
|
|
22
22
|
Object.keys(paramValue).forEach(paramSubKey => {
|
|
23
|
-
|
|
23
|
+
if (paramSubKey !== "heading" && paramSubKey !== "tilt" && paramSubKey !== "altitude") {
|
|
24
|
+
scene[paramKey][paramSubKey] = paramValue[paramSubKey];
|
|
25
|
+
}
|
|
24
26
|
});
|
|
25
27
|
}
|
|
26
28
|
else {
|
|
@@ -28,6 +30,71 @@ export function setCesiumSceneParams (scene, params) {
|
|
|
28
30
|
}
|
|
29
31
|
});
|
|
30
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Sets the camera parameters either from config or from an trigger.
|
|
35
|
+
* @param {Object} params Params.
|
|
36
|
+
* @param {Object} map3D olcs map.
|
|
37
|
+
* @param {Cesium} cesium cesium.
|
|
38
|
+
* @returns {void}
|
|
39
|
+
*/
|
|
40
|
+
export function setCameraParameter (params, map3D, cesium) {
|
|
41
|
+
let camera,
|
|
42
|
+
destination,
|
|
43
|
+
orientation,
|
|
44
|
+
heading;
|
|
45
|
+
|
|
46
|
+
if (params && map3D) {
|
|
47
|
+
if (typeof params.heading !== "undefined") {
|
|
48
|
+
heading = parseFloat(params.heading);
|
|
49
|
+
}
|
|
50
|
+
else if (typeof params.camera?.heading !== "undefined") {
|
|
51
|
+
heading = parseFloat(params.camera?.heading);
|
|
52
|
+
}
|
|
53
|
+
// if the cameraPosition is given, directly set the cesium camera position, otherwise use olcesium Camera
|
|
54
|
+
if (params.cameraPosition) {
|
|
55
|
+
camera = map3D.getCesiumScene().camera;
|
|
56
|
+
destination = cesium.Cartesian3.fromDegrees(params.cameraPosition[0], params.cameraPosition[1], params.cameraPosition[2]);
|
|
57
|
+
orientation = {
|
|
58
|
+
heading: cesium.Math.toRadians(heading),
|
|
59
|
+
pitch: cesium.Math.toRadians(parseFloat(params.pitch)),
|
|
60
|
+
roll: cesium.Math.toRadians(parseFloat(params.roll))
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
camera.setView({
|
|
64
|
+
destination,
|
|
65
|
+
orientation
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
let tilt,
|
|
70
|
+
altitude;
|
|
71
|
+
|
|
72
|
+
if (typeof params.tilt !== "undefined") {
|
|
73
|
+
tilt = parseFloat(params.tilt);
|
|
74
|
+
}
|
|
75
|
+
else if (typeof params.camera?.tilt !== "undefined") {
|
|
76
|
+
tilt = parseFloat(params.camera?.tilt);
|
|
77
|
+
}
|
|
78
|
+
if (typeof params.altitude !== "undefined") {
|
|
79
|
+
altitude = parseFloat(params.altitude);
|
|
80
|
+
}
|
|
81
|
+
else if (typeof params.camera?.altitude !== "undefined") {
|
|
82
|
+
altitude = parseFloat(params.camera?.altitude);
|
|
83
|
+
}
|
|
84
|
+
camera = map3D.getCamera();
|
|
85
|
+
|
|
86
|
+
if (tilt) {
|
|
87
|
+
camera.setTilt(tilt);
|
|
88
|
+
}
|
|
89
|
+
if (heading) {
|
|
90
|
+
camera.setHeading(heading);
|
|
91
|
+
}
|
|
92
|
+
if (altitude) {
|
|
93
|
+
camera.setAltitude(altitude);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
31
98
|
|
|
32
99
|
/**
|
|
33
100
|
* Creates a 3D-map.
|
|
@@ -52,52 +119,12 @@ export function createMap (settings) {
|
|
|
52
119
|
setCesiumSceneParams(map3D.getCesiumScene(), defaults.sceneOptions);
|
|
53
120
|
if (settings?.cesiumParameter) {
|
|
54
121
|
setCesiumSceneParams(map3D.getCesiumScene(), settings.cesiumParameter);
|
|
122
|
+
setCameraParameter(settings.cesiumParameter, map3D, Cesium);
|
|
55
123
|
}
|
|
56
124
|
|
|
57
125
|
return map3D;
|
|
58
126
|
}
|
|
59
127
|
|
|
60
|
-
/**
|
|
61
|
-
* Sets the camera parameters either from config or from an trigger.
|
|
62
|
-
* @param {Object} params Params.
|
|
63
|
-
* @param {Object} map3D olcs map.
|
|
64
|
-
* @param {Cesium} cesium cesium.
|
|
65
|
-
* @returns {void}
|
|
66
|
-
*/
|
|
67
|
-
export function setCameraParameter (params, map3D, cesium) {
|
|
68
|
-
let camera,
|
|
69
|
-
destination,
|
|
70
|
-
orientation;
|
|
71
|
-
|
|
72
|
-
// if the cameraPosition is given, directly set the cesium camera position, otherwise use olcesium Camera
|
|
73
|
-
if (map3D && params.cameraPosition) {
|
|
74
|
-
camera = map3D.getCesiumScene().camera;
|
|
75
|
-
destination = cesium.Cartesian3.fromDegrees(params.cameraPosition[0], params.cameraPosition[1], params.cameraPosition[2]);
|
|
76
|
-
orientation = {
|
|
77
|
-
heading: cesium.Math.toRadians(parseFloat(params.heading)),
|
|
78
|
-
pitch: cesium.Math.toRadians(parseFloat(params.pitch)),
|
|
79
|
-
roll: cesium.Math.toRadians(parseFloat(params.roll))
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
camera.setView({
|
|
83
|
-
destination,
|
|
84
|
-
orientation
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
else if (map3D !== undefined && params !== null) {
|
|
88
|
-
camera = map3D.getCamera();
|
|
89
|
-
if (params?.tilt) {
|
|
90
|
-
camera.setTilt(parseFloat(params.tilt));
|
|
91
|
-
}
|
|
92
|
-
if (params?.heading) {
|
|
93
|
-
camera.setHeading(parseFloat(params.heading));
|
|
94
|
-
}
|
|
95
|
-
if (params?.altitude) {
|
|
96
|
-
camera.setAltitude(parseFloat(params.altitude));
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
128
|
/**
|
|
102
129
|
* Reacts to 3D click event in cesium scene.
|
|
103
130
|
* @param {Event} event The cesium event.
|
|
@@ -135,7 +135,7 @@ describe("vectorTile.js", function () {
|
|
|
135
135
|
1.3229159522920524,
|
|
136
136
|
0.6614579761460262,
|
|
137
137
|
0.2645831904584105,
|
|
138
|
-
0.
|
|
138
|
+
0.1322915952292052
|
|
139
139
|
],
|
|
140
140
|
tileSize: 512
|
|
141
141
|
},
|
|
@@ -169,4 +169,4 @@ describe("vectorTile.js", function () {
|
|
|
169
169
|
expect(featureStyle[0].getFill().getColor()).toBe("rgba(255,253,238,1)");
|
|
170
170
|
});
|
|
171
171
|
});
|
|
172
|
-
});
|
|
172
|
+
});
|
package/test/map.test.js
CHANGED
|
@@ -167,8 +167,41 @@ describe("map.js", function () {
|
|
|
167
167
|
const map3D = map.createMap(config, "3D");
|
|
168
168
|
|
|
169
169
|
expect(map3D.mapMode).toBe("3D");
|
|
170
|
-
|
|
170
|
+
expect(map3D.getCesiumScene().camera.getAltitude()).toBe(config.cameraParameter.altitude);
|
|
171
|
+
expect(map3D.getCesiumScene().camera.getHeading()).toBe(config.cameraParameter.heading);
|
|
172
|
+
expect(map3D.getCesiumScene().camera.getTilt()).toBe(config.cameraParameter.tilt);
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
it("set the camera parameter from config under camera", function () {
|
|
176
|
+
const config = {
|
|
177
|
+
map2D: {
|
|
178
|
+
getView: () => {
|
|
179
|
+
return {
|
|
180
|
+
getProjection: () => {
|
|
181
|
+
return {getCode: () => "code"};
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
},
|
|
185
|
+
getViewport: () => {
|
|
186
|
+
return {
|
|
187
|
+
appendChild: jest.fn()
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
cameraParameter: {
|
|
192
|
+
camera: {
|
|
193
|
+
altitude: 272.3469798217454,
|
|
194
|
+
heading: -0.30858728378862876,
|
|
195
|
+
tilt: 0.9321791580603296
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
cesiumLib: "https://lib.virtualcitymap.de/v3.6.x/lib/Cesium/Cesium.js"
|
|
199
|
+
};
|
|
171
200
|
|
|
201
|
+
load3DScript(config.cesiumLib, function Loaded3DCallback () {
|
|
202
|
+
const map3D = map.createMap(config, "3D");
|
|
203
|
+
|
|
204
|
+
expect(map3D.mapMode).toBe("3D");
|
|
172
205
|
expect(map3D.getCesiumScene().camera.getAltitude()).toBe(config.cameraParameter.altitude);
|
|
173
206
|
expect(map3D.getCesiumScene().camera.getHeading()).toBe(config.cameraParameter.heading);
|
|
174
207
|
expect(map3D.getCesiumScene().camera.getTilt()).toBe(config.cameraParameter.tilt);
|