update projection processing. if a layer (or the map) declares its projection as 'none' then no SRS parameter is added to the WMS/WFS requests
git-svn-id: http://svn.openlayers.org/trunk/openlayers@960 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -165,7 +165,9 @@ OpenLayers.Layer.WFS.prototype =
|
||||
* @type String
|
||||
*/
|
||||
getFullRequestString:function(newParams) {
|
||||
this.params.SRS = this.map.getProjection();
|
||||
var projection = this.map.getProjection();
|
||||
this.params.SRS = (projection == "none") ? null : projection;
|
||||
|
||||
return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(
|
||||
this, arguments);
|
||||
},
|
||||
|
||||
@@ -132,7 +132,9 @@ OpenLayers.Layer.WMS.prototype =
|
||||
* @type String
|
||||
*/
|
||||
getFullRequestString:function(newParams) {
|
||||
this.params.SRS = this.map.getProjection();
|
||||
var projection = this.map.getProjection();
|
||||
this.params.SRS = (projection == "none") ? null : projection;
|
||||
|
||||
return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(
|
||||
this, arguments);
|
||||
},
|
||||
|
||||
@@ -5,15 +5,16 @@
|
||||
var layer;
|
||||
|
||||
function test_01_Layer_constructor (t) {
|
||||
t.plan( 10 );
|
||||
t.plan( 12 );
|
||||
|
||||
var options = { chicken: 151, foo: "bar" };
|
||||
var options = { chicken: 151, foo: "bar", projection: "none" };
|
||||
var layer = new OpenLayers.Layer('Test Layer', options);
|
||||
|
||||
t.ok( layer instanceof OpenLayers.Layer, "new OpenLayers.Layer returns object" );
|
||||
t.eq( layer.CLASS_NAME, "OpenLayers.Layer", "CLASS_NAME variable set correctly");
|
||||
|
||||
t.eq( layer.name, "Test Layer", "layer.name is correct" );
|
||||
t.ok( layer.projection, "none", "default layer projection correctly set");
|
||||
t.ok( ((layer.chicken == 151) && (layer.foo == "bar")), "layer.options correctly set to Layer Object" );
|
||||
t.ok( ((layer.options["chicken"] == 151) && (layer.options["foo"] == "bar")), "layer.options correctly backed up" );
|
||||
|
||||
@@ -26,6 +27,7 @@
|
||||
layer = new OpenLayers.Layer('Test Layer');
|
||||
t.ok( layer instanceof OpenLayers.Layer, "new OpenLayers.Layer returns object" );
|
||||
t.eq( layer.name, "Test Layer", "layer.name is correct" );
|
||||
t.ok( layer.projection == null, "default layer projection correctly set");
|
||||
t.ok( layer.options instanceof Object, "layer.options correctly initialized as a non-null Object" );
|
||||
}
|
||||
|
||||
|
||||
@@ -133,17 +133,22 @@
|
||||
function test_07_Layer_WMS_getFullRequestString (t) {
|
||||
|
||||
|
||||
t.plan( 1 );
|
||||
t.plan( 2 );
|
||||
|
||||
var map = new OpenLayers.Map('map');
|
||||
map.projection = "xx";
|
||||
tUrl = "http://octo.metacarta.com/cgi-bin/mapserv";
|
||||
tParams = { layers: 'basic',
|
||||
format: 'image/png'};
|
||||
var tLayer = new OpenLayers.Layer.WMS(name, tUrl, tParams, null);
|
||||
var tLayer = new OpenLayers.Layer.WMS(name, tUrl, tParams);
|
||||
map.addLayer(tLayer);
|
||||
str = tLayer.getFullRequestString();
|
||||
t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?LAYERS=basic&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=xx", "getFullRequestString() adds SRS value");
|
||||
|
||||
tLayer.projection = "none";
|
||||
str = tLayer.getFullRequestString();
|
||||
t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?LAYERS=basic&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage", "getFullRequestString() by default does *not* add SRS value if projection is 'none'");
|
||||
|
||||
}
|
||||
|
||||
function test_99_Layer_WMS_destroy (t) {
|
||||
|
||||
Reference in New Issue
Block a user