Remove remaining use of inherits in src

This commit is contained in:
Tim Schaub
2018-07-17 23:43:10 -06:00
parent f6046c023c
commit 1a5cf52b61
63 changed files with 837 additions and 982 deletions
+16 -18
View File
@@ -23,24 +23,24 @@ import {assign} from '../obj.js';
*/
/**
* @classdesc
* Abstract base class; normally only used for creating subclasses and not
* instantiated in apps.
* Note that with {@link module:ol/layer/Base} and all its subclasses, any property set in
* the options is set as a {@link module:ol/Object} property on the layer object, so
* is observable, and has get/set accessors.
*
* @constructor
* @abstract
* @extends {module:ol/Object}
* @param {module:ol/layer/Base~Options} options Layer options.
* @api
*/
class BaseLayer {
class BaseLayer extends BaseObject {
/**
* @classdesc
* Abstract base class; normally only used for creating subclasses and not
* instantiated in apps.
* Note that with {@link module:ol/layer/Base} and all its subclasses, any property set in
* the options is set as a {@link module:ol/Object} property on the layer object, so
* is observable, and has get/set accessors.
*
* @constructor
* @abstract
* @extends {module:ol/Object}
* @param {module:ol/layer/Base~Options} options Layer options.
* @api
*/
constructor(options) {
BaseObject.call(this);
super();
/**
* @type {Object.<string, *>}
@@ -249,7 +249,5 @@ class BaseLayer {
}
}
inherits(BaseLayer, BaseObject);
export default BaseLayer;
+13 -15
View File
@@ -40,18 +40,18 @@ const Property = {
};
/**
* @classdesc
* A {@link module:ol/Collection~Collection} of layers that are handled together.
*
* A generic `change` event is triggered when the group/Collection changes.
*
* @constructor
* @extends {module:ol/layer/Base}
* @param {module:ol/layer/Group~Options=} opt_options Layer options.
* @api
*/
class LayerGroup {
class LayerGroup extends BaseLayer {
/**
* @classdesc
* A {@link module:ol/Collection~Collection} of layers that are handled together.
*
* A generic `change` event is triggered when the group/Collection changes.
*
* @constructor
* @extends {module:ol/layer/Base}
* @param {module:ol/layer/Group~Options=} opt_options Layer options.
* @api
*/
constructor(opt_options) {
const options = opt_options || {};
@@ -60,7 +60,7 @@ class LayerGroup {
let layers = options.layers;
BaseLayer.call(this, baseOptions);
super(baseOptions);
/**
* @private
@@ -236,7 +236,5 @@ class LayerGroup {
}
}
inherits(LayerGroup, BaseLayer);
export default LayerGroup;
+15 -17
View File
@@ -60,20 +60,20 @@ const Property = {
const DEFAULT_GRADIENT = ['#00f', '#0ff', '#0f0', '#ff0', '#f00'];
/**
* @classdesc
* Layer for rendering vector data as a heatmap.
* Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
* property on the layer object; for example, setting `title: 'My Title'` in the
* options means that `title` is observable, and has get/set accessors.
*
* @constructor
* @extends {module:ol/layer/Vector}
* @fires module:ol/render/Event~RenderEvent
* @param {module:ol/layer/Heatmap~Options=} opt_options Options.
* @api
*/
class Heatmap {
class Heatmap extends VectorLayer {
/**
* @classdesc
* Layer for rendering vector data as a heatmap.
* Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
* property on the layer object; for example, setting `title: 'My Title'` in the
* options means that `title` is observable, and has get/set accessors.
*
* @constructor
* @extends {module:ol/layer/Vector}
* @fires module:ol/render/Event~RenderEvent
* @param {module:ol/layer/Heatmap~Options=} opt_options Options.
* @api
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
@@ -84,7 +84,7 @@ class Heatmap {
delete baseOptions.blur;
delete baseOptions.shadow;
delete baseOptions.weight;
VectorLayer.call(this, /** @type {module:ol/layer/Vector~Options} */ (baseOptions));
super(baseOptions);
/**
* @private
@@ -283,8 +283,6 @@ class Heatmap {
}
}
inherits(Heatmap, VectorLayer);
/**
* @param {Array.<string>} colors A list of colored.
+16 -18
View File
@@ -26,25 +26,25 @@ import Layer from '../layer/Layer.js';
*/
/**
* @classdesc
* Server-rendered images that are available for arbitrary extents and
* resolutions.
* Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
* property on the layer object; for example, setting `title: 'My Title'` in the
* options means that `title` is observable, and has get/set accessors.
*
* @constructor
* @extends {module:ol/layer/Layer}
* @fires module:ol/render/Event~RenderEvent
* @param {module:ol/layer/Image~Options=} opt_options Layer options.
* @api
*/
class ImageLayer {
class ImageLayer extends Layer {
/**
* @classdesc
* Server-rendered images that are available for arbitrary extents and
* resolutions.
* Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
* property on the layer object; for example, setting `title: 'My Title'` in the
* options means that `title` is observable, and has get/set accessors.
*
* @constructor
* @extends {module:ol/layer/Layer}
* @fires module:ol/render/Event~RenderEvent
* @param {module:ol/layer/Image~Options=} opt_options Layer options.
* @api
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
Layer.call(this, /** @type {module:ol/layer/Layer~Options} */ (options));
super(options);
/**
* The layer type.
@@ -57,8 +57,6 @@ class ImageLayer {
}
inherits(ImageLayer, Layer);
/**
* Return the associated {@link module:ol/source/Image source} of the image layer.
+24 -26
View File
@@ -44,35 +44,35 @@ import SourceState from '../source/State.js';
*/
/**
* @classdesc
* Abstract base class; normally only used for creating subclasses and not
* instantiated in apps.
* A visual representation of raster or vector map data.
* Layers group together those properties that pertain to how the data is to be
* displayed, irrespective of the source of that data.
*
* Layers are usually added to a map with {@link module:ol/Map#addLayer}. Components
* like {@link module:ol/interaction/Select~Select} use unmanaged layers
* internally. These unmanaged layers are associated with the map using
* {@link module:ol/layer/Layer~Layer#setMap} instead.
*
* A generic `change` event is fired when the state of the source changes.
*
* @constructor
* @abstract
* @extends {module:ol/layer/Base}
* @fires module:ol/render/Event~RenderEvent
* @param {module:ol/layer/Layer~Options} options Layer options.
* @api
*/
class Layer {
class Layer extends BaseLayer {
/**
* @classdesc
* Abstract base class; normally only used for creating subclasses and not
* instantiated in apps.
* A visual representation of raster or vector map data.
* Layers group together those properties that pertain to how the data is to be
* displayed, irrespective of the source of that data.
*
* Layers are usually added to a map with {@link module:ol/Map#addLayer}. Components
* like {@link module:ol/interaction/Select~Select} use unmanaged layers
* internally. These unmanaged layers are associated with the map using
* {@link module:ol/layer/Layer~Layer#setMap} instead.
*
* A generic `change` event is fired when the state of the source changes.
*
* @constructor
* @abstract
* @extends {module:ol/layer/Base}
* @fires module:ol/render/Event~RenderEvent
* @param {module:ol/layer/Layer~Options} options Layer options.
* @api
*/
constructor(options) {
const baseOptions = assign({}, options);
delete baseOptions.source;
BaseLayer.call(this, /** @type {module:ol/layer/Base~Options} */ (baseOptions));
super(baseOptions);
/**
* @private
@@ -214,8 +214,6 @@ class Layer {
}
}
inherits(Layer, BaseLayer);
/**
* Return `true` if the layer is visible, and if the passed resolution is
+16 -18
View File
@@ -31,21 +31,21 @@ import {assign} from '../obj.js';
*/
/**
* @classdesc
* For layer sources that provide pre-rendered, tiled images in grids that are
* organized by zoom levels for specific resolutions.
* Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
* property on the layer object; for example, setting `title: 'My Title'` in the
* options means that `title` is observable, and has get/set accessors.
*
* @constructor
* @extends {module:ol/layer/Layer}
* @fires module:ol/render/Event~RenderEvent
* @param {module:ol/layer/Tile~Options=} opt_options Tile layer options.
* @api
*/
class TileLayer {
class TileLayer extends Layer {
/**
* @classdesc
* For layer sources that provide pre-rendered, tiled images in grids that are
* organized by zoom levels for specific resolutions.
* Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
* property on the layer object; for example, setting `title: 'My Title'` in the
* options means that `title` is observable, and has get/set accessors.
*
* @constructor
* @extends {module:ol/layer/Layer}
* @fires module:ol/render/Event~RenderEvent
* @param {module:ol/layer/Tile~Options=} opt_options Tile layer options.
* @api
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
@@ -53,7 +53,7 @@ class TileLayer {
delete baseOptions.preload;
delete baseOptions.useInterimTilesOnError;
Layer.call(this, /** @type {module:ol/layer/Layer~Options} */ (baseOptions));
super(baseOptions);
this.setPreload(options.preload !== undefined ? options.preload : 0);
this.setUseInterimTilesOnError(options.useInterimTilesOnError !== undefined ?
@@ -109,8 +109,6 @@ class TileLayer {
}
}
inherits(TileLayer, Layer);
/**
* Return the associated {@link module:ol/source/Tile tilesource} of the layer.
+15 -17
View File
@@ -78,20 +78,20 @@ const Property = {
};
/**
* @classdesc
* Vector data that is rendered client-side.
* Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
* property on the layer object; for example, setting `title: 'My Title'` in the
* options means that `title` is observable, and has get/set accessors.
*
* @constructor
* @extends {module:ol/layer/Layer}
* @fires module:ol/render/Event~RenderEvent
* @param {module:ol/layer/Vector~Options=} opt_options Options.
* @api
*/
class VectorLayer {
class VectorLayer extends Layer {
/**
* @classdesc
* Vector data that is rendered client-side.
* Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
* property on the layer object; for example, setting `title: 'My Title'` in the
* options means that `title` is observable, and has get/set accessors.
*
* @constructor
* @extends {module:ol/layer/Layer}
* @fires module:ol/render/Event~RenderEvent
* @param {module:ol/layer/Vector~Options=} opt_options Options.
* @api
*/
constructor(opt_options) {
const options = opt_options ?
opt_options : /** @type {module:ol/layer/Vector~Options} */ ({});
@@ -102,7 +102,7 @@ class VectorLayer {
delete baseOptions.renderBuffer;
delete baseOptions.updateWhileAnimating;
delete baseOptions.updateWhileInteracting;
Layer.call(this, /** @type {module:ol/layer/Layer~Options} */ (baseOptions));
super(baseOptions);
/**
* @private
@@ -263,8 +263,6 @@ class VectorLayer {
}
}
inherits(VectorLayer, Layer);
/**
* Return the associated {@link module:ol/source/Vector vectorsource} of the layer.
+14 -16
View File
@@ -87,19 +87,19 @@ export const RenderType = {
*/
/**
* @classdesc
* Layer for vector tile data that is rendered client-side.
* Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
* property on the layer object; for example, setting `title: 'My Title'` in the
* options means that `title` is observable, and has get/set accessors.
*
* @constructor
* @extends {module:ol/layer/Vector}
* @param {module:ol/layer/VectorTile~Options=} opt_options Options.
* @api
*/
class VectorTileLayer {
class VectorTileLayer extends VectorLayer {
/**
* @classdesc
* Layer for vector tile data that is rendered client-side.
* Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
* property on the layer object; for example, setting `title: 'My Title'` in the
* options means that `title` is observable, and has get/set accessors.
*
* @constructor
* @extends {module:ol/layer/Vector}
* @param {module:ol/layer/VectorTile~Options=} opt_options Options.
* @api
*/
constructor(opt_options) {
const options = opt_options ? opt_options : {};
@@ -118,7 +118,7 @@ class VectorTileLayer {
delete baseOptions.preload;
delete baseOptions.useInterimTilesOnError;
VectorLayer.call(this, /** @type {module:ol/layer/Vector~Options} */ (baseOptions));
super(baseOptions);
this.setPreload(options.preload ? options.preload : 0);
this.setUseInterimTilesOnError(options.useInterimTilesOnError !== undefined ?
@@ -174,8 +174,6 @@ class VectorTileLayer {
}
}
inherits(VectorTileLayer, VectorLayer);
/**
* Return the associated {@link module:ol/source/VectorTile vectortilesource} of the layer.