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

geosolutions-it / MapStore2 / 19060241474

04 Nov 2025 06:46AM UTC coverage: 76.943% (+0.02%) from 76.92%
19060241474

Pull #11648

github

web-flow
Merge 763e0cf1e into 19e678788
Pull Request #11648: #11644: Implement dynamic request configurations

32057 of 49801 branches covered (64.37%)

201 of 222 new or added lines in 39 files covered. (90.54%)

4 existing lines in 3 files now uncovered.

39801 of 51728 relevant lines covered (76.94%)

39.94 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) {
4!
23
        return {
×
24
            detached: true,
25
            styledFeatures: undefined,
26
            remove: () => {}
27
        };
28
    }
29

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

41
    layerToGeoStylerStyle(options)
4✔
42
        .then((style) => {
43
            getStyle(applyDefaultStyleToVectorLayer({ ...options, style }), 'cesium')
4✔
44
                .then((styleFunc) => {
45
                    styledFeatures.setStyleFunction(styleFunc);
4✔
46
                });
47
        });
48
    return {
4✔
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) => {
NEW
63
        if (!isEqual(newOptions.features, oldOptions.features) || !isEqual(oldOptions.security, newOptions.security)) {
×
64
            return createLayer(newOptions, map);
×
65
        }
66
        if (layer?.styledFeatures && !isEqual(newOptions?.layerFilter, oldOptions?.layerFilter)) {
×
67
            const vectorFeatureFilter = createVectorFeatureFilter(newOptions);
×
68
            layer.styledFeatures.setFeatureFilter(vectorFeatureFilter);
×
69
        }
70

71
        if (layer?.styledFeatures && !isEqual(newOptions.style, oldOptions.style)) {
×
72
            layerToGeoStylerStyle(newOptions)
×
73
                .then((style) => {
74
                    getStyle(applyDefaultStyleToVectorLayer({ ...newOptions, style }), 'cesium')
×
75
                        .then((styleFunc) => {
76
                            layer.styledFeatures.setStyleFunction(styleFunc);
×
77
                        });
78
                });
79
        }
80
        if (layer?.styledFeatures && newOptions.opacity !== oldOptions.opacity) {
×
81
            layer.styledFeatures.setOpacity(newOptions.opacity);
×
82
        }
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

© 2025 Coveralls, Inc