From 568f854f29d3af36a911dd29d43f96a960090afe Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Fri, 29 Aug 2014 09:07:01 +0200 Subject: [PATCH] Add olx.layer.ImageOptions typedef --- externs/olx.js | 97 ++++++++++++++++++++++++++++++++++++++ src/ol/layer/imagelayer.js | 4 +- 2 files changed, 99 insertions(+), 2 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 10abe1a640..e1ac71a8a1 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -2734,6 +2734,103 @@ olx.layer.HeatmapOptions.prototype.source; olx.layer.HeatmapOptions.prototype.visible; +/** + * @typedef {{brightness: (number|undefined), + * contrast: (number|undefined), + * hue: (number|undefined), + * opacity: (number|undefined), + * saturation: (number|undefined), + * source: ol.source.Image, + * visible: (boolean|undefined), + * extent: (ol.Extent|undefined), + * minResolution: (number|undefined), + * maxResolution: (number|undefined)}} + * @api + */ +olx.layer.ImageOptions; + + +/** + * Brightness. Default is `0`. + * @type {number|undefined} + * @api + */ +olx.layer.ImageOptions.prototype.brightness; + + +/** + * Contrast. Default is `1`. + * @type {number|undefined} + * @api + */ +olx.layer.ImageOptions.prototype.contrast; + + +/** + * Hue. Default is `0`. + * @type {number|undefined} + * @api + */ +olx.layer.ImageOptions.prototype.hue; + + +/** + * Opacity (0, 1). Default is `1`. + * @type {number|undefined} + * @api stable + */ +olx.layer.ImageOptions.prototype.opacity; + + +/** + * Saturation. Default is `1`. + * @type {number|undefined} + * @api + */ +olx.layer.ImageOptions.prototype.saturation; + + +/** + * Source for this layer. + * @type {ol.source.Image} + * @api stable + */ +olx.layer.ImageOptions.prototype.source; + + +/** + * Visibility. Default is `true` (visible). + * @type {boolean|undefined} + * @api stable + */ +olx.layer.ImageOptions.prototype.visible; + + +/** + * The bounding extent for layer rendering. The layer will not be rendered + * outside of this extent. + * @type {ol.Extent|undefined} + * @api stable + */ +olx.layer.ImageOptions.prototype.extent; + + +/** + * The minimum resolution (inclusive) at which this layer will be visible. + * @type {number|undefined} + * @api stable + */ +olx.layer.ImageOptions.prototype.minResolution; + + +/** + * The maximum resolution (exclusive) below which this layer will be visible. + * @type {number|undefined} + * @api stable + */ +olx.layer.ImageOptions.prototype.maxResolution; + + /** * @typedef {{brightness: (number|undefined), * contrast: (number|undefined), diff --git a/src/ol/layer/imagelayer.js b/src/ol/layer/imagelayer.js index e885a9cbc9..11dc35c39d 100644 --- a/src/ol/layer/imagelayer.js +++ b/src/ol/layer/imagelayer.js @@ -15,10 +15,10 @@ goog.require('ol.layer.Layer'); * @constructor * @extends {ol.layer.Layer} * @fires ol.render.Event - * @param {olx.layer.LayerOptions} options Layer options. + * @param {olx.layer.ImageOptions} options Layer options. * @api stable */ ol.layer.Image = function(options) { - goog.base(this, options); + goog.base(this, /** @type {olx.layer.LayerOptions} */ (options)); }; goog.inherits(ol.layer.Image, ol.layer.Layer);