jsdoc Grid.js
git-svn-id: http://svn.openlayers.org/trunk/openlayers@889 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -3,33 +3,41 @@
|
|||||||
* text of the license. */
|
* text of the license. */
|
||||||
// @require: OpenLayers/Layer.js
|
// @require: OpenLayers/Layer.js
|
||||||
// @require: OpenLayers/Util.js
|
// @require: OpenLayers/Util.js
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
OpenLayers.Layer.Grid = Class.create();
|
OpenLayers.Layer.Grid = Class.create();
|
||||||
OpenLayers.Layer.Grid.prototype =
|
OpenLayers.Layer.Grid.prototype =
|
||||||
Object.extend( new OpenLayers.Layer.HTTPRequest(), {
|
Object.extend( new OpenLayers.Layer.HTTPRequest(), {
|
||||||
|
|
||||||
// tileSize: OpenLayers.Size
|
/** @type OpenLayers.Size */
|
||||||
tileSize: null,
|
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,
|
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,
|
alpha: false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {str} name
|
* @constructor
|
||||||
* @param {str} url
|
*
|
||||||
* @param {hash} params
|
* @param {String} name
|
||||||
* @param {Object} options Hash of extra options to tag onto the layer
|
* @param {String} url
|
||||||
|
* @param {Object} params
|
||||||
|
* @param {Object} options Hash of extra options to tag onto the layer
|
||||||
*/
|
*/
|
||||||
initialize: function(name, url, params, options) {
|
initialize: function(name, url, params, options) {
|
||||||
OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,
|
OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,
|
||||||
arguments);
|
arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/** on destroy, clear the grid.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
@@ -52,6 +60,8 @@ OpenLayers.Layer.Grid.prototype =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated User should just set the 'tileSize' via options
|
* @deprecated User should just set the 'tileSize' via options
|
||||||
|
*
|
||||||
|
* @param {OpenLayers.Size} size
|
||||||
*/
|
*/
|
||||||
setTileSize: function (size) {
|
setTileSize: function (size) {
|
||||||
if (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
|
* 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.
|
* a bounds and make sure the data that that bounds requires is pre-loaded.
|
||||||
*
|
*
|
||||||
* @param {OpenLayers.Bounds}
|
* @param {OpenLayers.Bounds} bounds
|
||||||
* @param {Boolean} zoomChanged
|
* @param {Boolean} zoomChanged
|
||||||
*/
|
*/
|
||||||
moveTo:function(bounds, 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() {
|
getGridBounds:function() {
|
||||||
var topLeftTile = this.grid[0][0];
|
var topLeftTile = this.grid[0][0];
|
||||||
var bottomRightTile = this.grid[this.grid.length-1][this.grid[0].length-1];
|
var bottomRightTile = this.grid[this.grid.length-1][this.grid[0].length-1];
|
||||||
@@ -102,7 +117,8 @@ OpenLayers.Layer.Grid.prototype =
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*
|
||||||
|
*/
|
||||||
_initTiles:function() {
|
_initTiles:function() {
|
||||||
|
|
||||||
//first of all, clear out the main div
|
//first of all, clear out the main div
|
||||||
@@ -168,9 +184,9 @@ OpenLayers.Layer.Grid.prototype =
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {bool} prepend - if true, prepend to beginning.
|
* @param {Boolean} prepend if true, prepend to beginning.
|
||||||
* if false, then append to end
|
* if false, then append to end
|
||||||
*/
|
*/
|
||||||
insertRow:function(prepend) {
|
insertRow:function(prepend) {
|
||||||
var modelRowIndex = (prepend) ? 0 : (this.grid.length - 1);
|
var modelRowIndex = (prepend) ? 0 : (this.grid.length - 1);
|
||||||
var modelRow = this.grid[modelRowIndex];
|
var modelRow = this.grid[modelRowIndex];
|
||||||
@@ -203,9 +219,9 @@ OpenLayers.Layer.Grid.prototype =
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {bool} prepend - if true, prepend to beginning.
|
* @param {Boolean} prepend if true, prepend to beginning.
|
||||||
* if false, then append to end
|
* if false, then append to end
|
||||||
*/
|
*/
|
||||||
insertColumn:function(prepend) {
|
insertColumn:function(prepend) {
|
||||||
var modelCellIndex;
|
var modelCellIndex;
|
||||||
var deltaX = (prepend) ? -this.tileSize.w : this.tileSize.w;
|
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
|
/** go through and remove all tiles from the grid, calling
|
||||||
* destroy() on each of them to kill circular references
|
* destroy() on each of them to kill circular references
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
clearGrid:function() {
|
clearGrid:function() {
|
||||||
if (this.grid) {
|
if (this.grid) {
|
||||||
while(this.grid.length > 0) {
|
while(this.grid.length > 0) {
|
||||||
@@ -253,15 +269,15 @@ OpenLayers.Layer.Grid.prototype =
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* addTile gives subclasses of Grid the opportunity to create an
|
* addTile gives subclasses of Grid the opportunity to create an
|
||||||
* OpenLayer.Tile of their choosing. The implementer should initialize
|
* OpenLayer.Tile of their choosing. The implementer should initialize
|
||||||
* the new tile and take whatever steps necessary to display it.
|
* the new tile and take whatever steps necessary to display it.
|
||||||
*
|
*
|
||||||
* @param {OpenLayers.Bounds} bounds
|
* @param {OpenLayers.Bounds} bounds
|
||||||
*
|
*
|
||||||
* @returns The added OpenLayers.Tile
|
* @returns The added OpenLayers.Tile
|
||||||
* @type OpenLayers.Tile
|
* @type OpenLayers.Tile
|
||||||
*/
|
*/
|
||||||
addTile:function(bounds,position) {
|
addTile:function(bounds,position) {
|
||||||
// Should be implemented by subclasses
|
// Should be implemented by subclasses
|
||||||
},
|
},
|
||||||
@@ -279,10 +295,10 @@ OpenLayers.Layer.Grid.prototype =
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {OpenLayers.Bounds} bounds
|
* @param {OpenLayers.Bounds} bounds
|
||||||
*
|
*
|
||||||
* @return {int}
|
* @return {int}
|
||||||
*/
|
*/
|
||||||
getZoomForExtent: function (bounds) {
|
getZoomForExtent: function (bounds) {
|
||||||
|
|
||||||
var maxRes = this.map.getMaxResolution();
|
var maxRes = this.map.getMaxResolution();
|
||||||
|
|||||||
Reference in New Issue
Block a user