Add MapServer layer fixes and tests. Paul wrote these tests (yay Paul!), and

found all the bugs. This fixes #545, #546, #547, #548 and #562.    


git-svn-id: http://svn.openlayers.org/trunk/openlayers@2893 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-03-25 21:35:12 +00:00
parent 75425b9cd4
commit eb13974c5e
3 changed files with 276 additions and 25 deletions

View File

@@ -23,43 +23,44 @@ OpenLayers.Layer.MapServer.prototype =
* @param {str} url
* @param {hash} params
*/
initialize: function(name, url, params) {
initialize: function(name, url, params, options) {
var newArguments = new Array();
//uppercase params
params = OpenLayers.Util.upperCaseObject(params);
newArguments.push(name, url, params);
newArguments.push(name, url, params, options);
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
if (arguments.length > 0) {
OpenLayers.Util.applyDefaults(
this.params,
OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)
this.DEFAULT_PARAMS
);
}
// unless explicitly set in options, if the layer is transparent,
// it will be an overlay
if (options == null || options.isBaseLayer == null) {
this.isBaseLayer = ((this.params.transparent != "true") &&
(this.params.transparent != true));
}
},
/**
* @type Boolean
*/
isBaseLayer: function() {
return (this.params.TRANSPARENT != 'true');
},
/**
* @param {String} name
* @param {hash} params
/**
* @param {Object} obj
*
* @returns A clone of this OpenLayers.Layer.MapServer, with the passed-in
* parameters merged in.
* @returns A clone of this OpenLayers.Layer.MapServer
* @type OpenLayers.Layer.MapServer
*/
clone: function (name, params) {
var mergedParams = {};
OpenLayers.Util.extend(mergedParams, this.params);
OpenLayers.Util.extend(mergedParams, params);
var obj = new OpenLayers.Layer.MapServer(name, this.url, mergedParams);
obj.setTileSize(this.tileSize);
clone: function (obj) {
if (obj == null) {
obj = new OpenLayers.Layer.MapServer(this.name,
this.url,
this.params,
this.options);
}
//get all additions from superclasses
obj = OpenLayers.Layer.Grid.prototype.clone.apply(this, [obj]);
// copy/set any non-init, non-simple values here
return obj;
},
@@ -76,7 +77,7 @@ OpenLayers.Layer.MapServer.prototype =
var url = this.getURL(bounds);
return new OpenLayers.Tile.Image(this, position, bounds, url, this.tileSize);
},
/**
* @param {OpenLayers.Bounds} bounds
*