getFullRequestString fails when layer has no projection, r=ahocevar (closes #3244)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11867 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -237,7 +237,7 @@ OpenLayers.Layer.WMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
*/
|
*/
|
||||||
getFullRequestString:function(newParams, altUrl) {
|
getFullRequestString:function(newParams, altUrl) {
|
||||||
var mapProjection = this.map.getProjectionObject();
|
var mapProjection = this.map.getProjectionObject();
|
||||||
var projectionCode = this.projection.equals(mapProjection) ?
|
var projectionCode = this.projection && this.projection.equals(mapProjection) ?
|
||||||
this.projection.getCode() :
|
this.projection.getCode() :
|
||||||
mapProjection.getCode();
|
mapProjection.getCode();
|
||||||
var value = (projectionCode == "none") ? null : projectionCode;
|
var value = (projectionCode == "none") ? null : projectionCode;
|
||||||
|
|||||||
+15
-1
@@ -229,7 +229,7 @@
|
|||||||
function test_Layer_WMS_getFullRequestString (t) {
|
function test_Layer_WMS_getFullRequestString (t) {
|
||||||
|
|
||||||
|
|
||||||
t.plan( 3 );
|
t.plan( 4 );
|
||||||
var map = new OpenLayers.Map('map');
|
var map = new OpenLayers.Map('map');
|
||||||
map.projection = "xx";
|
map.projection = "xx";
|
||||||
var tUrl = "http://octo.metacarta.com/cgi-bin/mapserv";
|
var tUrl = "http://octo.metacarta.com/cgi-bin/mapserv";
|
||||||
@@ -271,6 +271,20 @@
|
|||||||
"getFullRequestString() uses the layer projection if it equals the map projection");
|
"getFullRequestString() uses the layer projection if it equals the map projection");
|
||||||
map.destroy();
|
map.destroy();
|
||||||
|
|
||||||
|
map = new OpenLayers.Map("map", {projection: "EPSG:4326"});
|
||||||
|
map.addLayer(new OpenLayers.Layer(null, {isBaseLayer: true}));
|
||||||
|
tLayer = new OpenLayers.Layer.WMS(name, tUrl);
|
||||||
|
tLayer.map = map;
|
||||||
|
var error;
|
||||||
|
try {
|
||||||
|
tLayer.getFullRequestString();
|
||||||
|
error = false;
|
||||||
|
} catch(err) {
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
t.ok(!error, "no error on getFullRequestString if layer has no projection");
|
||||||
|
map.destroy();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_Layer_WMS_setOpacity (t) {
|
function test_Layer_WMS_setOpacity (t) {
|
||||||
|
|||||||
Reference in New Issue
Block a user