• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

geosolutions-it / MapStore2 / 13456178088

21 Feb 2025 11:49AM UTC coverage: 76.734% (+0.05%) from 76.688%
13456178088

Pull #10813

github

web-flow
Merge 7ffa6d126 into 1e493c5d2
Pull Request #10813: Fix #10805 JAXBException while updating an existing dashboard

31263 of 48901 branches covered (63.93%)

5 of 8 new or added lines in 2 files covered. (62.5%)

318 existing lines in 24 files now uncovered.

38808 of 50575 relevant lines covered (76.73%)

34.46 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/web/client/components/map/cesium/plugins/VectorLayer.js
1
/**
2
 * Copyright 2022, GeoSolutions Sas.
3
 * All rights reserved.
4
 *
5
 * This source code is licensed under the BSD-style license found in the
6
 * LICENSE file in the root directory of this source tree.
7
 */
8

9
import Layers from '../../../../utils/cesium/Layers';
10
import isEqual from 'lodash/isEqual';
11
import {
12
    getStyle,
13
    layerToGeoStylerStyle,
14
    flattenFeatures
15
} from '../../../../utils/VectorStyleUtils';
16
import { applyDefaultStyleToVectorLayer } from '../../../../utils/StyleUtils';
17
import GeoJSONStyledFeatures from  '../../../../utils/cesium/GeoJSONStyledFeatures';
18
import { createVectorFeatureFilter } from '../../../../utils/FilterUtils';
19

20
const createLayer = (options, map) => {
1✔
21

22
    if (!options.visibility) {
5!
UNCOV
23
        return {
×
24
            detached: true,
25
            styledFeatures: undefined,
26
            remove: () => {}
27
        };
28
    }
29

30
    const features = flattenFeatures(options?.features || [], ({ style, ...feature }) => feature);
8!
31
    const vectorFeatureFilter = createVectorFeatureFilter(options);
5✔
32
    let styledFeatures = new GeoJSONStyledFeatures({
5✔
33
        features,
34
        id: options?.id,
35
        map: map,
36
        opacity: options.opacity,
37
        queryable: options.queryable === undefined || options.queryable,
6✔
38
        featureFilter: vectorFeatureFilter // make filter for features if filter is existing
39
    });
40

41
    layerToGeoStylerStyle(options)
5✔
42
        .then((style) => {
43
            getStyle(applyDefaultStyleToVectorLayer({ ...options, style }), 'cesium')
5✔
44
                .then((styleFunc) => {
45
                    styledFeatures.setStyleFunction(styleFunc);
5✔
46
                });
47
        });
48
    return {
5✔
49
        detached: true,
50
        styledFeatures,
51
        remove: () => {
52
            if (styledFeatures) {
3!
53
                styledFeatures.destroy();
3✔
54
                styledFeatures = undefined;
3✔
55
            }
56
        }
57
    };
58
};
59

60
Layers.registerType('vector', {
1✔
61
    create: createLayer,
62
    update: (layer, newOptions, oldOptions, map) => {
63
        if (!isEqual(newOptions.features, oldOptions.features)) {
×
UNCOV
64
            return createLayer(newOptions, map);
×
65
        }
66
        if (layer?.styledFeatures && !isEqual(newOptions?.layerFilter, oldOptions?.layerFilter)) {
×
67
            const vectorFeatureFilter = createVectorFeatureFilter(newOptions);
×
UNCOV
68
            layer.styledFeatures.setFeatureFilter(vectorFeatureFilter);
×
69
        }
70

71
        if (layer?.styledFeatures && !isEqual(newOptions.style, oldOptions.style)) {
×
UNCOV
72
            layerToGeoStylerStyle(newOptions)
×
73
                .then((style) => {
UNCOV
74
                    getStyle(applyDefaultStyleToVectorLayer({ ...newOptions, style }), 'cesium')
×
75
                        .then((styleFunc) => {
76
                            layer.styledFeatures.setStyleFunction(styleFunc);
×
77
                        });
78
                });
79
        }
UNCOV
80
        if (layer?.styledFeatures && newOptions.opacity !== oldOptions.opacity) {
×
UNCOV
81
            layer.styledFeatures.setOpacity(newOptions.opacity);
×
82
        }
UNCOV
83
        return null;
×
84
    }
85
});
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc