OpenLayers OpenLayers

Ticket #653: defaultParams.patch

File defaultParams.patch, 1.1 kB (added by euzuro, 2 years ago)
  • lib/OpenLayers/Layer/HTTPRequest.js

    old new  
    1919     */ 
    2020    URL_HASH_FACTOR: (Math.sqrt(5) - 1) / 2, 
    2121 
     22    /** @final @type Object */ 
     23    DEFAULT_PARAMS: null, 
     24 
    2225    /** This is either an array of url strings or a single url string.  
    2326     *  
    2427     * @type Array(String) or String */ 
     
    5154        newArguments = [name, options]; 
    5255        OpenLayers.Layer.prototype.initialize.apply(this, newArguments); 
    5356        this.url = url; 
    54         this.params = OpenLayers.Util.extend( new Object(), params); 
     57 
     58      //Set Params 
     59      //  
     60 
     61        //if 'params' is already set, let it be. A subclass might be setting  
     62        // these before calling this initialize. 
     63        if (this.params == null) { 
     64            this.params = new Object(); 
     65        } 
     66 
     67        //add default params 
     68        OpenLayers.Util.extend(this.params, this.DEFAULT_PARAMS); 
     69 
     70        //add argument params 
     71        OpenLayers.Util.extend(this.params, params); 
    5572    }, 
    5673 
    5774    /**