Fixed viewRequestID regression and mixin issue that caused the mixin to always be applied unless maxGetUrlLength was explicitly set. Includes a regression test for the viewRequestID bit. r=tschaub (closes #2847)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10773 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -110,11 +110,11 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
|
||||
* options - {Object}
|
||||
*/
|
||||
initialize: function(layer, position, bounds, url, size, options) {
|
||||
options = options || {};
|
||||
if (options.maxGetUrlLength !== null) {
|
||||
OpenLayers.Util.applyDefaults(options, OpenLayers.Tile.Image.IFrame);
|
||||
OpenLayers.Tile.prototype.initialize.apply(this, arguments);
|
||||
|
||||
if (this.maxGetUrlLength != null) {
|
||||
OpenLayers.Util.extend(this, OpenLayers.Tile.Image.IFrame);
|
||||
}
|
||||
OpenLayers.Tile.prototype.initialize.apply(this, [layer, position, bounds, url, size, options]);
|
||||
|
||||
this.url = url; //deprecated remove me
|
||||
|
||||
@@ -355,9 +355,7 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
|
||||
* Creates the imgDiv property on the tile.
|
||||
*/
|
||||
initImgDiv: function() {
|
||||
if (this.imgDiv) {
|
||||
return;
|
||||
}
|
||||
if (this.imgDiv == null) {
|
||||
var offset = this.layer.imageOffset;
|
||||
var size = this.layer.getImageSize(this.bounds);
|
||||
|
||||
@@ -450,6 +448,7 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
|
||||
};
|
||||
OpenLayers.Event.observe(this.imgDiv, "error",
|
||||
OpenLayers.Function.bind(onerror, this));
|
||||
}
|
||||
|
||||
this.imgDiv.viewRequestID = this.layer.map.viewRequestID;
|
||||
},
|
||||
|
||||
@@ -77,17 +77,16 @@ OpenLayers.Tile.Image.IFrame = {
|
||||
(!this.useIFrame && nodeName == "div")) {
|
||||
// switch between get and post
|
||||
this.removeImgDiv();
|
||||
delete this.imgDiv;
|
||||
} else {
|
||||
return;
|
||||
this.imgDiv = null;
|
||||
}
|
||||
}
|
||||
if (this.useIFrame) {
|
||||
if (this.imgDiv == null) {
|
||||
var eventPane = document.createElement("div");
|
||||
|
||||
if(OpenLayers.Util.getBrowserName() == "msie") {
|
||||
// IE cannot handle events on elements without backgroundcolor. So we
|
||||
// use this little hack to make elements transparent
|
||||
// IE cannot handle events on elements without backgroundcolor.
|
||||
// So we use this little hack to make elements transparent
|
||||
eventPane.style.backgroundColor = '#FFFFFF';
|
||||
eventPane.style.filter = 'chroma(color=#FFFFFF)';
|
||||
}
|
||||
@@ -107,14 +106,14 @@ OpenLayers.Tile.Image.IFrame = {
|
||||
|
||||
if(this.layer.opacity != null) {
|
||||
|
||||
OpenLayers.Util.modifyDOMElement(this.imgDiv, null, null, null,
|
||||
null, null, null,
|
||||
OpenLayers.Util.modifyDOMElement(this.imgDiv, null, null,
|
||||
null, null, null, null,
|
||||
this.layer.opacity);
|
||||
}
|
||||
|
||||
// we need this reference to check back the viewRequestID
|
||||
this.imgDiv.map = this.layer.map;
|
||||
|
||||
}
|
||||
this.imgDiv.viewRequestID = this.layer.map.viewRequestID;
|
||||
|
||||
} else {
|
||||
|
||||
@@ -87,6 +87,29 @@
|
||||
t.ok( clone.imgDiv == null, "clone's imgDiv was not copied");
|
||||
}
|
||||
|
||||
function test_Tile_Image_IFrame_viewRequestID (t) {
|
||||
t.plan( 2 );
|
||||
var map = new OpenLayers.Map('map');
|
||||
var layer = new OpenLayers.Layer.WMS(
|
||||
"Name",
|
||||
"http://labs.metacarta.com/TESTURL?",
|
||||
{layers: 'basic'}
|
||||
);
|
||||
map.addLayer(layer);
|
||||
|
||||
var position = new OpenLayers.Pixel(20,30);
|
||||
var bounds = new OpenLayers.Bounds(1,2,3,4);
|
||||
tile = layer.addTile(bounds, position);
|
||||
tile.renderTile();
|
||||
t.eq(tile.imgDiv.viewRequestID, map.viewRequestID, "viewRequestID correct after renderTile");
|
||||
map.viewRequestID++;
|
||||
tile.renderTile();
|
||||
t.eq(tile.imgDiv.viewRequestID, map.viewRequestID, "viewRequestID correct after subsequent renderTile");
|
||||
tile.destroy();
|
||||
layer.destroy();
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Tile_Image_draw (t) {
|
||||
t.plan( 7 );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user