@masterportal/masterportalapi 2.28.0 → 2.29.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 CHANGED
@@ -16,6 +16,46 @@
16
16
 
17
17
  ---
18
18
 
19
+ ### 2.29.0 - 2023-10-27
20
+ ## Added
21
+ - The following packages from parcel automatic were installed for node builtin:
22
+ - dependencies:
23
+ - assert": 2.1.0,
24
+ - browserify-zlib: 0.2.0,
25
+ - https-browserify: 1.0.0
26
+ - stream-http: 3.2.0
27
+ - url: 0.11.3
28
+ - util: 0.12.5
29
+ - The following packages have been added:
30
+ - dependencies:
31
+ - ol-mapbox-style: 12.0.0
32
+
33
+ ## Changed
34
+ - The following packages have been updated:
35
+ - dependencies:
36
+ - core-js: 3.32.0 to 3.33.1
37
+ - dayjs: 1.11.9 to 1.11.10
38
+ - ol: 7.5.2 to 8.1.0 (includes the change of the symbol style format in ol/layer/WebGLPointsLayer)
39
+ - olcs: 2.15.0 to 2.16.0
40
+ - proj4: 2.9.0 to 2.9.1
41
+ - devDependencies:
42
+ - @babel/core: 7.22.9 to 7.23.2
43
+ - @babel/plugin-transform-modules-commonjs: 7.22.5 to 7.23.2
44
+ - @parcel/transformer-sass: 2.9.3 to 2.10.0
45
+ - @swc/jest: 0.2.27 to 0.2.29
46
+ - eslint: 8.46.0 to 8.52.0
47
+ - jest: 29.6.2 to 29.7.0
48
+ - jest-environment-jsdom: 29.6.2 to 29.7.0
49
+ - parcel: 2.9.3 to 2.10.0
50
+ - sass: 1.64.2 to 1.69.4
51
+ - Revert Cesium.Cesium3DTileset.fromUrl(url, options) adaptions in tileset.js for Cesium v1.107 deprecated warnings
52
+
53
+ ## Fixed
54
+ - styleList: styles of type oaf are now also added to the stylelist
55
+ - Issue Masterportal #1052 VectorStyle: path to an icon in the map or in the legend in style.json may be an icon name, a relative path to icon, a complete url or an svg.
56
+
57
+ ---
58
+
19
59
  ### 2.28.0 - 2023-09-27
20
60
  ## Added
21
61
  - GfiAttributes: GFI Attributes can now be configured as HTML tags, e.g <a>, <img> or <iframe>
@@ -56,30 +56,11 @@
56
56
  "renderer": "webgl",
57
57
  "hitTolerance": 20,
58
58
  "isPointLayer": true,
59
- "style": {
60
- "symbol": {
61
- "symbolType": "circle",
62
- "size": [
63
- "interpolate",
64
- ["linear"],
65
- ["get", "Total_votes"],
66
- 0,
67
- 6,
68
- 18,
69
- 24
70
- ],
71
- "color": [
72
- "interpolate",
73
- ["linear"],
74
- ["get", "compound"],
75
- -1,
76
- [240, 40, 30],
77
- 1,
78
- [0, 200, 60]
79
- ],
80
- "opacity": 0.8,
81
- "rotateWithView": true
82
- }
59
+ "style":{
60
+ "circle-radius": [ "interpolate", ["linear"], ["get", "Total_votes"], 0, 3, 18, 12 ],
61
+ "circle-fill-color": [ "interpolate", ["linear"], ["get", "compound"], -1, [240, 40, 30], 1, [0, 200, 60] ],
62
+ "circle-rotate-with-view": true,
63
+ "circle-opacity": 0.8
83
64
  }
84
65
  }
85
66
  ],
@@ -32,7 +32,7 @@
32
32
  "id": "2001",
33
33
  "typ": "GeoJSON",
34
34
  "name": "Landesgrenze Hamburg",
35
- "url": "https://geoportal-hamburg.de/lgv-config/landesgrenze_hh.json"
35
+ "url": "https://geodienste.hamburg.de/lgv-config/landesgrenze_hh.json"
36
36
  },
37
37
  {
38
38
  "id": "3001",
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.28.0",
4
+ "version": "2.29.0",
5
5
  "license": "MIT",
6
6
  "description": "Basic functions of the Masterportal as api",
7
7
  "repository": {
@@ -19,34 +19,41 @@
19
19
  "prepare": "husky install"
20
20
  },
21
21
  "dependencies": {
22
- "core-js": "^3.32.0",
23
- "dayjs": "^1.11.9",
24
- "ol": "7.5.2",
25
- "olcs": "2.15.0",
26
- "proj4": "^2.9.0",
22
+ "core-js": "^3.33.1",
23
+ "dayjs": "^1.11.10",
24
+ "ol": "8.1.0",
25
+ "ol-mapbox-style": "12.0.0",
26
+ "olcs": "2.16.0",
27
+ "proj4": "^2.9.1",
27
28
  "xml2js": "^0.6.2"
28
29
  },
29
30
  "devDependencies": {
30
- "@babel/core": "^7.22.9",
31
- "@babel/plugin-transform-modules-commonjs": "^7.22.5",
32
- "@parcel/transformer-sass": "^2.9.3",
33
- "@swc/jest": "^0.2.27",
31
+ "@babel/core": "^7.23.2",
32
+ "@babel/plugin-transform-modules-commonjs": "^7.23.0",
33
+ "@parcel/transformer-sass": "^2.10.0",
34
+ "@swc/jest": "^0.2.29",
35
+ "assert": "^2.1.0",
36
+ "browserify-zlib": "^0.2.0",
34
37
  "buffer": "^6.0.3",
35
38
  "canvas": "^2.11.2",
36
- "eslint": "^8.46.0",
39
+ "eslint": "^8.52.0",
37
40
  "events": "^3.3.0",
41
+ "https-browserify": "^1.0.0",
38
42
  "husky": "^8.0.3",
39
- "jest": "^29.6.2",
43
+ "jest": "^29.7.0",
40
44
  "jest-canvas-mock": "^2.5.2",
41
- "jest-environment-jsdom": "^29.6.2",
45
+ "jest-environment-jsdom": "^29.7.0",
42
46
  "jest-fetch-mock": "^3.0.3",
43
47
  "jsdoc": "^4.0.2",
44
- "parcel": "^2.9.3",
48
+ "parcel": "^2.10.0",
45
49
  "process": "^0.11.10",
46
- "sass": "^1.64.2",
50
+ "sass": "^1.69.4",
47
51
  "stream-browserify": "^3.0.0",
52
+ "stream-http": "^3.2.0",
48
53
  "timers-browserify": "^2.0.12",
49
- "use-resize-observer": "^9.1.0"
54
+ "url": "^0.11.3",
55
+ "use-resize-observer": "^9.1.0",
56
+ "util": "^0.12.5"
50
57
  },
51
58
  "peerDependencies": {
52
59
  "@cesium/engine": "^2.4.1"
@@ -13,8 +13,8 @@ function createTileSet (rawLayer) {
13
13
  if (rawLayer.cesium3DTilesetOptions) {
14
14
  Object.assign(options, rawLayer.cesium3DTilesetOptions);
15
15
  }
16
-
17
- return Promise.resolve(Cesium.Cesium3DTileset.fromUrl(url, options));
16
+ options.url = url;
17
+ return new Cesium.Cesium3DTileset(options);
18
18
  }
19
19
 
20
20
  /**
@@ -33,13 +33,8 @@ export default function Tileset (rawLayer) {
33
33
  typ: rawLayer.typ
34
34
  };
35
35
  if (Cesium) {
36
- this.tileset = Promise.resolve(createTileSet(rawLayer));
37
- this.tileset.then(function (tileset) {
38
- if (tileset) {
39
- tileset.layerReferenceId = rawLayer.id;
40
- }
41
- });
42
-
36
+ this.tileset = createTileSet(rawLayer);
37
+ this.tileset.layerReferenceId = rawLayer.id;
43
38
  }
44
39
  }
45
40
 
@@ -63,11 +58,7 @@ Tileset.prototype.setOpacity = function (opacity) {
63
58
  color = splitValues.toString();
64
59
  }
65
60
 
66
- this.tileset.then(function (tileset) {
67
- if (tileset) {
68
- tileset.style = new Cesium.Cesium3DTileStyle({color});
69
- }
70
- });
61
+ this.tileset.style = new Cesium.Cesium3DTileStyle({color});
71
62
  };
72
63
 
73
64
  /**
@@ -80,16 +71,10 @@ Tileset.prototype.setVisible = function (value, map) {
80
71
  if (map && typeof map.getCesiumScene === "function") {
81
72
  if (value) {
82
73
  if (!map.getCesiumScene().primitives.contains(this.tileset)) {
83
- this.tileset.then(function (tileset) {
84
- map.getCesiumScene().primitives.add(tileset);
85
- });
74
+ map.getCesiumScene().primitives.add(this.tileset);
86
75
  }
87
76
  }
88
- this.tileset.then(function (tileset) {
89
- if (tileset) {
90
- tileset.show = value;
91
- }
92
- });
77
+ this.tileset.show = value;
93
78
  }
94
79
  };
95
80
 
@@ -6,8 +6,8 @@ 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
8
  import WMTS from "ol/source/WMTS.js";
9
- import olcsAbstractSynchronizer from "olcs/AbstractSynchronizer.ts";
10
- import {extentToRectangle, tileLayerToImageryLayer, updateCesiumLayerProperties} from "olcs/core.ts";
9
+ import olcsAbstractSynchronizer from "olcs/AbstractSynchronizer.js";
10
+ import {extentToRectangle, tileLayerToImageryLayer, updateCesiumLayerProperties} from "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";
@@ -1,6 +1,6 @@
1
- import OLCesium from "olcs/OLCesium.ts";
1
+ import OLCesium from "olcs/OLCesium.js";
2
2
  import {transform, get} from "ol/proj.js";
3
- import VectorSynchronizer from "olcs/VectorSynchronizer.ts";
3
+ import VectorSynchronizer from "olcs/VectorSynchronizer.js";
4
4
 
5
5
  import FixedOverlaySynchronizer from "./3dUtils/fixedOverlaySynchronizer.js";
6
6
  import WMSRasterSynchronizer from "./3dUtils/wmsRasterSynchronizer.js";
@@ -15,14 +15,11 @@ import {packColor, parseLiteralStyle} from "ol/webgl/styleparser.js";
15
15
  * @private
16
16
  */
17
17
  const defaultPointStyle = {
18
- symbol: {
19
- symbolType: "circle",
20
- size: 20,
21
- color: "#006688",
22
- rotateWithView: false,
23
- offset: [0, 0],
24
- opacity: 0.6
25
- }
18
+ "circle-radius": 10,
19
+ "circle-fill-color": "#006688",
20
+ "circle-rotate-with-view": false,
21
+ "circle-displacement": [0, 0],
22
+ "circle-opacity": 0.6
26
23
  },
27
24
 
28
25
  defaultPolygonStyle = {
@@ -33,14 +30,13 @@ const defaultPointStyle = {
33
30
  },
34
31
 
35
32
  /** @type {import('ol/style/literal.js').LiteralStyle} */
36
- style = {
33
+ style = Object.assign({
37
34
  "stroke-color": ["get", "strokeColor"],
38
35
  "stroke-width": ["get", "strokeWidth", "number"],
39
36
  "fill-color": ["get", "fillColor"],
40
37
  "opacity": ["get", "opacity", "number"],
41
- "size": ["get", "circleSize", "number"],
42
- symbol: defaultPointStyle.symbol
43
- };
38
+ "size": ["get", "circleSize", "number"]
39
+ }, defaultPointStyle);
44
40
 
45
41
  /**
46
42
  * Creates a vector layer with custom renderer.
@@ -194,14 +190,14 @@ export function formatFeatureStyles (feature, styleObject) {
194
190
  feature.set("strokeColor", strokeColor || defaultPolygonStyle.strokeColor);
195
191
  feature.set("strokeWidth", strokeWidth || defaultPolygonStyle.strokeWidth);
196
192
  feature.set("opacity", fillColor ? (rule.style.polygonFillColor || rule.style.circleFillColor)[3] : defaultPolygonStyle.opacity);
197
- feature.set("circleSize", size || defaultPointStyle.symbol.size);
193
+ feature.set("circleSize", size || defaultPointStyle["circle-radius"] * 2);
198
194
  }
199
195
  else {
200
196
  feature.set("fillColor", defaultPolygonStyle.fillColor);
201
197
  feature.set("strokeColor", defaultPolygonStyle.strokeColor);
202
198
  feature.set("strokeWidth", defaultPolygonStyle.strokeWidth);
203
199
  feature.set("opacity", defaultPolygonStyle.opacity);
204
- feature.set("circleSize", defaultPointStyle.symbol.size);
200
+ feature.set("circleSize", defaultPointStyle["circle-radius"] * 2);
205
201
  }
206
202
  }
207
203
 
@@ -30,7 +30,7 @@ function getStyleIdsFromLayers () {
30
30
 
31
31
  if (configuredLayers) {
32
32
  configuredLayers.forEach(layer => {
33
- if (layer.typ === "WFS" || layer.typ === "GeoJSON" || layer.typ === "SensorThings" || layer.typ === "TileSet3D") {
33
+ if (layer.typ === "WFS" || layer.typ === "GeoJSON" || layer.typ === "SensorThings" || layer.typ === "TileSet3D" || layer.typ === "OAF") {
34
34
  if (layer?.styleId) {
35
35
  styleIds.push(layer.styleId);
36
36
  }
@@ -1,6 +1,5 @@
1
1
  import {Style, Icon} from "ol/style.js";
2
2
  import {prepareValue, isObjectPath} from "../../../lib/attributeMapper";
3
- import PointStyle from "./stylePoint";
4
3
 
5
4
  /**
6
5
  * Returns the rotation value and its corresponding value according to style.json.
@@ -33,21 +32,23 @@ export function getRotationValue (rotation, featureValues) {
33
32
  */
34
33
  export function createIconStyle (attributes, feature, isClustered) {
35
34
  const showCluster = isClustered && feature.get("features")?.length > 1,
36
-
37
- height = showCluster ? attributes.clusterImageHeight : attributes.imageHeight,
38
35
  imageName = showCluster ? attributes.clusterImageName : attributes.imageName,
39
36
  imageOffsetX = showCluster ? attributes.clusterImageOffsetY : attributes.imageOffsetX,
40
37
  imageOffsetY = showCluster ? attributes.clusterImageOffsetX : attributes.imageOffsetY,
41
38
  scale = showCluster ? attributes.clusterImageScale : attributes.imageScale,
42
- src = imageName.indexOf("/") === -1 ? attributes.imagePath + imageName : imageName,
43
- width = showCluster ? attributes.clusterImageWidth : attributes.imageWidth,
44
- iconOptions = {
45
- crossOrigin: "anonymous",
46
- src: src.startsWith("<svg") ? "data:image/svg+xml;charset=utf-8," + encodeURIComponent(src) : src,
47
- scale,
48
- anchor: [parseFloat(imageOffsetX), parseFloat(imageOffsetY)],
49
- imgSize: src.indexOf(".svg") > -1 ? [width, height] : ""
50
- };
39
+ wfsImgPath = attributes.imagePath;
40
+ let iconOptions = {},
41
+ src = imageName;
42
+
43
+ if (!imageName.startsWith("https:") && !imageName.startsWith("<svg")) {
44
+ src = wfsImgPath + imageName;
45
+ }
46
+ iconOptions = {
47
+ crossOrigin: "anonymous",
48
+ src: src.startsWith("<svg") ? "data:image/svg+xml;charset=utf-8," + encodeURIComponent(src) : src,
49
+ scale,
50
+ anchor: [parseFloat(imageOffsetX), parseFloat(imageOffsetY)]
51
+ };
51
52
 
52
53
  if (!showCluster) {
53
54
  iconOptions.anchorXUnits = attributes.imageOffsetXUnit;
@@ -67,13 +68,10 @@ export function createIconStyle (attributes, feature, isClustered) {
67
68
  * @return {ol.Style} style
68
69
  */
69
70
  export function createSVGStyle (svgPath) {
70
- const size = PointStyle.prototype.getSize();
71
-
72
71
  return new Style({
73
72
  image: new Icon({
74
73
  crossOrigin: "anonymous",
75
- src: "data:image/svg+xml;charset=utf-8," + encodeURIComponent(svgPath),
76
- imgSize: [size, size]
74
+ src: "data:image/svg+xml;charset=utf-8," + encodeURIComponent(svgPath)
77
75
  })
78
76
  });
79
77
  }
@@ -6,12 +6,11 @@ describe("tileset.js", function () {
6
6
 
7
7
  beforeEach(() => {
8
8
  global.Cesium = {};
9
- global.Cesium.Cesium3DTileset = {};
10
- global.Cesium.Cesium3DTileset.fromUrl = jest.fn();
9
+ global.Cesium.Cesium3DTileset = jest.fn();
11
10
  global.Cesium.Cesium3DTileStyle = jest.fn(color => color);
12
11
  attr = {
13
12
  id: "4002",
14
- name: "Gebäude LoD2",
13
+ name: "Gebäude LoD2",
15
14
  url: "https://geoportal-hamburg.de/gdi3d/datasource-data/LoD2",
16
15
  typ: "TileSet3D",
17
16
  cesium3DTilesetOptions: {
@@ -29,9 +28,7 @@ describe("tileset.js", function () {
29
28
  };
30
29
  }
31
30
  };
32
- cesium3DTilesetSpy = jest.spyOn(global.Cesium.Cesium3DTileset, "fromUrl").mockImplementation(() => {
33
- return Promise.resolve({});
34
- });
31
+ cesium3DTilesetSpy = jest.spyOn(global.Cesium, "Cesium3DTileset");
35
32
  console.warn = jest.fn();
36
33
  });
37
34
 
@@ -41,23 +38,21 @@ describe("tileset.js", function () {
41
38
  console.warn = consoleWarn;
42
39
  });
43
40
 
44
- async function checkAttributes (layer, attrs) {
45
- const tileset = await layer.tileset;
46
-
41
+ function checkAttributes (layer, attrs) {
47
42
  expect(layer.get("name")).toEqual(attrs.name);
48
43
  expect(layer.get("typ")).toEqual(attrs.typ);
49
44
  expect(layer.get("id")).toEqual(attrs.id);
50
- expect(tileset.layerReferenceId).toEqual(attrs.id);
45
+ expect(layer.tileset.layerReferenceId).toEqual(attrs.id);
51
46
  }
52
47
 
53
48
  describe("createLayer", function () {
54
49
  it("creates tileset layer without map", function () {
55
50
  const layer = new Tileset(attr);
56
51
 
52
+ checkAttributes(layer, attr);
57
53
  expect(layer.tileSet).toEqual(undefined);
58
54
  expect(layer.tileset.show).toEqual(undefined);
59
55
  expect(cesium3DTilesetSpy).toHaveBeenCalledTimes(1);
60
- checkAttributes(layer, attr);
61
56
  });
62
57
  it("creates 2 tileset layers with map and checks attributes", function () {
63
58
  const attr2 = {
@@ -75,62 +70,40 @@ describe("tileset.js", function () {
75
70
  });
76
71
  });
77
72
  describe("setOpacity", function () {
78
- it("calls setOpacity sets opacity to terrain style", function (done) {
73
+ it("calls setOpacity sets opacity to terrain style", function () {
79
74
  const layer = new Tileset(attr, map);
80
75
 
81
76
  layer.setOpacity(0.5);
82
77
 
83
- layer.tileset.then(function (tileset) {
84
- if (tileset) {
85
- expect(tileset.style).toEqual({color: "rgba(255, 255, 255, 0.5)"});
86
- done();
87
- }
88
- });
78
+ expect(layer.tileset.style).toEqual({color: "rgba(255, 255, 255, 0.5)"});
89
79
  });
90
80
  });
91
81
  describe("setVisible", function () {
92
- it("calls setVisible without map shall not fail", function (done) {
82
+ it("calls setVisible without map shall not fail", function () {
93
83
  const layer = new Tileset(attr, map);
94
84
 
95
85
  expect(layer.tileset.show).toEqual(undefined);
96
86
  layer.setVisible(true);
97
87
 
98
- layer.tileset.then(function (tileset) {
99
- if (tileset) {
100
- checkAttributes(layer, attr);
101
- expect(layer.tileset.show).toEqual(undefined);
102
- expect(cesium3DTilesetSpy).toHaveBeenCalledTimes(1);
103
- done();
104
- }
105
- });
88
+ checkAttributes(layer, attr);
89
+ expect(layer.tileset.show).toEqual(undefined);
90
+ expect(cesium3DTilesetSpy).toHaveBeenCalledTimes(1);
106
91
  });
107
- it("sets the tileset layer visible", function (done) {
92
+ it("sets the tileset layer visible", function () {
108
93
  const layer = new Tileset(attr, map);
109
94
 
110
95
  layer.setVisible(true, map);
111
-
112
- layer.tileset.then(function (tileset) {
113
- if (tileset) {
114
- checkAttributes(layer, attr);
115
- expect(tileset.show).toEqual(true);
116
- expect(cesium3DTilesetSpy).toHaveBeenCalledTimes(1);
117
- done();
118
- }
119
- });
96
+ checkAttributes(layer, attr);
97
+ expect(layer.tileset.show).toEqual(true);
98
+ expect(cesium3DTilesetSpy).toHaveBeenCalledTimes(1);
120
99
  });
121
- it("sets the tileset layer not visible", function (done) {
100
+ it("sets the tileset layer not visible", function () {
122
101
  const layer = new Tileset(attr, map);
123
102
 
124
103
  layer.setVisible(false, map);
125
-
126
- layer.tileset.then(function (tileset) {
127
- if (tileset) {
128
- checkAttributes(layer, attr);
129
- expect(tileset.show).toEqual(false);
130
- expect(cesium3DTilesetSpy).toHaveBeenCalledTimes(1);
131
- done();
132
- }
133
- });
104
+ checkAttributes(layer, attr);
105
+ expect(layer.tileset.show).toEqual(false);
106
+ expect(cesium3DTilesetSpy).toHaveBeenCalledTimes(1);
134
107
  });
135
108
  });
136
109
  describe("get", function () {
@@ -34,7 +34,7 @@ describe("stylePointIcon.js", () => {
34
34
  clusterAttributes = {
35
35
  clusterImageName: "bild.svg",
36
36
  clusterImageWidth: 10,
37
- clusterImagePath: "/imagePath",
37
+ imagePath: "/imagePath",
38
38
  clusterImageHeight: 20,
39
39
  clusterImageScale: 1
40
40
  },
@@ -61,12 +61,87 @@ describe("stylePointIcon.js", () => {
61
61
  }
62
62
  };
63
63
 
64
- it("should create icon point style", () => {
64
+ it("should create icon point style with imageName without path", () => {
65
65
  expect(stylePointIcon.createIconStyle(attributes, feature, false)).toBeInstanceOf(Style);
66
66
  expect(stylePointIcon.createIconStyle(clusterAttributes, clusteredFeature, true)).toBeInstanceOf(Style);
67
67
  expect(stylePointIcon.createIconStyle(attributes, feature, false).getImage()).toBeInstanceOf(Icon);
68
68
  expect(stylePointIcon.createIconStyle(attributes, feature, false).getImage().getScale()).toEqual(1);
69
69
  });
70
+ it("should create icon point style with pure imageName and wfsImgPath exists", () => {
71
+ let style = null;
72
+
73
+ attributes.imageName = "Rathaus.svg";
74
+ attributes.imagePath = "./geodaten/icons/";
75
+ style = stylePointIcon.createIconStyle(attributes, feature, false);
76
+
77
+ expect(style).toBeInstanceOf(Style);
78
+ expect(style.getImage()).toBeInstanceOf(Icon);
79
+ expect(style.getImage().getSrc()).toEqual(attributes.imagePath + attributes.imageName);
80
+ });
81
+ it("should create clustered icon point style with pure imageName and wfsImgPath exists", () => {
82
+ let style = null;
83
+
84
+ clusterAttributes.clusterImageName = "Rathaus.svg";
85
+ clusterAttributes.imagePath = "./geodaten/icons/";
86
+ style = stylePointIcon.createIconStyle(clusterAttributes, clusteredFeature, true);
87
+
88
+ expect(style).toBeInstanceOf(Style);
89
+ expect(style.getImage()).toBeInstanceOf(Icon);
90
+ expect(style.getImage().getSrc()).toEqual(clusterAttributes.imagePath + clusterAttributes.clusterImageName);
91
+ });
92
+ it("should create icon point style with path in imageName and wfsImgPath exists", () => {
93
+ let style = null;
94
+
95
+ attributes.imageName = "/svg/poi/Rathaus.svg";
96
+ attributes.imagePath = "https://localhost:9001/portal/basic/geodaten/icons/";
97
+ style = stylePointIcon.createIconStyle(attributes, feature, false);
98
+
99
+ expect(style).toBeInstanceOf(Style);
100
+ expect(style.getImage()).toBeInstanceOf(Icon);
101
+ expect(style.getImage().getSrc()).toEqual(attributes.imagePath + attributes.imageName);
102
+ });
103
+ it("should create clustered icon point style with path in imageName and wfsImgPath exists", () => {
104
+ let style = null;
105
+
106
+ clusterAttributes.clusterImageName = "/svg/poi/Rathaus.svg";
107
+ clusterAttributes.imagePath = "https://localhost:9001/portal/basic/geodaten/icons/";
108
+ style = stylePointIcon.createIconStyle(clusterAttributes, clusteredFeature, true);
109
+
110
+ expect(style).toBeInstanceOf(Style);
111
+ expect(style.getImage()).toBeInstanceOf(Icon);
112
+ expect(style.getImage().getSrc()).toEqual(clusterAttributes.imagePath + clusterAttributes.clusterImageName);
113
+ });
114
+ it("should create icon point style with whole path in imageName and wfsImgPath is empty", () => {
115
+ let style = null;
116
+
117
+ attributes.imageName = "https://localhost:9001/portal/basic/geodaten/icons/svg/poi/Rathaus.svg";
118
+ style = stylePointIcon.createIconStyle(attributes, feature, false);
119
+
120
+ expect(style).toBeInstanceOf(Style);
121
+ expect(style.getImage()).toBeInstanceOf(Icon);
122
+ expect(style.getImage().getSrc()).toEqual(attributes.imageName);
123
+ });
124
+ it("should create clustered icon point style with whole path in imageName and wfsImgPath is empty", () => {
125
+ let style = null;
126
+
127
+ clusterAttributes.clusterImageName = "https://localhost:9001/portal/basic/geodaten/icons/svg/poi/Rathaus.svg";
128
+ clusterAttributes.imagePath = "";
129
+ style = stylePointIcon.createIconStyle(clusterAttributes, clusteredFeature, true);
130
+
131
+ expect(style).toBeInstanceOf(Style);
132
+ expect(style.getImage()).toBeInstanceOf(Icon);
133
+ expect(style.getImage().getSrc()).toEqual(clusterAttributes.clusterImageName);
134
+ });
135
+ it("should create icon point style with svg", () => {
136
+ let style = null;
137
+
138
+ attributes.imageName = "<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='#E10019' class='bi bi-geo-fill' viewBox='0 0 16 16'><path fill-rule='evenodd' d='M4 4a4 4 0 1 1 4.5 3.969V13.5a.5.5 0 0 1-1 0V7.97A4 4 0 0 1 4 3.999zm2.493 8.574a.5.5 0 0 1-.411.575c-.712.118-1.28.295-1.655.493a1.319 1.319 0 0 0-.37.265.301.301 0 0 0-.057.09V14l.002.008a.147.147 0 0 0 .016.033.617.617 0 0 0 .145.15c.165.13.435.27.813.395.751.25 1.82.414 3.024.414s2.273-.163 3.024-.414c.378-.126.648-.265.813-.395a.619.619 0 0 0 .146-.15.148.148 0 0 0 .015-.033L12 14v-.004a.301.301 0 0 0-.057-.09 1.318 1.318 0 0 0-.37-.264c-.376-.198-.943-.375-1.655-.493a.5.5 0 1 1 .164-.986c.77.127 1.452.328 1.957.594C12.5 13 13 13.4 13 14c0 .426-.26.752-.544.977-.29.228-.68.413-1.116.558-.878.293-2.059.465-3.34.465-1.281 0-2.462-.172-3.34-.465-.436-.145-.826-.33-1.116-.558C3.26 14.752 3 14.426 3 14c0-.599.5-1 .961-1.243.505-.266 1.187-.467 1.957-.594a.5.5 0 0 1 .575.411z'/></svg>";
139
+ style = stylePointIcon.createIconStyle(attributes, feature, false);
140
+
141
+ expect(style).toBeInstanceOf(Style);
142
+ expect(style.getImage()).toBeInstanceOf(Icon);
143
+ expect(style.getImage().getSrc()).toEqual("data:image/svg+xml;charset=utf-8," + encodeURIComponent(attributes.imageName));
144
+ });
70
145
  it("should create cluster icon point style", () => {
71
146
  expect(stylePointIcon.createIconStyle(clusterAttributes, clusteredFeature, true)).toBeInstanceOf(Style);
72
147
  expect(stylePointIcon.createIconStyle(clusterAttributes, clusteredFeature, true).getImage()).toBeInstanceOf(Icon);