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

geosolutions-it / MapStore2 / 18035872370

26 Sep 2025 11:02AM UTC coverage: 76.779% (-0.01%) from 76.793%
18035872370

Pull #11514

github

web-flow
Merge c552b177c into 47ff486da
Pull Request #11514: Fix : #11455 Added a new Plugin called CameraPosition.

31817 of 49498 branches covered (64.28%)

88 of 106 new or added lines in 10 files covered. (83.02%)

9 existing lines in 4 files now uncovered.

39566 of 51532 relevant lines covered (76.78%)

37.81 hits per line

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

23.08
/web/client/components/mapcontrols/mouseposition/HeightTypeSelector.jsx
1
/*
2
 * Copyright 2025, 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 PropTypes from "prop-types";
10
import React from "react";
11
import { ControlLabel, FormControl, FormGroup } from "react-bootstrap";
12
import FlexBox from "../../layout/FlexBox";
13

14
/**
15
 * HeightTypeSelector allows to select a height type from a combobox.
16
 * @memberof components.mousePosition
17
 * @class
18
 * @prop {string} id the id of the component
19
 * @prop {string|object|function} label the label shown next to the combobox (if editHeight is true)
20
 * @prop {string[]} filterAllowedHeight list of allowed height type in the combobox list. Accepted values are "Ellipsoidal" and "MSL"
21
 * @prop {string} heightType the current selected height type
22
 * @prop {boolean} enabled if true shows the component
23
 * @prop {function} onHeightTypeChange callback when a new height type is selected
24
 */
25

26
const HeightTypeSelector = (props) => {
1✔
27
    const {
28
        id,
29
        label,
30
        filterAllowedHeight,
31
        heightType,
32
        enabled,
33
        onHeightTypeChange
NEW
34
    } = props;
×
35

NEW
36
    if (!enabled) {
×
NEW
37
        return null;
×
38
    }
NEW
39
    const availableHeightTypes = [
×
40
        { value: "Ellipsoidal", label: "Ellipsoidal" },
41
        { value: "MSL", label: "MSL" }
42
    ];
43

NEW
44
    const filteredHeightTypes = filterAllowedHeight && filterAllowedHeight.length > 0
×
NEW
45
        ? availableHeightTypes.filter((height) => filterAllowedHeight.includes(height.value))
×
46
        : availableHeightTypes;
47

NEW
48
    const options = filteredHeightTypes.map(({ value, label: optionLabel }) => (
×
NEW
49
        <option value={value} key={value}>{optionLabel}</option>
×
50
    ));
51

NEW
52
    return (
×
53
        <FlexBox component={FormGroup} centerChildrenVertically gap="sm">
54
            <ControlLabel style={{ margin: 0, fontWeight: 'normal', minWidth: 'max-content' }}>
55
                {label}
56
            </ControlLabel>
57
            <FormControl
58
                componentClass="select"
59
                id={id}
60
                value={heightType}
NEW
61
                onChange={(e) => onHeightTypeChange(e.target.value)}
×
62
                bsSize="small"
63
                style={{ borderRadius: 4 }}
64
            >
65
                {options}
66
            </FormControl>
67
        </FlexBox>
68
    );
69
};
70

71
HeightTypeSelector.propTypes = {
1✔
72
    id: PropTypes.string,
73
    label: PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.object]),
74
    filterAllowedHeight: PropTypes.array,
75
    heightType: PropTypes.string,
76
    enabled: PropTypes.bool,
77
    onHeightTypeChange: PropTypes.func
78
};
79

80
HeightTypeSelector.defaultProps = {
1✔
81
    id: "mapstore-heightselector",
82
    heightType: null,
83
    onHeightTypeChange: function() {},
84
    enabled: false
85
};
86

87
export default HeightTypeSelector;
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