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

geosolutions-it / MapStore2 / 19710972030

26 Nov 2025 03:38PM UTC coverage: 76.665% (-0.3%) from 76.929%
19710972030

Pull #11119

github

web-flow
Fix maven publish (#11739)
Pull Request #11119: Layer Selection Plugin on ArcGIS, WFS & WMS layers

32272 of 50209 branches covered (64.28%)

3 of 3 new or added lines in 2 files covered. (100.0%)

3018 existing lines in 249 files now uncovered.

40157 of 52380 relevant lines covered (76.66%)

37.9 hits per line

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

67.39
/web/client/utils/openlayers/Layers.js
1
/**
2
 * Copyright 2015, 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
const layerTypes = {};
1✔
10

11
export const registerType = function(type, impl) {
1✔
12
    layerTypes[type] = impl;
16✔
13
};
14

15
export const createLayer = function(type, options, map, mapId) {
1✔
16
    var layerCreator = layerTypes[type];
168✔
17
    if (layerCreator) {
168!
18
        return layerCreator.create(options, map, mapId);
168✔
19
    }
20
    return null;
×
21
};
22

23
export const updateLayer = function(type, layer, newOptions, oldOptions, map, mapId) {
1✔
24
    var layerCreator = layerTypes[type];
26✔
25
    if (layerCreator && layerCreator.update) {
26!
26
        return layerCreator.update(layer, newOptions, oldOptions, map, mapId);
26✔
27
    } else if (oldOptions && layer?.getSource?.()?.updateParams) {
×
28
        // old method, keept for compatibility.
29
        // TODO move it in specific layerCreator where possibile
30
        let changed = false;
×
31
        if (oldOptions.params && newOptions.params) {
×
32
            changed = Object.keys(oldOptions.params).reduce((found, param) => {
×
33
                if (newOptions.params[param] !== oldOptions.params[param]) {
×
34
                    return true;
×
35
                }
36
                return found;
×
37
            }, false);
38
        } else if (!oldOptions.params && newOptions.params) {
×
39
            changed = true;
×
40
        }
41

42
        if (changed) {
×
43
            layer.getSource().updateParams(newOptions.params);
×
44
        }
45
    }
46
    return null;
×
47
};
48

49
export const removeLayer = function(type, options, map, mapId, layer) {
1✔
50
    var layerCreator = layerTypes[type];
73✔
51
    if (layerCreator && layerCreator.remove) {
73!
52
        return layerCreator.remove(options, map, mapId, layer);
×
53
    }
54
    return null;
73✔
55
};
56

57
export const renderLayer = function(type, options, map, mapId, layer) {
1✔
58
    var layerCreator = layerTypes[type];
288✔
59
    if (layerCreator && layerCreator.render) {
288✔
60
        return layerCreator.render(options, map, mapId, layer);
53✔
61
    }
62
    return null;
235✔
63
};
64

65
export const isValid = function(type, layer) {
1✔
66
    var layerCreator = layerTypes[type];
163✔
67
    if (layerCreator && layerCreator.isValid) {
163!
UNCOV
68
        return layerCreator.isValid(layer);
×
69
    }
70
    return true;
163✔
71
};
72

73
export const isSupported = function(type) {
1✔
74
    return !!layerTypes[type];
3✔
75
};
76

77
export const isCompatible = function(type, options) {
1✔
78
    const layerCreator = layerTypes[type];
163✔
79
    if (layerCreator && layerCreator.isCompatible) {
163✔
80
        return layerCreator.isCompatible(options);
20✔
81
    }
82
    return true;
143✔
83
};
84

85
export default {
86
    registerType,
87
    createLayer,
88
    updateLayer,
89
    removeLayer,
90
    renderLayer,
91
    isValid,
92
    isSupported,
93
    isCompatible
94
};
95

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