Changeset 1939

Show
Ignore:
Timestamp:
03/09/10 12:07:06 (5 months ago)
Author:
fvanderbiest
Message:

Measure ux: ability to override default Measure control options

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/fvanderbiest/geoext.ux/ux/Measure/examples/Measure.js

    r1937 r1939  
    77    var measureLength = new GeoExt.ux.MeasureLength({ 
    88        map: map, 
     9        controlOptions: { 
     10            geodesic: true 
     11        }, 
    912        toggleGroup: 'tools' 
    1013    }); 
  • sandbox/fvanderbiest/geoext.ux/ux/Measure/lib/GeoExt.ux/Measure.js

    r1936 r1939  
    2828 
    2929    /** api: config[styleMap] 
    30      *  ``OpenLayers.StyleMap`` Optional StyleMap for the sketches 
     30     *  ``OpenLayers.StyleMap`` Optional StyleMap for the sketches. 
     31     */ 
     32 
     33    /** api: config[controlOptions] 
     34     *  ``Object`` Options for Measure control. 
    3135     */ 
    3236     
     
    5357    constructor: function(handler, config) { 
    5458        config.control = this.buildControl({ 
    55             handler: handler,  
     59            handler: handler, 
     60            options: config.controlOptions || {}, 
    5661            styleMap: config.styleMap || this.styleMap() 
    5762        }); 
    5863        delete config.styleMap; 
     64        delete config.controlOptions; 
    5965        if (typeof(config.template) == "string") { 
    6066            this.template = new Ext.XTemplate(config.template, { 
     
    7783     *         - handler: a reference to the OpenLayers.Handler class. 
    7884     *         - styleMap: an OpenLayers.StyleMap for sketches. 
     85     *         - options: control options to override default ones. 
    7986     * 
    8087     *  :return: ``OpenLayers.Control.Measure`` The configured control. 
     
    8794        }; 
    8895        return new OpenLayers.Control.Measure( 
    89             options.handler,
     96            options.handler, Ext.apply(
    9097                persist: true, 
    9198                eventListeners: listeners, 
     
    95102                    } 
    96103                } 
    97             } 
     104            }, options.options) 
    98105        ); 
    99106    },