[mapguide-commits] r6076 - trunk/MgDev/Web/src/viewerfiles

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Aug 16 02:43:59 EDT 2011


Author: hubu
Date: 2011-08-15 23:43:59 -0700 (Mon, 15 Aug 2011)
New Revision: 6076

Modified:
   trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ
Log:
Submit on behalf of Spark Liu: Fix 1783 - "Select radius" in AJAX viewer fails on FDO source that doesn't support curve polygon

We should use a more common geometry type, such as "polygon", in case that FDO doesn't support curve polygon.

Modified: trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ
===================================================================
--- trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ	2011-08-16 06:39:36 UTC (rev 6075)
+++ trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ	2011-08-16 06:43:59 UTC (rev 6076)
@@ -344,6 +344,14 @@
 %s
 var isAlertShow = false;
 
+var simulateCirclePoints = [];
+var simulateCircleHalfPointNumber = 40;
+(function () {
+    for (var index = 0; index < 2 * simulateCircleHalfPointNumber + 1; index++) {
+        simulateCirclePoints[2 * index] = Math.cos(Math.PI * index / simulateCircleHalfPointNumber);
+        simulateCirclePoints[2 * index + 1] = Math.sin(Math.PI * index / simulateCircleHalfPointNumber);
+    }
+})();
 
 // public functions -----------------------------------------------
 //
@@ -2742,14 +2750,14 @@
         var dx = rcx2 - rcx1, dy = rcy2 - rcy1;
         var r = Math.sqrt(dx*dx + dy*dy);
 
-        x1 = rcx1 - r;
-        w = 2 * r;
-        y1 = rcy1 - r;
-        h = w;
-
         shape.clear();
         shape.setColor("#cdcdff");
-        shape.fillEllipse(x1, y1, w, h);
+        var xs = [], ys = [];
+        for (var index = 0; index < 2 * simulateCircleHalfPointNumber + 1; index++) {
+            xs.push(rcx1 + r * simulateCirclePoints[2 * index]);
+            ys.push(rcy1 + r * simulateCirclePoints[2 * index + 1]);
+        }
+        shape.fillPolygon(xs, ys);
         shape.paint();
     }
     else
@@ -2907,7 +2915,17 @@
 
 function RequestCircleSelection(x, y, r, append)
 {  
-    QueryFeatureInfo("CURVEPOLYGON ((" + (x - r) + " " + y + " (CIRCULARARCSEGMENT (" + x + " " + (y - r) + ", " + (x + r) + " " + y + "), CIRCULARARCSEGMENT (" + x + " " + (y + r) + ", " + (x - r) + " " + y + "))))", append, 0, 7);
+    var fgfText = "POLYGON ((";
+    for (var index = 0; index < 2 * simulateCircleHalfPointNumber + 1; index++) {
+        if (index != 0) {
+            fgfText += ", "
+        }
+        fgfText += (x + r * simulateCirclePoints[2 * index]);
+        fgfText += " ";
+        fgfText += (y + r * simulateCirclePoints[2 * index + 1]);
+    }
+    fgfText += "))";
+    QueryFeatureInfo(fgfText, append, 0, 7);
 }
 
 function RequestPolygonSelection(xs, ys, append)



More information about the mapguide-commits mailing list