[fusion-commits] r2754 - trunk/lib

svn_fusion at osgeo.org svn_fusion at osgeo.org
Mon Jul 29 18:19:07 PDT 2013


Author: jng
Date: 2013-07-29 18:19:01 -0700 (Mon, 29 Jul 2013)
New Revision: 2754

Modified:
   trunk/lib/Map.js
Log:
#587: Fix incorrect circle digitization. For reasons currently beyond me, the getCentroid() of the approximated circle is way off for small circles, but getCenter() on its bounds gives the result we're looking for.

Modified: trunk/lib/Map.js
===================================================================
--- trunk/lib/Map.js	2013-07-29 02:01:53 UTC (rev 2753)
+++ trunk/lib/Map.js	2013-07-30 01:19:01 UTC (rev 2754)
@@ -1731,9 +1731,9 @@
     _onGeometryDigitized: function(evt, controlId, origCallback) {
         this._deactivateDigitizer(controlId, true, true);
         if (controlId == this.DRAW_CONTROL_CIRCLE) {
-            var center = evt.feature.geometry.getCentroid();
+            var bcenter = evt.feature.geometry.bounds.getCenterLonLat();
             var radius = evt.feature.geometry.bounds.getWidth() / 2;
-            origCallback({ x: center.x, y: center.y, r: radius });
+            origCallback({ x: bcenter.lon, y: bcenter.lat, r: radius });
         } else {
             origCallback(evt.feature.geometry);
         }



More information about the fusion-commits mailing list