-
Glenn Vorhes authoredGlenn Vorhes authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
propertiesZoomStyle.js 3.21 KiB
/**
* Created by gavorhes on 12/14/2015.
*/
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var provide_1 = require("../util/provide");
var zoomResolutionConvert = require("./zoomResolutionConvert");
var nm = provide_1.default('olHelpers');
/**
* A style function based on properties and zoom level, wraps normal feature, resolution function
* @callback propertiesZoomStyle
* @param {object} properties the feature properties
* @param {number} zoom level
*
*/
/**
* wrapper to define a style function by properties and zoom level
* @param {propertiesZoomStyle|*} styleFunc - style function
* @returns {function|*} new function
*/
function propertiesZoomStyle(styleFunc) {
if (styleFunc == undefined) {
return undefined;
}
return function (feature, resolution) {
styleFunc(feature.getProperties(), zoomResolutionConvert.resolutionToZoom(resolution));
};
}
nm.propertiesZoomStyle = propertiesZoomStyle;
exports.default = propertiesZoomStyle;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvcGVydGllc1pvb21TdHlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9vbEhlbHBlcnMvcHJvcGVydGllc1pvb21TdHlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRzs7O0FBRUgsMkNBQXNDO0FBQ3RDLCtEQUFpRTtBQUVqRSxJQUFNLEVBQUUsR0FBRyxpQkFBTyxDQUFDLFdBQVcsQ0FBQyxDQUFDO0FBR2hDOzs7Ozs7R0FNRztBQUVIOzs7O0dBSUc7QUFDSCw2QkFBNkIsU0FBUztJQUNsQyxFQUFFLENBQUMsQ0FBQyxTQUFTLElBQUksU0FBUyxDQUFDLENBQUEsQ0FBQztRQUN4QixNQUFNLENBQUMsU0FBUyxDQUFDO0lBQ3JCLENBQUM7SUFFRCxNQUFNLENBQUMsVUFBVSxPQUFtQixFQUFFLFVBQVU7UUFDNUMsU0FBUyxDQUFD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