jsdoc Grid.js

git-svn-id: http://svn.openlayers.org/trunk/openlayers@889 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-07-06 01:39:19 +00:00
parent b848e824d7
commit 353c7b810d

View File

@@ -3,33 +3,41 @@
* text of the license. */
// @require: OpenLayers/Layer.js
// @require: OpenLayers/Util.js
/**
* @class
*/
OpenLayers.Layer.Grid = Class.create();
OpenLayers.Layer.Grid.prototype =
Object.extend( new OpenLayers.Layer.HTTPRequest(), {
// tileSize: OpenLayers.Size
/** @type OpenLayers.Size */
tileSize: null,
// grid: Array(Array())
// this is an array of rows, each row is an array of tiles
/** this is an array of rows, each row is an array of tiles
*
* @type Array(Array()) */
grid: null,
// alpha: boolean
// asserts whether or not the layer's images have an alpha channel
/** asserts whether or not the layer's images have an alpha channel
*
* @type boolean */
alpha: false,
/**
* @param {str} name
* @param {str} url
* @param {hash} params
* @param {Object} options Hash of extra options to tag onto the layer
* @constructor
*
* @param {String} name
* @param {String} url
* @param {Object} params
* @param {Object} options Hash of extra options to tag onto the layer
*/
initialize: function(name, url, params, options) {
OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,
arguments);
},
/**
/** on destroy, clear the grid.
*
*/
destroy: function() {
@@ -52,6 +60,8 @@ OpenLayers.Layer.Grid.prototype =
/**
* @deprecated User should just set the 'tileSize' via options
*
* @param {OpenLayers.Size} size
*/
setTileSize: function (size) {
if (size)
@@ -62,7 +72,7 @@ OpenLayers.Layer.Grid.prototype =
* of actual 'tiles' is done by the map, but moveTo's role is to accept
* a bounds and make sure the data that that bounds requires is pre-loaded.
*
* @param {OpenLayers.Bounds}
* @param {OpenLayers.Bounds} bounds
* @param {Boolean} zoomChanged
*/
moveTo:function(bounds, zoomChanged) {
@@ -91,7 +101,12 @@ OpenLayers.Layer.Grid.prototype =
}
},
/**
* @returns A Bounds object representing the bounds of all the currently
* loaded tiles (including those partially or not at all seen
* onscreen)
* @type OpenLayers.Bounds
*/
getGridBounds:function() {
var topLeftTile = this.grid[0][0];
var bottomRightTile = this.grid[this.grid.length-1][this.grid[0].length-1];
@@ -102,7 +117,8 @@ OpenLayers.Layer.Grid.prototype =
},
/**
*/
*
*/
_initTiles:function() {
//first of all, clear out the main div
@@ -168,9 +184,9 @@ OpenLayers.Layer.Grid.prototype =
},
/**
* @param {bool} prepend - if true, prepend to beginning.
* if false, then append to end
*/
* @param {Boolean} prepend if true, prepend to beginning.
* if false, then append to end
*/
insertRow:function(prepend) {
var modelRowIndex = (prepend) ? 0 : (this.grid.length - 1);
var modelRow = this.grid[modelRowIndex];
@@ -203,9 +219,9 @@ OpenLayers.Layer.Grid.prototype =
},
/**
* @param {bool} prepend - if true, prepend to beginning.
* if false, then append to end
*/
* @param {Boolean} prepend if true, prepend to beginning.
* if false, then append to end
*/
insertColumn:function(prepend) {
var modelCellIndex;
var deltaX = (prepend) ? -this.tileSize.w : this.tileSize.w;
@@ -234,10 +250,10 @@ OpenLayers.Layer.Grid.prototype =
},
/** go through and remove all tiles from the grid, calling
* destroy() on each of them to kill circular references
*
* @private
*/
* destroy() on each of them to kill circular references
*
* @private
*/
clearGrid:function() {
if (this.grid) {
while(this.grid.length > 0) {
@@ -253,15 +269,15 @@ OpenLayers.Layer.Grid.prototype =
},
/**
* addTile gives subclasses of Grid the opportunity to create an
* OpenLayer.Tile of their choosing. The implementer should initialize
* the new tile and take whatever steps necessary to display it.
*
* @param {OpenLayers.Bounds} bounds
*
* @returns The added OpenLayers.Tile
* @type OpenLayers.Tile
*/
* addTile gives subclasses of Grid the opportunity to create an
* OpenLayer.Tile of their choosing. The implementer should initialize
* the new tile and take whatever steps necessary to display it.
*
* @param {OpenLayers.Bounds} bounds
*
* @returns The added OpenLayers.Tile
* @type OpenLayers.Tile
*/
addTile:function(bounds,position) {
// Should be implemented by subclasses
},
@@ -279,10 +295,10 @@ OpenLayers.Layer.Grid.prototype =
},
/**
* @param {OpenLayers.Bounds} bounds
*
* @return {int}
*/
* @param {OpenLayers.Bounds} bounds
*
* @return {int}
*/
getZoomForExtent: function (bounds) {
var maxRes = this.map.getMaxResolution();