@masterportal/masterportalapi 2.38.0 → 2.39.0
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 +24 -0
- package/package.json +2 -2
- package/src/index.js +1 -1
- package/src/layer/geojson/index.js +25 -0
- package/src/layer/oaf.js +25 -2
- package/src/maps/ol/olMap.js +1 -1
- package/src/vectorStyle/lib/valueOperations.js +1 -1
- package/tall +59 -0
- package/test/layer/geojson/index.test.js +30 -0
- package/test/layer/oaf.test.js +31 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,21 +3,45 @@
|
|
|
3
3
|
|
|
4
4
|
The [Semantic Versioning](https://semver.org/spec/v2.0.0.html) is used.
|
|
5
5
|
|
|
6
|
+
## Unreleased - in development
|
|
7
|
+
### __Breaking Changes__
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
### Deprecated
|
|
14
|
+
|
|
15
|
+
### Removed
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
## 2.39.0 - 2024-06-18
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
- peerDependencies:
|
|
24
|
+
- @cesium/engine: 6.2.0 to 9.2.0
|
|
25
|
+
|
|
26
|
+
---
|
|
6
27
|
## 2.38.0 - 2024-06-04
|
|
7
28
|
|
|
8
29
|
### Added
|
|
9
30
|
- Added support for Node LTS version ^20.12.2 and npm Version ^10.5.0.
|
|
31
|
+
- OAF, GeoJSON: added function loadFeaturesManually.
|
|
10
32
|
|
|
11
33
|
### Changed
|
|
12
34
|
- The following packages have been updated:
|
|
13
35
|
- dependencies:
|
|
14
36
|
- ol: 9.1.0 to 9.2.4
|
|
15
37
|
- olcs: 2.19.3 to 2.20.0
|
|
38
|
+
- Exports in src/layer/oaf.js changed to export default {} to provide ES-Syntax.
|
|
16
39
|
|
|
17
40
|
### Fixed
|
|
18
41
|
- The mitigation for issue 666 in ol-cesium since version 2.37.0 is removed
|
|
19
42
|
- Webgl: vectorTiles were not displayed.
|
|
20
43
|
- WMS-Layer: special loadFunction is only used if layer's attribute `isSecured` is true.
|
|
44
|
+
- Issue#1170: checkProperty was not negated, although it should be, so that styling-rules can be properly excluded.
|
|
21
45
|
|
|
22
46
|
---
|
|
23
47
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@masterportal/masterportalapi",
|
|
3
3
|
"author": "Implementierungspartnerschaft Masterportal <info@masterportal.org> (https://www.masterportal.org)",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.39.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Basic functions of the Masterportal as api",
|
|
7
7
|
"repository": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"util": "^0.12.5"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@cesium/engine": "^
|
|
59
|
+
"@cesium/engine": "^9.2.0"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": "^16.13.2 || ^18.12.0 || ^20.12.2",
|
package/src/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import wmts from "./layer/wmts";
|
|
|
6
6
|
import wfs from "./layer/wfs";
|
|
7
7
|
import * as geojson from "./layer/geojson";
|
|
8
8
|
import * as vectorTile from "./layer/vectorTile";
|
|
9
|
-
import
|
|
9
|
+
import oaf from "./layer/oaf";
|
|
10
10
|
import * as terrain from "./layer/terrain";
|
|
11
11
|
import * as entities from "./layer/entities";
|
|
12
12
|
import * as webgl from "./renderer/webgl";
|
|
@@ -167,3 +167,28 @@ export function showFeaturesById (layer, featureIdList) {
|
|
|
167
167
|
hideAllFeatures(layer);
|
|
168
168
|
setFeatureStyle(features, undefined);
|
|
169
169
|
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Load the features manually.
|
|
173
|
+
* @param {Object} layerAttributes raw layer attributes.
|
|
174
|
+
* @param {module:ol/vector/Source} layerSource - the source of the layer
|
|
175
|
+
* @returns {void}
|
|
176
|
+
*/
|
|
177
|
+
export function loadFeaturesManually (layerAttributes, layerSource) {
|
|
178
|
+
const getUrl = layerAttributes.url;
|
|
179
|
+
|
|
180
|
+
fetch(getUrl, layerSource)
|
|
181
|
+
.then(response => response.text())
|
|
182
|
+
.then(responseString => {
|
|
183
|
+
const features = layerSource.getFormat().readFeatures(responseString);
|
|
184
|
+
|
|
185
|
+
layerSource.addFeatures(features);
|
|
186
|
+
layerSource.dispatchEvent({
|
|
187
|
+
type: "featuresloadend",
|
|
188
|
+
features: layerSource.getFeatures()
|
|
189
|
+
});
|
|
190
|
+
})
|
|
191
|
+
.catch(error => {
|
|
192
|
+
console.error(error);
|
|
193
|
+
});
|
|
194
|
+
}
|
package/src/layer/oaf.js
CHANGED
|
@@ -178,7 +178,7 @@ function createUrl (rawLayer) {
|
|
|
178
178
|
* {@link https://openlayers.org/en/latest/apidoc/module-ol_source_Vector-VectorSource.html failure/success see}
|
|
179
179
|
* @returns {(ol.source.VectorSource|ol.source.Cluster)} VectorSource or Cluster, depending on whether clusterDistance is set.
|
|
180
180
|
*/
|
|
181
|
-
|
|
181
|
+
function createLayerSource (rawLayer, options = {}) {
|
|
182
182
|
if (!options.loadingStrategy) {
|
|
183
183
|
options.loadingStrategy = bbox;
|
|
184
184
|
}
|
|
@@ -203,7 +203,7 @@ export function createLayerSource (rawLayer, options = {}) {
|
|
|
203
203
|
* @param {options} [optionalParams.options] - additional options
|
|
204
204
|
* @returns {ol.Layer} Layer that can be added to map.
|
|
205
205
|
*/
|
|
206
|
-
|
|
206
|
+
function createLayer (rawLayer = {}, {layerParams = {}, options = {}} = {}) {
|
|
207
207
|
let layer, source;
|
|
208
208
|
|
|
209
209
|
// use WebGL render pipeline, if specified
|
|
@@ -239,3 +239,26 @@ export function createLayer (rawLayer = {}, {layerParams = {}, options = {}} = {
|
|
|
239
239
|
}
|
|
240
240
|
return layer;
|
|
241
241
|
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Load the features manually.
|
|
245
|
+
* @param {Object} layerAttributes raw layer attributes.
|
|
246
|
+
* @param {module:ol/vector/Source} layerSource - the source of the layer
|
|
247
|
+
* @returns {void}
|
|
248
|
+
*/
|
|
249
|
+
function loadFeaturesManually (layerAttributes, layerSource) {
|
|
250
|
+
const getUrl = createUrl(layerAttributes, layerAttributes.version, {getCode: () => layerAttributes.crs}, "");
|
|
251
|
+
|
|
252
|
+
fetch(getUrl, layerSource)
|
|
253
|
+
.then(response => {
|
|
254
|
+
return response.text();
|
|
255
|
+
})
|
|
256
|
+
.then(responseString => {
|
|
257
|
+
layerSource.addFeatures(layerSource.getFormat().readFeatures(responseString));
|
|
258
|
+
})
|
|
259
|
+
.catch(error => {
|
|
260
|
+
console.error(error);
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export default {createLayer, createLayerSource, loadFeaturesManually};
|
package/src/maps/ol/olMap.js
CHANGED
|
@@ -8,7 +8,7 @@ import wmts from "../../layer/wmts";
|
|
|
8
8
|
import * as geojson from "../../layer/geojson";
|
|
9
9
|
import wfs from "../../layer/wfs";
|
|
10
10
|
import * as vectortile from "../../layer/vectorTile";
|
|
11
|
-
import
|
|
11
|
+
import oaf from "../../layer/oaf";
|
|
12
12
|
import {createMapView} from "../../maps/mapView";
|
|
13
13
|
import rawLayerList from "../../rawLayerList";
|
|
14
14
|
import crs from "../../crs";
|
package/tall
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
v1.0.0
|
|
2
|
+
v1.1.0
|
|
3
|
+
v1.10.0
|
|
4
|
+
v1.2.0
|
|
5
|
+
v1.3.0
|
|
6
|
+
v1.4.0
|
|
7
|
+
v1.5.0
|
|
8
|
+
v1.6.0
|
|
9
|
+
v1.6.1
|
|
10
|
+
v1.7.0
|
|
11
|
+
v1.7.1
|
|
12
|
+
v1.8.0
|
|
13
|
+
v1.9.0
|
|
14
|
+
v2.0.0
|
|
15
|
+
v2.1.0
|
|
16
|
+
v2.1.1
|
|
17
|
+
v2.10.0
|
|
18
|
+
v2.11.0
|
|
19
|
+
v2.12.0
|
|
20
|
+
v2.13.0
|
|
21
|
+
v2.14.0
|
|
22
|
+
v2.15.0
|
|
23
|
+
v2.15.1
|
|
24
|
+
v2.15.2
|
|
25
|
+
v2.16.0
|
|
26
|
+
v2.17.0
|
|
27
|
+
v2.18.0
|
|
28
|
+
v2.19.0
|
|
29
|
+
v2.19.1
|
|
30
|
+
v2.19.2
|
|
31
|
+
v2.2.0
|
|
32
|
+
v2.20.0
|
|
33
|
+
v2.21.0
|
|
34
|
+
v2.22.0
|
|
35
|
+
v2.23.0
|
|
36
|
+
v2.24.0
|
|
37
|
+
v2.25.0
|
|
38
|
+
v2.26.0
|
|
39
|
+
v2.27.0
|
|
40
|
+
v2.28.0
|
|
41
|
+
v2.29.0
|
|
42
|
+
v2.3.0
|
|
43
|
+
v2.30.0
|
|
44
|
+
v2.31.0
|
|
45
|
+
v2.32.0
|
|
46
|
+
v2.33.0
|
|
47
|
+
v2.34.0
|
|
48
|
+
v2.35.0
|
|
49
|
+
v2.36.0
|
|
50
|
+
v2.37.0
|
|
51
|
+
v2.38.0
|
|
52
|
+
v2.39.0
|
|
53
|
+
v2.4.0
|
|
54
|
+
v2.5.0
|
|
55
|
+
v2.5.1
|
|
56
|
+
v2.6.0
|
|
57
|
+
v2.7.0
|
|
58
|
+
v2.8.0
|
|
59
|
+
v2.9.0
|
|
@@ -167,4 +167,34 @@ describe("geojson/index", function () {
|
|
|
167
167
|
expect(features[1].getStyle()()).toBeNull();
|
|
168
168
|
});
|
|
169
169
|
});
|
|
170
|
+
describe("loadFeaturesManually", function () {
|
|
171
|
+
it("loadFeaturesManually shall call fetch", function () {
|
|
172
|
+
console.error = jest.fn();
|
|
173
|
+
global.fetch = jest.fn().mockImplementationOnce(() => {
|
|
174
|
+
return new Promise((resolve) => {
|
|
175
|
+
resolve({
|
|
176
|
+
ok: true,
|
|
177
|
+
status: 200,
|
|
178
|
+
json: () => {
|
|
179
|
+
return [];
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
const layerParams = {
|
|
186
|
+
id: "id",
|
|
187
|
+
url: "url",
|
|
188
|
+
featureNS: "http://www.deegree.org/app",
|
|
189
|
+
featureType: "krankenhaeuser_hh",
|
|
190
|
+
version: "1.0.0"
|
|
191
|
+
},
|
|
192
|
+
options = {},
|
|
193
|
+
layer = geojson.createLayer(layerParams, {options});
|
|
194
|
+
|
|
195
|
+
geojson.loadFeaturesManually(layerParams, layer.getSource());
|
|
196
|
+
|
|
197
|
+
expect(global.fetch.mock.calls.length).toBe(1);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
170
200
|
});
|
package/test/layer/oaf.test.js
CHANGED
|
@@ -5,7 +5,7 @@ import {Style, Icon} from "ol/style.js";
|
|
|
5
5
|
import map from "../../src/maps/map.js";
|
|
6
6
|
import defaults from "../../src/defaults";
|
|
7
7
|
import GeoJSON from "ol/format/GeoJSON.js";
|
|
8
|
-
import
|
|
8
|
+
import oaf from "../../src/layer/oaf";
|
|
9
9
|
import {featureCollection} from "./resources/oafFeatures";
|
|
10
10
|
import * as webgl from "../../src/renderer/webgl.js";
|
|
11
11
|
|
|
@@ -287,4 +287,34 @@ describe("oaf.js", function () {
|
|
|
287
287
|
expect(webgl.afterLoading).toHaveBeenCalledWith(features, layerParams.styleId, layerParams.excludeTypesFromParsing, layerParams.isPointLayer);
|
|
288
288
|
});
|
|
289
289
|
});
|
|
290
|
+
describe("loadFeaturesManually", function () {
|
|
291
|
+
it("loadFeaturesManually shall call fetch", function () {
|
|
292
|
+
console.error = jest.fn();
|
|
293
|
+
global.fetch = jest.fn().mockImplementationOnce(() => {
|
|
294
|
+
return new Promise((resolve) => {
|
|
295
|
+
resolve({
|
|
296
|
+
ok: true,
|
|
297
|
+
status: 200,
|
|
298
|
+
json: () => {
|
|
299
|
+
return featureCollection;
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
const rawLayer = {
|
|
306
|
+
id: "id",
|
|
307
|
+
url: "url",
|
|
308
|
+
featureNS: "http://www.deegree.org/app",
|
|
309
|
+
featureType: "krankenhaeuser_hh",
|
|
310
|
+
version: "1.0.0"
|
|
311
|
+
},
|
|
312
|
+
options = {},
|
|
313
|
+
layer = oaf.createLayer(rawLayer, {options});
|
|
314
|
+
|
|
315
|
+
oaf.loadFeaturesManually(rawLayer, layer.getSource());
|
|
316
|
+
|
|
317
|
+
expect(global.fetch.mock.calls.length).toBe(1);
|
|
318
|
+
});
|
|
319
|
+
});
|
|
290
320
|
});
|