Merge all changes from the naturaldocs sandbox. This brings all the work that
has been done in the NaturalDocs branch back to trunk. Thanks to everyone who helped out in making this happen. (I could list people, but the list would be long, and I'm already mentally on vacation.) git-svn-id: http://svn.openlayers.org/trunk/openlayers@3545 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -4,17 +4,25 @@
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer/Grid.js
|
||||
* @requires OpenLayers/Tile/Image.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.WMS
|
||||
* Instances of OpenLayers.Layer.WMS are used to display data from OGC Web
|
||||
* Mapping Services. Create a new WMS layer with the <OpenLayers.Layer.WMS>
|
||||
* constructor.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Layer.Grid>
|
||||
*/
|
||||
OpenLayers.Layer.WMS = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.WMS.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer.Grid, {
|
||||
|
||||
/** Hashtable of default parameter key/value pairs
|
||||
* @final @type Object */
|
||||
/**
|
||||
* Constant: DEFAULT_PARAMS
|
||||
* {Object} Hashtable of default parameter key/value pairs
|
||||
*/
|
||||
DEFAULT_PARAMS: { service: "WMS",
|
||||
version: "1.1.1",
|
||||
request: "GetMap",
|
||||
@@ -23,16 +31,34 @@ OpenLayers.Layer.WMS.prototype =
|
||||
format: "image/jpeg"
|
||||
},
|
||||
|
||||
/**
|
||||
* Property: reproject
|
||||
* {Boolean} Try to reproject this layer if its coordinate reference system
|
||||
* is different than that of the base layer. Default is true.
|
||||
* Set this in the layer options. Should be set to false in
|
||||
* most cases.
|
||||
*/
|
||||
reproject: true,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} url
|
||||
* @param {Object} params
|
||||
* @param {Object} options Hashtable of extra options to tag onto the layer
|
||||
*/
|
||||
* Constructor: OpenLayers.Layer.WMS
|
||||
* Create a new WMS layer object
|
||||
*
|
||||
* Example:
|
||||
* (code)
|
||||
* var wms = new OpenLayers.Layer.WMS("NASA Global Mosaic",
|
||||
* "http://wms.jpl.nasa.gov/wms.cgi",
|
||||
* {layers: "modis,global_mosaic"});
|
||||
* (end)
|
||||
*
|
||||
* Parameters:
|
||||
* name - {String} A name for the layer
|
||||
* url - {String} Base url for the WMS
|
||||
* (e.g. http://wms.jpl.nasa.gov/wms.cgi)
|
||||
* params - {Object} An object with key/value pairs representing the
|
||||
* GetMap query string parameters and parameter values.
|
||||
* options - {Ojbect} Hashtable of extra options to tag onto the layer
|
||||
*/
|
||||
initialize: function(name, url, params, options) {
|
||||
var newArguments = new Array();
|
||||
//uppercase params
|
||||
@@ -54,7 +80,8 @@ OpenLayers.Layer.WMS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* Method: destroy
|
||||
* Destroy this layer
|
||||
*/
|
||||
destroy: function() {
|
||||
// for now, nothing special to do here.
|
||||
@@ -63,10 +90,11 @@ OpenLayers.Layer.WMS.prototype =
|
||||
|
||||
|
||||
/**
|
||||
* @param {Object} obj
|
||||
*
|
||||
* @returns An exact clone of this OpenLayers.Layer.WMS
|
||||
* @type OpenLayers.Layer.WMS
|
||||
* Method: clone
|
||||
* Create a clone of this layer
|
||||
*
|
||||
* Return:
|
||||
* {<OpenLayers.Layer.WMS>} An exact clone of this layer
|
||||
*/
|
||||
clone: function (obj) {
|
||||
|
||||
@@ -86,12 +114,17 @@ OpenLayers.Layer.WMS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
*
|
||||
* @returns A string with the layer's url and parameters and also the
|
||||
* passed-in bounds and appropriate tile size specified as
|
||||
* parameters
|
||||
* @type String
|
||||
* Method: getURL
|
||||
* Return a GetMap query string for this layer
|
||||
*
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>} A bounds representing the bbox for the
|
||||
* request.
|
||||
*
|
||||
* Return:
|
||||
* {String} A string with the layer's url and parameters and also the
|
||||
* passed-in bounds and appropriate tile size specified as
|
||||
* parameters.
|
||||
*/
|
||||
getURL: function (bounds) {
|
||||
bounds = this.adjustBounds(bounds);
|
||||
@@ -102,14 +135,15 @@ OpenLayers.Layer.WMS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* addTile creates a tile, initializes it, and
|
||||
* adds it to the layer div.
|
||||
*
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
*
|
||||
* @returns The added OpenLayers.Tile.Image
|
||||
* @type OpenLayers.Tile.Image
|
||||
*/
|
||||
* Method: addTile
|
||||
* addTile creates a tile, initializes it, and adds it to the layer div.
|
||||
*
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
*
|
||||
* Return:
|
||||
* {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
|
||||
*/
|
||||
addTile:function(bounds,position) {
|
||||
var url = this.getURL(bounds);
|
||||
return new OpenLayers.Tile.Image(this, position, bounds,
|
||||
@@ -117,12 +151,14 @@ OpenLayers.Layer.WMS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: mergeNewParams
|
||||
* Catch changeParams and uppercase the new params to be merged in
|
||||
* before calling changeParams on the super class.
|
||||
* before calling changeParams on the super class.
|
||||
*
|
||||
* Once params have been changed, we will need to re-init our tiles
|
||||
* Once params have been changed, we will need to re-init our tiles.
|
||||
*
|
||||
* @param {Object} newParams Hashtable of new params to use
|
||||
* Parameters:
|
||||
* newParams - {Object} Hashtable of new params to use
|
||||
*/
|
||||
mergeNewParams:function(newParams) {
|
||||
var upperParams = OpenLayers.Util.upperCaseObject(newParams);
|
||||
@@ -131,16 +167,20 @@ OpenLayers.Layer.WMS.prototype =
|
||||
newArguments);
|
||||
},
|
||||
|
||||
/** combine the layer's url with its params and these newParams.
|
||||
*
|
||||
* Add the SRS parameter from projection -- this is probably
|
||||
* more eloquently done via a setProjection() method, but this
|
||||
* works for now and always.
|
||||
*
|
||||
* @param {Object} newParams
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
/**
|
||||
* Method: getFullRequestString
|
||||
* Combine the layer's url with its params and these newParams.
|
||||
*
|
||||
* Add the SRS parameter from projection -- this is probably
|
||||
* more eloquently done via a setProjection() method, but this
|
||||
* works for now and always.
|
||||
*
|
||||
* Parameters:
|
||||
* newParams - {Object}
|
||||
*
|
||||
* Return:
|
||||
* {String}
|
||||
*/
|
||||
getFullRequestString:function(newParams) {
|
||||
var projection = this.map.getProjection();
|
||||
this.params.SRS = (projection == "none") ? null : projection;
|
||||
|
||||
Reference in New Issue
Block a user