make sure we do not fail if OpenLayers.Projection.defaults has not been set for a custom projection
This commit is contained in:
@@ -177,7 +177,8 @@ OpenLayers.Layer.WMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
reverseAxisOrder: function() {
|
reverseAxisOrder: function() {
|
||||||
var projCode = this.projection.getCode();
|
var projCode = this.projection.getCode();
|
||||||
return parseFloat(this.params.VERSION) >= 1.3 &&
|
return parseFloat(this.params.VERSION) >= 1.3 &&
|
||||||
!!(this.yx[projCode] || OpenLayers.Projection.defaults[projCode].yx);
|
!!(this.yx[projCode] || (OpenLayers.Projection.defaults[projCode] &&
|
||||||
|
OpenLayers.Projection.defaults[projCode].yx));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -423,6 +423,26 @@
|
|||||||
t.ok( layer.grid == null, "grid set to null");
|
t.ok( layer.grid == null, "grid set to null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_customProjection(t) {
|
||||||
|
t.plan(1);
|
||||||
|
var map = new OpenLayers.Map('map', {
|
||||||
|
units: 'm',
|
||||||
|
projection: new OpenLayers.Projection('EPSG:28992'),
|
||||||
|
maxExtent: new OpenLayers.Bounds(0, 300000, 300000, 6250000)
|
||||||
|
});
|
||||||
|
var layer = new OpenLayers.Layer.WMS(null, url, {layers: 'mylayer', version: '1.3.0'});
|
||||||
|
map.addLayer(layer);
|
||||||
|
var error = false;
|
||||||
|
try {
|
||||||
|
map.setCenter(new OpenLayers.LonLat(100000,300000), 5);
|
||||||
|
} catch(err) {
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
t.ok(!error, "no error on getURL if layer has a custom projection and no defaults defined");
|
||||||
|
layer.destroy();
|
||||||
|
map.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
function test_Layer_WMS_v13(t) {
|
function test_Layer_WMS_v13(t) {
|
||||||
|
|
||||||
t.plan(6);
|
t.plan(6);
|
||||||
|
|||||||
Reference in New Issue
Block a user