Fix ol.source.Zoomify namespace hierarchy

This commit is contained in:
Andreas Hocevar
2016-08-28 21:16:51 +02:00
committed by Tim Schaub
parent 2972917bb9
commit fe16cf9702
2 changed files with 19 additions and 19 deletions

View File

@@ -10,15 +10,6 @@ goog.require('ol.source.TileImage');
goog.require('ol.tilegrid.TileGrid');
/**
* @enum {string}
*/
ol.source.ZoomifyTierSizeCalculation = {
DEFAULT: 'default',
TRUNCATED: 'truncated'
};
/**
* @classdesc
* Layer source for tile data in Zoomify format.
@@ -35,7 +26,7 @@ ol.source.Zoomify = function(opt_options) {
var size = options.size;
var tierSizeCalculation = options.tierSizeCalculation !== undefined ?
options.tierSizeCalculation :
ol.source.ZoomifyTierSizeCalculation.DEFAULT;
ol.source.Zoomify.TierSizeCalculation.DEFAULT;
var imageWidth = size[0];
var imageHeight = size[1];
@@ -43,7 +34,7 @@ ol.source.Zoomify = function(opt_options) {
var tileSize = ol.DEFAULT_TILE_SIZE;
switch (tierSizeCalculation) {
case ol.source.ZoomifyTierSizeCalculation.DEFAULT:
case ol.source.Zoomify.TierSizeCalculation.DEFAULT:
while (imageWidth > tileSize || imageHeight > tileSize) {
tierSizeInTiles.push([
Math.ceil(imageWidth / tileSize),
@@ -52,7 +43,7 @@ ol.source.Zoomify = function(opt_options) {
tileSize += tileSize;
}
break;
case ol.source.ZoomifyTierSizeCalculation.TRUNCATED:
case ol.source.Zoomify.TierSizeCalculation.TRUNCATED:
var width = imageWidth;
var height = imageHeight;
while (width > tileSize || height > tileSize) {
@@ -123,7 +114,7 @@ ol.source.Zoomify = function(opt_options) {
crossOrigin: options.crossOrigin,
logo: options.logo,
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
tileClass: ol.source.ZoomifyTile_,
tileClass: ol.source.Zoomify.Tile_,
tileGrid: tileGrid,
tileUrlFunction: tileUrlFunction
});
@@ -142,7 +133,7 @@ ol.inherits(ol.source.Zoomify, ol.source.TileImage);
* @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function.
* @private
*/
ol.source.ZoomifyTile_ = function(
ol.source.Zoomify.Tile_ = function(
tileCoord, state, src, crossOrigin, tileLoadFunction) {
ol.ImageTile.call(this, tileCoord, state, src, crossOrigin, tileLoadFunction);
@@ -155,13 +146,13 @@ ol.source.ZoomifyTile_ = function(
this.zoomifyImageByContext_ = {};
};
ol.inherits(ol.source.ZoomifyTile_, ol.ImageTile);
ol.inherits(ol.source.Zoomify.Tile_, ol.ImageTile);
/**
* @inheritDoc
*/
ol.source.ZoomifyTile_.prototype.getImage = function(opt_context) {
ol.source.Zoomify.Tile_.prototype.getImage = function(opt_context) {
var tileSize = ol.DEFAULT_TILE_SIZE;
var key = opt_context !== undefined ?
ol.getUid(opt_context).toString() : '';
@@ -184,3 +175,12 @@ ol.source.ZoomifyTile_.prototype.getImage = function(opt_context) {
}
}
};
/**
* @enum {string}
*/
ol.source.Zoomify.TierSizeCalculation = {
DEFAULT: 'default',
TRUNCATED: 'truncated'
};

View File

@@ -189,15 +189,15 @@ describe('ol.source.Zoomify', function() {
describe('uses a custom tileClass', function() {
it('uses "ol.source.ZoomifyTile_" as tileClass', function() {
it('uses "ol.source.Zoomify.Tile_" as tileClass', function() {
var source = getZoomifySource();
expect(source.tileClass).to.be(ol.source.ZoomifyTile_);
expect(source.tileClass).to.be(ol.source.Zoomify.Tile_);
});
it('returns expected tileClass instances via "getTile"', function() {
var source = getZoomifySource();
var tile = source.getTile(0, 0, -1, 1, proj);
expect(tile).to.be.an(ol.source.ZoomifyTile_);
expect(tile).to.be.an(ol.source.Zoomify.Tile_);
});
it('"tile.getImage" returns and caches an unloaded image', function() {