Add documentation for API typedef functions

This commit is contained in:
Bart van den Eijnden
2014-02-13 13:23:04 +01:00
parent 20402a6e71
commit 87d651af04
6 changed files with 36 additions and 1 deletions

View File

@@ -2,7 +2,16 @@ goog.provide('ol.CanvasFunctionType');
/**
* A function returning the canvas element (`{HTMLCanvasElement}`)
* used by the source as an image. The arguments passed to the function are:
* {@link ol.Extent} the image extent, `{number}` the image resolution,
* `{number}` the device pixel ratio, {@link ol.Size} the image size, and
* {@link ol.proj.Projection} the image projection. The canvas returned by
* this function is cached by the source. The this keyword inside the function
* references the {@link ol.source.ImageCanvas}.
*
* @typedef {function(this:ol.source.ImageCanvas, ol.Extent, number,
* number, ol.Size, ol.proj.Projection): HTMLCanvasElement}
* @todo stability experimental
*/
ol.CanvasFunctionType;

View File

@@ -7,7 +7,9 @@ goog.require('goog.math');
/**
* A function that formats a {@link ol.Coordinate} into a string.
* A function that takes a {@link ol.Coordinate} and transforms it into a
* `{string}`.
*
* @typedef {function((ol.Coordinate|undefined)): string}
* @todo stability experimental
*/

View File

@@ -8,7 +8,11 @@ goog.require('ol.MapBrowserEvent.EventType');
/**
* A function that takes an {@link ol.MapBrowserEvent} and returns a
* `{boolean}`. If the condition is met, true should be returned.
*
* @typedef {function(ol.MapBrowserEvent): boolean}
* @todo stability experimental
*/
ol.events.ConditionType;

View File

@@ -203,6 +203,11 @@ ol.Feature.prototype.setGeometryName = function(name) {
/**
* A function that takes a `{number}` representing the view's resolution. It
* returns an Array of {@link ol.style.Style}. This way individual features
* can be styled. The this keyword inside the function references the
* {@link ol.Feature} to be styled.
*
* @typedef {function(this: ol.Feature, number): Array.<ol.style.Style>}
* @todo stability experimental
*/
@@ -219,6 +224,10 @@ ol.feature.defaultFeatureStyleFunction = goog.functions.constant([]);
/**
* A function that takes an {@link ol.Feature} and a `{number}` representing
* the view's resolution. The function should return an array of
* {@link ol.style.Style}. This way e.g. a vector layer can be styled.
*
* @typedef {function(ol.Feature, number): Array.<ol.style.Style>}
* @todo stability experimental
*/

View File

@@ -2,6 +2,10 @@ goog.provide('ol.TileLoadFunctionType');
/**
* A function that takes an {@link ol.ImageTile} for the image tile and a
* `{string}` for the src as arguments.
*
* @typedef {function(ol.ImageTile, string)}
* @todo stability experimental
*/
ol.TileLoadFunctionType;

View File

@@ -7,8 +7,15 @@ goog.require('ol.TileCoord');
/**
* A function that takes an {@link ol.TileCoord} for the tile coordinate,
* a `{number}` representing the pixel ratio and an {@link ol.proj.Projection}
* for the projection as arguments and returns a `{string}` or
* undefined representing the tile URL. The this keyword inside the function
* references the {@link ol.source.TileImage}.
*
* @typedef {function(this: ol.source.TileImage, ol.TileCoord,
* number, ol.proj.Projection): (string|undefined)}
* @todo stability experimental
*/
ol.TileUrlFunctionType;