all files / maps/layers/ bing-map.js

100% Statements 26/26
100% Branches 6/6
100% Functions 5/5
100% Lines 26/26
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   62×   176× 176× 176× 224× 224× 224× 112×   224× 84×   224×   176× 144× 144× 144×     32×     19× 19×        
define(["require", "exports", "@syncfusion/ej2-base"], function (require, exports, ej2_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var BingMap = (function () {
        function BingMap(maps) {
            this.maps = maps;
        }
        BingMap.prototype.getBingMap = function (tile, key, type, language, imageUrl, subDomains) {
            var quadKey = '';
            var maxZoom = Math.min(this.maps.tileZoomLevel, parseInt(this.maxZoom, 10));
            for (var i = maxZoom; i > 0; i--) {
                var digit = 0;
                var mask = 1 << (i - 1);
                if ((tile.x & mask) !== 0) {
                    digit++;
                }
                if ((tile.y & mask) !== 0) {
                    digit += 2;
                }
                quadKey = quadKey + '' + digit;
            }
            if (!ej2_base_1.isNullOrUndefined(subDomains)) {
                var subDomain = subDomains[Math.min(parseInt(quadKey.substr(quadKey.length - 1, 1), 10), subDomains.length)];
                imageUrl = imageUrl.replace('{quadkey}', quadKey).replace('{subdomain}', subDomain);
                return imageUrl += '&mkt=' + language + '&ur=IN&Key=' + key;
            }
            else {
                return '';
            }
        };
        BingMap.prototype.destroy = function () {
            this.maps = null;
            this.subDomains = [];
        };
        return BingMap;
    }());
    exports.BingMap = BingMap;
});