[fusion-commits] r3055 - in sandbox/php8/widgets: QuickPlot Redline/classes

svn_fusion at osgeo.org svn_fusion at osgeo.org
Tue May 31 07:47:07 PDT 2022


Author: jng
Date: 2022-05-31 07:47:07 -0700 (Tue, 31 May 2022)
New Revision: 3055

Modified:
   sandbox/php8/widgets/QuickPlot/GeneratePicture.php
   sandbox/php8/widgets/Redline/classes/markupmanager.php
Log:
Fix up Redline and QuickPlot for PHP8

Modified: sandbox/php8/widgets/QuickPlot/GeneratePicture.php
===================================================================
--- sandbox/php8/widgets/QuickPlot/GeneratePicture.php	2022-05-31 14:46:24 UTC (rev 3054)
+++ sandbox/php8/widgets/QuickPlot/GeneratePicture.php	2022-05-31 14:47:07 UTC (rev 3055)
@@ -60,7 +60,7 @@
         
         $array       = explode(",", $args["print_size"]);
         $printSize   = new Size(ParseLocaleDouble($array[0]), ParseLocaleDouble($array[1]));
-        $printSize_pixel   = new Size($printSize->width / 25.4 * $printDpi, $printSize->height / 25.4 * $printDpi);
+        $printSize_pixel   = new Size(intval($printSize->width / 25.4 * $printDpi), intval($printSize->height / 25.4 * $printDpi));
         $array       = explode(",", $args["box"]);
         $captureBox  = CreatePolygon($array);
         
@@ -115,12 +115,12 @@
         $colorString = substr($colorString, 2, 6) . substr($colorString, 0, 2);
         $color = new MgColor($colorString);
 
-        $mgReader = $renderingService->RenderMap($map, 
-                                                 $selection, 
+        $mgReader = $renderingService->RenderMap($map,
+                                                 $selection,
                                                  $center,
-                                                 $scaleDenominator, 
-                                                 $toSize->width, 
-                                                 $toSize->height,
+                                                 doubleval($scaleDenominator),
+                                                 intval($toSize->width),
+                                                 intval($toSize->height),
                                                  $color,
                                                  "PNG",
                                                  false);
@@ -137,7 +137,7 @@
         imagedestroy($image);
         // Crop the normalized image
         $croppedImg = imagecreatetruecolor($size->width, $size->height);
-        imagecopy($croppedImg, $normalizedImg, 0, 0, (imagesx($normalizedImg) - $size->width) / 2, (imagesy($normalizedImg) - $size->height) / 2, $size->width, $size->height);
+        imagecopy($croppedImg, $normalizedImg, 0, 0, intval((imagesx($normalizedImg) - $size->width) / 2), intval((imagesy($normalizedImg) - $size->height) / 2), $size->width, $size->height);
         // Free the normalized image
         imagedestroy($normalizedImg);
         if ($drawNorthArrow) {
@@ -147,7 +147,7 @@
         header ("Content-type: image/png"); 
         imagepng($croppedImg);
         
-        //Uncomment to see what PHP-isms get spewed out that may be tripping up rendering
+        //Uncomment below (and comment the 2 lines above) to see what PHP-isms get spewed out that may be tripping up rendering
         //Also replace instances of "////print_r" with "//print_r" to insta-uncomment all debugging calls
         /*
         ob_start();
@@ -196,10 +196,10 @@
         $naRes      = 300;
         $naMargin   = 12;
         // Calculate the margin as pixels according to the resolutions
-        $margin     = $resolution * $naMargin / 25.4;
+        $margin     = intval($resolution * $naMargin / 25.4);
         // Get the width of the north arrow on the map picture
-        $drawWidth  = $naWidth * $resolution / $naRes;
-        $drawHeight = $naHeight * $resolution / $naRes;
+        $drawWidth  = intval($naWidth * $resolution / $naRes);
+        $drawHeight = intval($naHeight * $resolution / $naRes);
         // Draw the north arrow on the map picture
         imagecopyresized($map, $rotatedNa, $mapWidth - $drawWidth - $margin, $mapHeight - $drawHeight - $margin, 0, 0, $drawWidth, $drawHeight, $naWidth, $naHeight);
         // Free the north arrow image

Modified: sandbox/php8/widgets/Redline/classes/markupmanager.php
===================================================================
--- sandbox/php8/widgets/Redline/classes/markupmanager.php	2022-05-31 14:46:24 UTC (rev 3054)
+++ sandbox/php8/widgets/Redline/classes/markupmanager.php	2022-05-31 14:47:07 UTC (rev 3055)
@@ -560,7 +560,7 @@
         $basic = (strcmp($this->args["REDLINESTYLIZATION"], "BASIC") == 0);
         // Create the Markup Layer Definition. Create or update, this code is the same.
 
-        $hexFgTransparency = sprintf("%02x", 255 * (100 - $this->args['FILLTRANSPARENCY']) / 100); // Convert % to an alpha value
+        $hexFgTransparency = sprintf("%02x", 255 * (100 - intval($this->args['FILLTRANSPARENCY'])) / 100); // Convert % to an alpha value
         $hexBgTransparency = $this->args['FILLBACKTRANS'] ? "FF" : "00";							 // All or nothing
         $bold = array_key_exists('LABELBOLD', $this->args) ? "true" : "false";
         $italic = array_key_exists('LABELITALIC', $this->args) ? "true" : "false";
@@ -905,7 +905,7 @@
         }
 
         //Call the service API
-        $br = $kmlService->GetFeaturesKml($markupLayer, $bbox, $devW, $devH, $mapDpi, 0, ($kmz ? "KMZ" : "KML"));
+        $br = $kmlService->GetFeaturesKml($markupLayer, $bbox, $devW, $devH, doubleval($mapDpi), 0, ($kmz ? "KMZ" : "KML"));
         $len = $br->GetLength();
 
         $outputBuffer = '';



More information about the fusion-commits mailing list