Merge pull request #767 from bartvde/projdefaults

make sure we do not fail if OpenLayers.Projection.defaults has not been set (r=@ahocevar) thanks @pvgenuchten for the report
This commit is contained in:
Bart van den Eijnden
2012-11-23 06:08:32 -08:00
2 changed files with 22 additions and 1 deletions

View File

@@ -177,7 +177,8 @@ OpenLayers.Layer.WMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
reverseAxisOrder: function() {
var projCode = this.projection.getCode();
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));
},
/**

View File

@@ -423,6 +423,26 @@
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) {
t.plan(6);