fix for #843 - remove unnecesary url prepping in image tiles
git-svn-id: http://svn.openlayers.org/trunk/openlayers@3768 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -159,7 +159,7 @@ OpenLayers.Layer.Image = OpenLayers.Class(OpenLayers.Layer, {
|
|||||||
if(firstRendering) {
|
if(firstRendering) {
|
||||||
//create the new tile
|
//create the new tile
|
||||||
this.tile = new OpenLayers.Tile.Image(this, ulPx, this.extent,
|
this.tile = new OpenLayers.Tile.Image(this, ulPx, this.extent,
|
||||||
this.url, this.tileSize);
|
null, this.tileSize);
|
||||||
} else {
|
} else {
|
||||||
//just resize the tile and set it's new position
|
//just resize the tile and set it's new position
|
||||||
this.tile.size = this.tileSize.clone();
|
this.tile.size = this.tileSize.clone();
|
||||||
|
|||||||
@@ -88,8 +88,8 @@ OpenLayers.Layer.MapServer = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
* {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
|
* {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
|
||||||
*/
|
*/
|
||||||
addTile:function(bounds,position) {
|
addTile:function(bounds,position) {
|
||||||
var url = this.getURL(bounds);
|
return new OpenLayers.Tile.Image(this, position, bounds,
|
||||||
return new OpenLayers.Tile.Image(this, position, bounds, url, this.tileSize);
|
null, this.tileSize);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -181,9 +181,6 @@ OpenLayers.Layer.MapServer.Untiled = OpenLayers.Class(
|
|||||||
//determine new tile size
|
//determine new tile size
|
||||||
this.setTileSize();
|
this.setTileSize();
|
||||||
|
|
||||||
//formulate request url string
|
|
||||||
var url = this.getURL(tileBounds);
|
|
||||||
|
|
||||||
//determine new position (upper left corner of new bounds)
|
//determine new position (upper left corner of new bounds)
|
||||||
var ul = new OpenLayers.LonLat(tileBounds.left, tileBounds.top);
|
var ul = new OpenLayers.LonLat(tileBounds.left, tileBounds.top);
|
||||||
var pos = this.map.getLayerPxFromLonLat(ul);
|
var pos = this.map.getLayerPxFromLonLat(ul);
|
||||||
@@ -197,7 +194,7 @@ OpenLayers.Layer.MapServer.Untiled = OpenLayers.Class(
|
|||||||
this.doneLoading = false;
|
this.doneLoading = false;
|
||||||
if (!this.tile) {
|
if (!this.tile) {
|
||||||
this.tile = new OpenLayers.Tile.Image(this, pos, tileBounds,
|
this.tile = new OpenLayers.Tile.Image(this, pos, tileBounds,
|
||||||
url, this.tileSize);
|
null, this.tileSize);
|
||||||
this.tile.draw();
|
this.tile.draw();
|
||||||
var onload = function() {
|
var onload = function() {
|
||||||
this.doneLoading = true;
|
this.doneLoading = true;
|
||||||
|
|||||||
@@ -116,9 +116,8 @@ OpenLayers.Layer.TMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
* {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
|
* {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
|
||||||
*/
|
*/
|
||||||
addTile:function(bounds,position) {
|
addTile:function(bounds,position) {
|
||||||
var url = this.getURL(bounds);
|
|
||||||
return new OpenLayers.Tile.Image(this, position, bounds,
|
return new OpenLayers.Tile.Image(this, position, bounds,
|
||||||
url, this.tileSize);
|
null, this.tileSize);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -162,9 +162,8 @@ OpenLayers.Layer.WMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
* {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
|
* {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
|
||||||
*/
|
*/
|
||||||
addTile:function(bounds,position) {
|
addTile:function(bounds,position) {
|
||||||
var url = this.getURL(bounds);
|
|
||||||
return new OpenLayers.Tile.Image(this, position, bounds,
|
return new OpenLayers.Tile.Image(this, position, bounds,
|
||||||
url, this.tileSize);
|
null, this.tileSize);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -64,16 +64,8 @@ OpenLayers.Layer.WorldWind = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
* Method: addTile
|
* Method: addTile
|
||||||
*/
|
*/
|
||||||
addTile:function(bounds,position) {
|
addTile:function(bounds,position) {
|
||||||
if (this.map.getResolution() <= (this.lzd/512)
|
return new OpenLayers.Tile.Image(this, position, bounds,
|
||||||
&& this.getZoom() <= this.zoomLevels) {
|
null, this.tileSize);
|
||||||
var url = this.getURL(bounds);
|
|
||||||
return new OpenLayers.Tile.Image(this, position, bounds,
|
|
||||||
url, this.tileSize);
|
|
||||||
} else {
|
|
||||||
return new OpenLayers.Tile.Image(this, position, bounds,
|
|
||||||
OpenLayers.Util.getImagesLocation() + "blank.gif",
|
|
||||||
this.tileSize);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
|
|||||||
*/
|
*/
|
||||||
frame: null,
|
frame: null,
|
||||||
|
|
||||||
/** TBD 3.0 - reorder the parameters to the init function to put URL
|
/** TBD 3.0 - reorder the parameters to the init function to remove
|
||||||
* as last, so we can continue to call tile.initialize()
|
* URL. the getUrl() function on the layer gets called on
|
||||||
* without changing the arguments.
|
* each draw() and moveTo(), so no need to specify it here.
|
||||||
*
|
*
|
||||||
* Constructor: OpenLayers.Tile.Image
|
* Constructor: OpenLayers.Tile.Image
|
||||||
* Constructor for a new <OpenLayers.Tile.Image> instance.
|
* Constructor for a new <OpenLayers.Tile.Image> instance.
|
||||||
@@ -47,14 +47,14 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
|
|||||||
* layer - {<OpenLayers.Layer>} layer that the tile will go in.
|
* layer - {<OpenLayers.Layer>} layer that the tile will go in.
|
||||||
* position - {<OpenLayers.Pixel>}
|
* position - {<OpenLayers.Pixel>}
|
||||||
* bounds - {<OpenLayers.Bounds>}
|
* bounds - {<OpenLayers.Bounds>}
|
||||||
* url - {<String>}
|
* url - {<String>} Deprecated. Remove me in 3.0.
|
||||||
* size - {<OpenLayers.Size>}
|
* size - {<OpenLayers.Size>}
|
||||||
*/
|
*/
|
||||||
initialize: function(layer, position, bounds, url, size) {
|
initialize: function(layer, position, bounds, url, size) {
|
||||||
OpenLayers.Tile.prototype.initialize.apply(this, arguments);
|
OpenLayers.Tile.prototype.initialize.apply(this, arguments);
|
||||||
|
|
||||||
this.url = url;
|
this.url = url; //deprecated remove me
|
||||||
|
|
||||||
this.frame = document.createElement('div');
|
this.frame = document.createElement('div');
|
||||||
this.frame.style.overflow = 'hidden';
|
this.frame.style.overflow = 'hidden';
|
||||||
this.frame.style.position = 'absolute';
|
this.frame.style.position = 'absolute';
|
||||||
|
|||||||
@@ -124,7 +124,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_06_Layer_MapServer_mergeNewParams (t) {
|
function test_06_Layer_MapServer_mergeNewParams (t) {
|
||||||
t.plan( 5 );
|
t.plan( 4 );
|
||||||
|
|
||||||
var map = new OpenLayers.Map("map");
|
var map = new OpenLayers.Map("map");
|
||||||
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
var url = "http://labs.metacarta.com/cgi-bin/mapserv";
|
||||||
@@ -135,8 +135,7 @@
|
|||||||
|
|
||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
map.zoomToMaxExtent();
|
map.zoomToMaxExtent();
|
||||||
t.ok( !layer.grid[0][0].url.match("chickpeas"), "chickpeas is not in URL of first tile in grid" );
|
|
||||||
|
|
||||||
layer.mergeNewParams(newParams);
|
layer.mergeNewParams(newParams);
|
||||||
|
|
||||||
t.eq( layer.params.layers, "sooper", "mergeNewParams() overwrites well");
|
t.eq( layer.params.layers, "sooper", "mergeNewParams() overwrites well");
|
||||||
|
|||||||
@@ -148,7 +148,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_06_Layer_WMS_mergeNewParams (t) {
|
function test_06_Layer_WMS_mergeNewParams (t) {
|
||||||
t.plan( 5 );
|
t.plan( 4 );
|
||||||
|
|
||||||
var map = new OpenLayers.Map("map");
|
var map = new OpenLayers.Map("map");
|
||||||
var url = "http://octo.metacarta.com/cgi-bin/mapserv";
|
var url = "http://octo.metacarta.com/cgi-bin/mapserv";
|
||||||
@@ -159,7 +159,6 @@
|
|||||||
|
|
||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
map.zoomToMaxExtent();
|
map.zoomToMaxExtent();
|
||||||
t.ok( !layer.grid[0][0].url.match("CHICKPEAS"), "CHICKPEAS is not in URL of first tile in grid" );
|
|
||||||
|
|
||||||
layer.mergeNewParams(newParams);
|
layer.mergeNewParams(newParams);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user