[fusion-commits] r2278 - trunk/widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Fri Nov 19 11:17:55 EST 2010


Author: madair
Date: 2010-11-19 08:17:55 -0800 (Fri, 19 Nov 2010)
New Revision: 2278

Modified:
   trunk/widgets/Measure.js
Log:
re ofsc #70: maintain a totalLength and totalArea values for other widgets to read

Modified: trunk/widgets/Measure.js
===================================================================
--- trunk/widgets/Measure.js	2010-11-17 08:58:12 UTC (rev 2277)
+++ trunk/widgets/Measure.js	2010-11-19 16:17:55 UTC (rev 2278)
@@ -71,6 +71,11 @@
     /* Style for the polygon line used for area draw */
     areaStyle: null,
     segmentLabels: true,
+    
+    /* maintain measurements for other widgets to read */
+    totalLength: 0,
+    totalArea: 0,
+    
     initializeWidget: function(widgetTag) {
         this.asCursor = ['crosshair'];
         var json = widgetTag.extension;
@@ -604,7 +609,17 @@
         }
         this.totalDistanceMarker.domObj.style.display = 'block';
         this.totalDistanceMarker.setQuantity(totalDistance);
+        this.totalLength = totalDistance;
       }
+      if (this.measureType & Fusion.Constant.MEASURE_TYPE_AREA) {
+	    var value = this.areaMarker.getQuantity();
+	    if (this.areaPrecision == 0) {
+		value = Math.floor(value);
+	    } else {
+		value = value.toPrecision(this.areaPrecision);
+	    }
+	    this.totalArea = value;
+	}
     },
 
   /*
@@ -632,6 +647,7 @@
       */
     clearTotalDistance: function() {
       this.totalDistanceMarker.domObj.style.display = 'none';
+      this.totalLength = 0;
     },
 
   /*



More information about the fusion-commits mailing list