bringing all changes from sandbox/euzuro/LayersReworking down into the trunk. this is a merge of r656:HEAD http://svn.openlayers.org/sandbox/euzuro/LayersReworking

git-svn-id: http://svn.openlayers.org/trunk/openlayers@806 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-06-27 23:16:26 +00:00
parent 63bd624827
commit ff0e83d0a0
24 changed files with 1262 additions and 467 deletions
+26 -12
View File
@@ -4,8 +4,6 @@
// @require: OpenLayers/Layer.js
// @require: OpenLayers/Util.js
OpenLayers.Layer.Grid = Class.create();
OpenLayers.Layer.Grid.TILE_WIDTH = 256;
OpenLayers.Layer.Grid.TILE_HEIGHT = 256;
OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
// str: url
@@ -25,17 +23,16 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
* @param {str} name
* @param {str} url
* @param {hash} params
* @param {Object} options Hash of extra options to tag onto the layer
*/
initialize: function(name, url, params) {
initialize: function(name, url, params, options) {
var newArguments = arguments;
if (arguments.length > 0) {
newArguments = [name];
newArguments = [name, options];
}
OpenLayers.Layer.prototype.initialize.apply(this, newArguments);
this.url = url;
this.params = params;
this.tileSize = new OpenLayers.Size(OpenLayers.Layer.Grid.TILE_WIDTH,
OpenLayers.Layer.Grid.TILE_HEIGHT);
},
/**
@@ -48,18 +45,33 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
OpenLayers.Layer.prototype.destroy.apply(this, arguments);
},
/** When the layer is added to a map, then we can ask the map for
* its default tile size
*
* @param {OpenLayers.Map} map
*/
setMap: function(map) {
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
if (this.tileSize == null) {
this.tileSize = this.map.getTileSize();
}
},
/**
* @deprecated User should just set the 'tileSize' via options
*/
setTileSize: function (size) {
this.tileSize = size.copyOf();
},
/**
* moveTo
* moveTo is a function called whenever the map is moved. All the moving
/** This function is called whenever the map is moved. All the moving
* of actual 'tiles' is done by the map, but moveTo's role is to accept
* a bounds and make sure the data that that bounds requires is pre-loaded.
*
* @param {OpenLayers.Bounds}
* @param {Boolean} zoomChanged
*/
moveTo:function(bounds,zoomChanged) {
moveTo:function(bounds, zoomChanged) {
if (!this.getVisibility()) {
if (zoomChanged) {
this.grid = null;
@@ -84,6 +96,8 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
}
}
},
getGridBounds:function() {
var topLeftTile = this.grid[0][0];
var bottomRightTile = this.grid[this.grid.length-1][this.grid[0].length-1];
@@ -106,7 +120,7 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
var viewSize = this.map.getSize();
var bounds = this.map.getExtent();
var extent = this.map.getFullExtent();
var extent = this.map.getMaxExtent();
var resolution = this.map.getResolution();
var tilelon = resolution*this.tileSize.w;
var tilelat = resolution*this.tileSize.h;
@@ -236,7 +250,7 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
*/
getFullRequestString:function(params) {
var requestString = "";
this.params.SRS = this.map.projection;
this.params.SRS = this.map.getProjection();
// concat tile params with layer params and convert to string
var allParams = Object.extend(this.params, params);
var paramsString = OpenLayers.Util.getParameterString(allParams);