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

geosolutions-it / MapStore2 / 16522104010

25 Jul 2025 12:35PM UTC coverage: 76.925%. Remained the same
16522104010

push

github

web-flow
Improving underground navigation in Cesium #11362 (#11363)

* Add UI toggle for Cesium collision detection with live map update and tests

* fix: update label

* fix: fix translation

31366 of 48788 branches covered (64.29%)

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

1 existing line in 1 file now uncovered.

38874 of 50535 relevant lines covered (76.92%)

36.47 hits per line

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

25.0
/web/client/plugins/map/mapsettings/MapSettings.jsx
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 React from 'react';
10
import { connect } from 'react-redux';
11
import { FormGroup, Checkbox, ControlLabel } from 'react-bootstrap';
12
import Select from 'react-select';
13
import { createSelector } from 'reselect';
14
import Message from '../../../components/I18N/Message';
15
import { updateMapOptions } from '../../../actions/map';
16
import ConfigUtils from '../../../utils/ConfigUtils';
17

18
import { mapSelector } from '../../../selectors/map';
19
import { mapTypeSelector, isCesium as isCesiumSelector } from '../../../selectors/maptype';
20
import localizedProps from '../../../components/misc/enhancers/localizedProps';
21
import utcDateWrapper from '../../../components/misc/enhancers/utcDateWrapper';
22
import { getMessageById } from '../../../utils/LocaleUtils';
23
import PropTypes from 'prop-types';
24
import DateTimePicker from '../../../components/misc/datetimepicker';
25

26
const mapStateToProps = createSelector(
1✔
27
    mapSelector,
28
    mapTypeSelector,
29
    isCesiumSelector,
30
    (map, mapType, isCesium) => ( { map, mapType, isCesium })
×
31
);
32

33
const actions = {
1✔
34
    updateConfigAction: updateMapOptions
35
};
36

37
const UTCDateTimePicker = utcDateWrapper({
1✔
38
    dateProp: "value",
39
    dateTypeProp: "type",
40
    setDateProp: "onChange"
41
})(DateTimePicker);
42

43
const Component = ({
1✔
44
    map,
45
    mapType,
46
    isCesium,
47
    updateConfigAction,
48
    mapOptions: defaultMapOptions
49
}, { messages }) => {
50
    const SelectLocalized = localizedProps(["placeholder", "options"])(Select);
×
51

52
    const mapOptions = {
×
53
        ...(defaultMapOptions && defaultMapOptions[mapType]
×
54
            || ConfigUtils.getConfigProp("defaultMapOptions") && ConfigUtils.getConfigProp("defaultMapOptions")[mapType] || {}),
55
        ...map?.mapOptions
56
    };
57

58
    const handleConfigUpdate = (options, key) => {
×
59
        updateConfigAction({[key]: !options[key]});
×
60
    };
61

62
    return isCesium ? (
×
63
        <form>
64
            <FormGroup>
65
                <ControlLabel>
66
                    <Message msgId="map.settings.title" />
67
                </ControlLabel>
68
            </FormGroup>
69
            <Checkbox
70
                checked={mapOptions.showSkyAtmosphere}
71
                onChange={() => handleConfigUpdate(mapOptions, 'showSkyAtmosphere')}
×
72
            >
73
                <Message msgId="map.settings.skyAtmosphere" />
74
            </Checkbox>
75
            <Checkbox
76
                checked={mapOptions.showGroundAtmosphere}
77
                onChange={() => handleConfigUpdate(mapOptions, 'showGroundAtmosphere')}
×
78
            >
79
                <Message msgId="map.settings.groundAtmosphere" />
80
            </Checkbox>
81
            <Checkbox
82
                checked={mapOptions.enableFog}
83
                onChange={() => handleConfigUpdate(mapOptions, 'enableFog')}
×
84
            >
85
                <Message msgId="map.settings.fog" />
86
            </Checkbox>
87
            <Checkbox
88
                checked={mapOptions.depthTestAgainstTerrain}
89
                onChange={() => handleConfigUpdate(mapOptions, 'depthTestAgainstTerrain')}
×
90
            >
91
                <Message msgId="map.settings.depthTest" />
92
            </Checkbox>
93
            <Checkbox
94
                checked={mapOptions.enableCollisionDetection !== undefined ? mapOptions.enableCollisionDetection : true}
×
NEW
95
                onChange={() => handleConfigUpdate(mapOptions, 'enableCollisionDetection')}
×
96
            >
97
                <Message msgId="map.settings.collisionDetection" />
98
            </Checkbox>
99
            <FormGroup>
100
                <ControlLabel><Message msgId="map.settings.lightings.title"/></ControlLabel>
101
                <SelectLocalized
102
                    options={[
103
                        {label: "map.settings.lightings.sunlightOption", value: "sunlight"},
104
                        {label: "map.settings.lightings.flashlightOption", value: "flashlight"},
105
                        {label: "map.settings.lightings.dateTimeOption", value: "dateTime"}
106
                    ]}
107
                    wrapperStyle = {{ marginTop: "10px"}}
108
                    value={mapOptions && mapOptions.lighting?.value || "sunlight"}
×
109
                    clearable={false}
110
                    onChange={(val) => {
111
                        if (val !== 'dateTime') {
×
112
                            updateConfigAction({"lighting": {value: val.value}});
×
113
                        } else {
114
                            updateConfigAction({"lighting": {value: val.value, dateTime: new Date().toISOString()}});
×
115
                        }
116
                    }}
117
                    placeholder="map.settings.lightings.placeholder"
118
                />
119
                {mapOptions?.lighting?.value === 'dateTime' ?
×
120
                    <div className="lighting-dateTime-picker">
121
                        <UTCDateTimePicker
122
                            value={mapOptions.lighting?.dateTime ? new Date(mapOptions.lighting?.dateTime) : new Date()}
×
123
                            hideOperator
124
                            time
125
                            popupPosition={"top"}
126
                            calendar
127
                            type={'date-time'}
128
                            onChange={(date) => {
129
                                updateConfigAction({"lighting": {...mapOptions.lighting, dateTime: date}});
×
130
                            }}
131
                            placeholder={getMessageById(messages, "map.settings.lightings.dateTimePlaceholder")} />
132
                    </div> :
133
                    null}
134
            </FormGroup>
135
        </form>
136
    ) : null;
137
};
138
Component.contextTypes = {
1✔
139
    messages: PropTypes.object
140
};
141
export default connect(mapStateToProps, actions)(Component);
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