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

geographika / cpsi-mapview / 6432360993

06 Oct 2023 01:35PM UTC coverage: 24.104% (+0.003%) from 24.101%
6432360993

push

github

geographika
Fix edge case and check for null not 0

446 of 2300 branches covered (0.0%)

Branch coverage included in aggregate %.

5 of 5 new or added lines in 1 file covered. (100.0%)

1310 of 4985 relevant lines covered (26.28%)

1.03 hits per line

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

80.0
/app/controller/toolbar/MapTools.js
1
/**
2
 * This class is the controller for the map toolbar of cpsi mapview
3
 *
4
 */
5
Ext.define('CpsiMapview.controller.toolbar.MapTools', {
1✔
6
    extend: 'Ext.app.ViewController',
7

8
    alias: 'controller.cmv_maptools',
9

10
    /**
11
     * Initialize measure buttons
12
     * @param {Ext.button.Button} btn The measure button
13
     */
14
    initializeMeasureBtn: function (btn) {
15

16
        // avoid showing "null" in IE11 by setting to an empty string
17
        btn.getViewModel().set('clickToDrawText', '');
1✔
18

19
        btn.setBind({
1✔
20
            text: '{measureTooltext}',
21
            tooltip: btn.measureType === 'line' ? '{lineMeasureTooltip}' :
1!
22
                '{polygonMeasureAreaTooltip}'
23
        });
24
        var tTipStr = btn.measureType === 'line' ?
1!
25
            btn.getViewModel().get('lineMeasureTooltip') :
26
            btn.getViewModel().get('polygonMeasureAreaTooltip');
27
        btn.tooltipStr = tTipStr;
1✔
28
    },
29

30
    /**
31
    * Limit a gazetteer to only return results within a certain extent
32
    * This sets viewbox and bounded parameters for a Nominatim search
33
    * @param {any} cmb
34
    */
35
    setGazetteerExtent: function (cmb) {
36

37
        var map = BasiGX.util.Map.getMapComponent().map;
1✔
38

39
        var app = Ext.getApplication ? Ext.getApplication() : Ext.app.Application.instance;
1!
40
        var initialExtent = app.initialExtent;
1✔
41

42
        var mv = map.getView();
1✔
43
        cmb.addMapExtentParams(initialExtent, mv.getProjection());
1✔
44
    },
45

46
    init: function () {
47

48
        // update the loggedIn property on the viewmodel so any role-restricted
49
        // buttons or menus are activated
50
        var me = this;
2✔
51
        Ext.GlobalEvents.on({
2✔
52
            login: function () {
53
                me.getViewModel().set('loggedIn', true);
×
54
            },
55
            logout: function () {
56
                me.getViewModel().set('loggedIn', false);
×
57
            }
58
        });
59

60
        // as gx_geocoder_combo does not allow binding of the map property
61
        // set this when the view is created
62
        // TODO add late-binding of the map to gx_geocoder_combo
63
        var map = BasiGX.util.Map.getMapComponent().map;
2✔
64
        var gazetteers = me.getView().query('gx_geocoder_combo');
2✔
65

66
        Ext.each(gazetteers, function (cmb) {
2✔
67
            cmb.map = map;
4✔
68
            cmb.map.addLayer(cmb.locationLayer);
4✔
69
        });
70
    }
71
});
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