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

commits at geoext.org commits at geoext.org
Tue Mar 9 15:02:03 CET 2010


Author: fvanderbiest
Date: 2010-03-09 15:02:02 +0100 (Tue, 09 Mar 2010)
New Revision: 1943

Modified:
   sandbox/fvanderbiest/geoext.ux/ux/Measure/examples/Measure.html
   sandbox/fvanderbiest/geoext.ux/ux/Measure/lib/GeoExt.ux/MeasureArea.js
   sandbox/fvanderbiest/geoext.ux/ux/Measure/lib/GeoExt.ux/MeasureLength.js
   sandbox/fvanderbiest/geoext.ux/ux/Measure/lib/GeoExt.ux/MeasurePosition.js
Log:
Measure ux: (a) templates revisited (b) use of local openlayers so that patch openlayers_2511_A1 is available (c) Ext.apply instead of Ext.applyIf (d) map units from event in MeasurePosition.js

Modified: sandbox/fvanderbiest/geoext.ux/ux/Measure/examples/Measure.html
===================================================================
--- sandbox/fvanderbiest/geoext.ux/ux/Measure/examples/Measure.html	2010-03-09 13:58:31 UTC (rev 1942)
+++ sandbox/fvanderbiest/geoext.ux/ux/Measure/examples/Measure.html	2010-03-09 14:02:02 UTC (rev 1943)
@@ -9,7 +9,8 @@
         
         <script type="text/javascript" src="http://extjs.cachefly.net/ext-2.2.1/adapter/ext/ext-base.js"></script>
         <script type="text/javascript" src="http://extjs.cachefly.net/ext-2.2.1/ext-all.js"></script>
-        <script src="http://dev.openlayers.org/nightly/OpenLayers.js"></script>
+        <!--<script src="http://dev.openlayers.org/nightly/OpenLayers.js"></script>-->
+        <script type="text/javascript" src="../../../../openlayers/lib/OpenLayers.js"></script>
         <script type="text/javascript" src="../../../../geoext/lib/GeoExt.js"></script>
         
         <!-- script resources for this ux -->

Modified: sandbox/fvanderbiest/geoext.ux/ux/Measure/lib/GeoExt.ux/MeasureArea.js
===================================================================
--- sandbox/fvanderbiest/geoext.ux/ux/Measure/lib/GeoExt.ux/MeasureArea.js	2010-03-09 13:58:31 UTC (rev 1942)
+++ sandbox/fvanderbiest/geoext.ux/ux/Measure/lib/GeoExt.ux/MeasureArea.js	2010-03-09 14:02:02 UTC (rev 1943)
@@ -28,12 +28,12 @@
     /** private: method[constructor]
      */
     constructor: function(config) {
-        Ext.applyIf(config, {
+        config = Ext.apply({
             iconCls: 'gx-map-measurearea',
             tooltip: "Area measurement",
-            template: '<p>{[values.measure.toFixed(this.decimals) + " "'
-                +'+ values.units + "<sup>2</sup>"]}</p>'
-        });
+            template: '<p>{[values.measure.toFixed(this.decimals)]}&nbsp;'+
+                '{units}<sup>2</sup></p>'
+        }, config);
         arguments.callee.superclass.constructor.call(this,
             OpenLayers.Handler.Polygon, config);
     }

Modified: sandbox/fvanderbiest/geoext.ux/ux/Measure/lib/GeoExt.ux/MeasureLength.js
===================================================================
--- sandbox/fvanderbiest/geoext.ux/ux/Measure/lib/GeoExt.ux/MeasureLength.js	2010-03-09 13:58:31 UTC (rev 1942)
+++ sandbox/fvanderbiest/geoext.ux/ux/Measure/lib/GeoExt.ux/MeasureLength.js	2010-03-09 14:02:02 UTC (rev 1943)
@@ -28,12 +28,12 @@
     /** private: method[constructor]
      */
     constructor: function(config) {
-        Ext.applyIf(config, {
+        config = Ext.apply({
             iconCls: 'gx-map-measurelength',
             tooltip: "Length measurement",
-            template: '<p>{[values.measure.toFixed(this.decimals) + " "'+
-                '+ values.units]}</p>'
-        });
+            template: '<p>{[values.measure.toFixed(this.decimals)]}&nbsp;'+
+                '{units}</p>'
+        }, config);
         arguments.callee.superclass.constructor.call(this, 
             OpenLayers.Handler.Path, config);
     }

Modified: sandbox/fvanderbiest/geoext.ux/ux/Measure/lib/GeoExt.ux/MeasurePosition.js
===================================================================
--- sandbox/fvanderbiest/geoext.ux/ux/Measure/lib/GeoExt.ux/MeasurePosition.js	2010-03-09 13:58:31 UTC (rev 1942)
+++ sandbox/fvanderbiest/geoext.ux/ux/Measure/lib/GeoExt.ux/MeasurePosition.js	2010-03-09 14:02:02 UTC (rev 1943)
@@ -35,28 +35,37 @@
                 config.decimals : 2
         };
         
-        Ext.applyIf(config, {
+        config = Ext.apply({
             iconCls: 'gx-map-measureposition',
             tooltip: "Position measurement"
-        });
+        }, config);
         
         arguments.callee.superclass.constructor.call(this, 
             OpenLayers.Handler.Point, config);
         
-        var units = this.control.map.getUnits();
-        if (units == 'degrees' || units == 'dd') {
-            this.template = new Ext.XTemplate(
-                '<p>{["lon: "+values.geometry.x.toFixed(this.decimals) + "&deg;"]}</p>'+
-                '<p>{["lat: "+values.geometry.y.toFixed(this.decimals) + "&deg;"]}</p>', 
-            scope);
-        } else {
-            this.template = new Ext.XTemplate(
-                '<p>{["X: "+values.geometry.x.toFixed(this.decimals) '+
-                '+ " " + values.units]}</p>'+
-                '<p>{["Y: "+values.geometry.y.toFixed(this.decimals) '+
-                '+ " " + values.units]}</p>', 
-            scope);
-        }
-        this.template.compile();
+        Ext.apply(scope, {
+            compiled: true,
+            isDegrees: function(units) {
+                if (units == 'degrees' || units == 'dd') {
+                    return true;
+                }
+                return false;
+            }
+        });
+        this.template = new Ext.XTemplate(
+            '<p>',
+            '<tpl if="this.isDegrees(units)">lon</tpl>',
+            '<tpl if="!this.isDegrees(units)">X</tpl>: ',
+            '{[values.measure.x.toFixed(this.decimals)]}',
+            '<tpl if="this.isDegrees(units)">&deg;</tpl>',
+            '<tpl if="!this.isDegrees(units)">{units}</tpl>',
+            '</p><p>',
+            '<tpl if="this.isDegrees(units)">lat</tpl>',
+            '<tpl if="!this.isDegrees(units)">Y</tpl>: ',
+            '{[values.measure.y.toFixed(this.decimals)]}',
+            '<tpl if="this.isDegrees(units)">&deg;</tpl>',
+            '<tpl if="!this.isDegrees(units)">{units}</tpl>',
+            '</p>',
+        scope);
     }
 });



More information about the Commits mailing list