added 'drawn' property to all tiles. removed redraw() and adapted all draw()s to auto handle redraw. remove getPosition() accessor that noone was using. set generic Tile's moveTo() to auto trigger the clear() and the redraw() (if desired). Update Image and WFS tile classes correspondingly. also update tests
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1198 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
/* 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. */
|
||||
|
||||
// @require: OpenLayers/Tile.js
|
||||
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
@@ -24,7 +26,10 @@ OpenLayers.Tile.Image.prototype =
|
||||
initialize: function(layer, position, bounds, url, size) {
|
||||
OpenLayers.Tile.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
destroy: function() {
|
||||
if ((this.imgDiv != null) && (this.imgDiv.parentNode == this.layer.div)) {
|
||||
this.layer.div.removeChild(this.imgDiv);
|
||||
@@ -34,46 +39,15 @@ OpenLayers.Tile.Image.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*/
|
||||
*
|
||||
*/
|
||||
draw:function() {
|
||||
if (this.layer.alpha) {
|
||||
this.imgDiv = OpenLayers.Util.createAlphaImageDiv(null,
|
||||
this.position,
|
||||
this.size,
|
||||
this.url,
|
||||
"absolute",
|
||||
null,
|
||||
null,
|
||||
true);
|
||||
} else {
|
||||
this.imgDiv = OpenLayers.Util.createImage(null,
|
||||
this.position,
|
||||
this.size,
|
||||
this.url,
|
||||
"absolute",
|
||||
null,
|
||||
true);
|
||||
OpenLayers.Tile.prototype.draw.apply(this, arguments);
|
||||
|
||||
if (this.imgDiv == null) {
|
||||
this.initImgDiv();
|
||||
}
|
||||
this.layer.div.appendChild(this.imgDiv);
|
||||
},
|
||||
|
||||
/** Clear the tile of any bounds/position-related data so that it can
|
||||
* be reused in a new location.
|
||||
*/
|
||||
clear: function() {
|
||||
this.imgDiv.style.display = "none";
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Bounds}
|
||||
* @param {OpenLayers.pixel} position
|
||||
*/
|
||||
moveTo: function (bounds, position) {
|
||||
this.url = this.layer.getURL(bounds);
|
||||
OpenLayers.Tile.prototype.moveTo.apply(this, arguments);
|
||||
},
|
||||
|
||||
redraw: function () {
|
||||
this.imgDiv.style.display = "none";
|
||||
if (this.layer.alpha) {
|
||||
OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,
|
||||
@@ -85,6 +59,49 @@ OpenLayers.Tile.Image.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
/** Clear the tile of any bounds/position-related data so that it can
|
||||
* be reused in a new location.
|
||||
*/
|
||||
clear: function() {
|
||||
OpenLayers.Tile.prototype.clear.apply(this, arguments);
|
||||
this.imgDiv.style.display = "none";
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Bounds}
|
||||
* @param {OpenLayers.pixel} position
|
||||
* @param {Boolean} redraw
|
||||
*/
|
||||
moveTo: function (bounds, position, redraw) {
|
||||
this.url = this.layer.getURL(bounds);
|
||||
OpenLayers.Tile.prototype.moveTo.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
initImgDiv: function() {
|
||||
if (this.layer.alpha) {
|
||||
this.imgDiv = OpenLayers.Util.createAlphaImageDiv(null,
|
||||
this.position,
|
||||
this.size,
|
||||
null,
|
||||
"absolute",
|
||||
null,
|
||||
null,
|
||||
true);
|
||||
} else {
|
||||
this.imgDiv = OpenLayers.Util.createImage(null,
|
||||
this.position,
|
||||
this.size,
|
||||
null,
|
||||
"absolute",
|
||||
null,
|
||||
true);
|
||||
}
|
||||
this.layer.div.appendChild(this.imgDiv);
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
CLASS_NAME: "OpenLayers.Tile.Image"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user