Move top-level typedefs to typedefs.js

With one exception, those directly in the `ol` namespace can be moved without problem.
Some left-over goog.requires are also removed.
This commit is contained in:
Peter Robins
2016-05-04 12:05:41 +00:00
parent d6395a3c82
commit 535e8f5e35
43 changed files with 293 additions and 326 deletions

View File

@@ -1,7 +1,6 @@
goog.provide('ol.animation'); goog.provide('ol.animation');
goog.require('ol'); goog.require('ol');
goog.require('ol.PreRenderFunction');
goog.require('ol.ViewHint'); goog.require('ol.ViewHint');
goog.require('ol.coordinate'); goog.require('ol.coordinate');
goog.require('ol.easing'); goog.require('ol.easing');

View File

@@ -4,13 +4,6 @@ goog.require('ol.TileRange');
goog.require('ol.math'); goog.require('ol.math');
/**
* @typedef {string|Array.<string>|ol.Attribution|Array.<ol.Attribution>}
* @api
*/
ol.AttributionLike;
/** /**
* @classdesc * @classdesc
* An attribution for a layer source. * An attribution for a layer source.

View File

@@ -1,17 +0,0 @@
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}
* @api
*/
ol.CanvasFunctionType;

View File

@@ -1,15 +1,8 @@
goog.provide('ol.CenterConstraint'); goog.provide('ol.CenterConstraint');
goog.provide('ol.CenterConstraintType');
goog.require('ol.math'); goog.require('ol.math');
/**
* @typedef {function((ol.Coordinate|undefined)): (ol.Coordinate|undefined)}
*/
ol.CenterConstraintType;
/** /**
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @return {ol.CenterConstraintType} The constraint. * @return {ol.CenterConstraintType} The constraint.

View File

@@ -3,7 +3,6 @@
// causes occasional loss of precision and rounding errors, especially in the // causes occasional loss of precision and rounding errors, especially in the
// alpha channel. // alpha channel.
goog.provide('ol.Color');
goog.provide('ol.color'); goog.provide('ol.color');
goog.require('goog.asserts'); goog.require('goog.asserts');
@@ -13,17 +12,6 @@ goog.require('ol');
goog.require('ol.math'); goog.require('ol.math');
/**
* A color represented as a short array [red, green, blue, alpha].
* red, green, and blue should be integers in the range 0..255 inclusive.
* alpha should be a float in the range 0..1 inclusive. If no alpha value is
* given then `1` will be used.
* @typedef {Array.<number>}
* @api
*/
ol.Color;
/** /**
* This RegExp matches # followed by 3 or 6 hex digits. * This RegExp matches # followed by 3 or 6 hex digits.
* @const * @const

View File

@@ -1,19 +1,8 @@
goog.provide('ol.ColorLike');
goog.provide('ol.colorlike'); goog.provide('ol.colorlike');
goog.require('ol.color'); goog.require('ol.color');
/**
* A type accepted by CanvasRenderingContext2D.fillStyle.
* Represents a color, pattern, or gradient.
*
* @typedef {string|CanvasPattern|CanvasGradient}
* @api
*/
ol.ColorLike;
/** /**
* @param {ol.Color|ol.ColorLike} color Color. * @param {ol.Color|ol.ColorLike} color Color.
* @return {ol.ColorLike} The color as an ol.ColorLike * @return {ol.ColorLike} The color as an ol.ColorLike

View File

@@ -5,7 +5,6 @@ goog.provide('ol.control.MousePosition');
goog.require('ol.events'); goog.require('ol.events');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');
goog.require('ol.Object'); goog.require('ol.Object');
goog.require('ol.TransformFunction');
goog.require('ol.control.Control'); goog.require('ol.control.Control');
goog.require('ol.proj'); goog.require('ol.proj');
goog.require('ol.proj.Projection'); goog.require('ol.proj.Projection');

View File

@@ -1,29 +1,9 @@
goog.provide('ol.Coordinate');
goog.provide('ol.CoordinateFormatType');
goog.provide('ol.coordinate'); goog.provide('ol.coordinate');
goog.require('ol.math'); goog.require('ol.math');
goog.require('ol.string'); goog.require('ol.string');
/**
* A function that takes a {@link ol.Coordinate} and transforms it into a
* `{string}`.
*
* @typedef {function((ol.Coordinate|undefined)): string}
* @api stable
*/
ol.CoordinateFormatType;
/**
* An array of numbers representing an xy coordinate. Example: `[16, 48]`.
* @typedef {Array.<number>} ol.Coordinate
* @api stable
*/
ol.Coordinate;
/** /**
* Add `delta` to `coordinate`. `coordinate` is modified in place and returned * Add `delta` to `coordinate`. `coordinate` is modified in place and returned
* by the function. * by the function.

View File

@@ -1,4 +1,3 @@
goog.provide('ol.Extent');
goog.provide('ol.extent'); goog.provide('ol.extent');
goog.provide('ol.extent.Corner'); goog.provide('ol.extent.Corner');
goog.provide('ol.extent.Relationship'); goog.provide('ol.extent.Relationship');
@@ -6,14 +5,6 @@ goog.provide('ol.extent.Relationship');
goog.require('goog.asserts'); goog.require('goog.asserts');
/**
* An array of numbers representing an extent: `[minx, miny, maxx, maxy]`.
* @typedef {Array.<number>}
* @api stable
*/
ol.Extent;
/** /**
* Extent corner. * Extent corner.
* @enum {string} * @enum {string}

View File

@@ -1,5 +1,4 @@
goog.provide('ol.Feature'); goog.provide('ol.Feature');
goog.provide('ol.FeatureStyleFunction');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('ol.events'); goog.require('ol.events');
@@ -284,18 +283,6 @@ ol.Feature.prototype.setGeometryName = function(name) {
}; };
/**
* A function that returns an array of {@link ol.style.Style styles} given a
* resolution. The `this` keyword inside the function references the
* {@link ol.Feature} to be styled.
*
* @typedef {function(this: ol.Feature, number):
* (ol.style.Style|Array.<ol.style.Style>)}
* @api stable
*/
ol.FeatureStyleFunction;
/** /**
* Convert the provided object into a feature style function. Functions passed * Convert the provided object into a feature style function. Functions passed
* through unchanged. Arrays of ol.style.Style or single style objects wrapped * through unchanged. Arrays of ol.style.Style or single style objects wrapped

View File

@@ -1,5 +1,3 @@
goog.provide('ol.FeatureLoader');
goog.provide('ol.FeatureUrlFunction');
goog.provide('ol.featureloader'); goog.provide('ol.featureloader');
goog.require('goog.asserts'); goog.require('goog.asserts');
@@ -11,38 +9,6 @@ goog.require('ol.proj.Projection');
goog.require('ol.xml'); goog.require('ol.xml');
/**
* {@link ol.source.Vector} sources use a function of this type to load
* features.
*
* This function takes an {@link ol.Extent} representing the area to be loaded,
* a `{number}` representing the resolution (map units per pixel) and an
* {@link ol.proj.Projection} for the projection as arguments. `this` within
* the function is bound to the {@link ol.source.Vector} it's called from.
*
* The function is responsible for loading the features and adding them to the
* source.
* @api
* @typedef {function(this:ol.source.Vector, ol.Extent, number,
* ol.proj.Projection)}
*/
ol.FeatureLoader;
/**
* {@link ol.source.Vector} sources use a function of this type to get the url
* to load features from.
*
* This function takes an {@link ol.Extent} representing the area to be loaded,
* a `{number}` representing the resolution (map units per pixel) and an
* {@link ol.proj.Projection} for the projection as arguments and returns a
* `{string}` representing the URL.
* @api
* @typedef {function(ol.Extent, number, ol.proj.Projection) : string}
*/
ol.FeatureUrlFunction;
/** /**
* @param {string|ol.FeatureUrlFunction} url Feature URL service. * @param {string|ol.FeatureUrlFunction} url Feature URL service.
* @param {ol.format.Feature} format Feature format. * @param {ol.format.Feature} format Feature format.

View File

@@ -1,19 +0,0 @@
goog.provide('ol.PostRenderFunction');
goog.provide('ol.PreRenderFunction');
/**
* @typedef {function(ol.Map, ?olx.FrameState): boolean}
*/
ol.PostRenderFunction;
/**
* Function to perform manipulations before rendering. This function is called
* with the {@link ol.Map} as first and an optional {@link olx.FrameState} as
* second argument. Return `true` to keep this function for the next frame,
* `false` to remove it.
* @typedef {function(ol.Map, ?olx.FrameState): boolean}
* @api
*/
ol.PreRenderFunction;

View File

@@ -6,7 +6,6 @@ goog.provide('ol.GeolocationProperty');
goog.require('ol.events'); goog.require('ol.events');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');
goog.require('ol.Object'); goog.require('ol.Object');
goog.require('ol.TransformFunction');
goog.require('ol.geom.Geometry'); goog.require('ol.geom.Geometry');
goog.require('ol.geom.Polygon'); goog.require('ol.geom.Polygon');
goog.require('ol.has'); goog.require('ol.has');

View File

@@ -91,14 +91,3 @@ ol.ImageCanvas.prototype.load = function() {
ol.ImageCanvas.prototype.getImage = function(opt_context) { ol.ImageCanvas.prototype.getImage = function(opt_context) {
return this.canvas_; return this.canvas_;
}; };
/**
* A function that is called to trigger asynchronous canvas drawing. It is
* called with a "done" callback that should be called when drawing is done.
* If any error occurs during drawing, the "done" callback should be called with
* that error.
*
* @typedef {function(function(Error))}
*/
ol.ImageCanvasLoader;

View File

@@ -1,21 +0,0 @@
goog.provide('ol.ImageLoadFunctionType');
/**
* A function that takes an {@link ol.Image} for the image and a `{string}` for
* the src as arguments. It is supposed to make it so the underlying image
* {@link ol.Image#getImage} is assigned the content specified by the src. If
* not specified, the default is
*
* function(image, src) {
* image.getImage().src = src;
* }
*
* Providing a custom `imageLoadFunction` can be useful to load images with
* post requests or - in general - through XHR requests, where the src of the
* image element would be set to a data URI when the content is loaded.
*
* @typedef {function(ol.Image, string)}
* @api
*/
ol.ImageLoadFunctionType;

View File

@@ -2,7 +2,7 @@ goog.provide('ol.interaction.DragPan');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('ol.Kinetic'); goog.require('ol.Kinetic');
goog.require('ol.Pixel');
goog.require('ol.ViewHint'); goog.require('ol.ViewHint');
goog.require('ol.coordinate'); goog.require('ol.coordinate');
goog.require('ol.functions'); goog.require('ol.functions');

View File

@@ -11,7 +11,6 @@ goog.require('ol.CollectionEventType');
goog.require('ol.Feature'); goog.require('ol.Feature');
goog.require('ol.MapBrowserEvent.EventType'); goog.require('ol.MapBrowserEvent.EventType');
goog.require('ol.MapBrowserPointerEvent'); goog.require('ol.MapBrowserPointerEvent');
goog.require('ol.Pixel');
goog.require('ol.ViewHint'); goog.require('ol.ViewHint');
goog.require('ol.array'); goog.require('ol.array');
goog.require('ol.coordinate'); goog.require('ol.coordinate');

View File

@@ -3,7 +3,6 @@ goog.provide('ol.interaction.Pointer');
goog.require('ol'); goog.require('ol');
goog.require('ol.MapBrowserEvent.EventType'); goog.require('ol.MapBrowserEvent.EventType');
goog.require('ol.MapBrowserPointerEvent'); goog.require('ol.MapBrowserPointerEvent');
goog.require('ol.Pixel');
goog.require('ol.interaction.Interaction'); goog.require('ol.interaction.Interaction');
goog.require('ol.object'); goog.require('ol.object');

View File

@@ -9,7 +9,6 @@ goog.require('ol.CollectionEventType');
goog.require('ol.Feature'); goog.require('ol.Feature');
goog.require('ol.Object'); goog.require('ol.Object');
goog.require('ol.Observable'); goog.require('ol.Observable');
goog.require('ol.Pixel');
goog.require('ol.coordinate'); goog.require('ol.coordinate');
goog.require('ol.events'); goog.require('ol.events');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');

View File

@@ -1,16 +1,6 @@
goog.provide('ol.LoadingStrategy');
goog.provide('ol.loadingstrategy'); goog.provide('ol.loadingstrategy');
/**
* One of `all`, `bbox`, `tile`.
*
* @typedef {function(ol.Extent, number): Array.<ol.Extent>}
* @api
*/
ol.LoadingStrategy;
/** /**
* Strategy function for loading all features with a single request. * Strategy function for loading all features with a single request.
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.

View File

@@ -20,7 +20,6 @@ goog.require('ol.MapEventType');
goog.require('ol.Object'); goog.require('ol.Object');
goog.require('ol.ObjectEvent'); goog.require('ol.ObjectEvent');
goog.require('ol.ObjectEventType'); goog.require('ol.ObjectEventType');
goog.require('ol.Pixel');
goog.require('ol.RendererType'); goog.require('ol.RendererType');
goog.require('ol.TileQueue'); goog.require('ol.TileQueue');
goog.require('ol.View'); goog.require('ol.View');
@@ -1443,19 +1442,6 @@ ol.Map.prototype.unskipFeature = function(feature) {
}; };
/**
* @typedef {{controls: ol.Collection.<ol.control.Control>,
* interactions: ol.Collection.<ol.interaction.Interaction>,
* keyboardEventTarget: (Element|Document),
* logos: (Object.<string, (string|Element)>),
* overlays: ol.Collection.<ol.Overlay>,
* rendererConstructor:
* function(new: ol.renderer.Map, Element, ol.Map),
* values: Object.<string, *>}}
*/
ol.MapOptionsInternal;
/** /**
* @param {olx.MapOptions} options Map options. * @param {olx.MapOptions} options Map options.
* @return {ol.MapOptionsInternal} Internal map options. * @return {ol.MapOptionsInternal} Internal map options.

View File

@@ -8,7 +8,6 @@ goog.require('ol.events');
goog.require('goog.style'); goog.require('goog.style');
goog.require('ol.Map'); goog.require('ol.Map');
goog.require('ol.MapEventType'); goog.require('ol.MapEventType');
goog.require('ol.Pixel');
goog.require('ol.Object'); goog.require('ol.Object');
goog.require('ol.animation'); goog.require('ol.animation');
goog.require('ol.dom'); goog.require('ol.dom');

View File

@@ -1,10 +0,0 @@
goog.provide('ol.Pixel');
/**
* An array with two elements, representing a pixel. The first element is the
* x-coordinate, the second the y-coordinate of the pixel.
* @typedef {Array.<number>}
* @api stable
*/
ol.Pixel;

View File

@@ -5,7 +5,6 @@ goog.provide('ol.proj.Units');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('ol'); goog.require('ol');
goog.require('ol.TransformFunction');
goog.require('ol.extent'); goog.require('ol.extent');
goog.require('ol.object'); goog.require('ol.object');
goog.require('ol.sphere.NORMAL'); goog.require('ol.sphere.NORMAL');

View File

@@ -1,4 +1,3 @@
goog.provide('ol.raster.Operation');
goog.provide('ol.raster.OperationType'); goog.provide('ol.raster.OperationType');

View File

@@ -2,7 +2,6 @@ goog.provide('ol.renderer.canvas.Layer');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.vec.Mat4'); goog.require('goog.vec.Mat4');
goog.require('ol.Pixel');
goog.require('ol.extent'); goog.require('ol.extent');
goog.require('ol.layer.Layer'); goog.require('ol.layer.Layer');
goog.require('ol.render.Event'); goog.require('ol.render.Event');

View File

@@ -1,16 +1,9 @@
goog.provide('ol.ResolutionConstraint'); goog.provide('ol.ResolutionConstraint');
goog.provide('ol.ResolutionConstraintType');
goog.require('ol.array'); goog.require('ol.array');
goog.require('ol.math'); goog.require('ol.math');
/**
* @typedef {function((number|undefined), number, number): (number|undefined)}
*/
ol.ResolutionConstraintType;
/** /**
* @param {Array.<number>} resolutions Resolutions. * @param {Array.<number>} resolutions Resolutions.
* @return {ol.ResolutionConstraintType} Zoom function. * @return {ol.ResolutionConstraintType} Zoom function.

View File

@@ -1,15 +1,8 @@
goog.provide('ol.RotationConstraint'); goog.provide('ol.RotationConstraint');
goog.provide('ol.RotationConstraintType');
goog.require('ol.math'); goog.require('ol.math');
/**
* @typedef {function((number|undefined), number): (number|undefined)}
*/
ol.RotationConstraintType;
/** /**
* @param {number|undefined} rotation Rotation. * @param {number|undefined} rotation Rotation.
* @param {number} delta Delta. * @param {number} delta Delta.

View File

@@ -1,18 +1,9 @@
goog.provide('ol.Size');
goog.provide('ol.size'); goog.provide('ol.size');
goog.require('goog.asserts'); goog.require('goog.asserts');
/**
* An array of numbers representing a size: `[width, height]`.
* @typedef {Array.<number>}
* @api stable
*/
ol.Size;
/** /**
* Returns a buffered size. * Returns a buffered size.
* @param {ol.Size} size Size. * @param {ol.Size} size Size.

View File

@@ -4,7 +4,6 @@ goog.require('goog.asserts');
goog.require('goog.uri.utils'); goog.require('goog.uri.utils');
goog.require('ol'); goog.require('ol');
goog.require('ol.Image'); goog.require('ol.Image');
goog.require('ol.ImageLoadFunctionType');
goog.require('ol.events'); goog.require('ol.events');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');
goog.require('ol.extent'); goog.require('ol.extent');

View File

@@ -1,6 +1,5 @@
goog.provide('ol.source.ImageCanvas'); goog.provide('ol.source.ImageCanvas');
goog.require('ol.CanvasFunctionType');
goog.require('ol.ImageCanvas'); goog.require('ol.ImageCanvas');
goog.require('ol.extent'); goog.require('ol.extent');
goog.require('ol.source.Image'); goog.require('ol.source.Image');

View File

@@ -4,7 +4,6 @@ goog.require('ol.events');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');
goog.require('goog.uri.utils'); goog.require('goog.uri.utils');
goog.require('ol.Image'); goog.require('ol.Image');
goog.require('ol.ImageLoadFunctionType');
goog.require('ol.extent'); goog.require('ol.extent');
goog.require('ol.object'); goog.require('ol.object');
goog.require('ol.source.Image'); goog.require('ol.source.Image');

View File

@@ -3,7 +3,6 @@ goog.provide('ol.source.ImageStatic');
goog.require('ol.events'); goog.require('ol.events');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');
goog.require('ol.Image'); goog.require('ol.Image');
goog.require('ol.ImageLoadFunctionType');
goog.require('ol.ImageState'); goog.require('ol.ImageState');
goog.require('ol.dom'); goog.require('ol.dom');
goog.require('ol.extent'); goog.require('ol.extent');

View File

@@ -3,7 +3,6 @@ goog.provide('ol.source.TileImage');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('ol.ImageTile'); goog.require('ol.ImageTile');
goog.require('ol.TileCache'); goog.require('ol.TileCache');
goog.require('ol.TileLoadFunctionType');
goog.require('ol.TileState'); goog.require('ol.TileState');
goog.require('ol.events'); goog.require('ol.events');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');

View File

@@ -1,6 +1,5 @@
goog.provide('ol.source.VectorTile'); goog.provide('ol.source.VectorTile');
goog.require('ol.TileLoadFunctionType');
goog.require('ol.TileState'); goog.require('ol.TileState');
goog.require('ol.VectorTile'); goog.require('ol.VectorTile');
goog.require('ol.events'); goog.require('ol.events');

View File

@@ -1,19 +1,9 @@
goog.provide('ol.TileCoord');
goog.provide('ol.tilecoord'); goog.provide('ol.tilecoord');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('ol.extent'); goog.require('ol.extent');
/**
* An array of three numbers representing the location of a tile in a tile
* grid. The order is `z`, `x`, and `y`. `z` is the zoom level.
* @typedef {Array.<number>} ol.TileCoord
* @api
*/
ol.TileCoord;
/** /**
* @enum {number} * @enum {number}
*/ */

View File

@@ -1,11 +0,0 @@
goog.provide('ol.TileLoadFunctionType');
/**
* A function that takes an {@link ol.Tile} for the tile and a `{string}` for
* the url as arguments.
*
* @typedef {function(ol.Tile, string)}
* @api
*/
ol.TileLoadFunctionType;

View File

@@ -1,4 +1,3 @@
goog.provide('ol.TilePriorityFunction');
goog.provide('ol.TileQueue'); goog.provide('ol.TileQueue');
goog.require('goog.asserts'); goog.require('goog.asserts');
@@ -8,12 +7,6 @@ goog.require('ol.TileState');
goog.require('ol.structs.PriorityQueue'); goog.require('ol.structs.PriorityQueue');
/**
* @typedef {function(ol.Tile, string, ol.Coordinate, number): number}
*/
ol.TilePriorityFunction;
/** /**
* @constructor * @constructor
* @extends {ol.structs.PriorityQueue.<Array>} * @extends {ol.structs.PriorityQueue.<Array>}

View File

@@ -1,28 +1,10 @@
goog.provide('ol.TileUrlFunction'); goog.provide('ol.TileUrlFunction');
goog.provide('ol.TileUrlFunctionType');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('ol.math'); goog.require('ol.math');
goog.require('ol.tilecoord'); goog.require('ol.tilecoord');
/**
* {@link ol.source.Tile} sources use a function of this type to get the url
* that provides a tile for a given tile coordinate.
*
* This function 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}` representing the tile
* URL, or undefined if no tile should be requested for the passed tile
* coordinate.
*
* @typedef {function(ol.TileCoord, number,
* ol.proj.Projection): (string|undefined)}
* @api
*/
ol.TileUrlFunctionType;
/** /**
* @param {string} template Template. * @param {string} template Template.
* @param {ol.tilegrid.TileGrid} tileGrid Tile grid. * @param {ol.tilegrid.TileGrid} tileGrid Tile grid.

View File

@@ -1,13 +0,0 @@
goog.provide('ol.TransformFunction');
/**
* A transform function accepts an array of input coordinate values, an optional
* output array, and an optional dimension (default should be 2). The function
* transforms the input coordinate values, populates the output array, and
* returns the output array.
*
* @typedef {function(Array.<number>, Array.<number>=, number=): Array.<number>}
* @api stable
*/
ol.TransformFunction;

289
src/ol/typedefs.js Normal file
View File

@@ -0,0 +1,289 @@
/**
* File for all top-level (in the `ol` namespace) typedefs used by the compiler,
* and referenced by JSDoc.
*/
/**
* @typedef {string|Array.<string>|ol.Attribution|Array.<ol.Attribution>}
* @api
*/
ol.AttributionLike;
/**
* 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}
* @api
*/
ol.CanvasFunctionType;
/**
* @typedef {function((ol.Coordinate|undefined)): (ol.Coordinate|undefined)}
*/
ol.CenterConstraintType;
/**
* A color represented as a short array [red, green, blue, alpha].
* red, green, and blue should be integers in the range 0..255 inclusive.
* alpha should be a float in the range 0..1 inclusive. If no alpha value is
* given then `1` will be used.
* @typedef {Array.<number>}
* @api
*/
ol.Color;
/**
* A type accepted by CanvasRenderingContext2D.fillStyle.
* Represents a color, pattern, or gradient.
*
* @typedef {string|CanvasPattern|CanvasGradient}
* @api
*/
ol.ColorLike;
/**
* An array of numbers representing an xy coordinate. Example: `[16, 48]`.
* @typedef {Array.<number>} ol.Coordinate
* @api stable
*/
ol.Coordinate;
/**
* A function that takes a {@link ol.Coordinate} and transforms it into a
* `{string}`.
*
* @typedef {function((ol.Coordinate|undefined)): string}
* @api stable
*/
ol.CoordinateFormatType;
/**
* An array of numbers representing an extent: `[minx, miny, maxx, maxy]`.
* @typedef {Array.<number>}
* @api stable
*/
ol.Extent;
/**
* {@link ol.source.Vector} sources use a function of this type to load
* features.
*
* This function takes an {@link ol.Extent} representing the area to be loaded,
* a `{number}` representing the resolution (map units per pixel) and an
* {@link ol.proj.Projection} for the projection as arguments. `this` within
* the function is bound to the {@link ol.source.Vector} it's called from.
*
* The function is responsible for loading the features and adding them to the
* source.
* @api
* @typedef {function(this:ol.source.Vector, ol.Extent, number,
* ol.proj.Projection)}
*/
ol.FeatureLoader;
/**
* A function that returns an array of {@link ol.style.Style styles} given a
* resolution. The `this` keyword inside the function references the
* {@link ol.Feature} to be styled.
*
* @typedef {function(this: ol.Feature, number):
* (ol.style.Style|Array.<ol.style.Style>)}
* @api stable
*/
ol.FeatureStyleFunction;
/**
* {@link ol.source.Vector} sources use a function of this type to get the url
* to load features from.
*
* This function takes an {@link ol.Extent} representing the area to be loaded,
* a `{number}` representing the resolution (map units per pixel) and an
* {@link ol.proj.Projection} for the projection as arguments and returns a
* `{string}` representing the URL.
* @api
* @typedef {function(ol.Extent, number, ol.proj.Projection) : string}
*/
ol.FeatureUrlFunction;
/**
* A function that is called to trigger asynchronous canvas drawing. It is
* called with a "done" callback that should be called when drawing is done.
* If any error occurs during drawing, the "done" callback should be called with
* that error.
*
* @typedef {function(function(Error))}
*/
ol.ImageCanvasLoader;
/**
* A function that takes an {@link ol.Image} for the image and a `{string}` for
* the src as arguments. It is supposed to make it so the underlying image
* {@link ol.Image#getImage} is assigned the content specified by the src. If
* not specified, the default is
*
* function(image, src) {
* image.getImage().src = src;
* }
*
* Providing a custom `imageLoadFunction` can be useful to load images with
* post requests or - in general - through XHR requests, where the src of the
* image element would be set to a data URI when the content is loaded.
*
* @typedef {function(ol.Image, string)}
* @api
*/
ol.ImageLoadFunctionType;
/**
* One of `all`, `bbox`, `tile`.
*
* @typedef {function(ol.Extent, number): Array.<ol.Extent>}
* @api
*/
ol.LoadingStrategy;
/**
* @typedef {{controls: ol.Collection.<ol.control.Control>,
* interactions: ol.Collection.<ol.interaction.Interaction>,
* keyboardEventTarget: (Element|Document),
* logos: (Object.<string, (string|Element)>),
* overlays: ol.Collection.<ol.Overlay>,
* rendererConstructor:
* function(new: ol.renderer.Map, Element, ol.Map),
* values: Object.<string, *>}}
*/
ol.MapOptionsInternal;
/**
* An array with two elements, representing a pixel. The first element is the
* x-coordinate, the second the y-coordinate of the pixel.
* @typedef {Array.<number>}
* @api stable
*/
ol.Pixel;
/**
* @typedef {function(ol.Map, ?olx.FrameState): boolean}
*/
ol.PostRenderFunction;
/**
* Function to perform manipulations before rendering. This function is called
* with the {@link ol.Map} as first and an optional {@link olx.FrameState} as
* second argument. Return `true` to keep this function for the next frame,
* `false` to remove it.
* @typedef {function(ol.Map, ?olx.FrameState): boolean}
* @api
*/
ol.PreRenderFunction;
/**
* @typedef {function((number|undefined), number, number): (number|undefined)}
*/
ol.ResolutionConstraintType;
/**
* @typedef {function((number|undefined), number): (number|undefined)}
*/
ol.RotationConstraintType;
/**
* An array of numbers representing a size: `[width, height]`.
* @typedef {Array.<number>}
* @api stable
*/
ol.Size;
/**
* An array of three numbers representing the location of a tile in a tile
* grid. The order is `z`, `x`, and `y`. `z` is the zoom level.
* @typedef {Array.<number>} ol.TileCoord
* @api
*/
ol.TileCoord;
/**
* A function that takes an {@link ol.Tile} for the tile and a `{string}` for
* the url as arguments.
*
* @typedef {function(ol.Tile, string)}
* @api
*/
ol.TileLoadFunctionType;
/**
* @typedef {function(ol.Tile, string, ol.Coordinate, number): number}
*/
ol.TilePriorityFunction;
/**
* @typedef {{
* dirty: boolean,
* renderedRenderOrder: (null|function(ol.Feature, ol.Feature):number),
* renderedTileRevision: number,
* renderedRevision: number,
* replayGroup: ol.render.IReplayGroup,
* skippedFeatures: Array.<string>}}
*/
ol.TileReplayState;
/**
* {@link ol.source.Tile} sources use a function of this type to get the url
* that provides a tile for a given tile coordinate.
*
* This function 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}` representing the tile
* URL, or undefined if no tile should be requested for the passed tile
* coordinate.
*
* @typedef {function(ol.TileCoord, number,
* ol.proj.Projection): (string|undefined)}
* @api
*/
ol.TileUrlFunctionType;
/**
* A transform function accepts an array of input coordinate values, an optional
* output array, and an optional dimension (default should be 2). The function
* transforms the input coordinate values, populates the output array, and
* returns the output array.
*
* @typedef {function(Array.<number>, Array.<number>=, number=): Array.<number>}
* @api stable
*/
ol.TransformFunction;

View File

@@ -6,18 +6,6 @@ goog.require('ol.dom');
goog.require('ol.proj.Projection'); goog.require('ol.proj.Projection');
/**
* @typedef {{
* dirty: boolean,
* renderedRenderOrder: (null|function(ol.Feature, ol.Feature):number),
* renderedTileRevision: number,
* renderedRevision: number,
* replayGroup: ol.render.IReplayGroup,
* skippedFeatures: Array.<string>}}
*/
ol.TileReplayState;
/** /**
* @constructor * @constructor
* @extends {ol.Tile} * @extends {ol.Tile}

View File

@@ -207,6 +207,9 @@ function build(config, paths, callback) {
} else { } else {
log.info('ol', 'Compiling ' + paths.length + ' sources'); log.info('ol', 'Compiling ' + paths.length + ' sources');
options.compile.js = paths.concat(options.compile.js || []); options.compile.js = paths.concat(options.compile.js || []);
// typedefs file has no `goog.provide`s, so is ignored by closure-util
// when calculating dependencies. So it's added here as a compiler option.
options.compile.js.push('src/ol/typedefs.js');
closure.compile(options, callback); closure.compile(options, callback);
} }
} }