Fix ol.source.Zoomify namespace hierarchy
This commit is contained in:
committed by
Tim Schaub
parent
2972917bb9
commit
fe16cf9702
+16
-16
@@ -10,15 +10,6 @@ goog.require('ol.source.TileImage');
|
|||||||
goog.require('ol.tilegrid.TileGrid');
|
goog.require('ol.tilegrid.TileGrid');
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
ol.source.ZoomifyTierSizeCalculation = {
|
|
||||||
DEFAULT: 'default',
|
|
||||||
TRUNCATED: 'truncated'
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
* Layer source for tile data in Zoomify format.
|
* Layer source for tile data in Zoomify format.
|
||||||
@@ -35,7 +26,7 @@ ol.source.Zoomify = function(opt_options) {
|
|||||||
var size = options.size;
|
var size = options.size;
|
||||||
var tierSizeCalculation = options.tierSizeCalculation !== undefined ?
|
var tierSizeCalculation = options.tierSizeCalculation !== undefined ?
|
||||||
options.tierSizeCalculation :
|
options.tierSizeCalculation :
|
||||||
ol.source.ZoomifyTierSizeCalculation.DEFAULT;
|
ol.source.Zoomify.TierSizeCalculation.DEFAULT;
|
||||||
|
|
||||||
var imageWidth = size[0];
|
var imageWidth = size[0];
|
||||||
var imageHeight = size[1];
|
var imageHeight = size[1];
|
||||||
@@ -43,7 +34,7 @@ ol.source.Zoomify = function(opt_options) {
|
|||||||
var tileSize = ol.DEFAULT_TILE_SIZE;
|
var tileSize = ol.DEFAULT_TILE_SIZE;
|
||||||
|
|
||||||
switch (tierSizeCalculation) {
|
switch (tierSizeCalculation) {
|
||||||
case ol.source.ZoomifyTierSizeCalculation.DEFAULT:
|
case ol.source.Zoomify.TierSizeCalculation.DEFAULT:
|
||||||
while (imageWidth > tileSize || imageHeight > tileSize) {
|
while (imageWidth > tileSize || imageHeight > tileSize) {
|
||||||
tierSizeInTiles.push([
|
tierSizeInTiles.push([
|
||||||
Math.ceil(imageWidth / tileSize),
|
Math.ceil(imageWidth / tileSize),
|
||||||
@@ -52,7 +43,7 @@ ol.source.Zoomify = function(opt_options) {
|
|||||||
tileSize += tileSize;
|
tileSize += tileSize;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ol.source.ZoomifyTierSizeCalculation.TRUNCATED:
|
case ol.source.Zoomify.TierSizeCalculation.TRUNCATED:
|
||||||
var width = imageWidth;
|
var width = imageWidth;
|
||||||
var height = imageHeight;
|
var height = imageHeight;
|
||||||
while (width > tileSize || height > tileSize) {
|
while (width > tileSize || height > tileSize) {
|
||||||
@@ -123,7 +114,7 @@ ol.source.Zoomify = function(opt_options) {
|
|||||||
crossOrigin: options.crossOrigin,
|
crossOrigin: options.crossOrigin,
|
||||||
logo: options.logo,
|
logo: options.logo,
|
||||||
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
|
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
|
||||||
tileClass: ol.source.ZoomifyTile_,
|
tileClass: ol.source.Zoomify.Tile_,
|
||||||
tileGrid: tileGrid,
|
tileGrid: tileGrid,
|
||||||
tileUrlFunction: tileUrlFunction
|
tileUrlFunction: tileUrlFunction
|
||||||
});
|
});
|
||||||
@@ -142,7 +133,7 @@ ol.inherits(ol.source.Zoomify, ol.source.TileImage);
|
|||||||
* @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function.
|
* @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.source.ZoomifyTile_ = function(
|
ol.source.Zoomify.Tile_ = function(
|
||||||
tileCoord, state, src, crossOrigin, tileLoadFunction) {
|
tileCoord, state, src, crossOrigin, tileLoadFunction) {
|
||||||
|
|
||||||
ol.ImageTile.call(this, tileCoord, state, src, crossOrigin, tileLoadFunction);
|
ol.ImageTile.call(this, tileCoord, state, src, crossOrigin, tileLoadFunction);
|
||||||
@@ -155,13 +146,13 @@ ol.source.ZoomifyTile_ = function(
|
|||||||
this.zoomifyImageByContext_ = {};
|
this.zoomifyImageByContext_ = {};
|
||||||
|
|
||||||
};
|
};
|
||||||
ol.inherits(ol.source.ZoomifyTile_, ol.ImageTile);
|
ol.inherits(ol.source.Zoomify.Tile_, ol.ImageTile);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @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 tileSize = ol.DEFAULT_TILE_SIZE;
|
||||||
var key = opt_context !== undefined ?
|
var key = opt_context !== undefined ?
|
||||||
ol.getUid(opt_context).toString() : '';
|
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'
|
||||||
|
};
|
||||||
|
|||||||
@@ -189,15 +189,15 @@ describe('ol.source.Zoomify', function() {
|
|||||||
|
|
||||||
describe('uses a custom tileClass', 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();
|
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() {
|
it('returns expected tileClass instances via "getTile"', function() {
|
||||||
var source = getZoomifySource();
|
var source = getZoomifySource();
|
||||||
var tile = source.getTile(0, 0, -1, 1, proj);
|
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() {
|
it('"tile.getImage" returns and caches an unloaded image', function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user