[fusion-commits] r2283 - trunk/widgets
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Fri Nov 19 14:59:39 EST 2010
Author: madair
Date: 2010-11-19 11:59:39 -0800 (Fri, 19 Nov 2010)
New Revision: 2283
Modified:
trunk/widgets/Measure.js
Log:
re ofsc #70: refining the calculation of totalLength for cases where type is 'both' and 'distance'
Modified: trunk/widgets/Measure.js
===================================================================
--- trunk/widgets/Measure.js 2010-11-19 16:54:00 UTC (rev 2282)
+++ trunk/widgets/Measure.js 2010-11-19 19:59:39 UTC (rev 2283)
@@ -601,13 +601,19 @@
* updates the summary display if it is loaded in a window somewhere
*/
updateTotalDistance: function() {
- var totalDistance = this.lastMarker.getQuantity();
- if (this.distanceMarkers.length > 1) {
+ var totalDistance = 0;
var units = Fusion.unitAbbr(this.units);
for (var i=0; i<this.distanceMarkers.length; i++) {
var distance = this.distanceMarkers[i].getQuantity();
totalDistance += distance;
}
+ if (this.lastMarker) {
+ var lastDist = this.lastMarker.getQuantity();
+ //only add this in if it's a multi-point geometry
+ if (lastDist != totalDistance) {
+ totalDistance += lastDist;
+ }
+ }
this.totalDistanceMarker.domObj.style.display = 'block';
this.totalDistanceMarker.setQuantity(totalDistance);
@@ -617,8 +623,7 @@
totalDistance = totalDistance.toPrecision(this.distPrecision);
}
this.totalLength = totalDistance;
- }
- if (this.measureType & Fusion.Constant.MEASURE_TYPE_AREA) {
+ if (this.measureType & Fusion.Constant.MEASURE_TYPE_AREA) {
var value = this.areaMarker.getQuantity();
if (this.areaPrecision == 0) {
value = Math.floor(value);
More information about the fusion-commits
mailing list