@masterportal/masterportalapi 2.6.0 → 2.7.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 +18 -0
- package/package.json +3 -3
- package/src/layer/vectorTile.js +1 -1
- package/src/layer/wms.js +2 -2
- package/src/maps/map.js +1 -1
- package/src/maps/ol/olMap.js +3 -3
- package/src/maps/olcs/olcsMap.js +1 -1
- package/test/map.test.js +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
3
3
|
|
|
4
4
|
The [Semantic Versioning](https://semver.org/spec/v2.0.0.html) is used.
|
|
5
5
|
|
|
6
|
+
## Unreleased - in development
|
|
7
|
+
### Added
|
|
8
|
+
### Changed
|
|
9
|
+
|
|
10
|
+
### Deprecated
|
|
11
|
+
|
|
12
|
+
### Removed
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
## 2.7.0 - 2022-09-14
|
|
16
|
+
### Changed
|
|
17
|
+
- The following packages have been updated:
|
|
18
|
+
- dependencies:
|
|
19
|
+
- ol: 6.15.1 to 7.1.0
|
|
20
|
+
- olcs: 2.13.0 to 2.13.1
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
6
24
|
## 2.6.0 - 2022-09-06
|
|
7
25
|
### Added
|
|
8
26
|
- Added possibility to set initial features for layer vectorBase.
|
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.7.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Basic functions of the Masterportal as api",
|
|
7
7
|
"repository": {
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"core-js": "^3.24.0",
|
|
23
|
-
"ol": "
|
|
24
|
-
"olcs": "^2.13.
|
|
23
|
+
"ol": "7.1.0",
|
|
24
|
+
"olcs": "^2.13.1",
|
|
25
25
|
"proj4": "^2.8.0",
|
|
26
26
|
"xml2js": "^0.4.23"
|
|
27
27
|
},
|
package/src/layer/vectorTile.js
CHANGED
|
@@ -21,7 +21,7 @@ const OL_DEFAULT_VECTOR_TILE_GRID_CRS = "EPSG:3857";
|
|
|
21
21
|
* @property {number[]} [extent] - extent
|
|
22
22
|
* @property {number} [maxZoom=22] - min zoom level
|
|
23
23
|
* @property {number} [minZoom] - max zoom level
|
|
24
|
-
* @property {function} [olAttribution] - optional function that takes a module:ol/
|
|
24
|
+
* @property {function} [olAttribution] - optional function that takes a module:ol/Map~FrameState and returns a string or an array of strings representing source attributions
|
|
25
25
|
* @property {number[]} [origin] - The tile grid origin, i.e. where the x and y axes meet ([z, 0, 0]). Tile coordinates increase left to right and downwards
|
|
26
26
|
* @property {number[][]} [origins] - Tile grid origins, i.e. where the x and y axes meet ([z, 0, 0]), for each zoom level. If given, the array length should match the length of the resolutions array, i.e. each resolution can have a different origin. Tile coordinates increase left to right and downwards. If not specified, extent or origin must be provided.
|
|
27
27
|
* @property {number[]} [resolutions] - Resolutions. The array index of each resolution needs to match the zoom level. This means that even if a minZoom is configured, the resolutions array will have a length of maxZoom + 1.
|
package/src/layer/wms.js
CHANGED
|
@@ -80,7 +80,7 @@ export function makeParams (rawLayer) {
|
|
|
80
80
|
* @param {string} [rawLayer.url] - WMS service URL
|
|
81
81
|
* @param {string} [rawLayer.serverType] - optional servertype definition: "geoserver" or "mapserver" or "qgis"
|
|
82
82
|
* @param {string} [rawLayer.gutter] - optional the size in pixels of the gutter around image tiles to ignore
|
|
83
|
-
* @param {function} [rawLayer.olAttribution] - optional function that takes a module:ol/
|
|
83
|
+
* @param {function} [rawLayer.olAttribution] - optional function that takes a module:ol/Map~FrameState and returns a string or an array of strings representing source attributions
|
|
84
84
|
* @param {string|number} [rawLayer.tilesize] - optional needed to create the tileGrid
|
|
85
85
|
* @param {object} options - optional resolutions and origin to create the TileGrid
|
|
86
86
|
* @param {Array} [options.resolutions] - optional resolutions to create the TileGrid, must be in descending order
|
|
@@ -128,7 +128,7 @@ export function createLayerSource (rawLayer, options) {
|
|
|
128
128
|
* @param {string} [rawLayer.maxScale] - optional the maximal resolution
|
|
129
129
|
* @param {string} [rawLayer.serverType] - optional servertype definition: "geoserver" or "mapserver" or "qgis"
|
|
130
130
|
* @param {string} [rawLayer.gutter] - optional the size in pixels of the gutter around image tiles to ignore
|
|
131
|
-
* @param {function} [rawLayer.olAttribution] - optional function that takes a module:ol/
|
|
131
|
+
* @param {function} [rawLayer.olAttribution] - optional function that takes a module:ol/Map~FrameState and returns a string or an array of strings representing source attributions
|
|
132
132
|
* @param {string|number} [rawLayer.tilesize] - optional needed to create the tileGrid
|
|
133
133
|
* @param {object} layerParams - additional layer params
|
|
134
134
|
* @param {object} options - optional resolutions and origin to create the TileGrid
|
package/src/maps/map.js
CHANGED
|
@@ -20,7 +20,7 @@ export default {
|
|
|
20
20
|
* @param {object} [settings={}] - settings object
|
|
21
21
|
* @param {object} [settings.mapParams] - additional parameter object that is spread into the ol.Map constructor object
|
|
22
22
|
* @param {function} [settings.callback] - optional callback for layer list loading
|
|
23
|
-
* @returns {module:ol/
|
|
23
|
+
* @returns {module:ol/Map~Map} The map.
|
|
24
24
|
*/
|
|
25
25
|
createMap: function (config, mapMode = "2D", settings = {}) {
|
|
26
26
|
const createMapFunctions = {
|
package/src/maps/ol/olMap.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Map
|
|
1
|
+
import {Map} from "ol";
|
|
2
2
|
import {defaults as olDefaultInteractions} from "ol/interaction.js";
|
|
3
3
|
import setBackgroundImage from "../../lib/setBackgroundImage";
|
|
4
4
|
import getInitialLayers from "../../lib/getInitialLayers";
|
|
@@ -30,7 +30,7 @@ const layerBuilderMap = {
|
|
|
30
30
|
vectortile,
|
|
31
31
|
oaf
|
|
32
32
|
},
|
|
33
|
-
originalAddLayer =
|
|
33
|
+
originalAddLayer = Map.prototype.addLayer;
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Adds a layer to the map, or adds a layer to the map by id.
|
|
@@ -73,7 +73,7 @@ function addLayer (layerOrId, params = {visibility: true, transparency: 0}) {
|
|
|
73
73
|
return originalAddLayer.call(this, layerOrId);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
Map.prototype.addLayer = addLayer;
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* Creates an openlayers map according to configuration. Does not set many default values itself, but uses function that do.
|
package/src/maps/olcs/olcsMap.js
CHANGED
|
@@ -99,7 +99,7 @@ export function setCameraParameter (params, map3D, cesium) {
|
|
|
99
99
|
/**
|
|
100
100
|
* Creates a 3D-map.
|
|
101
101
|
* @param {object} [settings] The settings for the 3D-map.
|
|
102
|
-
* @param {module:ol/
|
|
102
|
+
* @param {module:ol/Map~Map} [settings.map2D] The 2D-Map
|
|
103
103
|
* @param {Cesium.JulianDate} [settings.shadowTime] The shadow time in julian date format if undefined olcs default is Cesium.JulianDate.now().
|
|
104
104
|
* @returns {module:OLCesium} the 3d-map
|
|
105
105
|
*/
|
package/test/map.test.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Map} from "ol";
|
|
2
2
|
import TileLayer from "ol/layer/Tile";
|
|
3
3
|
import map from "../src/maps/map.js";
|
|
4
4
|
import {createMap as create3DMap} from "../src/maps/olcs/olcsMap.js";
|
|
@@ -86,12 +86,12 @@ describe("map.js", function () {
|
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
-
// NOTE: loading map.js monkey patches
|
|
89
|
+
// NOTE: loading map.js monkey patches Map.prototype.addLayer - testing result here
|
|
90
90
|
describe("addLayer", function () {
|
|
91
91
|
it("logs an error for unknown ids", function () {
|
|
92
92
|
console.error = jest.fn();
|
|
93
93
|
const consoleError = console.error,
|
|
94
|
-
result =
|
|
94
|
+
result = Map.prototype.addLayer("999999999999999");
|
|
95
95
|
|
|
96
96
|
expect(console.error).toHaveBeenCalled();
|
|
97
97
|
expect(result).toBeNull();
|
|
@@ -101,7 +101,7 @@ describe("map.js", function () {
|
|
|
101
101
|
it("logs an error for unknown types", function () {
|
|
102
102
|
console.error = jest.fn();
|
|
103
103
|
const consoleError = console.error,
|
|
104
|
-
result =
|
|
104
|
+
result = Map.prototype.addLayer("exists");
|
|
105
105
|
|
|
106
106
|
expect(result).toBeNull();
|
|
107
107
|
expect(console.error).toHaveBeenCalledWith("Layer with id 'exists' has unknown type 'doesntExist'. No layer added to map.");
|
|
@@ -109,17 +109,17 @@ describe("map.js", function () {
|
|
|
109
109
|
});
|
|
110
110
|
|
|
111
111
|
it("creates existing layers that have a known builder", function () {
|
|
112
|
-
const result =
|
|
112
|
+
const result = Map.prototype.addLayer("works");
|
|
113
113
|
|
|
114
114
|
expect(result).toBeInstanceOf(TileLayer);
|
|
115
115
|
});
|
|
116
116
|
|
|
117
117
|
it("sets visibility and transparency", function () {
|
|
118
|
-
const result1 =
|
|
119
|
-
result2 =
|
|
120
|
-
result3 =
|
|
121
|
-
result4 =
|
|
122
|
-
result5 =
|
|
118
|
+
const result1 = Map.prototype.addLayer("works"),
|
|
119
|
+
result2 = Map.prototype.addLayer("works", {}),
|
|
120
|
+
result3 = Map.prototype.addLayer("works", {visibility: false}),
|
|
121
|
+
result4 = Map.prototype.addLayer("works", {transparency: 50}),
|
|
122
|
+
result5 = Map.prototype.addLayer("works", {visibility: false, transparency: 20});
|
|
123
123
|
|
|
124
124
|
expect(result1.getOpacity()).toBe(1);
|
|
125
125
|
expect(result1.getVisible()).toBe(true);
|