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
+6 -31
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;
+4 -11
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).
+4 -18
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).