modify Grid to use HTTPRequest, update WMS & WFS with their necessary specifications -- capitalizing all parameters and adding SRS param from getProjection()
git-svn-id: http://svn.openlayers.org/trunk/openlayers@888 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -4,14 +4,9 @@
|
||||
// @require: OpenLayers/Layer.js
|
||||
// @require: OpenLayers/Util.js
|
||||
OpenLayers.Layer.Grid = Class.create();
|
||||
OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
|
||||
OpenLayers.Layer.Grid.prototype =
|
||||
Object.extend( new OpenLayers.Layer.HTTPRequest(), {
|
||||
|
||||
// str: url
|
||||
url: null,
|
||||
|
||||
// hash: params
|
||||
params: null,
|
||||
|
||||
// tileSize: OpenLayers.Size
|
||||
tileSize: null,
|
||||
|
||||
@@ -30,23 +25,17 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
|
||||
* @param {Object} options Hash of extra options to tag onto the layer
|
||||
*/
|
||||
initialize: function(name, url, params, options) {
|
||||
var newArguments = arguments;
|
||||
if (arguments.length > 0) {
|
||||
newArguments = [name, options];
|
||||
}
|
||||
OpenLayers.Layer.prototype.initialize.apply(this, newArguments);
|
||||
this.url = url;
|
||||
this.params = params;
|
||||
OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,
|
||||
arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
destroy: function() {
|
||||
this.params = null;
|
||||
this.clearGrid();
|
||||
this.grid = null;
|
||||
OpenLayers.Layer.prototype.destroy.apply(this, arguments);
|
||||
OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this, arguments);
|
||||
},
|
||||
|
||||
/** When the layer is added to a map, then we can ask the map for
|
||||
@@ -55,7 +44,7 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
|
||||
* @param {OpenLayers.Map} map
|
||||
*/
|
||||
setMap: function(map) {
|
||||
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
|
||||
OpenLayers.Layer.HTTPRequest.prototype.setMap.apply(this, arguments);
|
||||
if (this.tileSize == null) {
|
||||
this.tileSize = this.map.getTileSize();
|
||||
}
|
||||
@@ -243,40 +232,7 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
|
||||
}
|
||||
}
|
||||
},
|
||||
/** combine the ds's serverPath with its params and the tile's params.
|
||||
*
|
||||
* does checking on the serverPath variable, allowing for cases when it
|
||||
* is supplied with trailing ? or &, as well as cases where not.
|
||||
*
|
||||
* return in formatted string like this:
|
||||
* "server?key1=value1&key2=value2&key3=value3"
|
||||
*
|
||||
* @return {str}
|
||||
*/
|
||||
getFullRequestString:function(params) {
|
||||
var requestString = "";
|
||||
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);
|
||||
|
||||
var server = this.url;
|
||||
var lastServerChar = server.charAt(server.length - 1);
|
||||
|
||||
if ((lastServerChar == "&") || (lastServerChar == "?")) {
|
||||
requestString = server + paramsString;
|
||||
} else {
|
||||
if (server.indexOf('?') == -1) {
|
||||
//serverPath has no ? -- add one
|
||||
requestString = server + '?' + paramsString;
|
||||
} else {
|
||||
//serverPath contains ?, so must already have paramsString at the end
|
||||
requestString = server + '&' + paramsString;
|
||||
}
|
||||
}
|
||||
return requestString;
|
||||
},
|
||||
|
||||
/** go through and remove all tiles from the grid, calling
|
||||
* destroy() on each of them to kill circular references
|
||||
*
|
||||
@@ -310,15 +266,6 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
|
||||
// Should be implemented by subclasses
|
||||
},
|
||||
|
||||
/**
|
||||
* changeParams is designed to allow you to change the
|
||||
* parameters of a layer after it's created.
|
||||
* @param {Object} params Hash of new params to use
|
||||
*/
|
||||
changeParams:function(params) {
|
||||
this.params = Object.extend(this.params, OpenLayers.Util.upperCaseObject(params));
|
||||
this._initTiles();
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns Degrees per Pixel
|
||||
|
||||
Reference in New Issue
Block a user