Rename sub-sub-namespace typedefs to sub-namespace

These sub-sub-namespace typedefs are only used internally; some of them cause problems by creating a form of circular dependency. For example, ol.style.Atlas is created in style/atlasmanager.js; if ol.style.Atlas.Block is in a separate file, ol.style.Atlas is dependent on it, so the new file must precede ol.style.Atlas. However if it precedes it then it has to create the ol.style.Atlas namespace which should be created by atlasmanager.js. To get round this, these typedefs are renamed to remove the sub-sub-namespace.

Fortunately they are all non-api, so the rename should not affect anything.
This commit is contained in:
Peter Robins
2016-05-07 21:09:48 +00:00
parent a1c86ed560
commit c7aeebed8c
10 changed files with 118 additions and 117 deletions

View File

@@ -366,12 +366,6 @@ ol.format.WKT.prototype.writeGeometryText = function(geometry, opt_options) {
};
/**
* @typedef {{type: number, value: (number|string|undefined), position: number}}
*/
ol.format.WKT.Token;
/**
* @const
* @enum {number}
@@ -451,7 +445,7 @@ ol.format.WKT.Lexer.prototype.nextChar_ = function() {
/**
* Fetch and return the next token.
* @return {!ol.format.WKT.Token} Next string token.
* @return {!ol.format.WKTToken} Next string token.
*/
ol.format.WKT.Lexer.prototype.nextToken = function() {
var c = this.nextChar_();
@@ -537,7 +531,7 @@ ol.format.WKT.Parser = function(lexer) {
this.lexer_ = lexer;
/**
* @type {ol.format.WKT.Token}
* @type {ol.format.WKTToken}
* @private
*/
this.token_;

View File

@@ -129,7 +129,7 @@ ol.interaction.Snap = function(opt_options) {
options.pixelTolerance : 10;
/**
* @type {function(ol.interaction.Snap.SegmentDataType, ol.interaction.Snap.SegmentDataType): number}
* @type {function(ol.interaction.SnapSegmentDataType, ol.interaction.SnapSegmentDataType): number}
* @private
*/
this.sortByDistance_ = ol.interaction.Snap.sortByDistance.bind(this);
@@ -137,7 +137,7 @@ ol.interaction.Snap = function(opt_options) {
/**
* Segment RTree for each layer
* @type {ol.structs.RBush.<ol.interaction.Snap.SegmentDataType>}
* @type {ol.structs.RBush.<ol.interaction.SnapSegmentDataType>}
* @private
*/
this.rBush_ = new ol.structs.RBush();
@@ -378,7 +378,7 @@ ol.interaction.Snap.prototype.shouldStopEvent = ol.functions.FALSE;
* @param {ol.Pixel} pixel Pixel
* @param {ol.Coordinate} pixelCoordinate Coordinate
* @param {ol.Map} map Map.
* @return {ol.interaction.Snap.ResultType} Snap result
* @return {ol.interaction.SnapResultType} Snap result
*/
ol.interaction.Snap.prototype.snapTo = function(pixel, pixelCoordinate, map) {
@@ -437,7 +437,7 @@ ol.interaction.Snap.prototype.snapTo = function(pixel, pixelCoordinate, map) {
vertexPixel = [Math.round(vertexPixel[0]), Math.round(vertexPixel[1])];
}
}
return /** @type {ol.interaction.Snap.ResultType} */ ({
return /** @type {ol.interaction.SnapResultType} */ ({
snapped: snapped,
vertex: vertex,
vertexPixel: vertexPixel
@@ -479,7 +479,7 @@ ol.interaction.Snap.prototype.writeLineStringGeometry_ = function(feature, geome
var i, ii, segment, segmentData;
for (i = 0, ii = coordinates.length - 1; i < ii; ++i) {
segment = coordinates.slice(i, i + 2);
segmentData = /** @type {ol.interaction.Snap.SegmentDataType} */ ({
segmentData = /** @type {ol.interaction.SnapSegmentDataType} */ ({
feature: feature,
segment: segment
});
@@ -500,7 +500,7 @@ ol.interaction.Snap.prototype.writeMultiLineStringGeometry_ = function(feature,
coordinates = lines[j];
for (i = 0, ii = coordinates.length - 1; i < ii; ++i) {
segment = coordinates.slice(i, i + 2);
segmentData = /** @type {ol.interaction.Snap.SegmentDataType} */ ({
segmentData = /** @type {ol.interaction.SnapSegmentDataType} */ ({
feature: feature,
segment: segment
});
@@ -520,7 +520,7 @@ ol.interaction.Snap.prototype.writeMultiPointGeometry_ = function(feature, geome
var coordinates, i, ii, segmentData;
for (i = 0, ii = points.length; i < ii; ++i) {
coordinates = points[i];
segmentData = /** @type {ol.interaction.Snap.SegmentDataType} */ ({
segmentData = /** @type {ol.interaction.SnapSegmentDataType} */ ({
feature: feature,
segment: [coordinates, coordinates]
});
@@ -543,7 +543,7 @@ ol.interaction.Snap.prototype.writeMultiPolygonGeometry_ = function(feature, geo
coordinates = rings[j];
for (i = 0, ii = coordinates.length - 1; i < ii; ++i) {
segment = coordinates.slice(i, i + 2);
segmentData = /** @type {ol.interaction.Snap.SegmentDataType} */ ({
segmentData = /** @type {ol.interaction.SnapSegmentDataType} */ ({
feature: feature,
segment: segment
});
@@ -561,7 +561,7 @@ ol.interaction.Snap.prototype.writeMultiPolygonGeometry_ = function(feature, geo
*/
ol.interaction.Snap.prototype.writePointGeometry_ = function(feature, geometry) {
var coordinates = geometry.getCoordinates();
var segmentData = /** @type {ol.interaction.Snap.SegmentDataType} */ ({
var segmentData = /** @type {ol.interaction.SnapSegmentDataType} */ ({
feature: feature,
segment: [coordinates, coordinates]
});
@@ -581,7 +581,7 @@ ol.interaction.Snap.prototype.writePolygonGeometry_ = function(feature, geometry
coordinates = rings[j];
for (i = 0, ii = coordinates.length - 1; i < ii; ++i) {
segment = coordinates.slice(i, i + 2);
segmentData = /** @type {ol.interaction.Snap.SegmentDataType} */ ({
segmentData = /** @type {ol.interaction.SnapSegmentDataType} */ ({
feature: feature,
segment: segment
});
@@ -626,8 +626,8 @@ ol.interaction.Snap.handleUpEvent_ = function(evt) {
/**
* Sort segments by distance, helper function
* @param {ol.interaction.Snap.SegmentDataType} a The first segment data.
* @param {ol.interaction.Snap.SegmentDataType} b The second segment data.
* @param {ol.interaction.SnapSegmentDataType} a The first segment data.
* @param {ol.interaction.SnapSegmentDataType} b The second segment data.
* @return {number} The difference in distance.
* @this {ol.interaction.Snap}
*/

View File

@@ -71,31 +71,31 @@ ol.render.canvas.Immediate = function(context, pixelRatio, extent, transform, vi
/**
* @private
* @type {?ol.render.canvas.FillState}
* @type {?ol.render.canvasFillState}
*/
this.contextFillState_ = null;
/**
* @private
* @type {?ol.render.canvas.StrokeState}
* @type {?ol.render.canvasStrokeState}
*/
this.contextStrokeState_ = null;
/**
* @private
* @type {?ol.render.canvas.TextState}
* @type {?ol.render.canvasTextState}
*/
this.contextTextState_ = null;
/**
* @private
* @type {?ol.render.canvas.FillState}
* @type {?ol.render.canvasFillState}
*/
this.fillState_ = null;
/**
* @private
* @type {?ol.render.canvas.StrokeState}
* @type {?ol.render.canvasStrokeState}
*/
this.strokeState_ = null;
@@ -203,19 +203,19 @@ ol.render.canvas.Immediate = function(context, pixelRatio, extent, transform, vi
/**
* @private
* @type {?ol.render.canvas.FillState}
* @type {?ol.render.canvasFillState}
*/
this.textFillState_ = null;
/**
* @private
* @type {?ol.render.canvas.StrokeState}
* @type {?ol.render.canvasStrokeState}
*/
this.textStrokeState_ = null;
/**
* @private
* @type {?ol.render.canvas.TextState}
* @type {?ol.render.canvasTextState}
*/
this.textState_ = null;
@@ -700,7 +700,7 @@ ol.render.canvas.Immediate.prototype.drawMultiPolygon = function(geometry) {
/**
* @param {ol.render.canvas.FillState} fillState Fill state.
* @param {ol.render.canvasFillState} fillState Fill state.
* @private
*/
ol.render.canvas.Immediate.prototype.setContextFillState_ = function(fillState) {
@@ -720,7 +720,7 @@ ol.render.canvas.Immediate.prototype.setContextFillState_ = function(fillState)
/**
* @param {ol.render.canvas.StrokeState} strokeState Stroke state.
* @param {ol.render.canvasStrokeState} strokeState Stroke state.
* @private
*/
ol.render.canvas.Immediate.prototype.setContextStrokeState_ = function(strokeState) {
@@ -772,7 +772,7 @@ ol.render.canvas.Immediate.prototype.setContextStrokeState_ = function(strokeSta
/**
* @param {ol.render.canvas.TextState} textState Text state.
* @param {ol.render.canvasTextState} textState Text state.
* @private
*/
ol.render.canvas.Immediate.prototype.setContextTextState_ = function(textState) {

View File

@@ -1538,19 +1538,19 @@ ol.render.canvas.TextReplay = function(tolerance, maxExtent, resolution) {
/**
* @private
* @type {?ol.render.canvas.FillState}
* @type {?ol.render.canvasFillState}
*/
this.replayFillState_ = null;
/**
* @private
* @type {?ol.render.canvas.StrokeState}
* @type {?ol.render.canvasStrokeState}
*/
this.replayStrokeState_ = null;
/**
* @private
* @type {?ol.render.canvas.TextState}
* @type {?ol.render.canvasTextState}
*/
this.replayTextState_ = null;
@@ -1586,19 +1586,19 @@ ol.render.canvas.TextReplay = function(tolerance, maxExtent, resolution) {
/**
* @private
* @type {?ol.render.canvas.FillState}
* @type {?ol.render.canvasFillState}
*/
this.textFillState_ = null;
/**
* @private
* @type {?ol.render.canvas.StrokeState}
* @type {?ol.render.canvasStrokeState}
*/
this.textStrokeState_ = null;
/**
* @private
* @type {?ol.render.canvas.TextState}
* @type {?ol.render.canvasTextState}
*/
this.textState_ = null;
@@ -1638,7 +1638,7 @@ ol.render.canvas.TextReplay.prototype.drawText = function(flatCoordinates, offse
/**
* @param {ol.render.canvas.FillState} fillState Fill state.
* @param {ol.render.canvasFillState} fillState Fill state.
* @private
*/
ol.render.canvas.TextReplay.prototype.setReplayFillState_ = function(fillState) {
@@ -1662,7 +1662,7 @@ ol.render.canvas.TextReplay.prototype.setReplayFillState_ = function(fillState)
/**
* @param {ol.render.canvas.StrokeState} strokeState Stroke state.
* @param {ol.render.canvasStrokeState} strokeState Stroke state.
* @private
*/
ol.render.canvas.TextReplay.prototype.setReplayStrokeState_ = function(strokeState) {
@@ -1704,7 +1704,7 @@ ol.render.canvas.TextReplay.prototype.setReplayStrokeState_ = function(strokeSta
/**
* @param {ol.render.canvas.TextState} textState Text state.
* @param {ol.render.canvasTextState} textState Text state.
* @private
*/
ol.render.canvas.TextReplay.prototype.setReplayTextState_ = function(textState) {

View File

@@ -104,7 +104,7 @@ ol.renderer.webgl.Map = function(container, map) {
/**
* @private
* @type {ol.structs.LRUCache.<ol.renderer.webgl.TextureCacheEntry|null>}
* @type {ol.structs.LRUCache.<ol.renderer.webglTextureCacheEntry|null>}
*/
this.textureCache_ = new ol.structs.LRUCache();
@@ -294,7 +294,7 @@ ol.renderer.webgl.Map.prototype.disposeInternal = function() {
if (!gl.isContextLost()) {
this.textureCache_.forEach(
/**
* @param {?ol.renderer.webgl.TextureCacheEntry} textureCacheEntry
* @param {?ol.renderer.webglTextureCacheEntry} textureCacheEntry
* Texture cache entry.
*/
function(textureCacheEntry) {

View File

@@ -91,7 +91,7 @@ ol.source.Raster = function(options) {
/**
* The most recently rendered state.
* @type {?ol.source.Raster.RenderedState}
* @type {?ol.source.RasterRenderedState}
* @private
*/
this.renderedState_ = null;
@@ -445,14 +445,6 @@ ol.source.Raster.createTileRenderer_ = function(source) {
};
/**
* @typedef {{revision: number,
* resolution: number,
* extent: ol.Extent}}
*/
ol.source.Raster.RenderedState;
/**
* @classdesc
* Events emitted by {@link ol.source.Raster} instances are instances of this

View File

@@ -5,16 +5,6 @@ goog.require('goog.asserts');
goog.require('ol');
goog.require('ol.dom');
/**
* Provides information for an image inside an atlas manager.
* `offsetX` and `offsetY` is the position of the image inside
* the atlas image `image` and the position of the hit-detection image
* inside the hit-detection atlas image `hitImage`.
* @typedef {{offsetX: number, offsetY: number, image: HTMLCanvasElement,
* hitImage: HTMLCanvasElement}}
*/
ol.style.AtlasManagerInfo;
/**
* Manages the creation of image atlases.
@@ -239,15 +229,6 @@ ol.style.AtlasManager.prototype.add_ = function(isHitAtlas, id, width, height,
};
/**
* Provides information for an image inside an atlas.
* `offsetX` and `offsetY` are the position of the image inside
* the atlas image `image`.
* @typedef {{offsetX: number, offsetY: number, image: HTMLCanvasElement}}
*/
ol.style.AtlasInfo;
/**
* This class facilitates the creation of image atlases.
*
@@ -275,7 +256,7 @@ ol.style.Atlas = function(size, space) {
/**
* @private
* @type {Array.<ol.style.Atlas.Block>}
* @type {Array.<ol.style.AtlasBlock>}
*/
this.emptyBlocks_ = [{x: 0, y: 0, width: size, height: size}];
@@ -351,7 +332,7 @@ ol.style.Atlas.prototype.add = function(id, width, height, renderCallback, opt_t
/**
* @private
* @param {number} index The index of the block.
* @param {ol.style.Atlas.Block} block The block to split.
* @param {ol.style.AtlasBlock} block The block to split.
* @param {number} width The width of the entry to insert.
* @param {number} height The height of the entry to insert.
*/
@@ -359,9 +340,9 @@ ol.style.Atlas.prototype.split_ = function(index, block, width, height) {
var deltaWidth = block.width - width;
var deltaHeight = block.height - height;
/** @type {ol.style.Atlas.Block} */
/** @type {ol.style.AtlasBlock} */
var newBlock1;
/** @type {ol.style.Atlas.Block} */
/** @type {ol.style.AtlasBlock} */
var newBlock2;
if (deltaWidth > deltaHeight) {
@@ -410,8 +391,8 @@ ol.style.Atlas.prototype.split_ = function(index, block, width, height) {
* blocks (that are potentially smaller) are filled first.
* @private
* @param {number} index The index of the block to remove.
* @param {ol.style.Atlas.Block} newBlock1 The 1st block to add.
* @param {ol.style.Atlas.Block} newBlock2 The 2nd block to add.
* @param {ol.style.AtlasBlock} newBlock1 The 1st block to add.
* @param {ol.style.AtlasBlock} newBlock2 The 2nd block to add.
*/
ol.style.Atlas.prototype.updateBlocks_ = function(index, newBlock1, newBlock2) {
var args = [index, 1];
@@ -423,9 +404,3 @@ ol.style.Atlas.prototype.updateBlocks_ = function(index, newBlock1, newBlock2) {
}
this.emptyBlocks_.splice.apply(this.emptyBlocks_, args);
};
/**
* @typedef {{x: number, y: number, width: number, height: number}}
*/
ol.style.Atlas.Block;

View File

@@ -227,13 +227,6 @@ ol.style.Circle.prototype.load = ol.nullFunction;
ol.style.Circle.prototype.unlistenImageChange = ol.nullFunction;
/**
* @typedef {{strokeStyle: (string|undefined), strokeWidth: number,
* size: number, lineDash: Array.<number>}}
*/
ol.style.Circle.RenderOptions;
/**
* @private
* @param {ol.style.AtlasManager|undefined} atlasManager An atlas manager.
@@ -259,7 +252,7 @@ ol.style.Circle.prototype.render_ = function(atlasManager) {
var size = 2 * (this.radius_ + strokeWidth) + 1;
/** @type {ol.style.Circle.RenderOptions} */
/** @type {ol.style.CircleRenderOptions} */
var renderOptions = {
strokeStyle: strokeStyle,
strokeWidth: strokeWidth,
@@ -320,7 +313,7 @@ ol.style.Circle.prototype.render_ = function(atlasManager) {
/**
* @private
* @param {ol.style.Circle.RenderOptions} renderOptions Render options.
* @param {ol.style.CircleRenderOptions} renderOptions Render options.
* @param {CanvasRenderingContext2D} context The rendering context.
* @param {number} x The origin for the symbol (x).
* @param {number} y The origin for the symbol (y).
@@ -355,7 +348,7 @@ ol.style.Circle.prototype.draw_ = function(renderOptions, context, x, y) {
/**
* @private
* @param {ol.style.Circle.RenderOptions} renderOptions Render options.
* @param {ol.style.CircleRenderOptions} renderOptions Render options.
*/
ol.style.Circle.prototype.createHitDetectionCanvas_ = function(renderOptions) {
this.hitDetectionImageSize_ = [renderOptions.size, renderOptions.size];
@@ -375,7 +368,7 @@ ol.style.Circle.prototype.createHitDetectionCanvas_ = function(renderOptions) {
/**
* @private
* @param {ol.style.Circle.RenderOptions} renderOptions Render options.
* @param {ol.style.CircleRenderOptions} renderOptions Render options.
* @param {CanvasRenderingContext2D} context The context.
* @param {number} x The origin for the symbol (x).
* @param {number} y The origin for the symbol (y).

View File

@@ -289,20 +289,6 @@ ol.style.RegularShape.prototype.load = ol.nullFunction;
ol.style.RegularShape.prototype.unlistenImageChange = ol.nullFunction;
/**
* @typedef {{
* strokeStyle: (string|undefined),
* strokeWidth: number,
* size: number,
* lineCap: string,
* lineDash: Array.<number>,
* lineJoin: string,
* miterLimit: number
* }}
*/
ol.style.RegularShape.RenderOptions;
/**
* @private
* @param {ol.style.AtlasManager|undefined} atlasManager An atlas manager.
@@ -342,7 +328,7 @@ ol.style.RegularShape.prototype.render_ = function(atlasManager) {
var size = 2 * (this.radius_ + strokeWidth) + 1;
/** @type {ol.style.RegularShape.RenderOptions} */
/** @type {ol.style.RegularShapeRenderOptions} */
var renderOptions = {
strokeStyle: strokeStyle,
strokeWidth: strokeWidth,
@@ -405,7 +391,7 @@ ol.style.RegularShape.prototype.render_ = function(atlasManager) {
/**
* @private
* @param {ol.style.RegularShape.RenderOptions} renderOptions Render options.
* @param {ol.style.RegularShapeRenderOptions} renderOptions Render options.
* @param {CanvasRenderingContext2D} context The rendering context.
* @param {number} x The origin for the symbol (x).
* @param {number} y The origin for the symbol (y).
@@ -450,7 +436,7 @@ ol.style.RegularShape.prototype.draw_ = function(renderOptions, context, x, y) {
/**
* @private
* @param {ol.style.RegularShape.RenderOptions} renderOptions Render options.
* @param {ol.style.RegularShapeRenderOptions} renderOptions Render options.
*/
ol.style.RegularShape.prototype.createHitDetectionCanvas_ = function(renderOptions) {
this.hitDetectionImageSize_ = [renderOptions.size, renderOptions.size];
@@ -470,7 +456,7 @@ ol.style.RegularShape.prototype.createHitDetectionCanvas_ = function(renderOptio
/**
* @private
* @param {ol.style.RegularShape.RenderOptions} renderOptions Render options.
* @param {ol.style.RegularShapeRenderOptions} renderOptions Render options.
* @param {CanvasRenderingContext2D} context The context.
* @param {number} x The origin for the symbol (x).
* @param {number} y The origin for the symbol (y).

View File

@@ -369,6 +369,12 @@ ol.format.WFS.FeatureCollectionMetadata;
ol.format.WFS.TransactionResponse;
/**
* @typedef {{type: number, value: (number|string|undefined), position: number}}
*/
ol.format.WKTToken;
/**
* A function that takes a {@link ol.MapBrowserEvent} and two
* {@link ol.Pixel}s and returns a `{boolean}`. If the condition is met,
@@ -420,7 +426,7 @@ ol.interaction.SelectFilterFunction;
* vertexPixel: (ol.Pixel|null)
* }}
*/
ol.interaction.Snap.ResultType;
ol.interaction.SnapResultType;
/**
@@ -429,7 +435,7 @@ ol.interaction.Snap.ResultType;
* segment: Array.<ol.Coordinate>
* }}
*/
ol.interaction.Snap.SegmentDataType;
ol.interaction.SnapSegmentDataType;
/**
@@ -485,7 +491,7 @@ ol.raster.Pixel;
/**
* @typedef {{fillStyle: ol.ColorLike}}
*/
ol.render.canvas.FillState;
ol.render.canvasFillState;
/**
@@ -496,7 +502,7 @@ ol.render.canvas.FillState;
* miterLimit: number,
* strokeStyle: string}}
*/
ol.render.canvas.StrokeState;
ol.render.canvasStrokeState;
/**
@@ -504,13 +510,13 @@ ol.render.canvas.StrokeState;
* textAlign: string,
* textBaseline: string}}
*/
ol.render.canvas.TextState;
ol.render.canvasTextState;
/**
* @typedef {{magFilter: number, minFilter: number, texture: WebGLTexture}}
*/
ol.renderer.webgl.TextureCacheEntry;
ol.renderer.webglTextureCacheEntry;
/**
@@ -545,6 +551,14 @@ ol.reproj.Triangle;
ol.source.ImageOptions;
/**
* @typedef {{revision: number,
* resolution: number,
* extent: ol.Extent}}
*/
ol.source.RasterRenderedState;
/**
* @typedef {{attributions: (ol.AttributionLike|undefined),
* logo: (string|olx.LogoOptions|undefined),
@@ -598,6 +612,39 @@ ol.source.UrlTileOptions;
ol.structs.LRUCacheEntry;
/**
* @typedef {{x: number, y: number, width: number, height: number}}
*/
ol.style.AtlasBlock;
/**
* Provides information for an image inside an atlas.
* `offsetX` and `offsetY` are the position of the image inside
* the atlas image `image`.
* @typedef {{offsetX: number, offsetY: number, image: HTMLCanvasElement}}
*/
ol.style.AtlasInfo;
/**
* Provides information for an image inside an atlas manager.
* `offsetX` and `offsetY` is the position of the image inside
* the atlas image `image` and the position of the hit-detection image
* inside the hit-detection atlas image `hitImage`.
* @typedef {{offsetX: number, offsetY: number, image: HTMLCanvasElement,
* hitImage: HTMLCanvasElement}}
*/
ol.style.AtlasManagerInfo;
/**
* @typedef {{strokeStyle: (string|undefined), strokeWidth: number,
* size: number, lineDash: Array.<number>}}
*/
ol.style.CircleRenderOptions;
/**
* @typedef {{opacity: number,
* rotateWithView: boolean,
@@ -619,6 +666,20 @@ ol.style.ImageOptions;
ol.style.GeometryFunction;
/**
* @typedef {{
* strokeStyle: (string|undefined),
* strokeWidth: number,
* size: number,
* lineCap: string,
* lineDash: Array.<number>,
* lineJoin: string,
* miterLimit: number
* }}
*/
ol.style.RegularShapeRenderOptions;
/**
* A function that takes an {@link ol.Feature} and a `{number}` representing
* the view's resolution. The function should return a {@link ol.style.Style}