@masterportal/masterportalapi 2.42.2 → 2.44.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 +42 -3
- package/package.json +5 -5
- package/src/defaults.js +1 -1
- package/src/layer/tileset.js +2 -1
- package/src/layer/wms.js +7 -10
- package/src/maps/ol/olMap.js +14 -9
- package/test/layer/wms.test.js +9 -2
- package/test/map.test.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,11 +3,49 @@
|
|
|
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__
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
### Deprecated
|
|
14
|
+
|
|
15
|
+
### Removed
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 2.44.0 - 2025-01-22
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
- Tileset.js: The tileset layer knows now the rawLayer transparency.
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
- Transparency and visibility information in `addLayer` is now interpreted correctly again
|
|
28
|
+
- WMS-Layer: special loadFunction is used for every value attribute `isSecured` (behaviour equals <2.38.0)
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 2.43.0 - 2025-01-17
|
|
8
33
|
|
|
9
34
|
### Changed
|
|
10
|
-
-
|
|
35
|
+
- The following packages have been updated:
|
|
36
|
+
- dependencies:
|
|
37
|
+
- ol: 10.2.1 to 10.3.1
|
|
38
|
+
- peerDependencies:
|
|
39
|
+
- cesium/engine: 12.0.1 to 13.0.0
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
- 3D mesh layer was covered on level 0 by setting globe depthTestAgainstTerrain to false
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 2.42.2 - 2024-12-05
|
|
47
|
+
### Changed
|
|
48
|
+
- Revert Change, because of problems with Routing:
|
|
11
49
|
- The following packages have been updated:
|
|
12
50
|
- dependencies:
|
|
13
51
|
- ol: 9.2.4 to 10.2.1
|
|
@@ -16,6 +54,7 @@
|
|
|
16
54
|
- peerDependencies:
|
|
17
55
|
- cesium/engine: 9.2.0 to 12.0.1
|
|
18
56
|
|
|
57
|
+
---
|
|
19
58
|
|
|
20
59
|
## 2.42.1 - 2024-11-28
|
|
21
60
|
|
|
@@ -36,7 +75,7 @@
|
|
|
36
75
|
- cesium/engine: 9.2.0 to 12.0.1
|
|
37
76
|
|
|
38
77
|
### Fixed
|
|
39
|
-
- Issue #1275: Layers without capabilitiesURL are now working.
|
|
78
|
+
- Issue #1275: Layers without capabilitiesURL are now working.
|
|
40
79
|
|
|
41
80
|
---
|
|
42
81
|
|
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.44.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Basic functions of the Masterportal as api",
|
|
7
7
|
"repository": {
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"core-js": "^3.33.1",
|
|
23
23
|
"dayjs": "^1.11.10",
|
|
24
|
-
"ol": "
|
|
25
|
-
"ol-mapbox-style": "12.
|
|
26
|
-
"olcs": "2.
|
|
24
|
+
"ol": "^10.3.1",
|
|
25
|
+
"ol-mapbox-style": "^12.3.5",
|
|
26
|
+
"olcs": "^2.22.1",
|
|
27
27
|
"proj4": "^2.10.0",
|
|
28
28
|
"xml2js": "^0.6.2"
|
|
29
29
|
},
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"util": "^0.12.5"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@cesium/engine": "^
|
|
59
|
+
"@cesium/engine": "^13.0.0"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": "^16.13.2 || ^18.12.0 || ^20.12.2",
|
package/src/defaults.js
CHANGED
|
@@ -40,7 +40,7 @@ export default {
|
|
|
40
40
|
enableTerrainAdjustmentWhenLoading: true
|
|
41
41
|
},
|
|
42
42
|
globe: {
|
|
43
|
-
depthTestAgainstTerrain:
|
|
43
|
+
depthTestAgainstTerrain: false
|
|
44
44
|
},
|
|
45
45
|
highDynamicRange: false,
|
|
46
46
|
pickTranslucentDepth: true,
|
package/src/layer/tileset.js
CHANGED
|
@@ -33,7 +33,8 @@ export default function Tileset (rawLayer) {
|
|
|
33
33
|
this.values = {
|
|
34
34
|
name: rawLayer.name,
|
|
35
35
|
id: rawLayer.id,
|
|
36
|
-
typ: rawLayer.typ
|
|
36
|
+
typ: rawLayer.typ,
|
|
37
|
+
transparency: rawLayer.transparency
|
|
37
38
|
};
|
|
38
39
|
if (Cesium) {
|
|
39
40
|
this.tileset = Promise.resolve(createTileSet(this, rawLayer));
|
package/src/layer/wms.js
CHANGED
|
@@ -77,12 +77,13 @@ export function makeParams (rawLayer) {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
|
-
* Return a ol tile or image load function for the rawLayer.
|
|
80
|
+
* Return a ol tile or image load function for the rawLayer.
|
|
81
|
+
* @param {object} rawLayer - layer specification as in services.json
|
|
81
82
|
* @returns {function} tile/image load function
|
|
82
83
|
*/
|
|
83
|
-
export function
|
|
84
|
+
export function defaultLoadFunction ({isSecured}) {
|
|
84
85
|
return async (image, src) => {
|
|
85
|
-
const response = await fetch(src, {credentials: "include"}),
|
|
86
|
+
const response = await fetch(src, {credentials: isSecured ? "include" : "omit"}),
|
|
86
87
|
data = await response.blob();
|
|
87
88
|
|
|
88
89
|
image.getImage().src = URL.createObjectURL(data);
|
|
@@ -99,7 +100,7 @@ export function loadFunctionWithCredentials () {
|
|
|
99
100
|
* @param {string|number} [rawLayer.tilesize] - optional needed to create the tileGrid
|
|
100
101
|
* @param {string|"anonymous"} [rawLayer.crossOrigin] - optional needed for CORS requests of image data, to enable canvas export
|
|
101
102
|
* @param {string} [rawLayer.cqlFilter] - optional CQL filter to add to the request
|
|
102
|
-
* @param {boolean} [rawLayer.isSecured] -
|
|
103
|
+
* @param {boolean} [rawLayer.isSecured] - whether the layer is secured by BasicAuth and should include or omit the credentials prompt
|
|
103
104
|
* @param {object} options - optional resolutions and origin to create the TileGrid
|
|
104
105
|
* @param {Array} [options.resolutions] - optional resolutions to create the TileGrid, must be in descending order
|
|
105
106
|
* @param {Array} [options.origin] - optional origin to create the TileGrid
|
|
@@ -119,9 +120,7 @@ export function createLayerSource (rawLayer, options) {
|
|
|
119
120
|
projection: projection,
|
|
120
121
|
attributions: rawLayer.olAttribution,
|
|
121
122
|
crossOrigin: rawLayer.crossOrigin,
|
|
122
|
-
|
|
123
|
-
imageLoadFunction: loadFunctionWithCredentials()
|
|
124
|
-
} : {}
|
|
123
|
+
imageLoadFunction: defaultLoadFunction(rawLayer)
|
|
125
124
|
});
|
|
126
125
|
}
|
|
127
126
|
if (options && options.resolutions) {
|
|
@@ -139,9 +138,7 @@ export function createLayerSource (rawLayer, options) {
|
|
|
139
138
|
projection: projection,
|
|
140
139
|
attributions: rawLayer.olAttribution,
|
|
141
140
|
crossOrigin: rawLayer.crossOrigin,
|
|
142
|
-
|
|
143
|
-
tileLoadFunction: loadFunctionWithCredentials()
|
|
144
|
-
} : {}
|
|
141
|
+
tileLoadFunction: defaultLoadFunction(rawLayer)
|
|
145
142
|
});
|
|
146
143
|
}
|
|
147
144
|
|
package/src/maps/ol/olMap.js
CHANGED
|
@@ -83,15 +83,20 @@ function injectErrorCallback (layer, errorCallback) {
|
|
|
83
83
|
* @param {(string|ol/layer/Base)} layerOrId - if of layer to add to map
|
|
84
84
|
* @param {object} [params] - optional parameter object
|
|
85
85
|
* @param {boolean} [params.layerParams={}] - additional layerParams specified in portalConfig
|
|
86
|
-
* @param {boolean} [params.visibility=true] -
|
|
87
|
-
* @param {Number} [params.transparency=0] -
|
|
86
|
+
* @param {boolean} [params.layerParams.visibility=true] - if params.visibility not given, this is used
|
|
87
|
+
* @param {Number} [params.layerParams.transparency=0] - if params.transparency not given, this is used
|
|
88
|
+
* @param {boolean} [params.visibility=params.layerParams.visibility] - whether added layer is initially visible
|
|
89
|
+
* @param {Number} [params.transparency=params.layerParams.transparency] - how visible the layer is initially
|
|
88
90
|
* @param {Function} [params.errorCallback=console.error] - callback for layer source error events
|
|
89
91
|
* @returns {?ol.Layer} added layer
|
|
90
92
|
*/
|
|
91
|
-
function addLayer (layerOrId, params
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
function addLayer (layerOrId, params) {
|
|
94
|
+
const visibility = params?.visibility ?? params?.layerParams?.visibility ?? true,
|
|
95
|
+
transparency = params?.transparency ?? params?.layerParams?.transparency ?? 0,
|
|
96
|
+
layerParams = {...params?.layerParams || {}, visibility, transparency},
|
|
97
|
+
errorCallback = typeof params?.errorCallback === "function"
|
|
98
|
+
? params?.errorCallback
|
|
99
|
+
: console.error;
|
|
95
100
|
let layer, layerBuilder;
|
|
96
101
|
|
|
97
102
|
// if parameter is id, create and add layer with masterportalAPI mechanisms
|
|
@@ -107,9 +112,9 @@ function addLayer (layerOrId, params = {layerParams: {}, visibility: true, trans
|
|
|
107
112
|
console.error("Layer with id '" + layerOrId + "' has unknown type '" + rawLayer.typ + "'. No layer added to map.");
|
|
108
113
|
return null;
|
|
109
114
|
}
|
|
110
|
-
layer = layerBuilder.createLayer(rawLayer, {layerParams
|
|
111
|
-
layer.setVisible(typeof
|
|
112
|
-
layer.setOpacity(typeof
|
|
115
|
+
layer = layerBuilder.createLayer(rawLayer, {layerParams}, {map: this});
|
|
116
|
+
layer.setVisible(typeof visibility === "boolean" ? visibility : true);
|
|
117
|
+
layer.setOpacity(typeof transparency === "number" ? (100 - transparency) / 100 : 1);
|
|
113
118
|
injectErrorCallback(layer, errorCallback);
|
|
114
119
|
originalAddLayer.call(this, layer);
|
|
115
120
|
return layer;
|
package/test/layer/wms.test.js
CHANGED
|
@@ -102,7 +102,7 @@ describe("wms.js", function () {
|
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
|
|
105
|
-
describe("
|
|
105
|
+
describe("defaultLoadFunction", function () {
|
|
106
106
|
beforeEach(() => {
|
|
107
107
|
const blob = new Blob();
|
|
108
108
|
|
|
@@ -121,12 +121,19 @@ describe("wms.js", function () {
|
|
|
121
121
|
});
|
|
122
122
|
|
|
123
123
|
it("passes credentials if isSecured is set", async function () {
|
|
124
|
-
const result = wms.
|
|
124
|
+
const result = wms.defaultLoadFunction({isSecured: true}),
|
|
125
125
|
input = {src: ""};
|
|
126
126
|
|
|
127
127
|
await result({getImage: () => input}, "SECURE_WMS");
|
|
128
128
|
expect(input.src).toEqual("blob:BLOB");
|
|
129
129
|
});
|
|
130
|
+
it("does not pass credentials if isSecured is not set", async function () {
|
|
131
|
+
const result = wms.defaultLoadFunction({isSecured: false}),
|
|
132
|
+
input = {src: ""};
|
|
133
|
+
|
|
134
|
+
await result({getImage: () => input}, "INSECURE_WMS");
|
|
135
|
+
expect(input.src).toEqual("blob:BLOB");
|
|
136
|
+
});
|
|
130
137
|
});
|
|
131
138
|
|
|
132
139
|
describe("createLayerSource", function () {
|
package/test/map.test.js
CHANGED
|
@@ -122,9 +122,9 @@ describe("map.js", function () {
|
|
|
122
122
|
it("sets visibility and transparency", function () {
|
|
123
123
|
const result1 = Map.prototype.addLayer("works"),
|
|
124
124
|
result2 = Map.prototype.addLayer("works", {}),
|
|
125
|
-
result3 = Map.prototype.addLayer("works", {visibility: false}),
|
|
126
|
-
result4 = Map.prototype.addLayer("works", {transparency: 50}),
|
|
127
|
-
result5 = Map.prototype.addLayer("works", {visibility: false, transparency: 20});
|
|
125
|
+
result3 = Map.prototype.addLayer("works", {layerParams: {visibility: false}}),
|
|
126
|
+
result4 = Map.prototype.addLayer("works", {layerParams: {transparency: 50}}),
|
|
127
|
+
result5 = Map.prototype.addLayer("works", {layerParams: {visibility: false, transparency: 20}});
|
|
128
128
|
|
|
129
129
|
expect(result1.getOpacity()).toBe(1);
|
|
130
130
|
expect(result1.getVisible()).toBe(true);
|