OpenLayers OpenLayers

Changeset 6534

Show
Ignore:
Timestamp:
03/16/08 08:21:15 (10 months ago)
Author:
crschmidt
Message:

Add format-level layerOptions configuration property to WMC parser, to support
the configuration of user-preferred layer options in order to allow
configurability of options like buffer, ratio, etc. r=ahocevar (Closes #1411).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/examples/wmc.html

    r6145 r6534  
    2020        OpenLayers.Util.onImageLoadErrorColor = "transparent"; 
    2121         
    22         var format = new OpenLayers.Format.WMC(); 
     22        var format = new OpenLayers.Format.WMC({'layerOptions': {buffer: 0}}); 
    2323        var doc, context, map; 
    2424         
     
    138138        <textarea id="wmc">paste WMC doc here</textarea> 
    139139    <div id="docs"> 
    140             This is an example of parsing WMC documents. 
     140            This is an example of parsing WMC documents. <br /> 
     141            The format class has a layerOptions property, which can be used 
     142            to control the default options of the layer when it is created 
     143            by the parser. 
    141144    </div> 
    142145  </body> 
  • trunk/openlayers/lib/OpenLayers/Format/WMC.js

    r6401 r6534  
    2727     */ 
    2828    version: null, 
     29 
     30    /** 
     31     * Property: layerOptions 
     32     * {Object} Default options for layers created by the parser. These 
     33     *     options are overridden by the options which are read from the  
     34     *     capabilities document. 
     35     */ 
     36    layerOptions: null,  
    2937     
    3038    /** 
  • trunk/openlayers/lib/OpenLayers/Format/WMC/v1.js

    r6358 r6534  
    194194     */ 
    195195    getLayerFromInfo: function(layerInfo) { 
     196        var options = layerInfo.options; 
     197        if (this.layerOptions) { 
     198            OpenLayers.Util.applyDefaults(options, this.layerOptions); 
     199        } 
    196200        var layer = new OpenLayers.Layer.WMS( 
    197201            layerInfo.title, 
    198202            layerInfo.href, 
    199203            layerInfo.params, 
    200             layerInfo.options 
     204            options 
    201205        ); 
    202206        return layer;