[fusion-commits] r2416 - trunk/widgets/QuickPlot

svn_fusion at osgeo.org svn_fusion at osgeo.org
Wed Jul 27 21:52:20 EDT 2011


Author: liuar
Date: 2011-07-27 18:52:20 -0700 (Wed, 27 Jul 2011)
New Revision: 2416

Modified:
   trunk/widgets/QuickPlot/GeneratePicture.php
Log:
For ticket 1757: http://trac.osgeo.org/mapguide/ticket/1757

Modified: trunk/widgets/QuickPlot/GeneratePicture.php
===================================================================
--- trunk/widgets/QuickPlot/GeneratePicture.php	2011-07-26 19:50:52 UTC (rev 2415)
+++ trunk/widgets/QuickPlot/GeneratePicture.php	2011-07-28 01:52:20 UTC (rev 2416)
@@ -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