[Mapbender-commits] r5529 - in trunk/mapbender/http: classes extensions/fpdf print/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Feb 19 10:54:32 EST 2010


Author: christoph
Date: 2010-02-19 10:54:30 -0500 (Fri, 19 Feb 2010)
New Revision: 5529

Modified:
   trunk/mapbender/http/classes/class_stripRequest.php
   trunk/mapbender/http/classes/class_weldMaps2PNG.php
   trunk/mapbender/http/classes/class_weldMaps2PNG_rotate.php
   trunk/mapbender/http/extensions/fpdf/fpdf.php
   trunk/mapbender/http/print/classes/mbLegendDecorator.php
   trunk/mapbender/http/print/classes/mbMapDecorator.php
Log:


Modified: trunk/mapbender/http/classes/class_stripRequest.php
===================================================================
--- trunk/mapbender/http/classes/class_stripRequest.php	2010-02-19 15:27:17 UTC (rev 5528)
+++ trunk/mapbender/http/classes/class_stripRequest.php	2010-02-19 15:54:30 UTC (rev 5529)
@@ -142,7 +142,7 @@
 		$this->encodeGET();
 		return $this->url;
 	}
-	function encodeGET(){
+	function encodeGET($encode = true){
 		$a = explode("?",$this->url);
 		$patterns = explode("&", $a[1]);
 		$a[0].= "?";
@@ -153,7 +153,11 @@
 				$a[0] .= $tmp[0]."=";
 				for($ii=0; $ii<count($val); $ii++){
 					if($ii>0){$a[0].=",";}
+					if($encode){
 						$a[0].= urlencode($val[$ii]);
+					}else{
+						$a[0].= $val[$ii];
+					}
 				}
 				if ($i < (count($patterns)-1)) {
 					$a[0] .= "&";
@@ -175,4 +179,4 @@
 		return $this->url;
 	}
 }
-?>
\ No newline at end of file
+?>

Modified: trunk/mapbender/http/classes/class_weldMaps2PNG.php
===================================================================
--- trunk/mapbender/http/classes/class_weldMaps2PNG.php	2010-02-19 15:27:17 UTC (rev 5528)
+++ trunk/mapbender/http/classes/class_weldMaps2PNG.php	2010-02-19 15:54:30 UTC (rev 5529)
@@ -29,7 +29,7 @@
 
 class weldMaps2PNG{
 
-	function weldMaps2PNG($urls,$filename){
+	function weldMaps2PNG($urls,$filename, $encode = true){
 		if(!$urls || $urls == ""){
 			$e = new mb_exception("weldMaps2PNG: no maprequests delivered");
 		}
@@ -46,7 +46,7 @@
 			$obj = new stripRequest($url[$i]);
 
 			$url[$i] = $obj->setPNG();
-			$url[$i] = $obj->encodeGET();
+			$url[$i] = $obj->encodeGET($encode);
 			$img = $this->loadpng($url[$i]);
 			if($img != false){
 				imagecopy($image, $img, 0, 0, 0, 0, $width, $height);

Modified: trunk/mapbender/http/classes/class_weldMaps2PNG_rotate.php
===================================================================
--- trunk/mapbender/http/classes/class_weldMaps2PNG_rotate.php	2010-02-19 15:27:17 UTC (rev 5528)
+++ trunk/mapbender/http/classes/class_weldMaps2PNG_rotate.php	2010-02-19 15:54:30 UTC (rev 5529)
@@ -30,7 +30,7 @@
 
 class weldMaps2PNG_rotate extends weldMaps2PNG{
 
-    function weldMaps2PNG_rotate($urls,$filename, $angle){
+    function weldMaps2PNG_rotate($urls,$filename, $angle, $encode = true){
         if(!$urls || $urls == ""){
             $e = new mb_exception("weldMaps2PNG_rotate: no maprequests delivered");
         }
@@ -59,7 +59,7 @@
 
         //get image
         $urls = implode("___", $url);
-        $this->weldMaps2PNG($urls, $filename);
+        $this->weldMaps2PNG($urls, $filename, $encode);
         
 
         //rotate image
@@ -92,4 +92,4 @@
     
 }
 
-?>
\ No newline at end of file
+?>

Modified: trunk/mapbender/http/extensions/fpdf/fpdf.php
===================================================================
--- trunk/mapbender/http/extensions/fpdf/fpdf.php	2010-02-19 15:27:17 UTC (rev 5528)
+++ trunk/mapbender/http/extensions/fpdf/fpdf.php	2010-02-19 15:54:30 UTC (rev 5529)
@@ -267,6 +267,7 @@
 
 function Error($msg)
 {
+	throw(new Exception("Error in fpdf: $msg"));
 	//Fatal error
 	die('<b>FPDF error:</b> '.$msg);
 }

Modified: trunk/mapbender/http/print/classes/mbLegendDecorator.php
===================================================================
--- trunk/mapbender/http/print/classes/mbLegendDecorator.php	2010-02-19 15:27:17 UTC (rev 5528)
+++ trunk/mapbender/http/print/classes/mbLegendDecorator.php	2010-02-19 15:54:30 UTC (rev 5529)
@@ -41,17 +41,24 @@
 					continue;
 				}
 				// Title
-				$this->pdf->objPdf->Text($currentX, $currentY, $title);
-				$currentY += $mmPerPt * $this->conf->font_size;
-//				$currentY += $this->conf->font_size;
+				$titleFontSize = $this->conf->font_size + 1;
+				$this->pdf->objPdf->setFont($this->conf->font_family, "", $titleFontSize);
+				$this->pdf->objPdf->Text($currentX, $currentY, html_entity_decode(utf8_decode($title)));
+//				$currentY += $mmPerPt * $this->conf->font_size;
+				$currentY += $titleFontSize;
 				
+				$this->pdf->objPdf->setFont($this->conf->font_family, "", $this->conf->font_size);
 				for ($j = 0; $j < count($layerLegendArray); $j++) {
 					// Legend
 					$currentLegendObj = $layerLegendArray[$j];
-					
+
+					$this->pdf->objPdf->Text($currentX, $currentY, html_entity_decode(utf8_decode($currentLegendObj->title)));
+					//$currentY += $mmPerPt * $this->conf->font_size;
+					$currentY += $this->conf->font_size;
 					// store current legend image temporarily
 					$legendFilename = TMPDIR . "/legend_" . 
-						substr(md5(uniqid(rand())),0,7).".png";
+					substr(md5(uniqid(rand())),0,7).".png";
+
 					$saveLegend = new SaveLegend(
 						$currentLegendObj->legendUrl,
 						$legendFilename
@@ -59,17 +66,20 @@
 					list($width, $height) = getimagesize($legendFilename);
 					$width = $width/$this->pdf->objPdf->k;
 					$height = $height/$this->pdf->objPdf->k;
-
+					
+					try {
 					$this->pdf->objPdf->Image(
 						$legendFilename, 
 						$currentX, 
 						$currentY-3.5,
-						$width,
-						$height
+						($width * $this->conf->scale)
 					);
+					}catch(Exception $E){
+						$e = new mb_exception("Can't write Legend Image to pdf: ".$E->getmessage);
+					}
 
 
-					$currentY += $height;
+					$currentY += ($height * $this->conf->scale) ;
 					
 				}
 				$currentY += 5;

Modified: trunk/mapbender/http/print/classes/mbMapDecorator.php
===================================================================
--- trunk/mapbender/http/print/classes/mbMapDecorator.php	2010-02-19 15:27:17 UTC (rev 5528)
+++ trunk/mapbender/http/print/classes/mbMapDecorator.php	2010-02-19 15:54:30 UTC (rev 5529)
@@ -82,13 +82,13 @@
 		
 		if ($this->angle != 0) {
 			if (class_exists('weldMaps2PNG_rotate')) {
-				$i = new weldMaps2PNG_rotate(implode("___",$array_urls), $this->filename, $this->angle);
+				$i = new weldMaps2PNG_rotate(implode("___",$array_urls), $this->filename, $this->angle, false);
 			} else {
-				$i = new weldMaps2PNG(implode("___",$array_urls), $this->filename);
+				$i = new weldMaps2PNG(implode("___",$array_urls), $this->filename, false);
 				$e = new mb_warning("mbMapDecorator: no rotation possible.");
 			}
 		} else {
-			$i = new weldMaps2PNG(implode("___",$array_urls), $this->filename);
+			$i = new weldMaps2PNG(implode("___",$array_urls), $this->filename, false);
 		}
 		$this->pdf->objPdf->Image($this->filename, $this->conf->x_ul, $this->conf->y_ul, $width, $height,'png');
 		



More information about the Mapbender_commits mailing list