[fusion-commits] r2417 - sandbox/adsk/2.3r/widgets/QuickPlot

svn_fusion at osgeo.org svn_fusion at osgeo.org
Wed Jul 27 22:07:53 EDT 2011


Author: liuar
Date: 2011-07-27 19:07:53 -0700 (Wed, 27 Jul 2011)
New Revision: 2417

Modified:
   sandbox/adsk/2.3r/widgets/QuickPlot/GeneratePicture.php
Log:
On behalf of Mars Wu
For ticket 1757: http://trac.osgeo.org/mapguide/ticket/1757


Modified: sandbox/adsk/2.3r/widgets/QuickPlot/GeneratePicture.php
===================================================================
--- sandbox/adsk/2.3r/widgets/QuickPlot/GeneratePicture.php	2011-07-28 01:52:20 UTC (rev 2416)
+++ sandbox/adsk/2.3r/widgets/QuickPlot/GeneratePicture.php	2011-07-28 02:07:53 UTC (rev 2417)
@@ -13,8 +13,8 @@
     $captureBox;
     $normalizedCapture;
     $printSize;
-    $paperSize;
-    
+    $paperSize;
+
     GetParameters();
     GenerateMap($printSize);
 ?>
@@ -32,13 +32,13 @@
         // Not necessary to validate the parameters    	
         $sessionID   = $args["session_id"];
         $mapName     = $args["map_name"];
-        $rotation    = floatval($args["rotation"]);
+        $rotation    = ParseLocaleDouble($args["rotation"]);
         $printDpi    = intval($args["print_dpi"]);
 
         $scaleDenominator = intval($args["scale_denominator"]);
 
         $array       = explode(",", $args["paper_size"]);
-        $paperSize   = new Size(floatval($array[0]), floatval($array[1]));
+        $paperSize   = new Size(ParseLocaleDouble($array[0]), ParseLocaleDouble($array[1]));
         $printSize   = new Size($paperSize->width / 25.4 * $printDpi, $paperSize->height / 25.4 * $printDpi);
         
         $array       = explode(",", $args["box"]);
@@ -56,11 +56,11 @@
         
         for ($index = 0; $index < count($coordinates); ++$index)
         {
-            $coordinate = $geometryFactory->CreateCoordinateXY(floatval($coordinates[$index]), floatval($coordinates[++$index]));
+            $coordinate = $geometryFactory->CreateCoordinateXY(ParseLocaleDouble($coordinates[$index]), ParseLocaleDouble($coordinates[++$index]));
             $coordinateCollection->Add($coordinate);
         }
         
-        $coordinateCollection->Add($geometryFactory->CreateCoordinateXY(floatval($coordinates[0]), floatval($coordinates[1])));
+        $coordinateCollection->Add($geometryFactory->CreateCoordinateXY(ParseLocaleDouble($coordinates[0]), ParseLocaleDouble($coordinates[1])));
         
         $linearRingCollection = $geometryFactory->CreateLinearRing($coordinateCollection);
         $captureBox           = $geometryFactory->CreatePolygon($linearRingCollection, null);
@@ -100,7 +100,7 @@
             $mapAgent .= "s";
         }
         // Get the correct port number
-		$mapAgent .= "://127.0.0.1:" . $_SERVER["SERVER_PORT"];
+        $mapAgent .= "://127.0.0.1:" . $_SERVER["SERVER_PORT"];
         // Get the correct virtual directory
         $mapAgent .= substr($_SERVER["REQUEST_URI"], 0, strpos($_SERVER["REQUEST_URI"], "/", 1));
         $mapAgent .="/mapagent/mapagent.fcgi?VERSION=1.0.0&OPERATION=GETMAPIMAGE" .
@@ -130,7 +130,7 @@
 
         header ("Content-type: image/png"); 
         imagepng($croppedImg);
-        imagedestroy($croppedImg);
+        imagedestroy($croppedImg);
     }
     
     function DrawNorthArrow($map)
@@ -165,6 +165,13 @@
         // Free the north arrow image
         imagedestroy($rotatedNa); 
     }
+    
+    function ParseLocaleDouble($stringValue)
+    {
+        $lc = localeconv();
+        $result = str_replace(".", $lc["decimal_point"], $stringValue);
+        return doubleval($result);
+    }
 ?>
 
 <?php    



More information about the fusion-commits mailing list