[fusion-commits] r2031 - sandbox/jxlib-3.0/widgets
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Tue Jan 5 10:49:40 EST 2010
Author: madair
Date: 2010-01-05 10:49:39 -0500 (Tue, 05 Jan 2010)
New Revision: 2031
Modified:
sandbox/jxlib-3.0/widgets/Measure.js
Log:
fix error in area calculation
Modified: sandbox/jxlib-3.0/widgets/Measure.js
===================================================================
--- sandbox/jxlib-3.0/widgets/Measure.js 2010-01-05 15:47:33 UTC (rev 2030)
+++ sandbox/jxlib-3.0/widgets/Measure.js 2010-01-05 15:49:39 UTC (rev 2031)
@@ -68,12 +68,16 @@
/* Style for the polygon line used for area draw */
areaStyle: null,
+ /* optional DOM obj ID for button to clear the result */
+ clearButton: null,
+
initializeWidget: function(widgetTag) {
this.asCursor = ['crosshair'];
var json = widgetTag.extension;
this.units = (json.Units && (json.Units[0] != '')) ? Fusion.unitFromName(json.Units[0]): this.units;
this.distPrecision = json.DistancePrecision ? parseInt(json.DistancePrecision[0]) : 4;
this.areaPrecision = json.AreaPrecision ? parseInt(json.AreaPrecision[0]) : 4;
+ this.clearButton = json.clearButton ? json.clearButton[0] : null;
this.sTarget = json.Target ? json.Target[0] : "";
this.sBaseUrl = Fusion.getFusionURL() + 'widgets/Measure/Measure.php';
@@ -115,6 +119,9 @@
mapWidget.registerForEvent(Fusion.Event.MAP_LOADED, OpenLayers.Function.bind(this.setUnits, this, this.units));
this.registerParameter('Units');
+ if (this.clearButton) {
+ }
+
// style the sketch fancy
this.sketchSymbolizers = {
"Point": {
@@ -296,7 +303,7 @@
at = this.getMap().geoToPix(cg.x, cg.y);
quantity = geom.getGeodesicArea(proj);
//TODO: result is in square meters - convert to other units?
- var q = Math.pow(Fusion.convert(measureUnits, this.units, q));
+ var q = Fusion.convert(measureUnits, this.units, quantity);
this.totalArea = q.toPrecision(this.areaPrecision);
}
if (quantity > 1) {
More information about the fusion-commits
mailing list