@masterportal/masterportalapi 2.32.0 → 2.34.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
|
@@ -3,7 +3,34 @@
|
|
|
3
3
|
|
|
4
4
|
The [Semantic Versioning](https://semver.org/spec/v2.0.0.html) is used.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
## Unreleased - in development
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
### Changed
|
|
10
|
+
### Deprecated
|
|
11
|
+
### Removed
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
## 2.34.0 - 2024-03-04
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- stylePointCircle.js now has a zIndex of -1 to put unclustered Labels above clustered ones.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 2.33.0 - 2024-02-07
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
- createStyle: setting style to feature is limited to Point and MultiPoint geometries.
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
- 3D: the options are set correctly again for terrain.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## 2.32.0 - 2024-01-17
|
|
7
34
|
### Added
|
|
8
35
|
|
|
9
36
|
### Changed
|
|
@@ -15,31 +42,31 @@
|
|
|
15
42
|
|
|
16
43
|
---
|
|
17
44
|
|
|
18
|
-
|
|
19
|
-
|
|
45
|
+
## 2.31.0 - 2023-12-13
|
|
46
|
+
### Added
|
|
20
47
|
- Added support for Node LTS version ^20.9.0 and npm Version ^10.1.0.
|
|
21
48
|
|
|
22
|
-
|
|
49
|
+
### Changed
|
|
23
50
|
- WMS-Layer: the attribute extent of rawlayer is set at ol-layer.
|
|
24
51
|
|
|
25
|
-
|
|
52
|
+
### Fixed
|
|
26
53
|
- OAF-Layer: fix oaf layer in examples
|
|
27
54
|
|
|
28
55
|
---
|
|
29
56
|
|
|
30
|
-
|
|
31
|
-
|
|
57
|
+
## 2.30.0 - 2023-11-28
|
|
58
|
+
### Changed
|
|
32
59
|
- WMS-Layer and WMTS-Layer: create Layer no longer evaluates the minScale and maxScale attributes, but instead minResolution and maxResolution can be transferred.
|
|
33
60
|
|
|
34
|
-
|
|
61
|
+
### Fixed
|
|
35
62
|
- Issue Masterportal #1052 VectorStyle: fixed blinking of initial loaded features on great amount of features with a lot of conditional styles.
|
|
36
63
|
- Issue Masterportal #1088: gfiAttibutes with type=html are not displayed if there is no value in the data.
|
|
37
64
|
- Issue Masterportal #1091: VectorStyle: read geometry type from geoserver featureTypeRequest
|
|
38
65
|
|
|
39
66
|
---
|
|
40
67
|
|
|
41
|
-
|
|
42
|
-
|
|
68
|
+
## 2.29.0 - 2023-10-27
|
|
69
|
+
### Added
|
|
43
70
|
- The following packages from parcel automatic were installed for node builtin:
|
|
44
71
|
- dependencies:
|
|
45
72
|
- assert": 2.1.0,
|
|
@@ -52,7 +79,7 @@
|
|
|
52
79
|
- dependencies:
|
|
53
80
|
- ol-mapbox-style: 12.0.0
|
|
54
81
|
|
|
55
|
-
|
|
82
|
+
### Changed
|
|
56
83
|
- The following packages have been updated:
|
|
57
84
|
- dependencies:
|
|
58
85
|
- core-js: 3.32.0 to 3.33.1
|
|
@@ -72,35 +99,35 @@
|
|
|
72
99
|
- sass: 1.64.2 to 1.69.4
|
|
73
100
|
- Revert Cesium.Cesium3DTileset.fromUrl(url, options) adaptions in tileset.js for Cesium v1.107 deprecated warnings
|
|
74
101
|
|
|
75
|
-
|
|
102
|
+
### Fixed
|
|
76
103
|
- styleList: styles of type oaf are now also added to the stylelist
|
|
77
104
|
- 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.
|
|
78
105
|
|
|
79
106
|
---
|
|
80
107
|
|
|
81
|
-
|
|
82
|
-
|
|
108
|
+
## 2.28.0 - 2023-09-27
|
|
109
|
+
### Added
|
|
83
110
|
- GfiAttributes: GFI Attributes can now be configured as HTML tags, e.g <a>, <img> or <iframe>
|
|
84
111
|
|
|
85
|
-
|
|
112
|
+
### Changed
|
|
86
113
|
- The following packages have been updated:
|
|
87
114
|
- dependencies:
|
|
88
115
|
- ol: 7.5.1 to 7.5.2 (This version fix a bug for vectorTiles with declutter: true)
|
|
89
|
-
|
|
116
|
+
### Fixed
|
|
90
117
|
- Issue Masterportal #1067 VectorStyle: if there is a ? in the services URL, no further one is added
|
|
91
118
|
- Cesium tileset: set visibility and set opacity was fixed.
|
|
92
119
|
- Webgl: set default style for feature and fix the opacity problem
|
|
93
120
|
|
|
94
121
|
---
|
|
95
122
|
|
|
96
|
-
|
|
97
|
-
|
|
123
|
+
## 2.27.0 - 2023-08-31
|
|
124
|
+
### Changed
|
|
98
125
|
- VectorStyle: 'initializeStyleList' is asynchron, waits for loading finished and returns the loaded styles.
|
|
99
126
|
|
|
100
127
|
---
|
|
101
128
|
|
|
102
|
-
|
|
103
|
-
|
|
129
|
+
## 2.26.0 - 2023-08-23
|
|
130
|
+
### Changed
|
|
104
131
|
- The following packages have been updated:
|
|
105
132
|
- dependencies:
|
|
106
133
|
- ol: 7.4.0 to 7.5.1
|
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.34.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Basic functions of the Masterportal as api",
|
|
7
7
|
"repository": {
|
package/src/layer/terrain.js
CHANGED
|
@@ -6,12 +6,13 @@
|
|
|
6
6
|
* @returns {void}
|
|
7
7
|
*/
|
|
8
8
|
async function createTerrainProvider (rawLayer) {
|
|
9
|
-
const options = {}
|
|
10
|
-
|
|
9
|
+
const options = {};
|
|
10
|
+
let terrainProvider = "";
|
|
11
11
|
|
|
12
12
|
if (rawLayer.cesiumTerrainProviderOptions) {
|
|
13
13
|
Object.assign(options, rawLayer.cesiumTerrainProviderOptions);
|
|
14
14
|
}
|
|
15
|
+
terrainProvider = await Cesium.CesiumTerrainProvider.fromUrl(rawLayer.url, options);
|
|
15
16
|
|
|
16
17
|
return terrainProvider;
|
|
17
18
|
}
|
|
@@ -261,7 +261,9 @@ function createStyle (styleObject, feature, isClustered, wfsImgPathFromConfig) {
|
|
|
261
261
|
styleObjectGeometry.setText(getLabelStyle(feature, style, isClustered));
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
|
-
feature.
|
|
264
|
+
if (feature?.getGeometry().getType() === "Point" || feature?.getGeometry().getType() === "MultiPoint") {
|
|
265
|
+
feature.setStyle(styleObjectGeometry);
|
|
266
|
+
}
|
|
265
267
|
return styleObjectGeometry;
|
|
266
268
|
}
|
|
267
269
|
|
|
@@ -5,76 +5,14 @@ import PolygonStyle from "../../src/vectorStyle/styles/polygon/stylePolygon";
|
|
|
5
5
|
import {Style, Stroke, Fill} from "ol/style.js";
|
|
6
6
|
import {GeoJSON} from "ol/format.js";
|
|
7
7
|
|
|
8
|
+
let rules,
|
|
9
|
+
jsonObjects,
|
|
10
|
+
multiLineStringRules,
|
|
11
|
+
multiPolygonRules,
|
|
12
|
+
isClustered;
|
|
13
|
+
|
|
8
14
|
const wfsImgPathFromConfig = "/path/to/wfs/images",
|
|
9
|
-
|
|
10
|
-
{
|
|
11
|
-
conditions: {
|
|
12
|
-
properties: {
|
|
13
|
-
id: "test1"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
style: {
|
|
17
|
-
legendValue: "legendValueText",
|
|
18
|
-
circleStrokeColor: [255, 0, 0, 1],
|
|
19
|
-
type: "circle",
|
|
20
|
-
lineStrokeColor: [100, 0, 0, 1],
|
|
21
|
-
polygonStrokeColor: [100, 100, 0, 1]
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
style: {
|
|
26
|
-
legendValue: "LineStringLegend",
|
|
27
|
-
lineStrokeColor: [255, 0, 0, 1]
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
style: {
|
|
32
|
-
legendValue: "PolygonLegend",
|
|
33
|
-
polygonStrokeColor: [255, 0, 0, 255]
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
conditions: {
|
|
38
|
-
properties: {
|
|
39
|
-
value: [0, 50, "@min", "@max"]
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
style: {
|
|
43
|
-
legendValue: "legendValueText",
|
|
44
|
-
circleStrokeColor: [255, 0, 0, 1]
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
style: {
|
|
49
|
-
legendValue: "legendValueText",
|
|
50
|
-
circleStrokeColor: [255, 255, 255, 1]
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
],
|
|
54
|
-
multiLineStringRules = [{
|
|
55
|
-
style: {
|
|
56
|
-
legendValue: "legendValueText",
|
|
57
|
-
lineStrokeColor: [255, 255, 255, 1]
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
style: {
|
|
62
|
-
legendValue: "legendValueText",
|
|
63
|
-
lineStrokeColor: [255, 0, 0, 1]
|
|
64
|
-
}
|
|
65
|
-
}],
|
|
66
|
-
multiPolygonRules = [{
|
|
67
|
-
style: {
|
|
68
|
-
legendValue: "legendValueText",
|
|
69
|
-
polygonStrokeColor: [100, 100, 0, 1]
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
style: {
|
|
74
|
-
legendValue: "legendValueText",
|
|
75
|
-
polygonStrokeColor: [255, 0, 0, 1]
|
|
76
|
-
}
|
|
77
|
-
}],
|
|
15
|
+
defaultStrokeColor = [0, 0, 0, 1],
|
|
78
16
|
geojsonReader = new GeoJSON(),
|
|
79
17
|
jsonFeatures = {
|
|
80
18
|
"type": "FeatureCollection",
|
|
@@ -221,8 +159,6 @@ const wfsImgPathFromConfig = "/path/to/wfs/images",
|
|
|
221
159
|
null;
|
|
222
160
|
});
|
|
223
161
|
|
|
224
|
-
let jsonObjects;
|
|
225
|
-
|
|
226
162
|
|
|
227
163
|
beforeAll(function () {
|
|
228
164
|
jsonObjects = geojsonReader.readFeatures(jsonFeatures);
|
|
@@ -231,10 +167,82 @@ afterAll(() => {
|
|
|
231
167
|
warn.mockReset();
|
|
232
168
|
});
|
|
233
169
|
|
|
170
|
+
beforeEach(() => {
|
|
171
|
+
isClustered = false;
|
|
172
|
+
rules = [
|
|
173
|
+
{
|
|
174
|
+
conditions: {
|
|
175
|
+
properties: {
|
|
176
|
+
id: "test1"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
style: {
|
|
180
|
+
legendValue: "legendValueText",
|
|
181
|
+
circleStrokeColor: [255, 0, 0, 1],
|
|
182
|
+
type: "circle",
|
|
183
|
+
lineStrokeColor: [100, 0, 0, 1],
|
|
184
|
+
polygonStrokeColor: [100, 100, 0, 1]
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
style: {
|
|
189
|
+
legendValue: "LineStringLegend",
|
|
190
|
+
lineStrokeColor: [255, 0, 0, 1]
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
style: {
|
|
195
|
+
legendValue: "PolygonLegend",
|
|
196
|
+
polygonStrokeColor: [255, 0, 0, 255]
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
conditions: {
|
|
201
|
+
properties: {
|
|
202
|
+
value: [0, 50, "@min", "@max"]
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
style: {
|
|
206
|
+
legendValue: "legendValueText",
|
|
207
|
+
circleStrokeColor: [255, 0, 0, 1]
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
style: {
|
|
212
|
+
legendValue: "legendValueText",
|
|
213
|
+
circleStrokeColor: [255, 255, 255, 1]
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
];
|
|
217
|
+
multiLineStringRules = [{
|
|
218
|
+
style: {
|
|
219
|
+
legendValue: "legendValueText",
|
|
220
|
+
lineStrokeColor: [255, 255, 255, 1]
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
style: {
|
|
225
|
+
legendValue: "legendValueText",
|
|
226
|
+
lineStrokeColor: [255, 0, 0, 1]
|
|
227
|
+
}
|
|
228
|
+
}];
|
|
229
|
+
multiPolygonRules = [{
|
|
230
|
+
style: {
|
|
231
|
+
legendValue: "legendValueText",
|
|
232
|
+
polygonStrokeColor: [100, 100, 0, 1]
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
style: {
|
|
237
|
+
legendValue: "legendValueText",
|
|
238
|
+
polygonStrokeColor: [255, 0, 0, 1]
|
|
239
|
+
}
|
|
240
|
+
}];
|
|
241
|
+
});
|
|
242
|
+
|
|
234
243
|
describe("createStyle", () => {
|
|
235
244
|
it("should return the correct style for a feature", () => {
|
|
236
245
|
const styleObject = {styleId: "myStyle", rules: [{style: {type: "Point"}}]},
|
|
237
|
-
isClustered = false,
|
|
238
246
|
style = createStyle.createStyle(styleObject, jsonObjects[0], isClustered, wfsImgPathFromConfig);
|
|
239
247
|
|
|
240
248
|
expect(style).toBeInstanceOf(Style);
|
|
@@ -254,7 +262,6 @@ describe("createStyle", () => {
|
|
|
254
262
|
}
|
|
255
263
|
}],
|
|
256
264
|
styleObject = {styleId: "styleId", styleMultiGeomOnlyWithRule: true, rules: stylingRules},
|
|
257
|
-
isClustered = false,
|
|
258
265
|
multiLineStringFeature = jsonObjects[4],
|
|
259
266
|
style = createStyle.createStyle(styleObject, multiLineStringFeature, isClustered, wfsImgPathFromConfig);
|
|
260
267
|
|
|
@@ -263,7 +270,6 @@ describe("createStyle", () => {
|
|
|
263
270
|
style.forEach(aStyle => {
|
|
264
271
|
expect(aStyle).toBeInstanceOf(Style);
|
|
265
272
|
});
|
|
266
|
-
expect(multiLineStringFeature.getStyle()).toEqual(style);
|
|
267
273
|
});
|
|
268
274
|
|
|
269
275
|
it("should return the correct style for a feature with geometry of type MultiPolygon ", () => {
|
|
@@ -288,7 +294,6 @@ describe("createStyle", () => {
|
|
|
288
294
|
}
|
|
289
295
|
}],
|
|
290
296
|
styleObject = {styleId: "styleId", styleMultiGeomOnlyWithRule: true, rules: stylingRules},
|
|
291
|
-
isClustered = false,
|
|
292
297
|
multiPolygonFeature = jsonObjects[5],
|
|
293
298
|
style = createStyle.createStyle(styleObject, multiPolygonFeature, isClustered, wfsImgPathFromConfig);
|
|
294
299
|
|
|
@@ -297,7 +302,6 @@ describe("createStyle", () => {
|
|
|
297
302
|
style.forEach(aStyle => {
|
|
298
303
|
expect(aStyle).toBeInstanceOf(Style);
|
|
299
304
|
});
|
|
300
|
-
expect(multiPolygonFeature.getStyle()).toEqual(style);
|
|
301
305
|
});
|
|
302
306
|
|
|
303
307
|
it("should return the correct style for a feature with geometry of type GeometryCollection ", () => {
|
|
@@ -322,7 +326,6 @@ describe("createStyle", () => {
|
|
|
322
326
|
}
|
|
323
327
|
}],
|
|
324
328
|
styleObject = {styleId: "styleId", styleMultiGeomOnlyWithRule: true, rules: stylingRules},
|
|
325
|
-
isClustered = false,
|
|
326
329
|
geometryCollectionFeature = jsonObjects[6],
|
|
327
330
|
style = createStyle.createStyle(styleObject, geometryCollectionFeature, isClustered, wfsImgPathFromConfig);
|
|
328
331
|
|
|
@@ -331,7 +334,6 @@ describe("createStyle", () => {
|
|
|
331
334
|
style.forEach(aStyle => {
|
|
332
335
|
expect(aStyle).toBeInstanceOf(Style);
|
|
333
336
|
});
|
|
334
|
-
expect(geometryCollectionFeature.getStyle()).toEqual(style);
|
|
335
337
|
});
|
|
336
338
|
|
|
337
339
|
it("should return the correct style for a feature with geometry of type MultiPoint ", () => {
|
|
@@ -356,7 +358,6 @@ describe("createStyle", () => {
|
|
|
356
358
|
}
|
|
357
359
|
}],
|
|
358
360
|
styleObject = {styleId: "styleId", styleMultiGeomOnlyWithRule: true, rules: stylingRules},
|
|
359
|
-
isClustered = false,
|
|
360
361
|
multiPointFeature = jsonObjects[3],
|
|
361
362
|
style = createStyle.createStyle(styleObject, multiPointFeature, isClustered, wfsImgPathFromConfig);
|
|
362
363
|
|
|
@@ -370,8 +371,6 @@ describe("createStyle", () => {
|
|
|
370
371
|
});
|
|
371
372
|
|
|
372
373
|
describe("getSimpleGeometryStyle", function () {
|
|
373
|
-
let isClustered = false;
|
|
374
|
-
|
|
375
374
|
it("should return ol point style - not clustered", function () {
|
|
376
375
|
const styleObject = createStyle.getSimpleGeometryStyle("Point", jsonObjects[0], rules[0], isClustered, wfsImgPathFromConfig);
|
|
377
376
|
|
|
@@ -408,7 +407,7 @@ describe("getSimpleGeometryStyle", function () {
|
|
|
408
407
|
|
|
409
408
|
expect(styleObject).toBeInstanceOf(PointStyle);
|
|
410
409
|
expect(typeof styleObject).toBe("object");
|
|
411
|
-
expect(styleObject.getStyle().getImage().getStroke().getColor()).toEqual(
|
|
410
|
+
expect(styleObject.getStyle().getImage().getStroke().getColor()).toEqual(defaultStrokeColor);
|
|
412
411
|
expect(styleObject.getLegendInfos()[0].styleObject.circleStrokeColor).toEqual([255, 0, 0, 1]);
|
|
413
412
|
});
|
|
414
413
|
it("should return ol linestring style - clustered", function () {
|
|
@@ -438,51 +437,157 @@ describe("getSimpleGeometryStyle", function () {
|
|
|
438
437
|
|
|
439
438
|
describe("getMultiGeometryStyle", function () {
|
|
440
439
|
it("should return style array for multipoint", function () {
|
|
441
|
-
|
|
442
|
-
|
|
440
|
+
const style = createStyle.getMultiGeometryStyle("MultiPoint", jsonObjects[3], rules, isClustered, wfsImgPathFromConfig);
|
|
441
|
+
|
|
442
|
+
expect(Array.isArray(style)).toBe(true);
|
|
443
|
+
expect(style.length).toEqual(2);
|
|
444
|
+
});
|
|
445
|
+
it("should include ol point style - use defaultStyle for stroke color", function () {
|
|
446
|
+
delete rules[0].style.circleStrokeColor;
|
|
447
|
+
const style = createStyle.getMultiGeometryStyle("MultiPoint", jsonObjects[3], rules, isClustered, wfsImgPathFromConfig);
|
|
448
|
+
|
|
449
|
+
expect(style[0]).toBeInstanceOf(PointStyle);
|
|
450
|
+
expect(style[1]).toBeInstanceOf(PointStyle);
|
|
451
|
+
expect(style[0].getStyle().getImage().getStroke().getColor()).toEqual(defaultStrokeColor);
|
|
452
|
+
expect(style[1].getStyle().getImage().getStroke().getColor()).toEqual(defaultStrokeColor);
|
|
443
453
|
});
|
|
444
|
-
it("should include ol point style", function () {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
454
|
+
it("should include ol point style - is clustered and use defaultStyle for stroke color", function () {
|
|
455
|
+
isClustered = true;
|
|
456
|
+
delete rules[0].style.circleStrokeColor;
|
|
457
|
+
const style = createStyle.getMultiGeometryStyle("MultiPoint", jsonObjects[3], rules, isClustered, wfsImgPathFromConfig);
|
|
458
|
+
|
|
459
|
+
expect(style[0]).toBeInstanceOf(PointStyle);
|
|
460
|
+
expect(style[1]).toBeInstanceOf(PointStyle);
|
|
461
|
+
expect(style[0].getStyle().getImage().getStroke().getColor()).toEqual(defaultStrokeColor);
|
|
462
|
+
expect(style[1].getStyle().getImage().getStroke().getColor()).toEqual(defaultStrokeColor);
|
|
463
|
+
});
|
|
464
|
+
it("should include ol point style- use rules for stroke color", function () {
|
|
465
|
+
const style = createStyle.getMultiGeometryStyle("MultiPoint", jsonObjects[3], rules, isClustered, wfsImgPathFromConfig);
|
|
466
|
+
|
|
467
|
+
expect(style[0]).toBeInstanceOf(PointStyle);
|
|
468
|
+
expect(style[1]).toBeInstanceOf(PointStyle);
|
|
469
|
+
expect(style[0].getStyle().getImage().getStroke().getColor()).toEqual(rules[0].style.circleStrokeColor);
|
|
470
|
+
expect(style[1].getStyle().getImage().getStroke().getColor()).toEqual(rules[0].style.circleStrokeColor);
|
|
471
|
+
});
|
|
472
|
+
it("should include ol point style- is clustered and use rules for stroke color", function () {
|
|
473
|
+
isClustered = true;
|
|
474
|
+
rules[0].style.clusterCircleStrokeColor = [1, 2, 3, 4];
|
|
475
|
+
const style = createStyle.getMultiGeometryStyle("MultiPoint", jsonObjects[3], rules, isClustered, wfsImgPathFromConfig);
|
|
476
|
+
|
|
477
|
+
expect(style[0]).toBeInstanceOf(PointStyle);
|
|
478
|
+
expect(style[1]).toBeInstanceOf(PointStyle);
|
|
479
|
+
expect(style[0].getStyle().getImage().getStroke().getColor()).toEqual(rules[0].style.clusterCircleStrokeColor);
|
|
480
|
+
expect(style[1].getStyle().getImage().getStroke().getColor()).toEqual(rules[0].style.clusterCircleStrokeColor);
|
|
449
481
|
});
|
|
450
482
|
it("should return style array for MultiLineString", function () {
|
|
451
|
-
|
|
452
|
-
|
|
483
|
+
const style = createStyle.getMultiGeometryStyle("MultiLineString", jsonObjects[4], multiLineStringRules, isClustered, wfsImgPathFromConfig);
|
|
484
|
+
|
|
485
|
+
expect(Array.isArray(style)).toBe(true);
|
|
486
|
+
expect(style.length).toEqual(2);
|
|
487
|
+
});
|
|
488
|
+
it("MultiLineString: should include ol line style - use defaultStyle for stroke color", function () {
|
|
489
|
+
delete multiLineStringRules[0].style.lineStrokeColor;
|
|
490
|
+
delete multiLineStringRules[1].style.lineStrokeColor;
|
|
491
|
+
const style = createStyle.getMultiGeometryStyle("MultiLineString", jsonObjects[4], multiLineStringRules, isClustered, wfsImgPathFromConfig);
|
|
492
|
+
|
|
493
|
+
expect(style[0]).toBeInstanceOf(LineStringStyle);
|
|
494
|
+
expect(style[1]).toBeInstanceOf(LineStringStyle);
|
|
495
|
+
expect(style[0].getStyle().getStroke()).toBeInstanceOf(Stroke);
|
|
496
|
+
expect(style[1].getStyle().getStroke()).toBeInstanceOf(Stroke);
|
|
497
|
+
expect(style[0].getStyle().getStroke().getColor()).toEqual(defaultStrokeColor);
|
|
498
|
+
expect(style[1].getStyle().getStroke().getColor()).toEqual(defaultStrokeColor);
|
|
453
499
|
});
|
|
454
|
-
it("should include ol stroke
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
expect(
|
|
458
|
-
expect(
|
|
500
|
+
it("MultiLineString: should include ol line style - use rules for stroke color", function () {
|
|
501
|
+
const style = createStyle.getMultiGeometryStyle("MultiLineString", jsonObjects[4], multiLineStringRules, isClustered, wfsImgPathFromConfig);
|
|
502
|
+
|
|
503
|
+
expect(style[0]).toBeInstanceOf(LineStringStyle);
|
|
504
|
+
expect(style[1]).toBeInstanceOf(LineStringStyle);
|
|
505
|
+
expect(style[0].getStyle().getStroke()).toBeInstanceOf(Stroke);
|
|
506
|
+
expect(style[1].getStyle().getStroke()).toBeInstanceOf(Stroke);
|
|
507
|
+
expect(style[0].getStyle().getStroke().getColor()).toEqual(multiLineStringRules[0].style.lineStrokeColor);
|
|
508
|
+
expect(style[1].getStyle().getStroke().getColor()).toEqual(multiLineStringRules[0].style.lineStrokeColor);
|
|
459
509
|
});
|
|
460
510
|
it("should return style array for MultiPolygon", function () {
|
|
461
|
-
|
|
462
|
-
|
|
511
|
+
const style = createStyle.getMultiGeometryStyle("MultiPolygon", jsonObjects[5], multiPolygonRules, isClustered, wfsImgPathFromConfig);
|
|
512
|
+
|
|
513
|
+
expect(Array.isArray(style)).toBe(true);
|
|
514
|
+
expect(style.length).toEqual(2);
|
|
463
515
|
});
|
|
464
|
-
it("should include ol polygon style", function () {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
expect(
|
|
516
|
+
it("should include ol polygon style - use defaultStyle for stroke color", function () {
|
|
517
|
+
delete multiPolygonRules[0].style.polygonStrokeColor;
|
|
518
|
+
delete multiPolygonRules[1].style.polygonStrokeColor;
|
|
519
|
+
const style = createStyle.getMultiGeometryStyle("MultiPolygon", jsonObjects[5], multiPolygonRules, isClustered, wfsImgPathFromConfig);
|
|
520
|
+
|
|
521
|
+
expect(style[0]).toBeInstanceOf(PolygonStyle);
|
|
522
|
+
expect(style[0].getStyle().getStroke()).toBeInstanceOf(Stroke);
|
|
523
|
+
expect(style[0].getStyle().getFill()).toBeInstanceOf(Fill);
|
|
524
|
+
expect(style[0].getStyle().getStroke().getColor()).toEqual(defaultStrokeColor);
|
|
525
|
+
expect(style[1].getStyle().getStroke()).toBeInstanceOf(Stroke);
|
|
526
|
+
expect(style[1].getStyle().getFill()).toBeInstanceOf(Fill);
|
|
527
|
+
expect(style[1].getStyle().getStroke().getColor()).toEqual(defaultStrokeColor);
|
|
528
|
+
});
|
|
529
|
+
it("should include ol polygon style - use rules for stroke color", function () {
|
|
530
|
+
const style = createStyle.getMultiGeometryStyle("MultiPolygon", jsonObjects[5], multiPolygonRules, isClustered, wfsImgPathFromConfig);
|
|
531
|
+
|
|
532
|
+
expect(style[0]).toBeInstanceOf(PolygonStyle);
|
|
533
|
+
expect(style[0].getStyle().getStroke()).toBeInstanceOf(Stroke);
|
|
534
|
+
expect(style[0].getStyle().getFill()).toBeInstanceOf(Fill);
|
|
535
|
+
expect(style[0].getStyle().getStroke().getColor()).toEqual(multiPolygonRules[0].style.polygonStrokeColor);
|
|
536
|
+
expect(style[1].getStyle().getStroke()).toBeInstanceOf(Stroke);
|
|
537
|
+
expect(style[1].getStyle().getFill()).toBeInstanceOf(Fill);
|
|
538
|
+
expect(style[1].getStyle().getStroke().getColor()).toEqual(multiPolygonRules[0].style.polygonStrokeColor);
|
|
470
539
|
});
|
|
471
540
|
it("should return style array for GeometryCollection", function () {
|
|
472
|
-
|
|
473
|
-
|
|
541
|
+
const style = createStyle.getMultiGeometryStyle("GeometryCollection", jsonObjects[6], rules, isClustered, wfsImgPathFromConfig);
|
|
542
|
+
|
|
543
|
+
expect(Array.isArray(style)).toBe(true);
|
|
544
|
+
expect(style.length).toEqual(2);
|
|
474
545
|
});
|
|
475
|
-
it("should include ol line and point style", function () {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
546
|
+
it("should include ol line and point style - use defaultStyle for stroke color", function () {
|
|
547
|
+
delete rules[0].style.circleStrokeColor;
|
|
548
|
+
delete rules[0].style.lineStrokeColor;
|
|
549
|
+
delete multiLineStringRules[0].style.lineStrokeColor;
|
|
550
|
+
const style = createStyle.getMultiGeometryStyle("GeometryCollection", jsonObjects[6], rules, isClustered, wfsImgPathFromConfig),
|
|
551
|
+
multiLineStyle = createStyle.getMultiGeometryStyle("GeometryCollection", jsonObjects[6], multiLineStringRules, isClustered, wfsImgPathFromConfig);
|
|
552
|
+
|
|
553
|
+
expect(style[0]).toBeInstanceOf(PointStyle);
|
|
554
|
+
expect(style[0].getStyle().getImage().getStroke()).toBeInstanceOf(Stroke);
|
|
555
|
+
expect(style[0].getStyle().getImage().getStroke().getColor()).toEqual(defaultStrokeColor);
|
|
556
|
+
expect(style[1]).toBeInstanceOf(LineStringStyle);
|
|
557
|
+
expect(style[1].getStyle().getStroke()).toBeInstanceOf(Stroke);
|
|
558
|
+
expect(style[1].getStyle().getStroke().getColor()).toEqual(defaultStrokeColor);
|
|
559
|
+
|
|
560
|
+
expect(multiLineStyle[0]).toBeInstanceOf(PointStyle);
|
|
561
|
+
expect(multiLineStyle[0].getStyle().getImage().getStroke().getColor()).toEqual(defaultStrokeColor);
|
|
562
|
+
expect(multiLineStyle[1]).toBeInstanceOf(LineStringStyle);
|
|
563
|
+
expect(multiLineStyle[1].getStyle().getStroke()).toBeInstanceOf(Stroke);
|
|
564
|
+
expect(multiLineStyle[1].getStyle().getStroke().getColor()).toEqual(defaultStrokeColor);
|
|
565
|
+
});
|
|
566
|
+
it("should include ol line and point style - use rules for stroke color", function () {
|
|
567
|
+
const style = createStyle.getMultiGeometryStyle("GeometryCollection", jsonObjects[6], rules, isClustered, wfsImgPathFromConfig),
|
|
568
|
+
multiLineStyle = createStyle.getMultiGeometryStyle("GeometryCollection", jsonObjects[6], multiLineStringRules, isClustered, wfsImgPathFromConfig);
|
|
569
|
+
|
|
570
|
+
expect(style[0]).toBeInstanceOf(PointStyle);
|
|
571
|
+
expect(style[0].getStyle().getImage().getStroke()).toBeInstanceOf(Stroke);
|
|
572
|
+
expect(style[0].getStyle().getImage().getStroke().getColor()).toEqual(rules[0].style.circleStrokeColor);
|
|
573
|
+
expect(style[1]).toBeInstanceOf(LineStringStyle);
|
|
574
|
+
expect(style[1].getStyle().getStroke()).toBeInstanceOf(Stroke);
|
|
575
|
+
expect(style[1].getStyle().getStroke().getColor()).toEqual(rules[0].style.lineStrokeColor);
|
|
576
|
+
|
|
577
|
+
expect(multiLineStyle[0]).toBeInstanceOf(PointStyle);
|
|
578
|
+
// multiLineStringRules[0].style.circleStrokeColor is not defined --> use defaultStrokeColor
|
|
579
|
+
expect(multiLineStyle[0].getStyle().getImage().getStroke().getColor()).toEqual(defaultStrokeColor);
|
|
580
|
+
expect(multiLineStyle[1]).toBeInstanceOf(LineStringStyle);
|
|
581
|
+
expect(multiLineStyle[1].getStyle().getStroke()).toBeInstanceOf(Stroke);
|
|
582
|
+
expect(multiLineStyle[1].getStyle().getStroke().getColor()).toEqual(multiLineStringRules[0].style.lineStrokeColor);
|
|
482
583
|
});
|
|
483
|
-
it("features with more geometries than rules (rules: 1, geometries: 2) should have style for all geometries - styleMultiGeomOnlyWithRule
|
|
484
|
-
|
|
485
|
-
|
|
584
|
+
it("features with more geometries than rules (rules: 1, geometries: 2) should have style for all geometries - 'styleMultiGeomOnlyWithRule' is not set", function () {
|
|
585
|
+
const style = createStyle.getMultiGeometryStyle("MultiLineString", jsonObjects[4], rulesWithOneEntry, isClustered, wfsImgPathFromConfig);
|
|
586
|
+
|
|
587
|
+
expect(Array.isArray(style)).toBe(true);
|
|
588
|
+
expect(style.length).toEqual(2);
|
|
589
|
+
expect(style[0].getStyle().getStroke().getColor()).toEqual(rulesWithOneEntry[0].style.lineStrokeColor);
|
|
590
|
+
expect(style[1].getStyle()).toEqual(null);
|
|
486
591
|
});
|
|
487
592
|
});
|
|
488
593
|
|
|
@@ -497,12 +602,22 @@ describe("isMultiGeometry", function () {
|
|
|
497
602
|
});
|
|
498
603
|
|
|
499
604
|
describe("getGeometryStyle", function () {
|
|
500
|
-
it("should return
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
expect(
|
|
605
|
+
it("should return point style with correct settings", function () {
|
|
606
|
+
const style = createStyle.getGeometryStyle(jsonObjects[0], rules, isClustered, wfsImgPathFromConfig);
|
|
607
|
+
|
|
608
|
+
expect(style).toBeInstanceOf(PointStyle);
|
|
609
|
+
expect(Array.isArray(style.getStyle().getImage().getStroke().getColor())).toBe(true);
|
|
610
|
+
expect(style.getStyle().getImage().getStroke().getColor()).toEqual(rules[0].style.circleStrokeColor);
|
|
611
|
+
});
|
|
612
|
+
it("should return 'MultiPoint' style with correct settings", function () {
|
|
613
|
+
const style = createStyle.getGeometryStyle(jsonObjects[3], rules, isClustered, wfsImgPathFromConfig);
|
|
614
|
+
|
|
615
|
+
expect(Array.isArray(style)).toBe(true);
|
|
616
|
+
expect(style.length).toEqual(2);
|
|
617
|
+
expect(style[0].getStyle().getImage().getStroke().getColor()).toEqual(rules[0].style.circleStrokeColor);
|
|
618
|
+
expect(style[1].getStyle().getImage().getStroke().getColor()).toEqual(rules[0].style.circleStrokeColor);
|
|
504
619
|
});
|
|
505
620
|
it("should return null as style if no rule is found", function () {
|
|
506
|
-
expect(createStyle.getGeometryStyle(jsonObjects[0], [], wfsImgPathFromConfig).getStyle()).toBe(null);
|
|
621
|
+
expect(createStyle.getGeometryStyle(jsonObjects[0], [], isClustered, wfsImgPathFromConfig).getStyle()).toBe(null);
|
|
507
622
|
});
|
|
508
623
|
});
|