OpenLayers OpenLayers

Ticket #678: transparent.patch

File transparent.patch, 3.1 kB (added by euzuro, 1 year ago)

taking sde's patch and applying the same logic to WMS/Untiled. Goodness knows that it is embarrassing and wrong the way those two classes are the same and yet different. but those are the breaks right now. anyways. i've also augmented the wms layer's tests (not those of untiled because there *are* no those of untiled). alas alas. sigh

  • tests/Layer/test_WMS.html

    old new  
    1313                   format: 'image/png'}; 
    1414 
    1515    function test_01_Layer_WMS_constructor (t) { 
    16         t.plan( 4 ); 
     16        t.plan( 10 ); 
    1717 
    1818        var url = "http://octo.metacarta.com/cgi-bin/mapserv"; 
    1919        layer = new OpenLayers.Layer.WMS(name, url, params); 
     
    2323 
    2424        t.eq( layer.params.SERVICE, "WMS", "default params correclty uppercased and copied"); 
    2525 
     26        t.eq(layer.isBaseLayer, true, "no transparency setting, wms is baselayer"); 
    2627 
     28        params.TRANSPARENT = "true"; 
     29        var layer2 = new OpenLayers.Layer.WMS(name, url, params); 
     30        t.eq(layer2.isBaseLayer, false, "transparency == 'true', wms is baselayer"); 
     31 
     32        params.TRANSPARENT = "TRUE"; 
     33        var layer3 = new OpenLayers.Layer.WMS(name, url, params); 
     34        t.eq(layer3.isBaseLayer, false, "transparency == 'TRUE', wms is baselayer"); 
     35 
     36        params.TRANSPARENT = "TRuE"; 
     37        var layer4 = new OpenLayers.Layer.WMS(name, url, params); 
     38        t.eq(layer4.isBaseLayer, true, "transparency == 'TRuE', wms is not baselayer"); 
     39 
     40        params.TRANSPARENT = true; 
     41        var layer5 = new OpenLayers.Layer.WMS(name, url, params); 
     42        t.eq(layer5.isBaseLayer, false, "transparency == true, wms is baselayer"); 
     43 
     44        params.TRANSPARENT = false; 
     45        var layer6 = new OpenLayers.Layer.WMS(name, url, params); 
     46        t.eq(layer6.isBaseLayer, true, "transparency == false, wms is not baselayer"); 
    2747    } 
    2848     
    2949    function test_02_Layer_WMS_addtile (t) { 
  • lib/OpenLayers/Layer/WMS.js

    old new  
    4747        // unless explicitly set in options, if the layer is transparent,  
    4848        // it will be an overlay 
    4949        if (options == null || options.isBaseLayer == null) { 
    50             this.isBaseLayer = ((this.params.TRANSPARENT != "true") &&  
     50            this.isBaseLayer = ((this.params.TRANSPARENT != "TRUE") &&  
     51                                (this.params.TRANSPARENT != "true") &&  
    5152                                (this.params.TRANSPARENT != true)); 
    5253        } 
    5354    },     
  • lib/OpenLayers/Layer/WMS/Untiled.js

    old new  
    5757        // unless explicitly set in options, if the layer is transparent,  
    5858        // it will be an overlay         
    5959        if ((options == null) || (options.isBaseLayer == null)) { 
    60             this.isBaseLayer = ((this.params.TRANSPARENT != "true") &&  
     60            this.isBaseLayer = ((this.params.TRANSPARENT != "TRUE") &&  
     61                                (this.params.TRANSPARENT != "true") &&  
    6162                                (this.params.TRANSPARENT != true)); 
    6263        } 
    6364    },