Move jsdoc constructor comments

This commit is contained in:
Frederic Junod
2018-07-17 09:59:00 +02:00
parent 384920734f
commit f2d0b11d24
42 changed files with 369 additions and 334 deletions

View File

@@ -7,12 +7,13 @@ import {VERSION, inherits} from './util.js';
* Error object thrown when an assertion failed. This is an ECMA-262 Error,
* extended with a `code` property.
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error}
* @constructor
* @extends {Error}
* @param {number} code Error code.
*/
class AssertionError {
/**
* @param {number} code Error code.
*/
constructor(code) {
const path = VERSION.split('-')[0];
@@ -32,6 +33,9 @@ class AssertionError {
*/
this.code = code;
/**
* @type {string}
*/
this.name = 'AssertionError';
}

View File

@@ -22,13 +22,14 @@ const Property = {
* Events emitted by {@link module:ol/Collection~Collection} instances are instances of this
* type.
*
* @constructor
* @extends {module:ol/events/Event}
* @param {module:ol/CollectionEventType} type Type.
* @param {*=} opt_element Element.
*/
export class CollectionEvent {
/**
* @param {module:ol/CollectionEventType} type Type.
* @param {*=} opt_element Element.
*/
constructor(type, opt_element) {
Event.call(this, type);
@@ -60,15 +61,16 @@ inherits(CollectionEvent, Event);
* Collection; they trigger events on the appropriate object, not on the
* Collection as a whole.
*
* @constructor
* @extends {module:ol/Object}
* @fires module:ol/Collection~CollectionEvent
* @param {Array.<T>=} opt_array Array.
* @param {module:ol/Collection~Options=} opt_options Collection options.
* @template T
* @api
*/
class Collection {
/**
* @param {Array.<T>=} opt_array Array.
* @param {module:ol/Collection~Options=} opt_options Collection options.
* @template T
*/
constructor(opt_array, opt_options) {
BaseObject.call(this);

View File

@@ -51,15 +51,17 @@ import Style from './style/Style.js';
* var point = feature.getGeometry();
* ```
*
* @constructor
* @extends {module:ol/Object}
* @api
*/
class Feature {
/**
* @param {module:ol/geom/Geometry|Object.<string, *>=} opt_geometryOrProperties
* You may pass a Geometry object directly, or an object literal containing
* properties. If you pass an object literal, you may include a Geometry
* associated with a `geometry` key.
* @api
*/
class Feature {
constructor(opt_geometryOrProperties) {
BaseObject.call(this);

View File

@@ -44,12 +44,14 @@ import {get as getProjection, getTransformFromProjections, identityTransform} fr
* });
*
* @fires error
* @constructor
* @extends {module:ol/Object}
* @param {module:ol/Geolocation~Options=} opt_options Options.
* @api
*/
class Geolocation {
/**
* @param {module:ol/Geolocation~Options=} opt_options Options.
*/
constructor(opt_options) {
BaseObject.call(this);

View File

@@ -112,11 +112,13 @@ const INTERVALS = [
/**
* Render a grid for a coordinate system on a map.
* @constructor
* @param {module:ol/Graticule~Options=} opt_options Options.
* @api
*/
class Graticule {
/**
* @param {module:ol/Graticule~Options=} opt_options Options.
*/
constructor(opt_options) {
const options = opt_options || {};

View File

@@ -29,8 +29,11 @@ import {getHeight} from './extent.js';
/**
* @constructor
* @extends {module:ol/ImageBase}
*/
class ImageWrapper {
/**
* @param {module:ol/extent~Extent} extent Extent.
* @param {number|undefined} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
@@ -38,7 +41,6 @@ import {getHeight} from './extent.js';
* @param {?string} crossOrigin Cross origin.
* @param {module:ol/Image~LoadFunction} imageLoadFunction Image load function.
*/
class ImageWrapper {
constructor(extent, resolution, pixelRatio, src, crossOrigin, imageLoadFunction) {
ImageBase.call(this, extent, resolution, pixelRatio, ImageState.IDLE);

View File

@@ -6,15 +6,17 @@ import EventTarget from './events/EventTarget.js';
import EventType from './events/EventType.js';
/**
* @constructor
* @abstract
* @extends {module:ol/events/EventTarget}
*/
class ImageBase {
/**
* @param {module:ol/extent~Extent} extent Extent.
* @param {number|undefined} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
* @param {module:ol/ImageState} state State.
*/
class ImageBase {
constructor(extent, resolution, pixelRatio, state) {
EventTarget.call(this);

View File

@@ -17,8 +17,11 @@ import ImageState from './ImageState.js';
/**
* @constructor
* @extends {module:ol/ImageBase}
*/
class ImageCanvas {
/**
* @param {module:ol/extent~Extent} extent Extent.
* @param {number} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
@@ -26,7 +29,6 @@ import ImageState from './ImageState.js';
* @param {module:ol/ImageCanvas~Loader=} opt_loader Optional loader function to
* support asynchronous canvas drawing.
*/
class ImageCanvas {
constructor(extent, resolution, pixelRatio, canvas, opt_loader) {
/**

View File

@@ -15,8 +15,11 @@ import EventType from './events/EventType.js';
*/
/**
* @constructor
* @extends {module:ol/Tile}
*/
class ImageTile {
/**
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
* @param {module:ol/TileState} state State.
* @param {string} src Image source URI.
@@ -24,7 +27,6 @@ import EventType from './events/EventType.js';
* @param {module:ol/Tile~LoadFunction} tileLoadFunction Tile load function.
* @param {module:ol/Tile~Options=} opt_options Tile options.
*/
class ImageTile {
constructor(tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) {
Tile.call(this, tileCoord, state, opt_options);

View File

@@ -6,15 +6,16 @@
* @classdesc
* Implementation of inertial deceleration for map movement.
*
* @constructor
* @api
*/
class Kinetic {
/**
* @param {number} decay Rate of decay (must be negative).
* @param {number} minVelocity Minimum velocity (pixels/millisecond).
* @param {number} delay Delay to consider to calculate the kinetic
* initial values (milliseconds).
* @struct
* @api
*/
class Kinetic {
constructor(decay, minVelocity, delay) {
/**

View File

@@ -57,9 +57,7 @@ import CanvasVectorTileLayerRenderer from './renderer/canvas/VectorTileLayer.js'
* options or added with `addLayer` can be groups, which can contain further
* groups, and so on.
*
* @constructor
* @extends {module:ol/PluggableMap}
* @param {module:ol/PluggableMap~MapOptions} options Map options.
* @fires module:ol/MapBrowserEvent~MapBrowserEvent
* @fires module:ol/MapEvent~MapEvent
* @fires module:ol/render/Event~RenderEvent#postcompose
@@ -67,6 +65,10 @@ import CanvasVectorTileLayerRenderer from './renderer/canvas/VectorTileLayer.js'
* @api
*/
class Map {
/**
* @param {module:ol/PluggableMap~MapOptions} options Map options.
*/
constructor(options) {
options = assign({}, options);
if (!options.controls) {

View File

@@ -9,15 +9,17 @@ import MapEvent from './MapEvent.js';
* Events emitted as map browser events are instances of this type.
* See {@link module:ol/Map~Map} for which events trigger a map browser event.
*
* @constructor
* @extends {module:ol/MapEvent}
*/
class MapBrowserEvent {
/**
* @param {string} type Event type.
* @param {module:ol/PluggableMap} map Map.
* @param {Event} browserEvent Browser event.
* @param {boolean=} opt_dragging Is the map currently being dragged?
* @param {?module:ol/PluggableMap~FrameState=} opt_frameState Frame state.
*/
class MapBrowserEvent {
constructor(type, map, browserEvent, opt_dragging, opt_frameState) {
MapEvent.call(this, type, map, opt_frameState);

View File

@@ -11,14 +11,14 @@ import PointerEventType from './pointer/EventType.js';
import PointerEventHandler from './pointer/PointerEventHandler.js';
/**
* @param {module:ol/PluggableMap} map The map with the viewport to
* listen to events on.
* @param {number=} moveTolerance The minimal distance the pointer must travel
* to trigger a move.
* @constructor
* @extends {module:ol/events/EventTarget}
*/
class MapBrowserEventHandler {
/**
* @param {module:ol/PluggableMap} map The map with the viewport to listen to events on.
* @param {number=} moveTolerance The minimal distance the pointer must travel to trigger a move.
*/
constructor(map, moveTolerance) {
EventTarget.call(this);

View File

@@ -5,17 +5,17 @@ import {inherits} from './util.js';
import MapBrowserEvent from './MapBrowserEvent.js';
/**
* @constructor
* @extends {module:ol/MapBrowserEvent}
* @param {string} type Event type.
* @param {module:ol/PluggableMap} map Map.
* @param {module:ol/pointer/PointerEvent} pointerEvent Pointer
* event.
* @param {boolean=} opt_dragging Is the map currently being dragged?
* @param {?module:ol/PluggableMap~FrameState=} opt_frameState Frame state.
*/
class MapBrowserPointerEvent {
/**
* @param {string} type Event type.
* @param {module:ol/PluggableMap} map Map.
* @param {module:ol/pointer/PointerEvent} pointerEvent Pointer event.
* @param {boolean=} opt_dragging Is the map currently being dragged?
* @param {?module:ol/PluggableMap~FrameState=} opt_frameState Frame state.
*/
constructor(type, map, pointerEvent, opt_dragging, opt_frameState) {
MapBrowserEvent.call(this, type, map, pointerEvent.originalEvent, opt_dragging,

View File

@@ -9,14 +9,15 @@ import Event from './events/Event.js';
* Events emitted as map events are instances of this type.
* See {@link module:ol/Map~Map} for which events trigger a map event.
*
* @constructor
* @extends {module:ol/events/Event}
*/
class MapEvent {
/**
* @param {string} type Event type.
* @param {module:ol/PluggableMap} map Map.
* @param {?module:ol/PluggableMap~FrameState=} opt_frameState Frame state.
*/
class MapEvent {
constructor(type, map, opt_frameState) {
Event.call(this, type);

View File

@@ -10,17 +10,16 @@ import {assign} from './obj.js';
/**
* @classdesc
* Events emitted by {@link module:ol/Object~BaseObject} instances are instances of
* this type.
*
* @param {string} type The event type.
* @param {string} key The property name.
* @param {*} oldValue The old value for `key`.
* Events emitted by {@link module:ol/Object~BaseObject} instances are instances of this type.
* @extends {module:ol/events/Event}
* @constructor
*/
class ObjectEvent {
/**
* @param {string} type The event type.
* @param {string} key The property name.
* @param {*} oldValue The old value for `key`.
*/
constructor(type, key, oldValue) {
Event.call(this, type);
@@ -86,13 +85,15 @@ inherits(ObjectEvent, Event);
* Properties can be deleted by using the unset method. E.g.
* object.unset('foo').
*
* @constructor
* @extends {module:ol/Observable}
* @param {Object.<string, *>=} opt_values An object with key-value pairs.
* @fires module:ol/Object~ObjectEvent
* @api
*/
class BaseObject {
/**
* @param {Object.<string, *>=} opt_values An object with key-value pairs.
*/
constructor(opt_values) {
Observable.call(this);

View File

@@ -14,10 +14,8 @@ import EventType from './events/EventType.js';
* and unregistration. A generic `change` event is always available through
* {@link module:ol/Observable~Observable#changed}.
*
* @constructor
* @extends {module:ol/events/EventTarget}
* @fires module:ol/events/Event~Event
* @struct
* @api
*/
class Observable {

View File

@@ -93,12 +93,14 @@ const Property = {
* popup.setPosition(coordinate);
* map.addOverlay(popup);
*
* @constructor
* @extends {module:ol/Object}
* @param {module:ol/Overlay~Options} options Overlay options.
* @api
*/
class Overlay {
/**
* @param {module:ol/Overlay~Options} options Overlay options.
*/
constructor(options) {
BaseObject.call(this);

View File

@@ -131,9 +131,7 @@ import {create as createTransform, apply as applyTransform} from './transform.js
/**
* @constructor
* @extends {module:ol/Object}
* @param {module:ol/PluggableMap~MapOptions} options Map options.
* @fires module:ol/MapBrowserEvent~MapBrowserEvent
* @fires module:ol/MapEvent~MapEvent
* @fires module:ol/render/Event~RenderEvent#postcompose
@@ -141,6 +139,10 @@ import {create as createTransform, apply as applyTransform} from './transform.js
* @api
*/
class PluggableMap {
/**
* @param {module:ol/PluggableMap~MapOptions} options Map options.
*/
constructor(options) {
BaseObject.call(this);

View File

@@ -44,14 +44,16 @@ import EventType from './events/EventType.js';
* @classdesc
* Base class for tiles.
*
* @constructor
* @abstract
* @extends {module:ol/events/EventTarget}
*/
class Tile {
/**
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
* @param {module:ol/TileState} state State.
* @param {module:ol/Tile~Options=} opt_options Tile options.
*/
class Tile {
constructor(tileCoord, state, opt_options) {
EventTarget.call(this);

View File

@@ -6,12 +6,13 @@ import LRUCache from './structs/LRUCache.js';
import {fromKey, getKey} from './tilecoord.js';
/**
* @constructor
* @extends {module:ol/structs/LRUCache.<module:ol/Tile>}
* @param {number=} opt_highWaterMark High water mark.
* @struct
*/
class TileCache {
/**
* @param {number=} opt_highWaterMark High water mark.
*/
constructor(opt_highWaterMark) {
LRUCache.call(this, opt_highWaterMark);

View File

@@ -14,15 +14,14 @@ import PriorityQueue from './structs/PriorityQueue.js';
/**
* @constructor
* @extends {module:ol/structs/PriorityQueue.<Array>}
* @param {module:ol/TileQueue~PriorityFunction} tilePriorityFunction
* Tile priority function.
* @param {function(): ?} tileChangeCallback
* Function called on each tile change event.
* @struct
*/
class TileQueue {
/**
* @param {module:ol/TileQueue~PriorityFunction} tilePriorityFunction Tile priority function.
* @param {function(): ?} tileChangeCallback Function called on each tile change event.
*/
constructor(tilePriorityFunction, tileChangeCallback) {
PriorityQueue.call(

View File

@@ -1,18 +1,19 @@
/**
* @module ol/TileRange
*/
/**
* A representation of a contiguous block of tiles. A tile range is specified
* by its min/max tile coordinates and is inclusive of coordinates.
*
* @constructor
*/
class TileRange {
/**
* @param {number} minX Minimum X.
* @param {number} maxX Maximum X.
* @param {number} minY Minimum Y.
* @param {number} maxY Maximum Y.
* @struct
*/
class TileRange {
constructor(minX, maxX, minY, maxY) {
/**

View File

@@ -22,8 +22,11 @@ import {UNDEFINED} from './functions.js';
/**
* @constructor
* @extends {module:ol/Tile}
*/
class VectorImageTile {
/**
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
* @param {module:ol/TileState} state State.
* @param {number} sourceRevision Source revision.
@@ -43,7 +46,6 @@ import {UNDEFINED} from './functions.js';
* Function to call when a source tile's state changes.
* @param {number} zoom Integer zoom to render the tile for.
*/
class VectorImageTile {
constructor(
tileCoord,
state,

View File

@@ -19,8 +19,11 @@ const DEFAULT_EXTENT = [0, 0, 4096, 4096];
*/
/**
* @constructor
* @extends {module:ol/Tile}
*/
class VectorTile {
/**
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
* @param {module:ol/TileState} state State.
* @param {string} src Data source url.
@@ -28,7 +31,6 @@ const DEFAULT_EXTENT = [0, 0, 4096, 4096];
* @param {module:ol/Tile~LoadFunction} tileLoadFunction Tile load function.
* @param {module:ol/Tile~Options=} opt_options Tile options.
*/
class VectorTile {
constructor(tileCoord, state, src, format, tileLoadFunction, opt_options) {
Tile.call(this, tileCoord, state, opt_options);

View File

@@ -224,12 +224,14 @@ const DEFAULT_MIN_ZOOM = 0;
* The *center constraint* is determined by the `extent` option. By
* default the center is not constrained at all.
*
* @constructor
* @extends {module:ol/Object}
* @param {module:ol/View~ViewOptions=} opt_options View options.
* @api
*/
class View {
/**
* @param {module:ol/View~ViewOptions=} opt_options View options.
*/
constructor(opt_options) {
BaseObject.call(this);

View File

@@ -57,9 +57,7 @@ import WebGLVectorLayerRenderer from './renderer/webgl/VectorLayer.js';
* {@link module:ol/layer/Base}, so layers entered in the options or added
* with `addLayer` can be groups, which can contain further groups, and so on.
*
* @constructor
* @extends {module:ol/PluggableMap}
* @param {module:ol/PluggableMap~MapOptions} options Map options.
* @fires module:ol/MapBrowserEvent~MapBrowserEvent
* @fires module:ol/MapEvent~MapEvent
* @fires module:ol/render/Event~RenderEvent#postcompose
@@ -67,6 +65,10 @@ import WebGLVectorLayerRenderer from './renderer/webgl/VectorLayer.js';
* @api
*/
class WebGLMap {
/**
* @param {module:ol/PluggableMap~MapOptions} options Map options.
*/
constructor(options) {
options = assign({}, options);
if (!options.controls) {

View File

@@ -49,12 +49,13 @@ import {METERS_PER_UNIT} from '../proj/Units.js';
* be added using `proj4.defs()`. After all required projection definitions are
* added, call the {@link module:ol/proj/proj4~register} function.
*
* @constructor
* @param {module:ol/proj/Projection~Options} options Projection options.
* @struct
* @api
*/
class Projection {
/**
* @param {module:ol/proj/Projection~Options} options Projection options.
*/
constructor(options) {
/**
* @private

View File

@@ -44,12 +44,13 @@ export const WORLD_EXTENT = [-180, -85, 180, 85];
* @classdesc
* Projection object for web/spherical Mercator (EPSG:3857).
*
* @constructor
* @extends {module:ol/proj/Projection}
* @param {string} code Code.
*/
class EPSG3857Projection {
/**
* @param {string} code Code.
*/
constructor(code) {
Projection.call(this, {
code: code,

View File

@@ -41,11 +41,13 @@ export const METERS_PER_UNIT = Math.PI * RADIUS / 180;
*
* @constructor
* @extends {module:ol/proj/Projection}
* @param {string} code Code.
* @param {string=} opt_axisOrientation Axis orientation.
*/
class EPSG4326Projection {
/**
* @param {string} code Code.
* @param {string=} opt_axisOrientation Axis orientation.
*/
constructor(code, opt_axisOrientation) {
Projection.call(this, {
code: code,

View File

@@ -6,14 +6,12 @@
import {DEBUG as DEBUG_WEBGL} from '../../../../webgl.js';
/**
* @constructor
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
* @struct
*/
class Locations {
/**
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
*/
constructor(gl, program) {
/**

View File

@@ -6,14 +6,12 @@
import {DEBUG as DEBUG_WEBGL} from '../../../../webgl.js';
/**
* @constructor
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
* @struct
*/
class Locations {
/**
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
*/
constructor(gl, program) {
/**

View File

@@ -6,14 +6,12 @@
import {DEBUG as DEBUG_WEBGL} from '../../../../webgl.js';
/**
* @constructor
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
* @struct
*/
class Locations {
/**
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
*/
constructor(gl, program) {
/**

View File

@@ -6,14 +6,12 @@
import {DEBUG as DEBUG_WEBGL} from '../../../../webgl.js';
/**
* @constructor
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
* @struct
*/
class Locations {
/**
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
*/
constructor(gl, program) {
/**

View File

@@ -6,14 +6,12 @@
import {DEBUG as DEBUG_WEBGL} from '../../../webgl.js';
/**
* @constructor
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
* @struct
*/
class Locations {
/**
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
*/
constructor(gl, program) {
/**

View File

@@ -6,14 +6,12 @@
import {DEBUG as DEBUG_WEBGL} from '../../../webgl.js';
/**
* @constructor
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
* @struct
*/
class Locations {
/**
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
*/
constructor(gl, program) {
/**

View File

@@ -12,13 +12,13 @@ const BufferUsage = {
DYNAMIC_DRAW: DYNAMIC_DRAW
};
/**
* @constructor
class WebGLBuffer {
/**
* @param {Array.<number>=} opt_arr Array.
* @param {number=} opt_usage Usage.
* @struct
*/
class WebGLBuffer {
constructor(opt_arr, opt_usage) {
/**

View File

@@ -22,12 +22,14 @@ import ContextEventType from '../webgl/ContextEventType.js';
* @classdesc
* A WebGL context for accessing low-level WebGL capabilities.
*
* @constructor
* @extends {module:ol/Disposable}
*/
class WebGLContext {
/**
* @param {HTMLCanvasElement} canvas Canvas.
* @param {WebGLRenderingContext} gl GL.
*/
class WebGLContext {
constructor(canvas, gl) {
/**

View File

@@ -6,12 +6,13 @@ import {FRAGMENT_SHADER} from '../webgl.js';
import WebGLShader from '../webgl/Shader.js';
/**
* @constructor
* @extends {module:ol/webgl/Shader}
* @param {string} source Source.
* @struct
*/
class WebGLFragment {
/**
* @param {string} source Source.
*/
constructor(source) {
WebGLShader.call(this, source);
}

View File

@@ -4,12 +4,13 @@
import {FALSE} from '../functions.js';
/**
* @constructor
* @abstract
* @param {string} source Source.
* @struct
*/
class WebGLShader {
/**
* @param {string} source Source.
*/
constructor(source) {
/**

View File

@@ -6,12 +6,13 @@ import {VERTEX_SHADER} from '../webgl.js';
import WebGLShader from '../webgl/Shader.js';
/**
* @constructor
* @extends {module:ol/webgl/Shader}
* @param {string} source Source.
* @struct
*/
class WebGLVertex {
/**
* @param {string} source Source.
*/
constructor(source) {
WebGLShader.call(this, source);
}

View File

@@ -6,14 +6,12 @@
import {DEBUG as DEBUG_WEBGL} from '../../../../webgl.js';
/**
* @constructor
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
* @struct
*/
class Locations {
/**
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
*/
constructor(gl, program) {
{{#uniforms}}