赣州市洪水风险预警系统三维版本
guoshilong
2023-02-27 4d8c6dd77427e8e581fda17b6b65ba86bfb7a815
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import Check from '../Core/Check.js';
import defined from '../Core/defined.js';
 
    /**
     * A static class with helper functions used by the CesiumInspector and Cesium3DTilesInspector
     * @private
     */
    var InspectorShared = {};
 
    /**
     * Creates a checkbox component
     * @param {String} labelText The text to display in the checkbox label
     * @param {String} checkedBinding The name of the variable used for checked binding
     * @param {String} [enableBinding] The name of the variable used for enable binding
     * @return {Element}
     */
    InspectorShared.createCheckbox = function (labelText, checkedBinding, enableBinding) {
        //>>includeStart('debug', pragmas.debug);
        Check.typeOf.string('labelText', labelText);
        Check.typeOf.string('checkedBinding', checkedBinding);
        //>>includeEnd('debug');
        var checkboxContainer = document.createElement('div');
        var checkboxLabel = document.createElement('label');
        var checkboxInput = document.createElement('input');
        checkboxInput.type = 'checkbox';
 
        var binding = 'checked: ' + checkedBinding;
        if (defined(enableBinding)) {
            binding += ', enable: ' + enableBinding;
        }
        checkboxInput.setAttribute('data-bind', binding);
        checkboxLabel.appendChild(checkboxInput);
        checkboxLabel.appendChild(document.createTextNode(labelText));
        checkboxContainer.appendChild(checkboxLabel);
        return checkboxContainer;
    };
 
    /**
     * Creates a section element
     * @param {Element} panel The parent element
     * @param {String} headerText The text to display at the top of the section
     * @param {String} sectionVisibleBinding The name of the variable used for visible binding
     * @param {String} toggleSectionVisibilityBinding The name of the function used to toggle visibility
     * @return {Element}
     */
    InspectorShared.createSection = function (panel, headerText, sectionVisibleBinding, toggleSectionVisibilityBinding) {
        //>>includeStart('debug', pragmas.debug);
        Check.defined('panel', panel);
        Check.typeOf.string('headerText', headerText);
        Check.typeOf.string('sectionVisibleBinding', sectionVisibleBinding);
        Check.typeOf.string('toggleSectionVisibilityBinding', toggleSectionVisibilityBinding);
        //>>includeEnd('debug');
        var section = document.createElement('div');
        section.className = 'cesium-cesiumInspector-section';
        section.setAttribute('data-bind', 'css: { "cesium-cesiumInspector-section-collapsed": !' + sectionVisibleBinding + ' }');
        panel.appendChild(section);
 
        var sectionHeader = document.createElement('h3');
        sectionHeader.className = 'cesium-cesiumInspector-sectionHeader';
        sectionHeader.appendChild(document.createTextNode(headerText));
        sectionHeader.setAttribute('data-bind', 'click: ' + toggleSectionVisibilityBinding);
        section.appendChild(sectionHeader);
 
        var sectionContent = document.createElement('div');
        sectionContent.className = 'cesium-cesiumInspector-sectionContent';
        section.appendChild(sectionContent);
        return sectionContent;
    };
export default InspectorShared;