@masterportal/masterportalapi 2.34.0 → 2.36.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 +17 -4
- package/jest.config.js +3 -2
- package/package.json +5 -5
- package/src/layer/geojson/index.js +1 -1
- package/src/layer/wfs.js +1 -1
- package/src/layer/wms.js +4 -1
- package/src/maps/olcs/3dUtils/fixedOverlaySynchronizer.js +1 -1
- package/src/maps/olcs/3dUtils/wmsRasterSynchronizer.js +4 -4
- package/src/maps/olcs/olcsMap.js +2 -2
- package/src/vectorStyle/styles/point/stylePoint.js +1 -1
- package/src/vectorStyle/styles/point/stylePointCircle.js +7 -5
- package/test/layer/wms.test.js +4 -1
- package/test/vectorStyle/createStyle.test.js +20 -2
- package/test/vectorStyle/styles/point/stylePointCircle.test.js +46 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,13 +3,26 @@
|
|
|
3
3
|
|
|
4
4
|
The [Semantic Versioning](https://semver.org/spec/v2.0.0.html) is used.
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## 2.36.0 - 2024-04-11
|
|
7
7
|
|
|
8
|
-
### Added
|
|
9
8
|
### Changed
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
- The following packages have been updated:
|
|
10
|
+
- dependencies:
|
|
11
|
+
- ol: 8.2.0 to 9.1.0
|
|
12
|
+
- ol-mapbox-style: 12.0.0 to 12.2.1
|
|
13
|
+
- olcs: 2.16.0 to 2.19.3
|
|
14
|
+
- proj4: 2.9.1 to 2.10.0
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 2.35.0 - 2024-04-02
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- WMS: Support for using CQL filters by attribute added.
|
|
22
|
+
|
|
12
23
|
### Fixed
|
|
24
|
+
- Issue Masterportal #1127: fixed styling of clustered and not clustered circles.
|
|
25
|
+
- WFST parsing featureType wfs.js with attribute required true by default.
|
|
13
26
|
|
|
14
27
|
---
|
|
15
28
|
## 2.34.0 - 2024-03-04
|
package/jest.config.js
CHANGED
|
@@ -11,9 +11,10 @@ module.exports = {
|
|
|
11
11
|
"collectCoverageFrom": ["src/**/*.js"],
|
|
12
12
|
/** coverage reporters */
|
|
13
13
|
"coverageReporters": ["json", "lcov", "text", "clover", "cobertura"],
|
|
14
|
-
/** mapping svg to string representation since jest can't handle svg */
|
|
14
|
+
/** mapping svg to string representation since jest can't handle svg and mapping olcs paths*/
|
|
15
15
|
"moduleNameMapper": {
|
|
16
|
-
"marker.svg": "<rootDir>/public/stringMarker.js"
|
|
16
|
+
"marker.svg": "<rootDir>/public/stringMarker.js",
|
|
17
|
+
"olcs/lib/olcs/(.*)$": "<rootDir>/node_modules/olcs/lib/olcs/$1"
|
|
17
18
|
},
|
|
18
19
|
"testEnvironment": "jsdom",
|
|
19
20
|
"setupFilesAfterEnv": ["./jest.setup.js"],
|
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.36.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Basic functions of the Masterportal as api",
|
|
7
7
|
"repository": {
|
|
@@ -21,10 +21,10 @@
|
|
|
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.
|
|
27
|
-
"proj4": "^2.
|
|
24
|
+
"ol": "9.1.0",
|
|
25
|
+
"ol-mapbox-style": "12.2.1",
|
|
26
|
+
"olcs": "2.19.3",
|
|
27
|
+
"proj4": "^2.10.0",
|
|
28
28
|
"xml2js": "^0.6.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
package/src/layer/wfs.js
CHANGED
package/src/layer/wms.js
CHANGED
|
@@ -55,6 +55,7 @@ export function addOptionalParams (params, rawLayer) {
|
|
|
55
55
|
* @param {boolean} rawLayer.singleTile - whether only one tile shall be requested that fills the whole view
|
|
56
56
|
* @param {boolean} rawLayer.STYLES - styles of the layer, if available
|
|
57
57
|
* @param {(string|number)} rawLayer.tilesize - if singleTile is true, this is the requested tilesize
|
|
58
|
+
* @param {string} rawLayer.cqlFilter - CQL filter
|
|
58
59
|
* @returns {object} maps query parameter names to values
|
|
59
60
|
*/
|
|
60
61
|
export function makeParams (rawLayer) {
|
|
@@ -66,7 +67,8 @@ export function makeParams (rawLayer) {
|
|
|
66
67
|
LAYERS: rawLayer.layers,
|
|
67
68
|
VERSION: rawLayer.version,
|
|
68
69
|
TRANSPARENT: rawLayer.transparent,
|
|
69
|
-
SINGLETILE: rawLayer.singleTile
|
|
70
|
+
SINGLETILE: rawLayer.singleTile,
|
|
71
|
+
CQL_FILTER: rawLayer.cqlFilter
|
|
70
72
|
}, rawLayer.singleTile ? {} : {WIDTH: rawLayer.tilesize, HEIGHT: rawLayer.tilesize});
|
|
71
73
|
|
|
72
74
|
params = addOptionalParams(params, rawLayer);
|
|
@@ -90,6 +92,7 @@ async function defaultTileLoadFunction (imageTile, src) {
|
|
|
90
92
|
* @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
|
|
91
93
|
* @param {string|number} [rawLayer.tilesize] - optional needed to create the tileGrid
|
|
92
94
|
* @param {string|"anonymous"} [rawLayer.crossOrigin] - optional needed for CORS requests of image data, to enable canvas export
|
|
95
|
+
* @param {string} [rawLayer.cqlFilter] - optional CQL filter to add to the request
|
|
93
96
|
* @param {object} options - optional resolutions and origin to create the TileGrid
|
|
94
97
|
* @param {Array} [options.resolutions] - optional resolutions to create the TileGrid, must be in descending order
|
|
95
98
|
* @param {Array} [options.origin] - optional origin to create the TileGrid
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* @module olcs.WMSRasterSynchronizer
|
|
3
3
|
*/
|
|
4
4
|
import olLayerGroup from "ol/layer/Group.js";
|
|
5
|
-
import {getUid} from "olcs/util.js";
|
|
5
|
+
import {getUid} from "olcs/lib/olcs/util.js";
|
|
6
6
|
import TileWMS from "ol/source/TileWMS.js";
|
|
7
7
|
import ImageWMS from "ol/source/ImageWMS.js";
|
|
8
8
|
import WMTS from "ol/source/WMTS.js";
|
|
9
|
-
import
|
|
10
|
-
import {extentToRectangle, tileLayerToImageryLayer, updateCesiumLayerProperties} from "olcs/core.js";
|
|
9
|
+
import AbstractSynchronizer from "olcs/lib/olcs/AbstractSynchronizer.js";
|
|
10
|
+
import {extentToRectangle, tileLayerToImageryLayer, updateCesiumLayerProperties} from "olcs/lib/olcs/core.js";
|
|
11
11
|
import {Tile, Image as ImageLayer} from "ol/layer.js";
|
|
12
12
|
import {stableSort} from "ol/array.js";
|
|
13
13
|
import {getBottomLeft, getBottomRight, getTopRight, getTopLeft} from "ol/extent.js";
|
|
@@ -18,7 +18,7 @@ import proj4 from "proj4";
|
|
|
18
18
|
/**
|
|
19
19
|
* Represents a WMSRasterSynchronizer.
|
|
20
20
|
*/
|
|
21
|
-
class WMSRasterSynchronizer extends
|
|
21
|
+
class WMSRasterSynchronizer extends AbstractSynchronizer {
|
|
22
22
|
/**
|
|
23
23
|
* This object takes care of one-directional synchronization of
|
|
24
24
|
* Openlayers WMS raster layers to the given Cesium globe. This Synchronizer
|
package/src/maps/olcs/olcsMap.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import OLCesium from "olcs
|
|
1
|
+
import OLCesium from "olcs";
|
|
2
2
|
import {transform, get} from "ol/proj.js";
|
|
3
|
-
import VectorSynchronizer from "olcs/VectorSynchronizer.js";
|
|
3
|
+
import VectorSynchronizer from "olcs/lib/olcs/VectorSynchronizer.js";
|
|
4
4
|
|
|
5
5
|
import FixedOverlaySynchronizer from "./3dUtils/fixedOverlaySynchronizer.js";
|
|
6
6
|
import WMSRasterSynchronizer from "./3dUtils/wmsRasterSynchronizer.js";
|
|
@@ -61,7 +61,7 @@ class PointStyle extends StyleClass {
|
|
|
61
61
|
return createIconStyle(this.attributes, this.feature, isClustered);
|
|
62
62
|
}
|
|
63
63
|
else if (type === "circle") {
|
|
64
|
-
return createCircleStyle(this.attributes, isClustered);
|
|
64
|
+
return createCircleStyle(this.attributes, this.feature, isClustered);
|
|
65
65
|
}
|
|
66
66
|
else if (type === "nominal") {
|
|
67
67
|
return isClustered ? createIconStyle(this.attributes, this.feature, isClustered) : createNominalPointStyle(this.attributes, this.feature, defaultStyle.point.imageName);
|
|
@@ -5,14 +5,16 @@ import {returnColor} from "../../lib/colorConvertions";
|
|
|
5
5
|
* Creates pointStyle as circle.
|
|
6
6
|
* all features get same circle.
|
|
7
7
|
* @param {Object} attributes - The attributes from the circle
|
|
8
|
+
* @param {Object} feature - The feature
|
|
8
9
|
* @param {Boolean} isClustered - true if features are clustered
|
|
9
10
|
* @returns {ol/style} - The created style.
|
|
10
11
|
*/
|
|
11
|
-
export function createCircleStyle (attributes, isClustered) {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
export function createCircleStyle (attributes, feature, isClustered) {
|
|
13
|
+
const showCluster = isClustered && feature.get("features")?.length > 1,
|
|
14
|
+
radius = showCluster ? parseFloat(attributes.clusterCircleRadius, 10) : parseFloat(attributes.circleRadius, 10),
|
|
15
|
+
fillcolor = showCluster ? returnColor(attributes.clusterCircleFillColor, "rgb") : returnColor(attributes.circleFillColor, "rgb"),
|
|
16
|
+
strokecolor = showCluster ? returnColor(attributes.clusterCircleStrokeColor, "rgb") : returnColor(attributes.circleStrokeColor, "rgb"),
|
|
17
|
+
strokewidth = showCluster ? parseFloat(attributes.clusterCircleStrokeWidth, 10) : parseFloat(attributes.circleStrokeWidth, 10);
|
|
16
18
|
|
|
17
19
|
return new Style({
|
|
18
20
|
image: new CircleStyle({
|
package/test/layer/wms.test.js
CHANGED
|
@@ -25,7 +25,8 @@ describe("wms.js", function () {
|
|
|
25
25
|
LAYERS: "b",
|
|
26
26
|
VERSION: "c",
|
|
27
27
|
TRANSPARENT: "d",
|
|
28
|
-
SINGLETILE: "e"
|
|
28
|
+
SINGLETILE: "e",
|
|
29
|
+
CQL_FILTER: "f"
|
|
29
30
|
};
|
|
30
31
|
});
|
|
31
32
|
|
|
@@ -38,6 +39,7 @@ describe("wms.js", function () {
|
|
|
38
39
|
expect(extendedParams.VERSION).toEqual("c");
|
|
39
40
|
expect(extendedParams.TRANSPARENT).toEqual("d");
|
|
40
41
|
expect(extendedParams.SINGLETILE).toEqual("e");
|
|
42
|
+
expect(extendedParams.CQL_FILTER).toEqual("f");
|
|
41
43
|
expect(extendedParams.TIME).toEqual("The time");
|
|
42
44
|
expect(extendedParams.STYLES).not.toBeDefined();
|
|
43
45
|
});
|
|
@@ -50,6 +52,7 @@ describe("wms.js", function () {
|
|
|
50
52
|
expect(extendedParams.VERSION).toEqual("c");
|
|
51
53
|
expect(extendedParams.TRANSPARENT).toEqual("d");
|
|
52
54
|
expect(extendedParams.SINGLETILE).toEqual("e");
|
|
55
|
+
expect(extendedParams.CQL_FILTER).toEqual("f");
|
|
53
56
|
expect(extendedParams.STYLES).toEqual("The style");
|
|
54
57
|
expect(extendedParams.TIME).not.toBeDefined();
|
|
55
58
|
});
|
|
@@ -402,8 +402,17 @@ describe("getSimpleGeometryStyle", function () {
|
|
|
402
402
|
});
|
|
403
403
|
|
|
404
404
|
it("should return ol point style - clustered", function () {
|
|
405
|
+
const geometry = jsonObjects[0].getGeometry();
|
|
406
|
+
let styleObject = null;
|
|
407
|
+
|
|
405
408
|
isClustered = true;
|
|
406
|
-
|
|
409
|
+
jsonObjects[0].get = (key) => {
|
|
410
|
+
if (key === "features") {
|
|
411
|
+
return [{id: "cluster1"}, {id: "cluster2"}];
|
|
412
|
+
}
|
|
413
|
+
return geometry;
|
|
414
|
+
};
|
|
415
|
+
styleObject = createStyle.getSimpleGeometryStyle("Point", jsonObjects[0], rules[0], isClustered, wfsImgPathFromConfig);
|
|
407
416
|
|
|
408
417
|
expect(styleObject).toBeInstanceOf(PointStyle);
|
|
409
418
|
expect(typeof styleObject).toBe("object");
|
|
@@ -470,9 +479,18 @@ describe("getMultiGeometryStyle", function () {
|
|
|
470
479
|
expect(style[1].getStyle().getImage().getStroke().getColor()).toEqual(rules[0].style.circleStrokeColor);
|
|
471
480
|
});
|
|
472
481
|
it("should include ol point style- is clustered and use rules for stroke color", function () {
|
|
482
|
+
const geometry = jsonObjects[3].getGeometry();
|
|
483
|
+
let style = null;
|
|
484
|
+
|
|
473
485
|
isClustered = true;
|
|
486
|
+
jsonObjects[3].get = (key) => {
|
|
487
|
+
if (key === "features") {
|
|
488
|
+
return [{id: "cluster1"}, {id: "cluster2"}];
|
|
489
|
+
}
|
|
490
|
+
return geometry;
|
|
491
|
+
};
|
|
474
492
|
rules[0].style.clusterCircleStrokeColor = [1, 2, 3, 4];
|
|
475
|
-
|
|
493
|
+
style = createStyle.getMultiGeometryStyle("MultiPoint", jsonObjects[3], rules, isClustered, wfsImgPathFromConfig);
|
|
476
494
|
|
|
477
495
|
expect(style[0]).toBeInstanceOf(PointStyle);
|
|
478
496
|
expect(style[1]).toBeInstanceOf(PointStyle);
|
|
@@ -7,24 +7,61 @@ describe("stylePointCircle.js", () => {
|
|
|
7
7
|
circleRadius: 15,
|
|
8
8
|
circleFillColor: [10, 200, 100, 0.5],
|
|
9
9
|
circleStrokeColor: [10, 200, 100, 0.5],
|
|
10
|
-
circleStrokeWidth: 1
|
|
11
|
-
},
|
|
12
|
-
clusterAttributes = {
|
|
10
|
+
circleStrokeWidth: 1,
|
|
13
11
|
clusterCircleRadius: 20,
|
|
14
12
|
clusterCircleFillColor: [10, 200, 100, 0.5],
|
|
15
13
|
clusterCircleStrokeColor: [10, 200, 100, 0.5],
|
|
16
14
|
clusterCircleStrokeWidth: 1
|
|
15
|
+
},
|
|
16
|
+
feature = {
|
|
17
|
+
getProperties: () => {
|
|
18
|
+
return {
|
|
19
|
+
name: "singleFeature",
|
|
20
|
+
id: "123"
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
get: () => {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
clusteredFeature = {
|
|
28
|
+
get: () => {
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
name: "singleFeature1",
|
|
32
|
+
id: "123"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "singleFeature2",
|
|
36
|
+
id: "456"
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
}
|
|
17
40
|
};
|
|
18
41
|
|
|
19
42
|
it("should create circle style", () => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
expect(
|
|
43
|
+
const style = stylePointCircle.createCircleStyle(attributes, feature, false);
|
|
44
|
+
|
|
45
|
+
expect(style).toBeInstanceOf(Style);
|
|
46
|
+
expect(style.getImage()).toBeInstanceOf(Circle);
|
|
47
|
+
expect(style.getImage().getRadius()).toEqual(15);
|
|
48
|
+
expect(style.getImage().getFill().getColor()).toEqual(attributes.circleFillColor);
|
|
23
49
|
});
|
|
24
50
|
it("should create circle cluster style", () => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
expect(
|
|
51
|
+
const style = stylePointCircle.createCircleStyle(attributes, clusteredFeature, true);
|
|
52
|
+
|
|
53
|
+
expect(style).toBeInstanceOf(Style);
|
|
54
|
+
expect(style.getImage()).toBeInstanceOf(Circle);
|
|
55
|
+
expect(style.getImage().getRadius()).toEqual(20);
|
|
56
|
+
expect(style.getImage().getFill().getColor()).toEqual(attributes.clusterCircleFillColor);
|
|
57
|
+
});
|
|
58
|
+
it("should create circle not cluster style - respects feature.get('features')", () => {
|
|
59
|
+
const style = stylePointCircle.createCircleStyle(attributes, feature, true);
|
|
60
|
+
|
|
61
|
+
expect(style).toBeInstanceOf(Style);
|
|
62
|
+
expect(style.getImage()).toBeInstanceOf(Circle);
|
|
63
|
+
expect(style.getImage().getRadius()).toEqual(15);
|
|
64
|
+
expect(style.getImage().getFill().getColor()).toEqual(attributes.circleFillColor);
|
|
28
65
|
});
|
|
29
66
|
});
|
|
30
67
|
});
|