• 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

46.67
/web/client/plugins/Swipe.jsx
1
/*
2
* Copyright 2020, 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 React from 'react';
10
import { connect } from 'react-redux';
11
import { createSelector } from 'reselect';
12

13
import { layerSwipeSettingsSelector, swipeModeSettingsSelector, spyModeSettingsSelector, getSwipeLayerId, swipeSliderSettingsSelector } from '../selectors/swipe';
14
import swipe from '../reducers/swipe';
15
import epics from '../epics/swipe';
16
import {
17
    setActive,
18
    setMode,
19
    setSwipeLayer,
20
    setSwipeSliderOps
21
} from '../actions/swipe';
22

23
import { createPlugin } from '../utils/PluginsUtils';
24

25
import SwipeSettings from './SwipeSettings';
26
import SliderSwipeSupport from '../components/map/openlayers/swipe/SliderSwipeSupport';
27
import SpyGlassSupport from '../components/map/openlayers/swipe/SpyGlassSupport';
28
import SwipeButton from './swipe/SwipeButton';
29

30

31
export const Support = ({ mode, map, layer, active, swipeModeSettings, spyModeSettings, swipeSliderOptions, onSetSwipeSliderOptions }) => {
1✔
32
    if (mode === "spy") {
2✔
33
        return <SpyGlassSupport map={map} layer={layer} active={active} radius={spyModeSettings.radius} />;
1✔
34
    }
35
    return <SliderSwipeSupport map={map} layer={layer} active={active} type={swipeModeSettings.direction} swipeSliderOptions={swipeSliderOptions} onSetSwipeSliderOptions={onSetSwipeSliderOptions} />;
1✔
36
};
37

38
const swipeSupportSelector = createSelector([
1✔
39
    getSwipeLayerId,
40
    layerSwipeSettingsSelector,
41
    swipeModeSettingsSelector,
42
    spyModeSettingsSelector,
43
    swipeSliderSettingsSelector
UNCOV
44
], (layer, swipeSettings, swipeModeSettings, spyModeSettings, swipeSliderOptions) => ({
×
45
    layer,
46
    active: swipeSettings.active || false,
×
47
    swipeModeSettings,
48
    spyModeSettings,
49
    mode: swipeSettings?.mode || "swipe",
×
50
    swipeSliderOptions
51
}));
52

53
const MapSwipeSupport = connect(swipeSupportSelector, {
1✔
54
    onSetSwipeSliderOptions: setSwipeSliderOps
55
})(Support);
56

57
const tocToolsSelector = createSelector(getSwipeLayerId, layerSwipeSettingsSelector, (swipeLayerId, swipeSettings) => ({swipeLayerId, swipeSettings}));
1✔
58

59
/**
60
 * Swipe. Add to the TOC the possibility to select a layer for Swipe.
61
 * @name Swipe
62
 * @memberof plugins
63
 * @class
64
 */
65
export default createPlugin(
66
    'Swipe',
67
    {
68
        options: {
69
            disablePluginIf: "{state('mapType') === 'leaflet' || state('mapType') === 'cesium'}"
70
        },
71
        component: SwipeSettings,
72
        containers: {
73
            TOC: [{
74
                name: "Swipe",
75
                target: "context-menu",
76
                Component: connect(
77
                    tocToolsSelector,
78
                    {
79
                        onSetActive: setActive,
80
                        onSetSwipeMode: setMode,
81
                        onSetSwipeLayer: setSwipeLayer
82
                    }
83
                )(SwipeButton),
84
                position: 13
85
            }, {
86
                name: "Swipe",
87
                target: "node-tool",
88
                Component: connect(tocToolsSelector, { onSetActive: setActive })(({
89
                    itemComponent,
90
                    node,
91
                    swipeLayerId,
92
                    swipeSettings,
93
                    onSetActive
94
                }) => {
95
                    const ItemComponent = itemComponent;
×
UNCOV
96
                    const showConfiguration = () => {
×
97
                        onSetActive(!swipeSettings.configuring, "configuring");
×
98
                    };
UNCOV
99
                    if (!swipeLayerId || swipeLayerId !== node?.id) {
×
UNCOV
100
                        return null;
×
101
                    }
102
                    return (
×
103
                        <ItemComponent
104
                            glyph={swipeSettings?.mode === "swipe" ? 'transfer' : 'search'}
×
105
                            active={swipeLayerId === node?.id}
106
                            tooltipId={'toc.configureTool'}
UNCOV
107
                            onClick={() => showConfiguration()}
×
108
                        />
109
                    );
110
                }),
111
                position: 13
112
            }],
113
            Map: {
114
                name: "Swipe",
115
                Tool: MapSwipeSupport
116
            }
117
        },
118
        reducers: {
119
            swipe
120
        },
121
        epics
122
    }
123
);
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