"use strict";
/**
 * @module
 * @hidden
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseLayerSetOL = void 0;
var tslib_1 = require("tslib");
var olHas = tslib_1.__importStar(require("ol/has"));
/**
 * @hidden
 */
var BaseLayerSetOL = /** @class */ (function () {
    function BaseLayerSetOL(externalBaseLayersGroup, projection, dpi, extent, inPerUnit, view) {
        this.externalBaseLayersGroup = externalBaseLayersGroup;
        this.projection = projection;
        this.dpi = dpi;
        this.extent = extent;
        this.inPerUnit = inPerUnit;
        this.view = view;
    }
    BaseLayerSetOL.prototype.getMetersPerUnit = function () {
        return this.inPerUnit / 39.37;
    };
    BaseLayerSetOL.prototype.scaleToResolution = function (scale) {
        return (scale / this.inPerUnit / this.dpi) * olHas.DEVICE_PIXEL_RATIO;
    };
    BaseLayerSetOL.prototype.resolutionToScale = function (resolution) {
        return (resolution * this.dpi * this.inPerUnit) / olHas.DEVICE_PIXEL_RATIO;
    };
    BaseLayerSetOL.prototype.updateExternalBaseLayers = function (externalBaseLayers) {
        if (this.externalBaseLayersGroup) {
            var layers = this.externalBaseLayersGroup.getLayers();
            layers.forEach(function (l) {
                var match = (externalBaseLayers || []).filter(function (el) { return el.name === l.get("title"); });
                if (match.length == 1) {
                    l.setVisible(!!match[0].visible);
                }
                else {
                    l.setVisible(false);
                }
            });
        }
    };
    /**
     *
     * @virtual
     * @param {RefreshMode} mode
     * @memberof BaseLayerSetOL
     */
    BaseLayerSetOL.prototype.refreshMap = function (mode) { };
    return BaseLayerSetOL;
}());
exports.BaseLayerSetOL = BaseLayerSetOL;
//# sourceMappingURL=base-layer-set.js.map