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

geosolutions-it / MapStore2 / 14534587011

18 Apr 2025 11:41AM UTC coverage: 76.977% (-0.02%) from 76.993%
14534587011

Pull #11037

github

web-flow
Merge f22d700f6 into 48d6a1a15
Pull Request #11037: Remove object assign pollyfills

30792 of 47937 branches covered (64.23%)

446 of 556 new or added lines in 94 files covered. (80.22%)

8 existing lines in 4 files now uncovered.

38277 of 49725 relevant lines covered (76.98%)

36.07 hits per line

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

25.0
/web/client/components/map/leaflet/plugins/BingLayer.js
1
/**
2
 * Copyright 2015, 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
import L from 'leaflet';
9
import Layers from '../../../../utils/leaflet/Layers';
10
import 'leaflet-plugins/layer/tile/Bing';
11

12
L.BingLayer.prototype.loadMetadata = function() {
1✔
13
    if (this.metaRequested) {
×
14
        return;
×
15
    }
16
    this.metaRequested = true;
×
17
    const _this = this;
×
18
    const cbid = '_bing_metadata_' + L.Util.stamp(this);
×
19
    window[cbid] = function(meta) {
×
20
        _this.meta = meta;
×
21
        window[cbid] = undefined;
×
22
        const e = document.getElementById(cbid);
×
23
        e.parentNode.removeChild(e);
×
24
        if (meta.errorDetails) {
×
25
            _this.fire('load', {layer: _this});
×
26
            return _this.onError(meta);
×
27
        }
28
        _this.initMetadata(meta);
×
29
        return null;
×
30
    };
31
    const urlScheme = document.location.protocol === 'file:' ? 'https' : document.location.protocol.slice(0, -1);
×
32
    const url = urlScheme + '://dev.virtualearth.net/REST/v1/Imagery/Metadata/'
×
33
                + this.options.type + '?include=ImageryProviders&jsonp=' + cbid +
34
                '&key=' + this._key + '&UriScheme=' + urlScheme;
35
    const script = document.createElement('script');
×
36
    script.type = 'text/javascript';
×
37
    script.src = url;
×
38
    script.id = cbid;
×
39
    document.getElementsByTagName('head')[0].appendChild(script);
×
40
};
41
L.BingLayer.prototype.onError = function(meta) {
1✔
42
    if (this.options.onError) {
×
43
        return this.options.onError(meta);
×
44
    }
45
    return null;
×
46
};
47

48

49
Layers.registerType('bing', {
1✔
50
    create: (options) => {
51
        var key = options.apiKey;
1✔
52
        let layerOptions = {
1✔
53
            subdomains: [0, 1, 2, 3],
54
            type: options.name,
55
            attribution: 'Bing',
56
            culture: '',
57
            onError: options.onError,
58
            maxNativeZoom: options.maxNativeZoom || 19,
2✔
59
            maxZoom: options.maxZoom || 23
2✔
60
        };
61
        if (options.zoomOffset) {
1!
NEW
62
            layerOptions = Object.assign({}, layerOptions, {
×
63
                zoomOffset: options.zoomOffset
64
            });
65
        }
66
        return new L.BingLayer(key, layerOptions);
1✔
67
    },
68
    isValid: (layer) => {
69
        if (layer.meta && layer.meta.statusCode && layer.meta.statusCode !== 200) {
2!
70
            return false;
×
71
        }
72
        return true;
2✔
73
    }
74
});
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