diff --git a/types/openlayers/index.d.ts b/types/openlayers/index.d.ts index 4454efdeb9..0a12c36d13 100644 --- a/types/openlayers/index.d.ts +++ b/types/openlayers/index.d.ts @@ -18,12 +18,14 @@ declare module ol { * 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} + * @param code Error code. */ class AssertionError extends Error { /** * 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} + * @param code Error code. */ constructor(code: number); @@ -53,6 +55,7 @@ declare module ol { * ], * .. * + * @param options Attribution options. * @struct * @api stable */ @@ -73,6 +76,7 @@ declare module ol { * ], * .. * + * @param options Attribution options. * @struct * @api stable */ @@ -80,6 +84,7 @@ declare module ol { /** * Get the attribution markup. + * @return The attribution HTML. * @api stable */ getHTML(): string; @@ -94,6 +99,7 @@ declare module ol { * Collection as a whole. * * @fires ol.Collection.Event + * @param opt_array Array. * @template T * @api stable */ @@ -107,6 +113,7 @@ declare module ol { * Collection as a whole. * * @fires ol.Collection.Event + * @param opt_array Array. * @template T * @api stable */ @@ -121,14 +128,18 @@ declare module ol { /** * Add elements to the collection. This pushes each item in the provided array * to the end of the collection. + * @param arr Array. + * @return This collection. * @api stable */ extend(arr: T[]): ol.Collection; /** * Iterate over each element, calling the provided callback. + * @param f The function to call * for every element. This function takes 3 arguments (the element, the * index and the array). The return value is ignored. + * @param opt_this The object to use as `this` in `f`. * @template S * @api stable */ @@ -139,18 +150,22 @@ declare module ol { * is mutated, no events will be dispatched by the collection, and the * collection's "length" property won't be in sync with the actual length * of the array. + * @return Array. * @api stable */ getArray(): T[]; /** * Get the element at the provided index. + * @param index Index. + * @return Element. * @api stable */ item(index: number): T; /** * Get the length of this collection. + * @return The length of the array. * @observable * @api stable */ @@ -158,6 +173,8 @@ declare module ol { /** * Insert an element at the provided index. + * @param index Index. + * @param elem Element. * @api stable */ insertAt(index: number, elem: T): void; @@ -165,18 +182,23 @@ declare module ol { /** * Remove the last element of the collection and return it. * Return `undefined` if the collection is empty. + * @return Element. * @api stable */ pop(): (T); /** * Insert the provided element at the end of the collection. + * @param elem Element. + * @return Length. * @api stable */ push(elem: T): number; /** * Remove the first occurrence of an element from the collection. + * @param elem Element. + * @return The removed element or undefined if none found. * @api stable */ remove(elem: T): (T); @@ -184,12 +206,16 @@ declare module ol { /** * Remove the element at the provided index and return it. * Return `undefined` if the collection does not contain this index. + * @param index Index. + * @return Value. * @api stable */ removeAt(index: number): (T); /** * Set the element at the provided index. + * @param index Index. + * @param elem Element. * @api stable */ setAt(index: number, elem: T): void; @@ -203,6 +229,8 @@ declare module ol { * Events emitted by {@link ol.Collection} instances are instances of this * type. * + * @param type Type. + * @param opt_element Element. */ class Event extends ol.events.Event { /** @@ -210,6 +238,8 @@ declare module ol { * Events emitted by {@link ol.Collection} instances are instances of this * type. * + * @param type Type. + * @param opt_element Element. */ constructor(type: ol.Collection.EventType, opt_element?: any); @@ -226,17 +256,22 @@ declare module ol { * `rgb(r,g,b)` or `rgba(r,g,b,a)` format, or in hex `#rrggbb` or `#rgb` format. * Color names, like 'red', 'blue' or 'green', may also be used with the * Canvas renderer. + * */ module color { /** * Return the color as an array. This function maintains a cache of calculated * arrays which means the result should not be modified. + * @param color Color. + * @return Color. * @api */ function asArray(color: (ol.Color | string)): ol.Color; /** * Return the color as an rgba string. + * @param color Color. + * @return Rgba string. * @api */ function asString(color: (ol.Color | string)): string; @@ -248,6 +283,8 @@ declare module ol { */ module colorlike { /** + * @param color Color. + * @return The color as an ol.ColorLike * @api */ function asColorLike(color: (ol.Color | ol.ColorLike)): ol.ColorLike; @@ -261,6 +298,7 @@ declare module ol { * By default it will show in the bottom right portion of the map, but this can * be changed by using a css selector for `.ol-attribution`. * + * @param opt_options Attribution options. * @api stable */ class Attribution extends ol.control.Control { @@ -270,24 +308,29 @@ declare module ol { * in the map. This control is one of the default controls included in maps. * By default it will show in the bottom right portion of the map, but this can * be changed by using a css selector for `.ol-attribution`. + * + * @param opt_options Attribution options. * @api stable */ constructor(opt_options?: olx.control.AttributionOptions); /** * Update the attribution element. + * @param mapEvent Map event. * @api */ static render(mapEvent: ol.MapEvent): void; /** * Return `true` if the attribution is collapsible, `false` otherwise. + * @return True if the widget is collapsible. * @api stable */ getCollapsible(): boolean; /** * Set whether the attribution should be collapsible. + * @param collapsible True if the widget is collapsible. * @api stable */ setCollapsible(collapsible: boolean): void; @@ -296,6 +339,7 @@ declare module ol { * Collapse or expand the attribution according to the passed parameter. Will * not do anything if the attribution isn't collapsible or if the current * collapsed state is already the one requested. + * @param collapsed True if the widget is collapsed. * @api stable */ setCollapsed(collapsed: boolean): void; @@ -303,6 +347,7 @@ declare module ol { /** * Return `true` when the attribution is currently collapsed or `false` * otherwise. + * @return True if the widget is collapsed. * @api stable */ getCollapsed(): boolean; @@ -331,6 +376,7 @@ declare module ol { * You can also extend this base for your own control class. See * examples/custom-controls for an example of how to do this. * + * @param options Control options. * @api stable */ class Control extends ol.Object { @@ -357,12 +403,14 @@ declare module ol { * You can also extend this base for your own control class. See * examples/custom-controls for an example of how to do this. * + * @param options Control options. * @api stable */ constructor(options: olx.control.ControlOptions); /** * Get the map associated with this control. + * @return Map. * @api stable */ getMap(): ol.Map; @@ -371,6 +419,7 @@ declare module ol { * Remove the control from its current map and attach it to the new map. * Subclasses may set up event handlers to get notified about changes to * the map here. + * @param map Map. * @api stable */ setMap(map: ol.Map): void; @@ -381,6 +430,7 @@ declare module ol { * after `setMap` is called on the control). If no `target` is set in the * options passed to the control constructor and if `setTarget` is not called * then the control is added to the map's overlay container. + * @param target Target. * @api */ setTarget(target: (Element | string)): void; @@ -398,6 +448,7 @@ declare module ol { * toggle the map in full screen mode. * * + * @param opt_options Options. * @api stable */ class FullScreen extends ol.control.Control { @@ -413,6 +464,7 @@ declare module ol { * toggle the map in full screen mode. * * + * @param opt_options Options. * @api stable */ constructor(opt_options?: olx.control.FullScreenOptions); @@ -426,6 +478,8 @@ declare module ol { * * {@link ol.control.Rotate} * * {@link ol.control.Attribution} * + * @param opt_options Defaults options. + * @return Controls. * @api stable */ function defaults(opt_options?: olx.control.DefaultsOptions): ol.Collection; @@ -437,6 +491,7 @@ declare module ol { * By default the control is shown in the top right corner of the map, but this * can be changed by using the css selector `.ol-mouse-position`. * + * @param opt_options Mouse position * options. * @api stable */ @@ -448,6 +503,7 @@ declare module ol { * By default the control is shown in the top right corner of the map, but this * can be changed by using the css selector `.ol-mouse-position`. * + * @param opt_options Mouse position * options. * @api stable */ @@ -455,6 +511,7 @@ declare module ol { /** * Update the mouseposition element. + * @param mapEvent Map event. * @api */ static render(mapEvent: ol.MapEvent): void; @@ -462,6 +519,7 @@ declare module ol { /** * Return the coordinate format type used to render the current position or * undefined. + * @return The format to render the current * position in. * @observable * @api stable @@ -470,6 +528,7 @@ declare module ol { /** * Return the projection that is used to report the mouse position. + * @return The projection to report mouse * position in. * @observable * @api stable @@ -478,6 +537,7 @@ declare module ol { /** * Set the coordinate format type used to render the current position. + * @param format The format to render the current * position in. * @observable * @api stable @@ -486,6 +546,7 @@ declare module ol { /** * Set the projection that is used to report the mouse position. + * @param projection The projection to report mouse * position in. * @observable * @api stable @@ -496,30 +557,35 @@ declare module ol { /** * Create a new control with a map acting as an overview map for an other * defined map. + * @param opt_options OverviewMap options. * @api */ class OverviewMap extends ol.control.Control { /** * Create a new control with a map acting as an overview map for an other * defined map. + * @param opt_options OverviewMap options. * @api */ constructor(opt_options?: olx.control.OverviewMapOptions); /** * Update the overview map element. + * @param mapEvent Map event. * @api */ static render(mapEvent: ol.MapEvent): void; /** * Return `true` if the overview map is collapsible, `false` otherwise. + * @return True if the widget is collapsible. * @api stable */ getCollapsible(): boolean; /** * Set whether the overview map should be collapsible. + * @param collapsible True if the widget is collapsible. * @api stable */ setCollapsible(collapsible: boolean): void; @@ -528,18 +594,21 @@ declare module ol { * Collapse or expand the overview map according to the passed parameter. Will * not do anything if the overview map isn't collapsible or if the current * collapsed state is already the one requested. + * @param collapsed True if the widget is collapsed. * @api stable */ setCollapsed(collapsed: boolean): void; /** * Determine if the overview map is collapsed. + * @return The overview map is collapsed. * @api stable */ getCollapsed(): boolean; /** * Return the overview map. + * @return Overview map. * @api */ getOverviewMap(): ol.Map; @@ -551,6 +620,7 @@ declare module ol { * To style this control use css selector `.ol-rotate`. A `.ol-hidden` css * selector is added to the button when the rotation is 0. * + * @param opt_options Rotate options. * @api stable */ class Rotate extends ol.control.Control { @@ -560,12 +630,14 @@ declare module ol { * To style this control use css selector `.ol-rotate`. A `.ol-hidden` css * selector is added to the button when the rotation is 0. * + * @param opt_options Rotate options. * @api stable */ constructor(opt_options?: olx.control.RotateOptions); /** * Update the rotate control element. + * @param mapEvent Map event. * @api */ static render(mapEvent: ol.MapEvent): void; @@ -581,6 +653,7 @@ declare module ol { * By default the scale line will show in the bottom left portion of the map, * but this can be changed by using the css selector `.ol-scale-line`. * + * @param opt_options Scale line options. * @api stable */ class ScaleLine extends ol.control.Control { @@ -594,12 +667,14 @@ declare module ol { * By default the scale line will show in the bottom left portion of the map, * but this can be changed by using the css selector `.ol-scale-line`. * + * @param opt_options Scale line options. * @api stable */ constructor(opt_options?: olx.control.ScaleLineOptions); /** * Return the units to use in the scale line. + * @return The units to use in the scale * line. * @observable * @api stable @@ -608,12 +683,14 @@ declare module ol { /** * Update the scale line element. + * @param mapEvent Map event. * @api */ static render(mapEvent: ol.MapEvent): void; /** * Set the units to use in the scale line. + * @param units The units to use in the scale line. * @observable * @api stable */ @@ -639,6 +716,7 @@ declare module ol { * This control is one of the default controls of a map. To style this control * use css selectors `.ol-zoom-in` and `.ol-zoom-out`. * + * @param opt_options Zoom options. * @api stable */ class Zoom extends ol.control.Control { @@ -648,6 +726,7 @@ declare module ol { * This control is one of the default controls of a map. To style this control * use css selectors `.ol-zoom-in` and `.ol-zoom-out`. * + * @param opt_options Zoom options. * @api stable */ constructor(opt_options?: olx.control.ZoomOptions); @@ -661,6 +740,7 @@ declare module ol { * * map.addControl(new ol.control.ZoomSlider()); * + * @param opt_options Zoom slider options. * @api stable */ class ZoomSlider extends ol.control.Control { @@ -672,12 +752,14 @@ declare module ol { * * map.addControl(new ol.control.ZoomSlider()); * + * @param opt_options Zoom slider options. * @api stable */ constructor(opt_options?: olx.control.ZoomSliderOptions); /** * Update the zoomslider element. + * @param mapEvent Map event. * @api */ static render(mapEvent: ol.MapEvent): void; @@ -688,6 +770,7 @@ declare module ol { * A button control which, when pressed, changes the map view to a specific * extent. To style this control use the css selector `.ol-zoom-extent`. * + * @param opt_options Options. * @api stable */ class ZoomToExtent extends ol.control.Control { @@ -696,6 +779,7 @@ declare module ol { * A button control which, when pressed, changes the map view to a specific * extent. To style this control use the css selector `.ol-zoom-extent`. * + * @param opt_options Options. * @api stable */ constructor(opt_options?: olx.control.ZoomToExtentOptions); @@ -713,6 +797,9 @@ declare module ol { * ol.coordinate.add(coord, [-2, 4]); * // coord is now [5.85, 51.983333] * + * @param coordinate Coordinate. + * @param delta Delta. + * @return The input coordinate adjusted by the given delta. * @api stable */ function add(coordinate: ol.Coordinate, delta: ol.Coordinate): ol.Coordinate; @@ -735,7 +822,9 @@ declare module ol { * var out = stringifyFunc(coord); * // out is now '7.85, 47.98' * + * @param opt_fractionDigits The number of digits to include * after the decimal point. Default is `0`. + * @return Coordinate format. * @api stable */ function createStringXY(opt_fractionDigits?: number): ol.CoordinateFormatType; @@ -759,8 +848,12 @@ declare module ol { * var out = ol.coordinate.format(coord, template, 2); * // out is now 'Coordinate is (7.85|47.98).' * + * @param coordinate Coordinate. + * @param template A template string with `{x}` and `{y}` placeholders * that will be replaced by first and second coordinate values. + * @param opt_fractionDigits The number of digits to include * after the decimal point. Default is `0`. + * @return Formatted coordinate. * @api stable */ function format(coordinate: (ol.Coordinate), template: string, opt_fractionDigits?: number): string; @@ -776,6 +869,9 @@ declare module ol { * ol.coordinate.rotate(coord, rotateRadians); * // coord is now [-47.983333, 7.85] * + * @param coordinate Coordinate. + * @param angle Angle in radian. + * @return Coordinate. * @api stable */ function rotate(coordinate: ol.Coordinate, angle: number): ol.Coordinate; @@ -796,7 +892,10 @@ declare module ol { * var out = ol.coordinate.toStringHDMS(coord, 1); * // out is now '47° 58′ 60.0″ N 7° 50′ 60.0″ E' * + * @param coordinate Coordinate. + * @param opt_fractionDigits The number of digits to include * after the decimal point. Default is `0`. + * @return Hemisphere, degrees, minutes and seconds. * @api stable */ function toStringHDMS(coordinate?: ol.Coordinate, opt_fractionDigits?: number): string; @@ -816,7 +915,10 @@ declare module ol { * var out = ol.coordinate.toStringXY(coord, 1); * // out is now '7.8, 48.0' * + * @param coordinate Coordinate. + * @param opt_fractionDigits The number of digits to include * after the decimal point. Default is `0`. + * @return XY. * @api stable */ function toStringXY(coordinate?: ol.Coordinate, opt_fractionDigits?: number): string; @@ -872,6 +974,7 @@ declare module ol { * * @see {@link http://www.w3.org/TR/orientation-event/} * + * @param opt_options Options. * @api */ class DeviceOrientation extends ol.Object { @@ -925,12 +1028,14 @@ declare module ol { * * @see {@link http://www.w3.org/TR/orientation-event/} * + * @param opt_options Options. * @api */ constructor(opt_options?: olx.DeviceOrientationOptions); /** * Rotation around the device z-axis (in radians). + * @return The euler angle in radians of the device from the * standard Z axis. * @observable * @api @@ -939,6 +1044,7 @@ declare module ol { /** * Rotation around the device x-axis (in radians). + * @return The euler angle in radians of the device from the * planar X axis. * @observable * @api @@ -947,6 +1053,7 @@ declare module ol { /** * Rotation around the device y-axis (in radians). + * @return The euler angle in radians of the device from the * planar Y axis. * @observable * @api @@ -955,6 +1062,7 @@ declare module ol { /** * The heading of the device relative to north (in radians). + * @return The heading of the device relative to north, in * radians, normalizing for different browser behavior. * @observable * @api @@ -963,6 +1071,7 @@ declare module ol { /** * Determine if orientation is being tracked. + * @return Changes in device orientation are being tracked. * @observable * @api */ @@ -970,6 +1079,7 @@ declare module ol { /** * Enable or disable tracking of device orientation events. + * @param tracking The status of tracking changes to alpha, beta and * gamma. If true, changes are tracked and reported immediately. * @observable * @api @@ -993,24 +1103,32 @@ declare module ol { module easing { /** * Start slow and speed up. + * @param t Input between 0 and 1. + * @return Output between 0 and 1. * @api */ function easeIn(t: number): number; /** * Start fast and slow down. + * @param t Input between 0 and 1. + * @return Output between 0 and 1. * @api */ function easeOut(t: number): number; /** * Start slow, speed up, and then slow down again. + * @param t Input between 0 and 1. + * @return Output between 0 and 1. * @api */ function inAndOut(t: number): number; /** * Maintain a constant speed over time. + * @param t Input between 0 and 1. + * @return Output between 0 and 1. * @api */ function linear(t: number): number; @@ -1019,6 +1137,8 @@ declare module ol { * Start slow, speed up, and at the very end slow down again. This has the * same general behavior as {@link ol.easing.inAndOut}, but the final slowdown * is delayed. + * @param t Input between 0 and 1. + * @return Output between 0 and 1. * @api */ function upAndDown(t: number): number; @@ -1035,6 +1155,7 @@ declare module ol { * this can be configured in the listener registration function. * Some classes have their own event type, which return additional * properties; see the specific event class page for details. + * */ module events { module condition { @@ -1042,6 +1163,8 @@ declare module ol { * Return `true` if only the alt-key is pressed, `false` otherwise (e.g. when * additionally the shift-key is pressed). * + * @param mapBrowserEvent Map browser event. + * @return True if only the alt key is pressed. * @api stable */ function altKeyOnly(mapBrowserEvent: ol.MapBrowserEvent): boolean; @@ -1050,6 +1173,8 @@ declare module ol { * Return `true` if only the alt-key and shift-key is pressed, `false` otherwise * (e.g. when additionally the platform-modifier-key is pressed). * + * @param mapBrowserEvent Map browser event. + * @return True if only the alt and shift keys are pressed. * @api stable */ function altShiftKeysOnly(mapBrowserEvent: ol.MapBrowserEvent): boolean; @@ -1057,6 +1182,8 @@ declare module ol { /** * Return always true. * + * @param mapBrowserEvent Map browser event. + * @return True. * @api stable */ function always(mapBrowserEvent: ol.MapBrowserEvent): boolean; @@ -1064,6 +1191,8 @@ declare module ol { /** * Return `true` if the event is a `click` event, `false` otherwise. * + * @param mapBrowserEvent Map browser event. + * @return True if the event is a map `click` event. * @api stable */ function click(mapBrowserEvent: ol.MapBrowserEvent): boolean; @@ -1071,6 +1200,8 @@ declare module ol { /** * Return always false. * + * @param mapBrowserEvent Map browser event. + * @return False. * @api stable */ function never(mapBrowserEvent: ol.MapBrowserEvent): boolean; @@ -1079,6 +1210,8 @@ declare module ol { * Return `true` if the browser event is a `pointermove` event, `false` * otherwise. * + * @param mapBrowserEvent Map browser event. + * @return True if the browser event is a `pointermove` event. * @api */ function pointerMove(mapBrowserEvent: ol.MapBrowserEvent): boolean; @@ -1086,6 +1219,8 @@ declare module ol { /** * Return `true` if the event is a map `singleclick` event, `false` otherwise. * + * @param mapBrowserEvent Map browser event. + * @return True if the event is a map `singleclick` event. * @api stable */ function singleClick(mapBrowserEvent: ol.MapBrowserEvent): boolean; @@ -1093,6 +1228,8 @@ declare module ol { /** * Return `true` if the event is a map `dblclick` event, `false` otherwise. * + * @param mapBrowserEvent Map browser event. + * @return True if the event is a map `dblclick` event. * @api stable */ function doubleClick(mapBrowserEvent: ol.MapBrowserEvent): boolean; @@ -1101,6 +1238,8 @@ declare module ol { * Return `true` if no modifier key (alt-, shift- or platform-modifier-key) is * pressed. * + * @param mapBrowserEvent Map browser event. + * @return True only if there no modifier keys are pressed. * @api stable */ function noModifierKeys(mapBrowserEvent: ol.MapBrowserEvent): boolean; @@ -1110,6 +1249,8 @@ declare module ol { * ctrl-key otherwise) is pressed, `false` otherwise (e.g. when additionally * the shift-key is pressed). * + * @param mapBrowserEvent Map browser event. + * @return True if only the platform modifier key is pressed. * @api stable */ function platformModifierKeyOnly(mapBrowserEvent: ol.MapBrowserEvent): boolean; @@ -1118,6 +1259,8 @@ declare module ol { * Return `true` if only the shift-key is pressed, `false` otherwise (e.g. when * additionally the alt-key is pressed). * + * @param mapBrowserEvent Map browser event. + * @return True if only the shift key is pressed. * @api stable */ function shiftKeyOnly(mapBrowserEvent: ol.MapBrowserEvent): boolean; @@ -1126,6 +1269,8 @@ declare module ol { * Return `true` if the target element is not editable, i.e. not a ``-, * `