@masterportal/masterportalapi 2.33.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
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": {
|
|
@@ -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
|
|
|
@@ -287,7 +294,6 @@ describe("createStyle", () => {
|
|
|
287
294
|
}
|
|
288
295
|
}],
|
|
289
296
|
styleObject = {styleId: "styleId", styleMultiGeomOnlyWithRule: true, rules: stylingRules},
|
|
290
|
-
isClustered = false,
|
|
291
297
|
multiPolygonFeature = jsonObjects[5],
|
|
292
298
|
style = createStyle.createStyle(styleObject, multiPolygonFeature, isClustered, wfsImgPathFromConfig);
|
|
293
299
|
|
|
@@ -320,7 +326,6 @@ describe("createStyle", () => {
|
|
|
320
326
|
}
|
|
321
327
|
}],
|
|
322
328
|
styleObject = {styleId: "styleId", styleMultiGeomOnlyWithRule: true, rules: stylingRules},
|
|
323
|
-
isClustered = false,
|
|
324
329
|
geometryCollectionFeature = jsonObjects[6],
|
|
325
330
|
style = createStyle.createStyle(styleObject, geometryCollectionFeature, isClustered, wfsImgPathFromConfig);
|
|
326
331
|
|
|
@@ -353,7 +358,6 @@ describe("createStyle", () => {
|
|
|
353
358
|
}
|
|
354
359
|
}],
|
|
355
360
|
styleObject = {styleId: "styleId", styleMultiGeomOnlyWithRule: true, rules: stylingRules},
|
|
356
|
-
isClustered = false,
|
|
357
361
|
multiPointFeature = jsonObjects[3],
|
|
358
362
|
style = createStyle.createStyle(styleObject, multiPointFeature, isClustered, wfsImgPathFromConfig);
|
|
359
363
|
|
|
@@ -367,8 +371,6 @@ describe("createStyle", () => {
|
|
|
367
371
|
});
|
|
368
372
|
|
|
369
373
|
describe("getSimpleGeometryStyle", function () {
|
|
370
|
-
let isClustered = false;
|
|
371
|
-
|
|
372
374
|
it("should return ol point style - not clustered", function () {
|
|
373
375
|
const styleObject = createStyle.getSimpleGeometryStyle("Point", jsonObjects[0], rules[0], isClustered, wfsImgPathFromConfig);
|
|
374
376
|
|
|
@@ -405,7 +407,7 @@ describe("getSimpleGeometryStyle", function () {
|
|
|
405
407
|
|
|
406
408
|
expect(styleObject).toBeInstanceOf(PointStyle);
|
|
407
409
|
expect(typeof styleObject).toBe("object");
|
|
408
|
-
expect(styleObject.getStyle().getImage().getStroke().getColor()).toEqual(
|
|
410
|
+
expect(styleObject.getStyle().getImage().getStroke().getColor()).toEqual(defaultStrokeColor);
|
|
409
411
|
expect(styleObject.getLegendInfos()[0].styleObject.circleStrokeColor).toEqual([255, 0, 0, 1]);
|
|
410
412
|
});
|
|
411
413
|
it("should return ol linestring style - clustered", function () {
|
|
@@ -435,51 +437,157 @@ describe("getSimpleGeometryStyle", function () {
|
|
|
435
437
|
|
|
436
438
|
describe("getMultiGeometryStyle", function () {
|
|
437
439
|
it("should return style array for multipoint", function () {
|
|
438
|
-
|
|
439
|
-
|
|
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);
|
|
440
453
|
});
|
|
441
|
-
it("should include ol point style", function () {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
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);
|
|
446
481
|
});
|
|
447
482
|
it("should return style array for MultiLineString", function () {
|
|
448
|
-
|
|
449
|
-
|
|
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);
|
|
450
499
|
});
|
|
451
|
-
it("should include ol stroke
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
expect(
|
|
455
|
-
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);
|
|
456
509
|
});
|
|
457
510
|
it("should return style array for MultiPolygon", function () {
|
|
458
|
-
|
|
459
|
-
|
|
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);
|
|
460
515
|
});
|
|
461
|
-
it("should include ol polygon style", function () {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
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);
|
|
467
539
|
});
|
|
468
540
|
it("should return style array for GeometryCollection", function () {
|
|
469
|
-
|
|
470
|
-
|
|
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);
|
|
471
545
|
});
|
|
472
|
-
it("should include ol line and point style", function () {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
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);
|
|
479
583
|
});
|
|
480
|
-
it("features with more geometries than rules (rules: 1, geometries: 2) should have style for all geometries - styleMultiGeomOnlyWithRule
|
|
481
|
-
|
|
482
|
-
|
|
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);
|
|
483
591
|
});
|
|
484
592
|
});
|
|
485
593
|
|
|
@@ -494,12 +602,22 @@ describe("isMultiGeometry", function () {
|
|
|
494
602
|
});
|
|
495
603
|
|
|
496
604
|
describe("getGeometryStyle", function () {
|
|
497
|
-
it("should return
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
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);
|
|
501
619
|
});
|
|
502
620
|
it("should return null as style if no rule is found", function () {
|
|
503
|
-
expect(createStyle.getGeometryStyle(jsonObjects[0], [], wfsImgPathFromConfig).getStyle()).toBe(null);
|
|
621
|
+
expect(createStyle.getGeometryStyle(jsonObjects[0], [], isClustered, wfsImgPathFromConfig).getStyle()).toBe(null);
|
|
504
622
|
});
|
|
505
623
|
});
|