Files
openlayers/lib/OpenLayers/Tile.js
crschmidt 0ba7961df4 Commit tile-reuse branch back to trunk. This branch offers numerous performance
improvements in the form of reduced memory use and lower element creating costs,
hopefully making the OpenLayers code more usable in internet explorer as well
as less of a memory hog in Firefox and other browsers. Additionally, a buffer
is available around the main map grid which allows tiles to be loaded outside
of the viewing area for faster dragging.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1137 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-09 03:47:33 +00:00

103 lines
2.5 KiB
JavaScript

/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
/*
* OpenLayers.Tile
*
* @class This is a class designed to designate a single tile, however
* it is explicitly designed to do relatively little. Tiles store information
* about themselves -- such as the URL that they are related to, and their
* size - but do not add themselves to the layer div automatically, for
* example.
*/
OpenLayers.Tile = Class.create();
OpenLayers.Tile.prototype = {
/** @type String */
id: null,
/** @type OpenLayers.Layer */
layer: null,
/** @type String url of the request */
url:null,
/** @type OpenLayers.Bounds */
bounds:null,
/** @type OpenLayers.Size */
size:null,
/** Top Left pixel of the tile
* @type OpenLayers.Pixel */
position:null,
/**
* @constructor
*
* @param {OpenLayers.Layer} layer
* @param {OpenLayers.Pixel} position
* @param {OpenLayers.Bounds} bounds
* @param {String} url
* @param {OpenLayers.Size} size
*/
initialize: function(layer, position, bounds, url, size) {
if (arguments.length > 0) {
this.layer = layer;
this.position = position;
this.bounds = bounds;
this.url = url;
this.size = size;
//give the tile a unique id based on its BBOX.
this.id = OpenLayers.Util.createUniqueID("Tile_");
}
},
/** nullify references to prevent circular references and memory leaks
*/
destroy:function() {
this.layer = null;
this.bounds = null;
this.size = null;
},
/**
*/
draw:function() {
// HACK HACK - should we make it a standard to put this sort of warning
// message in functions that are supposed to be overridden?
//
// Log.warn(this.CLASS_NAME + ": draw() not implemented");
},
redraw: function () {
this.draw();
},
moveTo: function (bounds, position) {
this.bounds = bounds.clone();
this.position = position.clone();
this.redraw();
},
/** remove this tile from the ds
*/
remove:function() {
},
/**
* @type OpenLayers.Pixel
*/
getPosition: function() {
return this.position;
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Tile"
};