[Commits] r1939 - in sandbox/fvanderbiest/geoext.ux/ux/Measure: examples lib/GeoExt.ux

commits at geoext.org commits at geoext.org
Tue Mar 9 12:07:07 CET 2010


Author: fvanderbiest
Date: 2010-03-09 12:07:06 +0100 (Tue, 09 Mar 2010)
New Revision: 1939

Modified:
   sandbox/fvanderbiest/geoext.ux/ux/Measure/examples/Measure.js
   sandbox/fvanderbiest/geoext.ux/ux/Measure/lib/GeoExt.ux/Measure.js
Log:
Measure ux: ability to override default Measure control options

Modified: sandbox/fvanderbiest/geoext.ux/ux/Measure/examples/Measure.js
===================================================================
--- sandbox/fvanderbiest/geoext.ux/ux/Measure/examples/Measure.js	2010-03-09 10:51:49 UTC (rev 1938)
+++ sandbox/fvanderbiest/geoext.ux/ux/Measure/examples/Measure.js	2010-03-09 11:07:06 UTC (rev 1939)
@@ -6,6 +6,9 @@
 
     var measureLength = new GeoExt.ux.MeasureLength({
         map: map,
+        controlOptions: {
+            geodesic: true
+        },
         toggleGroup: 'tools'
     });
 

Modified: sandbox/fvanderbiest/geoext.ux/ux/Measure/lib/GeoExt.ux/Measure.js
===================================================================
--- sandbox/fvanderbiest/geoext.ux/ux/Measure/lib/GeoExt.ux/Measure.js	2010-03-09 10:51:49 UTC (rev 1938)
+++ sandbox/fvanderbiest/geoext.ux/ux/Measure/lib/GeoExt.ux/Measure.js	2010-03-09 11:07:06 UTC (rev 1939)
@@ -27,8 +27,12 @@
 GeoExt.ux.Measure = Ext.extend(GeoExt.Action, {
 
     /** api: config[styleMap]
-     *  ``OpenLayers.StyleMap`` Optional StyleMap for the sketches
+     *  ``OpenLayers.StyleMap`` Optional StyleMap for the sketches.
      */
+
+    /** api: config[controlOptions]
+     *  ``Object`` Options for Measure control.
+     */
     
     /** private: property[tip]
      *  ``Ext.Tip`` The displayed tip.
@@ -52,10 +56,12 @@
      */
     constructor: function(handler, config) {
         config.control = this.buildControl({
-            handler: handler, 
+            handler: handler,
+            options: config.controlOptions || {},
             styleMap: config.styleMap || this.styleMap()
         });
         delete config.styleMap;
+        delete config.controlOptions;
         if (typeof(config.template) == "string") {
             this.template = new Ext.XTemplate(config.template, {
                 decimals: (config.hasOwnProperty('decimals')) ? 
@@ -76,6 +82,7 @@
      *  :param options ``Object`` A hash with keys:
      *         - handler: a reference to the OpenLayers.Handler class.
      *         - styleMap: an OpenLayers.StyleMap for sketches.
+     *         - options: control options to override default ones.
      *
      *  :return: ``OpenLayers.Control.Measure`` The configured control.
      */
@@ -86,7 +93,7 @@
             "measurepartial": OpenLayers.Function.bind(this.cleanup, this)
         };
         return new OpenLayers.Control.Measure(
-            options.handler, {
+            options.handler, Ext.apply({
                 persist: true,
                 eventListeners: listeners,
                 handlerOptions: {
@@ -94,7 +101,7 @@
                         styleMap: options.styleMap
                     }
                 }
-            }
+            }, options.options)
         );
     },
     



More information about the Commits mailing list