1 /* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
 
   2  * See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
 
   3  * text of the license. */
 
   4 // @require: OpenLayers/Layer/Grid.js
 
   8 OpenLayers.Layer.WMS = Class.create();
 
   9 OpenLayers.Layer.WMS.prototype = 
 
  10   Object.extend( new OpenLayers.Layer.Grid(), {
 
  12     /** @final @type hash */
 
  13     DEFAULT_PARAMS: { service: "WMS",
 
  17                       exceptions: "application/vnd.ogc.se_inimage",
 
  26     * @param {hash} params
 
  28     initialize: function(name, url, params) {
 
  29         var newArguments = new Array();
 
  30         if (arguments.length > 0) {
 
  32             params = OpenLayers.Util.upperCaseObject(params);
 
  33             newArguments.push(name, url, params);
 
  35         OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
 
  37         if (arguments.length > 0) {
 
  38             OpenLayers.Util.applyDefaults(
 
  40                            OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)
 
  46     /** WFS layer is never a base class. 
 
  49     isBaseLayer: function() {
 
  50         return (this.params.TRANSPARENT != 'true');
 
  54     * @param {String} name
 
  55     * @param {hash} params
 
  57     * @returns A clone of this OpenLayers.Layer.WMS, with the passed-in
 
  58     *          parameters merged in.
 
  59     * @type OpenLayers.Layer.WMS
 
  61     clone: function (name, params) {
 
  62         var mergedParams = {};
 
  63         Object.extend(mergedParams, this.params);
 
  64         Object.extend(mergedParams, params);
 
  65         var obj = new OpenLayers.Layer.WMS(name, this.url, mergedParams);
 
  66         obj.setTileSize(this.tileSize);
 
  71     * addTile creates a tile, initializes it (via 'draw' in this case), and 
 
  72     * adds it to the layer div. 
 
  74     * @param {OpenLayers.Bounds} bounds
 
  76     * @returns The added OpenLayers.Tile.Image
 
  77     * @type OpenLayers.Tile.Image
 
  79     addTile:function(bounds,position) {
 
  80         url = this.getFullRequestString(
 
  81                      {BBOX:bounds.toBBOX(),
 
  82                       WIDTH:this.tileSize.w,
 
  83                       HEIGHT:this.tileSize.h});
 
  85         return new OpenLayers.Tile.Image(this, position, bounds, 
 
  89     /** @final @type String */
 
  90     CLASS_NAME: "OpenLayers.Layer.WMS"