OpenLayers OpenLayers

Ticket #562: MapServer.js.2.patch

File MapServer.js.2.patch, 2.8 kB (added by crschmidt, 2 years ago)

non-reversed version of paul's patch

  • MapServer.js

    old new  
    2323    * @param {str} url 
    2424    * @param {hash} params 
    2525    */ 
    26     initialize: function(name, url, params) { 
     26    initialize: function(name, url, params, options) { 
    2727        var newArguments = new Array(); 
    28         //uppercase params 
    29         params = OpenLayers.Util.upperCaseObject(params); 
    30         newArguments.push(name, url, params); 
     28        newArguments.push(name, url, params, options); 
    3129        OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments); 
    3230 
    3331        if (arguments.length > 0) { 
    3432            OpenLayers.Util.applyDefaults( 
    3533                           this.params, 
    36                            OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS) 
     34                           this.DEFAULT_PARAMS 
    3735                           ); 
    3836        } 
    39     }, 
    4037 
    41  
    42     /**  
    43      * @type Boolean 
    44      */ 
    45     isBaseLayer: function() { 
    46         return (this.params.TRANSPARENT != 'true'); 
     38        // unless explicitly set in options, if the layer is transparent,  
     39        // it will be an overlay 
     40        if (options == null || options.isBaseLayer == null) { 
     41            this.isBaseLayer = ((this.params.transparent != "true") &&  
     42                                (this.params.transparent != true)); 
     43        } 
    4744    }, 
    4845 
    49     /** 
    50     * @param {String} name 
    51     * @param {hash} params 
     46    /** 
     47    * @param {Object} obj 
    5248    * 
    53     * @returns A clone of this OpenLayers.Layer.MapServer, with the passed-in 
    54     *          parameters merged in. 
     49    * @returns A clone of this OpenLayers.Layer.MapServer 
    5550    * @type OpenLayers.Layer.MapServer 
    5651    */ 
    57     clone: function (name, params) { 
    58         var mergedParams = {}; 
    59         OpenLayers.Util.extend(mergedParams, this.params); 
    60         OpenLayers.Util.extend(mergedParams, params); 
    61         var obj = new OpenLayers.Layer.MapServer(name, this.url, mergedParams); 
    62         obj.setTileSize(this.tileSize); 
     52    clone: function (obj) { 
     53        if (obj == null) { 
     54            obj = new OpenLayers.Layer.MapServer(this.name, 
     55                                           this.url, 
     56                                           this.params, 
     57                                           this.options); 
     58        } 
     59        //get all additions from superclasses 
     60        obj = OpenLayers.Layer.Grid.prototype.clone.apply(this, [obj]); 
     61 
     62        // copy/set any non-init, non-simple values here 
     63 
    6364        return obj; 
    6465    }, 
    6566 
     
    7677        var url = this.getURL(bounds); 
    7778        return new OpenLayers.Tile.Image(this, position, bounds, url, this.tileSize); 
    7879    }, 
    79          
     80     
    8081    /** 
    8182     * @param {OpenLayers.Bounds} bounds 
    8283     *