pass the position in as parameter on new tile creation. remove unnecessary setPosition() function, as tiles no longer really get moved. they get drawn in their div and then the div moves around. no need to make that any more complicated. update tests for that. Also, finish renaming 'grid' to 'layer' (from r369).
git-svn-id: http://svn.openlayers.org/trunk/openlayers@390 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -66,7 +66,8 @@ OpenLayers.Layer.WFS.prototype =
|
||||
addTile:function(bounds, position) {
|
||||
url = this.getFullRequestString(
|
||||
{ bbox:bounds.toBBOX() });
|
||||
var tile = new OpenLayers.Tile.WFS(this, bounds, url, this.tileSize);
|
||||
var tile = new OpenLayers.Tile.WFS(this, position, bounds,
|
||||
url, this.tileSize);
|
||||
tile.draw();
|
||||
return tile;
|
||||
},
|
||||
|
||||
@@ -58,9 +58,9 @@ OpenLayers.Layer.WMS.prototype =
|
||||
{bbox:bounds.toBBOX(),
|
||||
width:this.tileSize.w,
|
||||
height:this.tileSize.h});
|
||||
var tile = new OpenLayers.Tile.Image(this, bounds, url, this.tileSize);
|
||||
var tile = new OpenLayers.Tile.Image(this, position, bounds,
|
||||
url, this.tileSize);
|
||||
tile.draw();
|
||||
tile.setPosition(position);
|
||||
this.div.appendChild(tile.img);
|
||||
return tile;
|
||||
},
|
||||
|
||||
+4
-11
@@ -30,15 +30,17 @@ OpenLayers.Tile.prototype = {
|
||||
* @constructor
|
||||
*
|
||||
* @param {OpenLayers.Layer} layer
|
||||
* @param {OpenLayers.Pixel} position
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
* @param {String} url
|
||||
* @param {OpenLayers.Size} size
|
||||
*/
|
||||
initialize: function(layer, bounds, url, size) {
|
||||
initialize: function(layer, position, bounds, url, size) {
|
||||
if (arguments.length > 0) {
|
||||
this.layer = layer;
|
||||
this.url = url;
|
||||
this.position = position;
|
||||
this.bounds = bounds;
|
||||
this.url = url;
|
||||
this.size = size;
|
||||
}
|
||||
},
|
||||
@@ -67,15 +69,6 @@ OpenLayers.Tile.prototype = {
|
||||
remove:function() {
|
||||
},
|
||||
|
||||
/** This should be overridden by subclasses if they have special needs
|
||||
*
|
||||
* @param OpenLayers.Pixel
|
||||
*/
|
||||
setPosition:function(pixel) {
|
||||
this.position = pixel;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* @type OpenLayers.Pixel
|
||||
*/
|
||||
|
||||
@@ -12,12 +12,13 @@ OpenLayers.Tile.Image.prototype =
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {OpenLayers.Grid} grid
|
||||
* @param {OpenLayers.Grid} layer
|
||||
* @param {OpenLayers.Pixel} position
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
* @param {String} url
|
||||
* @param {OpenLayers.Size} size
|
||||
*/
|
||||
initialize: function(grid, bounds, url, size) {
|
||||
initialize: function(layer, position, bounds, url, size) {
|
||||
OpenLayers.Tile.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
|
||||
@@ -26,25 +27,12 @@ OpenLayers.Tile.Image.prototype =
|
||||
draw:function() {
|
||||
OpenLayers.Tile.prototype.draw.apply(this, arguments);
|
||||
this.img = OpenLayers.Util.createImage(null,
|
||||
null,
|
||||
this.position,
|
||||
this.size,
|
||||
this.url,
|
||||
"absolute");
|
||||
},
|
||||
|
||||
/**
|
||||
* @param OpenLayers.Pixel
|
||||
*/
|
||||
setPosition:function(pixel) {
|
||||
OpenLayers.Tile.prototype.setPosition.apply(this, arguments);
|
||||
|
||||
//update the image's location
|
||||
if (this.img) {
|
||||
this.img.style.top = this.position.y + "px";
|
||||
this.img.style.left = this.position.x + "px";
|
||||
}
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
CLASS_NAME: "OpenLayers.Tile.Image"
|
||||
}
|
||||
|
||||
@@ -16,12 +16,13 @@ OpenLayers.Tile.WFS.prototype =
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {OpenLayers.Grid} grid
|
||||
* @param {OpenLayers.Layer} layer
|
||||
* @param {OpenLayers.Pixel} position
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
* @param {String} url
|
||||
* @param {OpenLayers.Size} size
|
||||
*/
|
||||
initialize: function(grid, bounds, url, size) {
|
||||
initialize: function(layer, position, bounds, url, size) {
|
||||
OpenLayers.Tile.prototype.initialize.apply(this, arguments);
|
||||
|
||||
this.markers = new Array();
|
||||
@@ -37,12 +38,6 @@ OpenLayers.Tile.WFS.prototype =
|
||||
this.loadFeaturesForRegion("requestSuccess");
|
||||
},
|
||||
|
||||
/**
|
||||
* @param OpenLayers.Pixel
|
||||
*/
|
||||
setPosition:function(pixel) {
|
||||
this.position = pixel;
|
||||
},
|
||||
|
||||
/** get the full request string from the ds and the tile params
|
||||
* and call the AJAX loadURL().
|
||||
|
||||
Reference in New Issue
Block a user