remove tabs and trailing whitespace. Non functional change
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10439 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
+108
-108
@@ -3,7 +3,7 @@
|
|||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
/*
|
/*
|
||||||
* Development supported by a R&D grant DC08P02OUK006 - Old Maps Online
|
* Development supported by a R&D grant DC08P02OUK006 - Old Maps Online
|
||||||
* (www.oldmapsonline.org) from Ministry of Culture of the Czech Republic.
|
* (www.oldmapsonline.org) from Ministry of Culture of the Czech Republic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class: OpenLayers.Layer.Zoomify
|
* Class: OpenLayers.Layer.Zoomify
|
||||||
*
|
*
|
||||||
* Inherits from:
|
* Inherits from:
|
||||||
* - <OpenLayers.Layer.Grid>
|
* - <OpenLayers.Layer.Grid>
|
||||||
*/
|
*/
|
||||||
@@ -46,34 +46,34 @@ OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
/**
|
/**
|
||||||
* Property: numberOfTiers
|
* Property: numberOfTiers
|
||||||
* {Integer} Depth of the Zoomify pyramid, number of tiers (zoom levels)
|
* {Integer} Depth of the Zoomify pyramid, number of tiers (zoom levels)
|
||||||
* - filled during Zoomify pyramid initialization.
|
* - filled during Zoomify pyramid initialization.
|
||||||
*/
|
*/
|
||||||
numberOfTiers: 0,
|
numberOfTiers: 0,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: tileCountUpToTier
|
* Property: tileCountUpToTier
|
||||||
* {Array(Integer)} Number of tiles up to the given tier of pyramid.
|
* {Array(Integer)} Number of tiles up to the given tier of pyramid.
|
||||||
* - filled during Zoomify pyramid initialization.
|
* - filled during Zoomify pyramid initialization.
|
||||||
*/
|
*/
|
||||||
tileCountUpToTier: new Array(),
|
tileCountUpToTier: new Array(),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: tierSizeInTiles
|
* Property: tierSizeInTiles
|
||||||
* {Array(<OpenLayers.Size>)} Size (in tiles) for each tier of pyramid.
|
* {Array(<OpenLayers.Size>)} Size (in tiles) for each tier of pyramid.
|
||||||
* - filled during Zoomify pyramid initialization.
|
* - filled during Zoomify pyramid initialization.
|
||||||
*/
|
*/
|
||||||
tierSizeInTiles: new Array(),
|
tierSizeInTiles: new Array(),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: tierImageSize
|
* Property: tierImageSize
|
||||||
* {Array(<OpenLayers.Size>)} Image size in pixels for each pyramid tier.
|
* {Array(<OpenLayers.Size>)} Image size in pixels for each pyramid tier.
|
||||||
* - filled during Zoomify pyramid initialization.
|
* - filled during Zoomify pyramid initialization.
|
||||||
*/
|
*/
|
||||||
tierImageSize: new Array(),
|
tierImageSize: new Array(),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor: OpenLayers.Layer.Zoomify
|
* Constructor: OpenLayers.Layer.Zoomify
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* name - {String} A name for the layer.
|
* name - {String} A name for the layer.
|
||||||
* url - {String} - Relative or absolute path to the image or more
|
* url - {String} - Relative or absolute path to the image or more
|
||||||
@@ -83,93 +83,93 @@ OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
* options - {Object} Hashtable of extra options to tag onto the layer
|
* options - {Object} Hashtable of extra options to tag onto the layer
|
||||||
*/
|
*/
|
||||||
initialize: function(name, url, size, options) {
|
initialize: function(name, url, size, options) {
|
||||||
|
|
||||||
// initilize the Zoomify pyramid for given size
|
// initilize the Zoomify pyramid for given size
|
||||||
this.initializeZoomify( size );
|
this.initializeZoomify( size );
|
||||||
|
|
||||||
var newArguments = [];
|
var newArguments = [];
|
||||||
newArguments.push(name, url, size, {}, options);
|
newArguments.push(name, url, size, {}, options);
|
||||||
|
|
||||||
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
|
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: initializeZoomify
|
* Method: initializeZoomify
|
||||||
* It generates constants for all tiers of the Zoomify pyramid
|
* It generates constants for all tiers of the Zoomify pyramid
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* size - {<OpenLayers.Size>} The size of the image in pixels
|
* size - {<OpenLayers.Size>} The size of the image in pixels
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
initializeZoomify: function( size ) {
|
initializeZoomify: function( size ) {
|
||||||
|
|
||||||
var imageSize = size.clone()
|
|
||||||
var tiles = new OpenLayers.Size(
|
|
||||||
Math.ceil( imageSize.w / this.standardTileSize ),
|
|
||||||
Math.ceil( imageSize.h / this.standardTileSize )
|
|
||||||
);
|
|
||||||
|
|
||||||
this.tierSizeInTiles.push( tiles );
|
var imageSize = size.clone()
|
||||||
this.tierImageSize.push( imageSize );
|
var tiles = new OpenLayers.Size(
|
||||||
|
Math.ceil( imageSize.w / this.standardTileSize ),
|
||||||
while (imageSize.w > this.standardTileSize ||
|
Math.ceil( imageSize.h / this.standardTileSize )
|
||||||
imageSize.h > this.standardTileSize ) {
|
);
|
||||||
|
|
||||||
imageSize = new OpenLayers.Size(
|
|
||||||
Math.floor( imageSize.w / 2 ),
|
|
||||||
Math.floor( imageSize.h / 2 )
|
|
||||||
);
|
|
||||||
tiles = new OpenLayers.Size(
|
|
||||||
Math.ceil( imageSize.w / this.standardTileSize ),
|
|
||||||
Math.ceil( imageSize.h / this.standardTileSize )
|
|
||||||
);
|
|
||||||
this.tierSizeInTiles.push( tiles );
|
|
||||||
this.tierImageSize.push( imageSize );
|
|
||||||
}
|
|
||||||
|
|
||||||
this.tierSizeInTiles.reverse();
|
this.tierSizeInTiles.push( tiles );
|
||||||
this.tierImageSize.reverse();
|
this.tierImageSize.push( imageSize );
|
||||||
|
|
||||||
this.numberOfTiers = this.tierSizeInTiles.length;
|
while (imageSize.w > this.standardTileSize ||
|
||||||
|
imageSize.h > this.standardTileSize ) {
|
||||||
this.tileCountUpToTier[0] = 0;
|
|
||||||
for (var i = 1; i < this.numberOfTiers; i++) {
|
imageSize = new OpenLayers.Size(
|
||||||
this.tileCountUpToTier.push(
|
Math.floor( imageSize.w / 2 ),
|
||||||
this.tierSizeInTiles[i-1].w * this.tierSizeInTiles[i-1].h +
|
Math.floor( imageSize.h / 2 )
|
||||||
this.tileCountUpToTier[i-1]
|
);
|
||||||
);
|
tiles = new OpenLayers.Size(
|
||||||
}
|
Math.ceil( imageSize.w / this.standardTileSize ),
|
||||||
},
|
Math.ceil( imageSize.h / this.standardTileSize )
|
||||||
|
);
|
||||||
|
this.tierSizeInTiles.push( tiles );
|
||||||
|
this.tierImageSize.push( imageSize );
|
||||||
|
}
|
||||||
|
|
||||||
|
this.tierSizeInTiles.reverse();
|
||||||
|
this.tierImageSize.reverse();
|
||||||
|
|
||||||
|
this.numberOfTiers = this.tierSizeInTiles.length;
|
||||||
|
|
||||||
|
this.tileCountUpToTier[0] = 0;
|
||||||
|
for (var i = 1; i < this.numberOfTiers; i++) {
|
||||||
|
this.tileCountUpToTier.push(
|
||||||
|
this.tierSizeInTiles[i-1].w * this.tierSizeInTiles[i-1].h +
|
||||||
|
this.tileCountUpToTier[i-1]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod:destroy
|
* APIMethod:destroy
|
||||||
*/
|
*/
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
// for now, nothing special to do here.
|
// for now, nothing special to do here.
|
||||||
OpenLayers.Layer.Grid.prototype.destroy.apply(this, arguments);
|
OpenLayers.Layer.Grid.prototype.destroy.apply(this, arguments);
|
||||||
|
|
||||||
// Remove from memory the Zoomify pyramid - is that enough?
|
// Remove from memory the Zoomify pyramid - is that enough?
|
||||||
this.tileCountUpToTier.length = 0
|
this.tileCountUpToTier.length = 0
|
||||||
this.tierSizeInTiles.length = 0
|
this.tierSizeInTiles.length = 0
|
||||||
this.tierImageSize.length = 0
|
this.tierImageSize.length = 0
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: clone
|
* APIMethod: clone
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* obj - {Object}
|
* obj - {Object}
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {<OpenLayers.Layer.Zoomify>} An exact clone of this <OpenLayers.Layer.Zoomify>
|
* {<OpenLayers.Layer.Zoomify>} An exact clone of this <OpenLayers.Layer.Zoomify>
|
||||||
*/
|
*/
|
||||||
clone: function (obj) {
|
clone: function (obj) {
|
||||||
|
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
obj = new OpenLayers.Layer.Zoomify(this.name,
|
obj = new OpenLayers.Layer.Zoomify(this.name,
|
||||||
this.url,
|
this.url,
|
||||||
this.size,
|
this.size,
|
||||||
this.options);
|
this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,17 +179,17 @@ OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
// copy/set any non-init, non-simple values here
|
// copy/set any non-init, non-simple values here
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: getURL
|
* Method: getURL
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* bounds - {<OpenLayers.Bounds>}
|
* bounds - {<OpenLayers.Bounds>}
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {String} A string with the layer's url and parameters and also the
|
* {String} A string with the layer's url and parameters and also the
|
||||||
* passed-in bounds and appropriate tile size specified as
|
* passed-in bounds and appropriate tile size specified as
|
||||||
* parameters
|
* parameters
|
||||||
*/
|
*/
|
||||||
getURL: function (bounds) {
|
getURL: function (bounds) {
|
||||||
@@ -199,9 +199,9 @@ OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
var y = Math.round((this.tileOrigin.lat - bounds.top) / (res * this.tileSize.h));
|
var y = Math.round((this.tileOrigin.lat - bounds.top) / (res * this.tileSize.h));
|
||||||
var z = this.map.getZoom();
|
var z = this.map.getZoom();
|
||||||
|
|
||||||
var tileIndex = x + y * this.tierSizeInTiles[z].w + this.tileCountUpToTier[z];
|
var tileIndex = x + y * this.tierSizeInTiles[z].w + this.tileCountUpToTier[z];
|
||||||
var path = "TileGroup" + Math.floor( (tileIndex) / 256 ) +
|
var path = "TileGroup" + Math.floor( (tileIndex) / 256 ) +
|
||||||
"/" + z + "-" + x + "-" + y + ".jpg";
|
"/" + z + "-" + x + "-" + y + ".jpg";
|
||||||
var url = this.url;
|
var url = this.url;
|
||||||
if (url instanceof Array) {
|
if (url instanceof Array) {
|
||||||
url = this.selectUrl(path, url);
|
url = this.selectUrl(path, url);
|
||||||
@@ -213,50 +213,50 @@ OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
* Method: getImageSize
|
* Method: getImageSize
|
||||||
* getImageSize returns size for a particular tile. If bounds are given as
|
* getImageSize returns size for a particular tile. If bounds are given as
|
||||||
* first argument, size is calculated (bottom-right tiles are non square).
|
* first argument, size is calculated (bottom-right tiles are non square).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
getImageSize: function() {
|
getImageSize: function() {
|
||||||
if (arguments.length > 0) {
|
if (arguments.length > 0) {
|
||||||
bounds = this.adjustBounds(arguments[0]);
|
bounds = this.adjustBounds(arguments[0]);
|
||||||
var res = this.map.getResolution();
|
var res = this.map.getResolution();
|
||||||
var x = Math.round((bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w));
|
var x = Math.round((bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w));
|
||||||
var y = Math.round((this.tileOrigin.lat - bounds.top) / (res * this.tileSize.h));
|
var y = Math.round((this.tileOrigin.lat - bounds.top) / (res * this.tileSize.h));
|
||||||
var z = this.map.getZoom();
|
var z = this.map.getZoom();
|
||||||
var w = this.standardTileSize;
|
var w = this.standardTileSize;
|
||||||
var h = this.standardTileSize;
|
var h = this.standardTileSize;
|
||||||
if (x == this.tierSizeInTiles[z].w -1 ) {
|
if (x == this.tierSizeInTiles[z].w -1 ) {
|
||||||
var w = this.tierImageSize[z].w % this.standardTileSize;
|
var w = this.tierImageSize[z].w % this.standardTileSize;
|
||||||
};
|
};
|
||||||
if (y == this.tierSizeInTiles[z].h -1 ) {
|
if (y == this.tierSizeInTiles[z].h -1 ) {
|
||||||
var h = this.tierImageSize[z].h % this.standardTileSize;
|
var h = this.tierImageSize[z].h % this.standardTileSize;
|
||||||
};
|
};
|
||||||
return (new OpenLayers.Size(w, h));
|
return (new OpenLayers.Size(w, h));
|
||||||
} else {
|
} else {
|
||||||
return this.tileSize;
|
return this.tileSize;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: addTile
|
* Method: addTile
|
||||||
* addTile creates a tile, initializes it, and adds it to the layer div.
|
* addTile creates a tile, initializes it, and adds it to the layer div.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* bounds - {<OpenLayers.Bounds>}
|
* bounds - {<OpenLayers.Bounds>}
|
||||||
* position - {<OpenLayers.Pixel>}
|
* position - {<OpenLayers.Pixel>}
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
|
* {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
|
||||||
*/
|
*/
|
||||||
addTile:function(bounds,position) {
|
addTile:function(bounds,position) {
|
||||||
return new OpenLayers.Tile.Image(this, position, bounds,
|
return new OpenLayers.Tile.Image(this, position, bounds,
|
||||||
null, this.tileSize);
|
null, this.tileSize);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: setMap
|
* APIMethod: setMap
|
||||||
* When the layer is added to a map, then we can fetch our origin
|
* When the layer is added to a map, then we can fetch our origin
|
||||||
* (if we don't have one.)
|
* (if we don't have one.)
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* map - {<OpenLayers.Map>}
|
* map - {<OpenLayers.Map>}
|
||||||
*/
|
*/
|
||||||
@@ -266,9 +266,9 @@ OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
this.map.maxExtent.top);
|
this.map.maxExtent.top);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: calculateGridLayout
|
* Method: calculateGridLayout
|
||||||
* Generate parameters for the grid layout. This
|
* Generate parameters for the grid layout. This
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* bounds - {<OpenLayers.Bound>}
|
* bounds - {<OpenLayers.Bound>}
|
||||||
@@ -282,25 +282,25 @@ OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
calculateGridLayout: function(bounds, extent, resolution) {
|
calculateGridLayout: function(bounds, extent, resolution) {
|
||||||
var tilelon = resolution * this.tileSize.w;
|
var tilelon = resolution * this.tileSize.w;
|
||||||
var tilelat = resolution * this.tileSize.h;
|
var tilelat = resolution * this.tileSize.h;
|
||||||
|
|
||||||
var offsetlon = bounds.left - extent.left;
|
var offsetlon = bounds.left - extent.left;
|
||||||
var tilecol = Math.floor(offsetlon/tilelon) - this.buffer;
|
var tilecol = Math.floor(offsetlon/tilelon) - this.buffer;
|
||||||
var tilecolremain = offsetlon/tilelon - tilecol;
|
var tilecolremain = offsetlon/tilelon - tilecol;
|
||||||
var tileoffsetx = -tilecolremain * this.tileSize.w;
|
var tileoffsetx = -tilecolremain * this.tileSize.w;
|
||||||
var tileoffsetlon = extent.left + tilecol * tilelon;
|
var tileoffsetlon = extent.left + tilecol * tilelon;
|
||||||
|
|
||||||
var offsetlat = extent.top - bounds.top + tilelat;
|
var offsetlat = extent.top - bounds.top + tilelat;
|
||||||
var tilerow = Math.floor(offsetlat/tilelat) - this.buffer;
|
var tilerow = Math.floor(offsetlat/tilelat) - this.buffer;
|
||||||
var tilerowremain = tilerow - offsetlat/tilelat;
|
var tilerowremain = tilerow - offsetlat/tilelat;
|
||||||
var tileoffsety = tilerowremain * this.tileSize.h;
|
var tileoffsety = tilerowremain * this.tileSize.h;
|
||||||
var tileoffsetlat = extent.top - tilelat*tilerow;
|
var tileoffsetlat = extent.top - tilelat*tilerow;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
tilelon: tilelon, tilelat: tilelat,
|
tilelon: tilelon, tilelat: tilelat,
|
||||||
tileoffsetlon: tileoffsetlon, tileoffsetlat: tileoffsetlat,
|
tileoffsetlon: tileoffsetlon, tileoffsetlat: tileoffsetlat,
|
||||||
tileoffsetx: tileoffsetx, tileoffsety: tileoffsety
|
tileoffsetx: tileoffsetx, tileoffsety: tileoffsety
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
CLASS_NAME: "OpenLayers.Layer.Zoomify"
|
CLASS_NAME: "OpenLayers.Layer.Zoomify"
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user