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

compassinformatics / cpsi-mapview / 15022980938

14 May 2025 02:11PM UTC coverage: 26.333% (+0.04%) from 26.29%
15022980938

push

github

geographika
Move describe to test globals

492 of 2344 branches covered (20.99%)

Branch coverage included in aggregate %.

1464 of 5084 relevant lines covered (28.8%)

1.17 hits per line

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

25.0
/app/data/model/LayerTreeNode.js
1
/**
2
 * The CPSI MapView layer tree node class used by the stores used in trees.
3
 *
4
 * @class CpsiMapview.data.model.LayerTreeNode
5
 */
6
Ext.define('CpsiMapview.data.model.LayerTreeNode', {
1✔
7
    extend: 'GeoExt.data.model.LayerTreeNode',
8

9
    requires: ['CpsiMapview.util.Style'],
10

11
    /**
12
     * The layer property that will be used to hold a title for the description of the model in views.
13
     *
14
     * @cfg {String}
15
     */
16
    descriptionTitleProperty: 'descTitle',
17

18
    fields: [
19
        {
20
            name: 'qtitle',
21
            type: 'string',
22
            persist: false,
23
            convert: function (v, record) {
24
                return (
9✔
25
                    record.getOlLayerProp(
18✔
26
                        record.descriptionTitleProperty,
27
                        ''
28
                    ) || record.get('text')
29
                );
30
            }
31
        },
32
        {
33
            name: '__toggleMode',
34
            type: 'string',
35
            defaultValue: 'ol3'
36
        },
37
        {
38
            // overwrite the text property to add custom behavior
39
            name: 'text',
40
            type: 'string',
41
            persist: false,
42
            convert: function (v, record) {
43
                if (!v) {
9!
44
                    // folders / LayerGroups
45
                    const layerGroup = record.getOlLayer();
9✔
46
                    if (layerGroup) {
9!
47
                        return record.getOlLayer().get('name');
9✔
48
                    }
49
                }
50

51
                // add layer style to node text if we have the style chooser
52
                // in the context menu and not as direct item under the node
53
                const layerTree = Ext.ComponentQuery.query('cmv_layertree')[0];
×
54
                if (layerTree && layerTree.styleSwitcherBelowNode === false) {
×
55
                    const olLayer = record.getOlLayer();
×
56
                    if (olLayer && olLayer.get('activatedStyle')) {
×
57
                        // get activated layer style
58
                        const activatedStyle = olLayer.get('activatedStyle');
×
59
                        const styleTitle =
60
                            CpsiMapview.util.Style.getLayerStyleTitle(
×
61
                                activatedStyle,
62
                                olLayer
63
                            );
64

65
                        // apply node name + style name
66
                        const treeNodeConf = olLayer.get('_origTreeConf');
×
67
                        if (treeNodeConf && treeNodeConf.text && styleTitle) {
×
68
                            return treeNodeConf.text + ' (' + styleTitle + ')';
×
69
                        }
70
                    }
71
                }
72

73
                return v;
×
74
            }
75
        }
76
    ],
77

78
    /**
79
     * Only toggle checkboxes if the layer is in the layer tree
80
     * This avoids a costly refresh of the entire tree
81
     * @param {any} evt
82
     */
83
    onLayerVisibleChange: function (evt) {
84
        const layer = evt.target;
×
85

86
        if (!this.__updating) {
×
87
            this.set('checked', layer.get('visible'));
×
88
        }
89
    }
90
});
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