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
+6 -2
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, * Error object thrown when an assertion failed. This is an ECMA-262 Error,
* extended with a `code` property. * extended with a `code` property.
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error} * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error}
* @constructor
* @extends {Error} * @extends {Error}
* @param {number} code Error code.
*/ */
class AssertionError { class AssertionError {
/**
* @param {number} code Error code.
*/
constructor(code) { constructor(code) {
const path = VERSION.split('-')[0]; const path = VERSION.split('-')[0];
@@ -32,6 +33,9 @@ class AssertionError {
*/ */
this.code = code; this.code = code;
/**
* @type {string}
*/
this.name = 'AssertionError'; this.name = 'AssertionError';
} }
+10 -8
View File
@@ -22,13 +22,14 @@ const Property = {
* Events emitted by {@link module:ol/Collection~Collection} instances are instances of this * Events emitted by {@link module:ol/Collection~Collection} instances are instances of this
* type. * type.
* *
* @constructor
* @extends {module:ol/events/Event} * @extends {module:ol/events/Event}
* @param {module:ol/CollectionEventType} type Type.
* @param {*=} opt_element Element.
*/ */
export class CollectionEvent { export class CollectionEvent {
/**
* @param {module:ol/CollectionEventType} type Type.
* @param {*=} opt_element Element.
*/
constructor(type, opt_element) { constructor(type, opt_element) {
Event.call(this, type); Event.call(this, type);
@@ -60,15 +61,16 @@ inherits(CollectionEvent, Event);
* Collection; they trigger events on the appropriate object, not on the * Collection; they trigger events on the appropriate object, not on the
* Collection as a whole. * Collection as a whole.
* *
* @constructor
* @extends {module:ol/Object} * @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 * @api
*/ */
class Collection { class Collection {
/**
* @param {Array.<T>=} opt_array Array.
* @param {module:ol/Collection~Options=} opt_options Collection options.
* @template T
*/
constructor(opt_array, opt_options) { constructor(opt_array, opt_options) {
BaseObject.call(this); BaseObject.call(this);
+7 -5
View File
@@ -51,15 +51,17 @@ import Style from './style/Style.js';
* var point = feature.getGeometry(); * var point = feature.getGeometry();
* ``` * ```
* *
* @constructor
* @extends {module:ol/Object} * @extends {module:ol/Object}
* @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 * @api
*/ */
class Feature { 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.
*/
constructor(opt_geometryOrProperties) { constructor(opt_geometryOrProperties) {
BaseObject.call(this); BaseObject.call(this);
+4 -2
View File
@@ -44,12 +44,14 @@ import {get as getProjection, getTransformFromProjections, identityTransform} fr
* }); * });
* *
* @fires error * @fires error
* @constructor
* @extends {module:ol/Object} * @extends {module:ol/Object}
* @param {module:ol/Geolocation~Options=} opt_options Options.
* @api * @api
*/ */
class Geolocation { class Geolocation {
/**
* @param {module:ol/Geolocation~Options=} opt_options Options.
*/
constructor(opt_options) { constructor(opt_options) {
BaseObject.call(this); BaseObject.call(this);
+4 -2
View File
@@ -112,11 +112,13 @@ const INTERVALS = [
/** /**
* Render a grid for a coordinate system on a map. * Render a grid for a coordinate system on a map.
* @constructor
* @param {module:ol/Graticule~Options=} opt_options Options.
* @api * @api
*/ */
class Graticule { class Graticule {
/**
* @param {module:ol/Graticule~Options=} opt_options Options.
*/
constructor(opt_options) { constructor(opt_options) {
const options = opt_options || {}; const options = opt_options || {};
+11 -9
View File
@@ -29,16 +29,18 @@ import {getHeight} from './extent.js';
/** /**
* @constructor
* @extends {module:ol/ImageBase} * @extends {module:ol/ImageBase}
* @param {module:ol/extent~Extent} extent Extent.
* @param {number|undefined} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
* @param {string} src Image source URI.
* @param {?string} crossOrigin Cross origin.
* @param {module:ol/Image~LoadFunction} imageLoadFunction Image load function.
*/ */
class ImageWrapper { class ImageWrapper {
/**
* @param {module:ol/extent~Extent} extent Extent.
* @param {number|undefined} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
* @param {string} src Image source URI.
* @param {?string} crossOrigin Cross origin.
* @param {module:ol/Image~LoadFunction} imageLoadFunction Image load function.
*/
constructor(extent, resolution, pixelRatio, src, crossOrigin, imageLoadFunction) { constructor(extent, resolution, pixelRatio, src, crossOrigin, imageLoadFunction) {
ImageBase.call(this, extent, resolution, pixelRatio, ImageState.IDLE); ImageBase.call(this, extent, resolution, pixelRatio, ImageState.IDLE);
@@ -124,9 +126,9 @@ class ImageWrapper {
this.changed(); this.changed();
this.imageListenerKeys_ = [ this.imageListenerKeys_ = [
listenOnce(this.image_, EventType.ERROR, listenOnce(this.image_, EventType.ERROR,
this.handleImageError_, this), this.handleImageError_, this),
listenOnce(this.image_, EventType.LOAD, listenOnce(this.image_, EventType.LOAD,
this.handleImageLoad_, this) this.handleImageLoad_, this)
]; ];
this.imageLoadFunction_(this, this.src_); this.imageLoadFunction_(this, this.src_);
} }
+7 -5
View File
@@ -6,15 +6,17 @@ import EventTarget from './events/EventTarget.js';
import EventType from './events/EventType.js'; import EventType from './events/EventType.js';
/** /**
* @constructor
* @abstract * @abstract
* @extends {module:ol/events/EventTarget} * @extends {module:ol/events/EventTarget}
* @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 { 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.
*/
constructor(extent, resolution, pixelRatio, state) { constructor(extent, resolution, pixelRatio, state) {
EventTarget.call(this); EventTarget.call(this);
+9 -7
View File
@@ -17,16 +17,18 @@ import ImageState from './ImageState.js';
/** /**
* @constructor
* @extends {module:ol/ImageBase} * @extends {module:ol/ImageBase}
* @param {module:ol/extent~Extent} extent Extent.
* @param {number} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
* @param {HTMLCanvasElement} canvas Canvas.
* @param {module:ol/ImageCanvas~Loader=} opt_loader Optional loader function to
* support asynchronous canvas drawing.
*/ */
class ImageCanvas { class ImageCanvas {
/**
* @param {module:ol/extent~Extent} extent Extent.
* @param {number} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
* @param {HTMLCanvasElement} canvas Canvas.
* @param {module:ol/ImageCanvas~Loader=} opt_loader Optional loader function to
* support asynchronous canvas drawing.
*/
constructor(extent, resolution, pixelRatio, canvas, opt_loader) { constructor(extent, resolution, pixelRatio, canvas, opt_loader) {
/** /**
+9 -7
View File
@@ -15,16 +15,18 @@ import EventType from './events/EventType.js';
*/ */
/** /**
* @constructor
* @extends {module:ol/Tile} * @extends {module:ol/Tile}
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
* @param {module:ol/TileState} state State.
* @param {string} src Image source URI.
* @param {?string} crossOrigin Cross origin.
* @param {module:ol/Tile~LoadFunction} tileLoadFunction Tile load function.
* @param {module:ol/Tile~Options=} opt_options Tile options.
*/ */
class ImageTile { class ImageTile {
/**
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
* @param {module:ol/TileState} state State.
* @param {string} src Image source URI.
* @param {?string} crossOrigin Cross origin.
* @param {module:ol/Tile~LoadFunction} tileLoadFunction Tile load function.
* @param {module:ol/Tile~Options=} opt_options Tile options.
*/
constructor(tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) { constructor(tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) {
Tile.call(this, tileCoord, state, opt_options); Tile.call(this, tileCoord, state, opt_options);
+7 -6
View File
@@ -6,15 +6,16 @@
* @classdesc * @classdesc
* Implementation of inertial deceleration for map movement. * Implementation of inertial deceleration for map movement.
* *
* @constructor
* @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 * @api
*/ */
class Kinetic { 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).
*/
constructor(decay, minVelocity, delay) { constructor(decay, minVelocity, delay) {
/** /**
+4 -2
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 * options or added with `addLayer` can be groups, which can contain further
* groups, and so on. * groups, and so on.
* *
* @constructor
* @extends {module:ol/PluggableMap} * @extends {module:ol/PluggableMap}
* @param {module:ol/PluggableMap~MapOptions} options Map options.
* @fires module:ol/MapBrowserEvent~MapBrowserEvent * @fires module:ol/MapBrowserEvent~MapBrowserEvent
* @fires module:ol/MapEvent~MapEvent * @fires module:ol/MapEvent~MapEvent
* @fires module:ol/render/Event~RenderEvent#postcompose * @fires module:ol/render/Event~RenderEvent#postcompose
@@ -67,6 +65,10 @@ import CanvasVectorTileLayerRenderer from './renderer/canvas/VectorTileLayer.js'
* @api * @api
*/ */
class Map { class Map {
/**
* @param {module:ol/PluggableMap~MapOptions} options Map options.
*/
constructor(options) { constructor(options) {
options = assign({}, options); options = assign({}, options);
if (!options.controls) { if (!options.controls) {
+8 -6
View File
@@ -9,15 +9,17 @@ import MapEvent from './MapEvent.js';
* Events emitted as map browser events are instances of this type. * 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. * See {@link module:ol/Map~Map} for which events trigger a map browser event.
* *
* @constructor
* @extends {module:ol/MapEvent} * @extends {module:ol/MapEvent}
* @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 { 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.
*/
constructor(type, map, browserEvent, opt_dragging, opt_frameState) { constructor(type, map, browserEvent, opt_dragging, opt_frameState) {
MapEvent.call(this, type, map, opt_frameState); MapEvent.call(this, type, map, opt_frameState);
+5 -5
View File
@@ -11,14 +11,14 @@ import PointerEventType from './pointer/EventType.js';
import PointerEventHandler from './pointer/PointerEventHandler.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} * @extends {module:ol/events/EventTarget}
*/ */
class MapBrowserEventHandler { 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) { constructor(map, moveTolerance) {
EventTarget.call(this); EventTarget.call(this);
+7 -7
View File
@@ -5,17 +5,17 @@ import {inherits} from './util.js';
import MapBrowserEvent from './MapBrowserEvent.js'; import MapBrowserEvent from './MapBrowserEvent.js';
/** /**
* @constructor
* @extends {module:ol/MapBrowserEvent} * @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 { 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) { constructor(type, map, pointerEvent, opt_dragging, opt_frameState) {
MapBrowserEvent.call(this, type, map, pointerEvent.originalEvent, opt_dragging, MapBrowserEvent.call(this, type, map, pointerEvent.originalEvent, opt_dragging,
+5 -4
View File
@@ -9,14 +9,15 @@ import Event from './events/Event.js';
* Events emitted as map events are instances of this type. * Events emitted as map events are instances of this type.
* See {@link module:ol/Map~Map} for which events trigger a map event. * See {@link module:ol/Map~Map} for which events trigger a map event.
* *
* @constructor
* @extends {module:ol/events/Event} * @extends {module:ol/events/Event}
* @param {string} type Event type.
* @param {module:ol/PluggableMap} map Map.
* @param {?module:ol/PluggableMap~FrameState=} opt_frameState Frame state.
*/ */
class MapEvent { class MapEvent {
/**
* @param {string} type Event type.
* @param {module:ol/PluggableMap} map Map.
* @param {?module:ol/PluggableMap~FrameState=} opt_frameState Frame state.
*/
constructor(type, map, opt_frameState) { constructor(type, map, opt_frameState) {
Event.call(this, type); Event.call(this, type);
+10 -9
View File
@@ -10,17 +10,16 @@ import {assign} from './obj.js';
/** /**
* @classdesc * @classdesc
* Events emitted by {@link module:ol/Object~BaseObject} instances are instances of * Events emitted by {@link module:ol/Object~BaseObject} instances are instances of this type.
* this type.
*
* @param {string} type The event type.
* @param {string} key The property name.
* @param {*} oldValue The old value for `key`.
* @extends {module:ol/events/Event} * @extends {module:ol/events/Event}
* @constructor
*/ */
class ObjectEvent { 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) { constructor(type, key, oldValue) {
Event.call(this, type); Event.call(this, type);
@@ -86,13 +85,15 @@ inherits(ObjectEvent, Event);
* Properties can be deleted by using the unset method. E.g. * Properties can be deleted by using the unset method. E.g.
* object.unset('foo'). * object.unset('foo').
* *
* @constructor
* @extends {module:ol/Observable} * @extends {module:ol/Observable}
* @param {Object.<string, *>=} opt_values An object with key-value pairs.
* @fires module:ol/Object~ObjectEvent * @fires module:ol/Object~ObjectEvent
* @api * @api
*/ */
class BaseObject { class BaseObject {
/**
* @param {Object.<string, *>=} opt_values An object with key-value pairs.
*/
constructor(opt_values) { constructor(opt_values) {
Observable.call(this); Observable.call(this);
-2
View File
@@ -14,10 +14,8 @@ import EventType from './events/EventType.js';
* and unregistration. A generic `change` event is always available through * and unregistration. A generic `change` event is always available through
* {@link module:ol/Observable~Observable#changed}. * {@link module:ol/Observable~Observable#changed}.
* *
* @constructor
* @extends {module:ol/events/EventTarget} * @extends {module:ol/events/EventTarget}
* @fires module:ol/events/Event~Event * @fires module:ol/events/Event~Event
* @struct
* @api * @api
*/ */
class Observable { class Observable {
+4 -2
View File
@@ -93,12 +93,14 @@ const Property = {
* popup.setPosition(coordinate); * popup.setPosition(coordinate);
* map.addOverlay(popup); * map.addOverlay(popup);
* *
* @constructor
* @extends {module:ol/Object} * @extends {module:ol/Object}
* @param {module:ol/Overlay~Options} options Overlay options.
* @api * @api
*/ */
class Overlay { class Overlay {
/**
* @param {module:ol/Overlay~Options} options Overlay options.
*/
constructor(options) { constructor(options) {
BaseObject.call(this); BaseObject.call(this);
+4 -2
View File
@@ -131,9 +131,7 @@ import {create as createTransform, apply as applyTransform} from './transform.js
/** /**
* @constructor
* @extends {module:ol/Object} * @extends {module:ol/Object}
* @param {module:ol/PluggableMap~MapOptions} options Map options.
* @fires module:ol/MapBrowserEvent~MapBrowserEvent * @fires module:ol/MapBrowserEvent~MapBrowserEvent
* @fires module:ol/MapEvent~MapEvent * @fires module:ol/MapEvent~MapEvent
* @fires module:ol/render/Event~RenderEvent#postcompose * @fires module:ol/render/Event~RenderEvent#postcompose
@@ -141,6 +139,10 @@ import {create as createTransform, apply as applyTransform} from './transform.js
* @api * @api
*/ */
class PluggableMap { class PluggableMap {
/**
* @param {module:ol/PluggableMap~MapOptions} options Map options.
*/
constructor(options) { constructor(options) {
BaseObject.call(this); BaseObject.call(this);
+6 -4
View File
@@ -44,14 +44,16 @@ import EventType from './events/EventType.js';
* @classdesc * @classdesc
* Base class for tiles. * Base class for tiles.
* *
* @constructor
* @abstract * @abstract
* @extends {module:ol/events/EventTarget} * @extends {module:ol/events/EventTarget}
* @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 { 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.
*/
constructor(tileCoord, state, opt_options) { constructor(tileCoord, state, opt_options) {
EventTarget.call(this); EventTarget.call(this);
+4 -3
View File
@@ -6,12 +6,13 @@ import LRUCache from './structs/LRUCache.js';
import {fromKey, getKey} from './tilecoord.js'; import {fromKey, getKey} from './tilecoord.js';
/** /**
* @constructor
* @extends {module:ol/structs/LRUCache.<module:ol/Tile>} * @extends {module:ol/structs/LRUCache.<module:ol/Tile>}
* @param {number=} opt_highWaterMark High water mark.
* @struct
*/ */
class TileCache { class TileCache {
/**
* @param {number=} opt_highWaterMark High water mark.
*/
constructor(opt_highWaterMark) { constructor(opt_highWaterMark) {
LRUCache.call(this, opt_highWaterMark); LRUCache.call(this, opt_highWaterMark);
+5 -6
View File
@@ -14,15 +14,14 @@ import PriorityQueue from './structs/PriorityQueue.js';
/** /**
* @constructor
* @extends {module:ol/structs/PriorityQueue.<Array>} * @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 { class TileQueue {
/**
* @param {module:ol/TileQueue~PriorityFunction} tilePriorityFunction Tile priority function.
* @param {function(): ?} tileChangeCallback Function called on each tile change event.
*/
constructor(tilePriorityFunction, tileChangeCallback) { constructor(tilePriorityFunction, tileChangeCallback) {
PriorityQueue.call( PriorityQueue.call(
+8 -7
View File
@@ -1,18 +1,19 @@
/** /**
* @module ol/TileRange * @module ol/TileRange
*/ */
/** /**
* A representation of a contiguous block of tiles. A tile range is specified * A representation of a contiguous block of tiles. A tile range is specified
* by its min/max tile coordinates and is inclusive of coordinates. * by its min/max tile coordinates and is inclusive of coordinates.
*
* @constructor
* @param {number} minX Minimum X.
* @param {number} maxX Maximum X.
* @param {number} minY Minimum Y.
* @param {number} maxY Maximum Y.
* @struct
*/ */
class TileRange { class TileRange {
/**
* @param {number} minX Minimum X.
* @param {number} maxX Maximum X.
* @param {number} minY Minimum Y.
* @param {number} maxY Maximum Y.
*/
constructor(minX, maxX, minY, maxY) { constructor(minX, maxX, minY, maxY) {
/** /**
+21 -19
View File
@@ -22,28 +22,30 @@ import {UNDEFINED} from './functions.js';
/** /**
* @constructor
* @extends {module:ol/Tile} * @extends {module:ol/Tile}
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
* @param {module:ol/TileState} state State.
* @param {number} sourceRevision Source revision.
* @param {module:ol/format/Feature} format Feature format.
* @param {module:ol/Tile~LoadFunction} tileLoadFunction Tile load function.
* @param {module:ol/tilecoord~TileCoord} urlTileCoord Wrapped tile coordinate for source urls.
* @param {module:ol/Tile~UrlFunction} tileUrlFunction Tile url function.
* @param {module:ol/tilegrid/TileGrid} sourceTileGrid Tile grid of the source.
* @param {module:ol/tilegrid/TileGrid} tileGrid Tile grid of the renderer.
* @param {Object.<string, module:ol/VectorTile>} sourceTiles Source tiles.
* @param {number} pixelRatio Pixel ratio.
* @param {module:ol/proj/Projection} projection Projection.
* @param {function(new: module:ol/VectorTile, module:ol/tilecoord~TileCoord, module:ol/TileState, string,
* module:ol/format/Feature, module:ol/Tile~LoadFunction)} tileClass Class to
* instantiate for source tiles.
* @param {function(this: module:ol/source/VectorTile, module:ol/events/Event)} handleTileChange
* Function to call when a source tile's state changes.
* @param {number} zoom Integer zoom to render the tile for.
*/ */
class VectorImageTile { class VectorImageTile {
/**
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
* @param {module:ol/TileState} state State.
* @param {number} sourceRevision Source revision.
* @param {module:ol/format/Feature} format Feature format.
* @param {module:ol/Tile~LoadFunction} tileLoadFunction Tile load function.
* @param {module:ol/tilecoord~TileCoord} urlTileCoord Wrapped tile coordinate for source urls.
* @param {module:ol/Tile~UrlFunction} tileUrlFunction Tile url function.
* @param {module:ol/tilegrid/TileGrid} sourceTileGrid Tile grid of the source.
* @param {module:ol/tilegrid/TileGrid} tileGrid Tile grid of the renderer.
* @param {Object.<string, module:ol/VectorTile>} sourceTiles Source tiles.
* @param {number} pixelRatio Pixel ratio.
* @param {module:ol/proj/Projection} projection Projection.
* @param {function(new: module:ol/VectorTile, module:ol/tilecoord~TileCoord, module:ol/TileState, string,
* module:ol/format/Feature, module:ol/Tile~LoadFunction)} tileClass Class to
* instantiate for source tiles.
* @param {function(this: module:ol/source/VectorTile, module:ol/events/Event)} handleTileChange
* Function to call when a source tile's state changes.
* @param {number} zoom Integer zoom to render the tile for.
*/
constructor( constructor(
tileCoord, tileCoord,
state, state,
+9 -7
View File
@@ -19,16 +19,18 @@ const DEFAULT_EXTENT = [0, 0, 4096, 4096];
*/ */
/** /**
* @constructor
* @extends {module:ol/Tile} * @extends {module:ol/Tile}
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
* @param {module:ol/TileState} state State.
* @param {string} src Data source url.
* @param {module:ol/format/Feature} format Feature format.
* @param {module:ol/Tile~LoadFunction} tileLoadFunction Tile load function.
* @param {module:ol/Tile~Options=} opt_options Tile options.
*/ */
class VectorTile { class VectorTile {
/**
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
* @param {module:ol/TileState} state State.
* @param {string} src Data source url.
* @param {module:ol/format/Feature} format Feature format.
* @param {module:ol/Tile~LoadFunction} tileLoadFunction Tile load function.
* @param {module:ol/Tile~Options=} opt_options Tile options.
*/
constructor(tileCoord, state, src, format, tileLoadFunction, opt_options) { constructor(tileCoord, state, src, format, tileLoadFunction, opt_options) {
Tile.call(this, tileCoord, state, opt_options); Tile.call(this, tileCoord, state, opt_options);
+4 -2
View File
@@ -224,12 +224,14 @@ const DEFAULT_MIN_ZOOM = 0;
* The *center constraint* is determined by the `extent` option. By * The *center constraint* is determined by the `extent` option. By
* default the center is not constrained at all. * default the center is not constrained at all.
* *
* @constructor
* @extends {module:ol/Object} * @extends {module:ol/Object}
* @param {module:ol/View~ViewOptions=} opt_options View options.
* @api * @api
*/ */
class View { class View {
/**
* @param {module:ol/View~ViewOptions=} opt_options View options.
*/
constructor(opt_options) { constructor(opt_options) {
BaseObject.call(this); BaseObject.call(this);
+4 -2
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 * {@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. * with `addLayer` can be groups, which can contain further groups, and so on.
* *
* @constructor
* @extends {module:ol/PluggableMap} * @extends {module:ol/PluggableMap}
* @param {module:ol/PluggableMap~MapOptions} options Map options.
* @fires module:ol/MapBrowserEvent~MapBrowserEvent * @fires module:ol/MapBrowserEvent~MapBrowserEvent
* @fires module:ol/MapEvent~MapEvent * @fires module:ol/MapEvent~MapEvent
* @fires module:ol/render/Event~RenderEvent#postcompose * @fires module:ol/render/Event~RenderEvent#postcompose
@@ -67,6 +65,10 @@ import WebGLVectorLayerRenderer from './renderer/webgl/VectorLayer.js';
* @api * @api
*/ */
class WebGLMap { class WebGLMap {
/**
* @param {module:ol/PluggableMap~MapOptions} options Map options.
*/
constructor(options) { constructor(options) {
options = assign({}, options); options = assign({}, options);
if (!options.controls) { if (!options.controls) {
+107 -106
View File
@@ -49,222 +49,223 @@ import {METERS_PER_UNIT} from '../proj/Units.js';
* be added using `proj4.defs()`. After all required projection definitions are * be added using `proj4.defs()`. After all required projection definitions are
* added, call the {@link module:ol/proj/proj4~register} function. * added, call the {@link module:ol/proj/proj4~register} function.
* *
* @constructor
* @param {module:ol/proj/Projection~Options} options Projection options.
* @struct
* @api * @api
*/ */
class Projection { class Projection {
/**
* @param {module:ol/proj/Projection~Options} options Projection options.
*/
constructor(options) { constructor(options) {
/** /**
* @private * @private
* @type {string} * @type {string}
*/ */
this.code_ = options.code; this.code_ = options.code;
/** /**
* Units of projected coordinates. When set to `TILE_PIXELS`, a * Units of projected coordinates. When set to `TILE_PIXELS`, a
* `this.extent_` and `this.worldExtent_` must be configured properly for each * `this.extent_` and `this.worldExtent_` must be configured properly for each
* tile. * tile.
* @private * @private
* @type {module:ol/proj/Units} * @type {module:ol/proj/Units}
*/ */
this.units_ = /** @type {module:ol/proj/Units} */ (options.units); this.units_ = /** @type {module:ol/proj/Units} */ (options.units);
/** /**
* Validity extent of the projection in projected coordinates. For projections * Validity extent of the projection in projected coordinates. For projections
* with `TILE_PIXELS` units, this is the extent of the tile in * with `TILE_PIXELS` units, this is the extent of the tile in
* tile pixel space. * tile pixel space.
* @private * @private
* @type {module:ol/extent~Extent} * @type {module:ol/extent~Extent}
*/ */
this.extent_ = options.extent !== undefined ? options.extent : null; this.extent_ = options.extent !== undefined ? options.extent : null;
/** /**
* Extent of the world in EPSG:4326. For projections with * Extent of the world in EPSG:4326. For projections with
* `TILE_PIXELS` units, this is the extent of the tile in * `TILE_PIXELS` units, this is the extent of the tile in
* projected coordinate space. * projected coordinate space.
* @private * @private
* @type {module:ol/extent~Extent} * @type {module:ol/extent~Extent}
*/ */
this.worldExtent_ = options.worldExtent !== undefined ? this.worldExtent_ = options.worldExtent !== undefined ?
options.worldExtent : null; options.worldExtent : null;
/** /**
* @private * @private
* @type {string} * @type {string}
*/ */
this.axisOrientation_ = options.axisOrientation !== undefined ? this.axisOrientation_ = options.axisOrientation !== undefined ?
options.axisOrientation : 'enu'; options.axisOrientation : 'enu';
/** /**
* @private * @private
* @type {boolean} * @type {boolean}
*/ */
this.global_ = options.global !== undefined ? options.global : false; this.global_ = options.global !== undefined ? options.global : false;
/** /**
* @private * @private
* @type {boolean} * @type {boolean}
*/ */
this.canWrapX_ = !!(this.global_ && this.extent_); this.canWrapX_ = !!(this.global_ && this.extent_);
/** /**
* @private * @private
* @type {function(number, module:ol/coordinate~Coordinate):number|undefined} * @type {function(number, module:ol/coordinate~Coordinate):number|undefined}
*/ */
this.getPointResolutionFunc_ = options.getPointResolution; this.getPointResolutionFunc_ = options.getPointResolution;
/** /**
* @private * @private
* @type {module:ol/tilegrid/TileGrid} * @type {module:ol/tilegrid/TileGrid}
*/ */
this.defaultTileGrid_ = null; this.defaultTileGrid_ = null;
/** /**
* @private * @private
* @type {number|undefined} * @type {number|undefined}
*/ */
this.metersPerUnit_ = options.metersPerUnit; this.metersPerUnit_ = options.metersPerUnit;
} }
/** /**
* @return {boolean} The projection is suitable for wrapping the x-axis * @return {boolean} The projection is suitable for wrapping the x-axis
*/ */
canWrapX() { canWrapX() {
return this.canWrapX_; return this.canWrapX_;
} }
/** /**
* Get the code for this projection, e.g. 'EPSG:4326'. * Get the code for this projection, e.g. 'EPSG:4326'.
* @return {string} Code. * @return {string} Code.
* @api * @api
*/ */
getCode() { getCode() {
return this.code_; return this.code_;
} }
/** /**
* Get the validity extent for this projection. * Get the validity extent for this projection.
* @return {module:ol/extent~Extent} Extent. * @return {module:ol/extent~Extent} Extent.
* @api * @api
*/ */
getExtent() { getExtent() {
return this.extent_; return this.extent_;
} }
/** /**
* Get the units of this projection. * Get the units of this projection.
* @return {module:ol/proj/Units} Units. * @return {module:ol/proj/Units} Units.
* @api * @api
*/ */
getUnits() { getUnits() {
return this.units_; return this.units_;
} }
/** /**
* Get the amount of meters per unit of this projection. If the projection is * Get the amount of meters per unit of this projection. If the projection is
* not configured with `metersPerUnit` or a units identifier, the return is * not configured with `metersPerUnit` or a units identifier, the return is
* `undefined`. * `undefined`.
* @return {number|undefined} Meters. * @return {number|undefined} Meters.
* @api * @api
*/ */
getMetersPerUnit() { getMetersPerUnit() {
return this.metersPerUnit_ || METERS_PER_UNIT[this.units_]; return this.metersPerUnit_ || METERS_PER_UNIT[this.units_];
} }
/** /**
* Get the world extent for this projection. * Get the world extent for this projection.
* @return {module:ol/extent~Extent} Extent. * @return {module:ol/extent~Extent} Extent.
* @api * @api
*/ */
getWorldExtent() { getWorldExtent() {
return this.worldExtent_; return this.worldExtent_;
} }
/** /**
* Get the axis orientation of this projection. * Get the axis orientation of this projection.
* Example values are: * Example values are:
* enu - the default easting, northing, elevation. * enu - the default easting, northing, elevation.
* neu - northing, easting, up - useful for "lat/long" geographic coordinates, * neu - northing, easting, up - useful for "lat/long" geographic coordinates,
* or south orientated transverse mercator. * or south orientated transverse mercator.
* wnu - westing, northing, up - some planetary coordinate systems have * wnu - westing, northing, up - some planetary coordinate systems have
* "west positive" coordinate systems * "west positive" coordinate systems
* @return {string} Axis orientation. * @return {string} Axis orientation.
* @api * @api
*/ */
getAxisOrientation() { getAxisOrientation() {
return this.axisOrientation_; return this.axisOrientation_;
} }
/** /**
* Is this projection a global projection which spans the whole world? * Is this projection a global projection which spans the whole world?
* @return {boolean} Whether the projection is global. * @return {boolean} Whether the projection is global.
* @api * @api
*/ */
isGlobal() { isGlobal() {
return this.global_; return this.global_;
} }
/** /**
* Set if the projection is a global projection which spans the whole world * Set if the projection is a global projection which spans the whole world
* @param {boolean} global Whether the projection is global. * @param {boolean} global Whether the projection is global.
* @api * @api
*/ */
setGlobal(global) { setGlobal(global) {
this.global_ = global; this.global_ = global;
this.canWrapX_ = !!(global && this.extent_); this.canWrapX_ = !!(global && this.extent_);
} }
/** /**
* @return {module:ol/tilegrid/TileGrid} The default tile grid. * @return {module:ol/tilegrid/TileGrid} The default tile grid.
*/ */
getDefaultTileGrid() { getDefaultTileGrid() {
return this.defaultTileGrid_; return this.defaultTileGrid_;
} }
/** /**
* @param {module:ol/tilegrid/TileGrid} tileGrid The default tile grid. * @param {module:ol/tilegrid/TileGrid} tileGrid The default tile grid.
*/ */
setDefaultTileGrid(tileGrid) { setDefaultTileGrid(tileGrid) {
this.defaultTileGrid_ = tileGrid; this.defaultTileGrid_ = tileGrid;
} }
/** /**
* Set the validity extent for this projection. * Set the validity extent for this projection.
* @param {module:ol/extent~Extent} extent Extent. * @param {module:ol/extent~Extent} extent Extent.
* @api * @api
*/ */
setExtent(extent) { setExtent(extent) {
this.extent_ = extent; this.extent_ = extent;
this.canWrapX_ = !!(this.global_ && extent); this.canWrapX_ = !!(this.global_ && extent);
} }
/** /**
* Set the world extent for this projection. * Set the world extent for this projection.
* @param {module:ol/extent~Extent} worldExtent World extent * @param {module:ol/extent~Extent} worldExtent World extent
* [minlon, minlat, maxlon, maxlat]. * [minlon, minlat, maxlon, maxlat].
* @api * @api
*/ */
setWorldExtent(worldExtent) { setWorldExtent(worldExtent) {
this.worldExtent_ = worldExtent; this.worldExtent_ = worldExtent;
} }
/** /**
* Set the getPointResolution function (see {@link module:ol/proj~getPointResolution} * Set the getPointResolution function (see {@link module:ol/proj~getPointResolution}
* for this projection. * for this projection.
* @param {function(number, module:ol/coordinate~Coordinate):number} func Function * @param {function(number, module:ol/coordinate~Coordinate):number} func Function
* @api * @api
*/ */
setGetPointResolution(func) { setGetPointResolution(func) {
this.getPointResolutionFunc_ = func; this.getPointResolutionFunc_ = func;
} }
/** /**
* Get the custom point resolution function for this projection (if set). * Get the custom point resolution function for this projection (if set).
* @return {function(number, module:ol/coordinate~Coordinate):number|undefined} The custom point * @return {function(number, module:ol/coordinate~Coordinate):number|undefined} The custom point
* resolution function (if set). * resolution function (if set).
*/ */
getPointResolutionFunc() { getPointResolutionFunc() {
return this.getPointResolutionFunc_; return this.getPointResolutionFunc_;
} }
+3 -2
View File
@@ -44,12 +44,13 @@ export const WORLD_EXTENT = [-180, -85, 180, 85];
* @classdesc * @classdesc
* Projection object for web/spherical Mercator (EPSG:3857). * Projection object for web/spherical Mercator (EPSG:3857).
* *
* @constructor
* @extends {module:ol/proj/Projection} * @extends {module:ol/proj/Projection}
* @param {string} code Code.
*/ */
class EPSG3857Projection { class EPSG3857Projection {
/**
* @param {string} code Code.
*/
constructor(code) { constructor(code) {
Projection.call(this, { Projection.call(this, {
code: code, code: code,
+4 -2
View File
@@ -41,11 +41,13 @@ export const METERS_PER_UNIT = Math.PI * RADIUS / 180;
* *
* @constructor * @constructor
* @extends {module:ol/proj/Projection} * @extends {module:ol/proj/Projection}
* @param {string} code Code.
* @param {string=} opt_axisOrientation Axis orientation.
*/ */
class EPSG4326Projection { class EPSG4326Projection {
/**
* @param {string} code Code.
* @param {string=} opt_axisOrientation Axis orientation.
*/
constructor(code, opt_axisOrientation) { constructor(code, opt_axisOrientation) {
Projection.call(this, { Projection.call(this, {
code: code, code: code,
@@ -6,14 +6,12 @@
import {DEBUG as DEBUG_WEBGL} from '../../../../webgl.js'; import {DEBUG as DEBUG_WEBGL} from '../../../../webgl.js';
/**
* @constructor
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
* @struct
*/
class Locations { class Locations {
/**
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
*/
constructor(gl, program) { constructor(gl, program) {
/** /**
@@ -6,14 +6,12 @@
import {DEBUG as DEBUG_WEBGL} from '../../../../webgl.js'; import {DEBUG as DEBUG_WEBGL} from '../../../../webgl.js';
/**
* @constructor
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
* @struct
*/
class Locations { class Locations {
/**
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
*/
constructor(gl, program) { constructor(gl, program) {
/** /**
@@ -6,14 +6,12 @@
import {DEBUG as DEBUG_WEBGL} from '../../../../webgl.js'; import {DEBUG as DEBUG_WEBGL} from '../../../../webgl.js';
/**
* @constructor
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
* @struct
*/
class Locations { class Locations {
/**
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
*/
constructor(gl, program) { constructor(gl, program) {
/** /**
@@ -6,14 +6,12 @@
import {DEBUG as DEBUG_WEBGL} from '../../../../webgl.js'; import {DEBUG as DEBUG_WEBGL} from '../../../../webgl.js';
/**
* @constructor
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
* @struct
*/
class Locations { class Locations {
/**
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
*/
constructor(gl, program) { constructor(gl, program) {
/** /**
@@ -6,14 +6,12 @@
import {DEBUG as DEBUG_WEBGL} from '../../../webgl.js'; import {DEBUG as DEBUG_WEBGL} from '../../../webgl.js';
/**
* @constructor
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
* @struct
*/
class Locations { class Locations {
/**
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
*/
constructor(gl, program) { constructor(gl, program) {
/** /**
@@ -6,14 +6,12 @@
import {DEBUG as DEBUG_WEBGL} from '../../../webgl.js'; import {DEBUG as DEBUG_WEBGL} from '../../../webgl.js';
/**
* @constructor
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
* @struct
*/
class Locations { class Locations {
/**
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
*/
constructor(gl, program) { constructor(gl, program) {
/** /**
+16 -16
View File
@@ -12,39 +12,39 @@ const BufferUsage = {
DYNAMIC_DRAW: DYNAMIC_DRAW DYNAMIC_DRAW: DYNAMIC_DRAW
}; };
/**
* @constructor
* @param {Array.<number>=} opt_arr Array.
* @param {number=} opt_usage Usage.
* @struct
*/
class WebGLBuffer { class WebGLBuffer {
/**
* @param {Array.<number>=} opt_arr Array.
* @param {number=} opt_usage Usage.
*/
constructor(opt_arr, opt_usage) { constructor(opt_arr, opt_usage) {
/** /**
* @private * @private
* @type {Array.<number>} * @type {Array.<number>}
*/ */
this.arr_ = opt_arr !== undefined ? opt_arr : []; this.arr_ = opt_arr !== undefined ? opt_arr : [];
/** /**
* @private * @private
* @type {number} * @type {number}
*/ */
this.usage_ = opt_usage !== undefined ? opt_usage : BufferUsage.STATIC_DRAW; this.usage_ = opt_usage !== undefined ? opt_usage : BufferUsage.STATIC_DRAW;
} }
/** /**
* @return {Array.<number>} Array. * @return {Array.<number>} Array.
*/ */
getArray() { getArray() {
return this.arr_; return this.arr_;
} }
/** /**
* @return {number} Usage. * @return {number} Usage.
*/ */
getUsage() { getUsage() {
return this.usage_; return this.usage_;
} }
+5 -3
View File
@@ -22,12 +22,14 @@ import ContextEventType from '../webgl/ContextEventType.js';
* @classdesc * @classdesc
* A WebGL context for accessing low-level WebGL capabilities. * A WebGL context for accessing low-level WebGL capabilities.
* *
* @constructor
* @extends {module:ol/Disposable} * @extends {module:ol/Disposable}
* @param {HTMLCanvasElement} canvas Canvas.
* @param {WebGLRenderingContext} gl GL.
*/ */
class WebGLContext { class WebGLContext {
/**
* @param {HTMLCanvasElement} canvas Canvas.
* @param {WebGLRenderingContext} gl GL.
*/
constructor(canvas, gl) { constructor(canvas, gl) {
/** /**
+6 -5
View File
@@ -6,19 +6,20 @@ import {FRAGMENT_SHADER} from '../webgl.js';
import WebGLShader from '../webgl/Shader.js'; import WebGLShader from '../webgl/Shader.js';
/** /**
* @constructor
* @extends {module:ol/webgl/Shader} * @extends {module:ol/webgl/Shader}
* @param {string} source Source.
* @struct
*/ */
class WebGLFragment { class WebGLFragment {
/**
* @param {string} source Source.
*/
constructor(source) { constructor(source) {
WebGLShader.call(this, source); WebGLShader.call(this, source);
} }
/** /**
* @inheritDoc * @inheritDoc
*/ */
getType() { getType() {
return FRAGMENT_SHADER; return FRAGMENT_SHADER;
} }
+12 -11
View File
@@ -4,31 +4,32 @@
import {FALSE} from '../functions.js'; import {FALSE} from '../functions.js';
/** /**
* @constructor
* @abstract * @abstract
* @param {string} source Source.
* @struct
*/ */
class WebGLShader { class WebGLShader {
/**
* @param {string} source Source.
*/
constructor(source) { constructor(source) {
/** /**
* @private * @private
* @type {string} * @type {string}
*/ */
this.source_ = source; this.source_ = source;
} }
/** /**
* @abstract * @abstract
* @return {number} Type. * @return {number} Type.
*/ */
getType() {} getType() {}
/** /**
* @return {string} Source. * @return {string} Source.
*/ */
getSource() { getSource() {
return this.source_; return this.source_;
} }
+6 -5
View File
@@ -6,19 +6,20 @@ import {VERTEX_SHADER} from '../webgl.js';
import WebGLShader from '../webgl/Shader.js'; import WebGLShader from '../webgl/Shader.js';
/** /**
* @constructor
* @extends {module:ol/webgl/Shader} * @extends {module:ol/webgl/Shader}
* @param {string} source Source.
* @struct
*/ */
class WebGLVertex { class WebGLVertex {
/**
* @param {string} source Source.
*/
constructor(source) { constructor(source) {
WebGLShader.call(this, source); WebGLShader.call(this, source);
} }
/** /**
* @inheritDoc * @inheritDoc
*/ */
getType() { getType() {
return VERTEX_SHADER; return VERTEX_SHADER;
} }
+4 -6
View File
@@ -6,14 +6,12 @@
import {DEBUG as DEBUG_WEBGL} from '../../../../webgl.js'; import {DEBUG as DEBUG_WEBGL} from '../../../../webgl.js';
/**
* @constructor
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
* @struct
*/
class Locations { class Locations {
/**
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
*/
constructor(gl, program) { constructor(gl, program) {
{{#uniforms}} {{#uniforms}}