From aa57bc86e55181ee694d6cfa57917e36505e1495 Mon Sep 17 00:00:00 2001 From: Roman Zoller Date: Fri, 23 Mar 2018 09:42:06 +0100 Subject: [PATCH] Move olx.layer.HeatmapOptions to ol/layer/Heatmap --- externs/olx.js | 118 ---------------------------------------- src/ol/layer/Heatmap.js | 26 ++++++++- 2 files changed, 25 insertions(+), 119 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 6bfc8de381..31a1c49215 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,124 +5,6 @@ let olx; -/** - * @typedef {{gradient: (Array.|undefined), - * radius: (number|undefined), - * blur: (number|undefined), - * shadow: (number|undefined), - * weight: (string|function(module:ol/Feature~Feature):number|undefined), - * extent: (ol.Extent|undefined), - * minResolution: (number|undefined), - * maxResolution: (number|undefined), - * opacity: (number|undefined), - * source: (ol.source.Vector|undefined), - * visible: (boolean|undefined), - * zIndex: (number|undefined)}} - */ -olx.layer.HeatmapOptions; - - -/** - * The color gradient of the heatmap, specified as an array of CSS color - * strings. Default is `['#00f', '#0ff', '#0f0', '#ff0', '#f00']`. - * @type {Array.|undefined} - * @api - */ -olx.layer.HeatmapOptions.prototype.gradient; - - -/** - * Radius size in pixels. Default is `8`. - * @type {number|undefined} - * @api - */ -olx.layer.HeatmapOptions.prototype.radius; - - -/** - * Blur size in pixels. Default is `15`. - * @type {number|undefined} - * @api - */ -olx.layer.HeatmapOptions.prototype.blur; - - -/** - * Shadow size in pixels. Default is `250`. - * @type {number|undefined} - * @api - */ -olx.layer.HeatmapOptions.prototype.shadow; - - -/** - * The feature attribute to use for the weight or a function that returns a - * weight from a feature. Weight values should range from 0 to 1 (and values - * outside will be clamped to that range). Default is `weight`. - * @type {string|function(module:ol/Feature~Feature):number|undefined} - * @api - */ -olx.layer.HeatmapOptions.prototype.weight; - - -/** - * The bounding extent for layer rendering. The layer will not be rendered - * outside of this extent. - * @type {ol.Extent|undefined} - * @api - */ -olx.layer.HeatmapOptions.prototype.extent; - - -/** - * The minimum resolution (inclusive) at which this layer will be visible. - * @type {number|undefined} - * @api - */ -olx.layer.HeatmapOptions.prototype.minResolution; - - -/** - * The maximum resolution (exclusive) below which this layer will be visible. - * @type {number|undefined} - * @api - */ -olx.layer.HeatmapOptions.prototype.maxResolution; - - -/** - * Opacity. 0-1. Default is `1`. - * @type {number|undefined} - * @api - */ -olx.layer.HeatmapOptions.prototype.opacity; - - -/** - * Source. - * @type {ol.source.Vector} - * @api - */ -olx.layer.HeatmapOptions.prototype.source; - - -/** - * Visibility. Default is `true` (visible). - * @type {boolean|undefined} - * @api - */ -olx.layer.HeatmapOptions.prototype.visible; - - -/** - * The z-index for layer rendering. At rendering time, the layers will be - * ordered, first by Z-index and then by position. The default Z-index is 0. - * @type {number|undefined} - * @api - */ -olx.layer.HeatmapOptions.prototype.zIndex; - - /** * @typedef {{opacity: (number|undefined), * map: (ol.PluggableMap|undefined), diff --git a/src/ol/layer/Heatmap.js b/src/ol/layer/Heatmap.js index e668e8d183..9362db3f2a 100644 --- a/src/ol/layer/Heatmap.js +++ b/src/ol/layer/Heatmap.js @@ -13,6 +13,30 @@ import Icon from '../style/Icon.js'; import Style from '../style/Style.js'; +/** + * @typedef {Object} Options + * @property {number} [opacity=1] Opacity (0, 1). + * @property {boolean} [visible=true] Visibility. + * @property {ol.Extent} [extent] The bounding extent for layer rendering. The layer will not be + * rendered outside of this extent. + * @property {number} [zIndex=0] The z-index for layer rendering. At rendering time, the layers + * will be ordered, first by Z-index and then by position. + * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be + * visible. + * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will + * be visible. + * @property {Array.} [gradient=['#00f', '#0ff', '#0f0', '#ff0', '#f00']] The color gradient + * of the heatmap, specified as an array of CSS color strings. + * @property {number} [radius=8] Radius size in pixels. + * @property {number} [blur=15] Blur size in pixels. + * @property {number} [shadow=250] Shadow size in pixels. + * @property {string|function(module:ol/Feature~Feature):number} [weight='weight'] The feature + * attribute to use for the weight or a function that returns a weight from a feature. Weight values + * should range from 0 to 1 (and values outside will be clamped to that range). + * @property {ol.source.Vector} [source] Source. + */ + + /** * @enum {string} * @private @@ -41,7 +65,7 @@ const DEFAULT_GRADIENT = ['#00f', '#0ff', '#0f0', '#ff0', '#f00']; * @constructor * @extends {module:ol/layer/Vector~VectorLayer} * @fires ol.render.Event - * @param {olx.layer.HeatmapOptions=} opt_options Options. + * @param {module:ol/layer/Heatmap~Options=} opt_options Options. * @api */ const Heatmap = function(opt_options) {