[Mapbender-commits] r3415 - branches/print_dev/http/print/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Jan 8 07:44:12 EST 2009


Author: mschulz
Date: 2009-01-08 07:44:12 -0500 (Thu, 08 Jan 2009)
New Revision: 3415

Added:
   branches/print_dev/http/print/classes/mbOverviewDecorator.php
Modified:
   branches/print_dev/http/print/classes/mbMapDecorator.php
   branches/print_dev/http/print/classes/mbPdf.php
   branches/print_dev/http/print/classes/mbTemplatePdf.php
   branches/print_dev/http/print/classes/mbTemplatePdfDecorator.php
Log:
added overview decorator

Modified: branches/print_dev/http/print/classes/mbMapDecorator.php
===================================================================
--- branches/print_dev/http/print/classes/mbMapDecorator.php	2009-01-07 16:42:28 UTC (rev 3414)
+++ branches/print_dev/http/print/classes/mbMapDecorator.php	2009-01-08 12:44:12 UTC (rev 3415)
@@ -1,35 +1,35 @@
 <?php
 
-include (dirname(__FILE__)."/../../classes/class_stripRequest.php");
-include (dirname(__FILE__)."/../../classes/class_weldMaps2PNG.php");
+require_once(dirname(__FILE__)."/../../classes/class_stripRequest.php");
+require_once(dirname(__FILE__)."/../../classes/class_weldMaps2PNG.php");
 
 class mbMapDecorator extends mbTemplatePdfDecorator {
 
 	protected $filename;
-	protected $pdf;
-	protected $conf;
 	
 	public function __construct($pdfObj, $mapConf) {
-		$this->pdf = $pdfObj;
-		$this->conf = $mapConf;
+		parent::__construct($pdfObj, $mapConf);
 		$this->filename = TMPDIR."/".parent::generateOutputFileName("map","png");
-		$this->draw();	
+		$this->decorate();	
 	}
 	
-	protected function draw() {
+	public function decorate() {
 		$urls = $_REQUEST["map_url"];
 		$array_urls = explode("___", $urls);
+		$width = $this->conf->width;
+		$height = $this->conf->height;
+		$res = $this->pdf->k*($this->conf->res_dpi/72);
 		$myURL = new stripRequest($array_urls[0]);
-		$map_width = $this->conf->width;
-		$map_height = $this->conf->height;
+		$this->mapExtent = $myURL->get('BBOX');
 		for($i=0; $i<count($array_urls); $i++){
 			$m = new stripRequest($array_urls[$i]);
-			$m->set('width',(intval($map_width*$this->pdf->k)));
-			$m->set('height',(intval($map_height*$this->pdf->k)));
+			$m->set('width',(intval($width*$res)));
+			$m->set('height',(intval($height*$res)));
 			$array_urls[$i] = $m->url;
 		}
+		
 		$i = new weldMaps2PNG(implode("___",$array_urls),$this->filename);
-		$this->pdf->Image($this->filename, $this->conf->x_ul, $this->conf->y_ul, $map_width, $map_height,'png');
+		$this->pdf->Image($this->filename, $this->conf->x_ul, $this->conf->y_ul, $width, $height,'png');
 	}
 }
 

Added: branches/print_dev/http/print/classes/mbOverviewDecorator.php
===================================================================
--- branches/print_dev/http/print/classes/mbOverviewDecorator.php	                        (rev 0)
+++ branches/print_dev/http/print/classes/mbOverviewDecorator.php	2009-01-08 12:44:12 UTC (rev 3415)
@@ -0,0 +1,37 @@
+<?php
+
+require_once(dirname(__FILE__)."/../../classes/class_stripRequest.php");
+require_once(dirname(__FILE__)."/../../classes/class_weldOverview2PNG.php");
+
+class mbOverviewDecorator extends mbTemplatePdfDecorator {
+
+	protected $filename;
+	
+	public function __construct($pdfObj, $mapConf) {
+		parent::__construct($pdfObj, $mapConf);
+		$this->filename = TMPDIR."/".parent::generateOutputFileName("map","png");
+		$this->decorate();	
+	}
+	
+	public function decorate() {
+		$overview_url = $_REQUEST["overview_url"];
+		$o_url = new stripRequest($overview_url);
+		$width = $this->conf->width;
+		$height = $this->conf->height;
+		$res = $this->pdf->k*($this->conf->res_dpi/72);		
+		$o_url->set('width',(intval($width*$res)));
+		$o_url->set('height',(intval($height*$res)));
+		$overview_url = $o_url->url;	
+
+		$urls = $_REQUEST["map_url"];
+		$array_urls = explode("___", $urls);
+		$myURL = new stripRequest($array_urls[0]);
+		$myURL->set('bbox', $this->mapExtent);
+
+		$i = new weldOverview2PNG($overview_url,$myURL->url ,$this->filename);
+		$this->pdf->Image($this->filename, $this->conf->x_ul, $this->conf->y_ul, $width, $height,'png');
+	}
+}
+
+
+?>

Modified: branches/print_dev/http/print/classes/mbPdf.php
===================================================================
--- branches/print_dev/http/print/classes/mbPdf.php	2009-01-07 16:42:28 UTC (rev 3414)
+++ branches/print_dev/http/print/classes/mbPdf.php	2009-01-08 12:44:12 UTC (rev 3415)
@@ -8,8 +8,8 @@
 	/* the actual pdf */
 	public $objPdf; 
 	public $confPdf;
-	public $outputFileName;	
-	
+	public $outputFileName;
+
 	public $isRendered = false;
 	public $isSaved = false;
 

Modified: branches/print_dev/http/print/classes/mbTemplatePdf.php
===================================================================
--- branches/print_dev/http/print/classes/mbTemplatePdf.php	2009-01-07 16:42:28 UTC (rev 3414)
+++ branches/print_dev/http/print/classes/mbTemplatePdf.php	2009-01-08 12:44:12 UTC (rev 3415)
@@ -4,6 +4,9 @@
 
 class mbTemplatePdf extends mbPdf {
 
+	/* it seems several decorators are going to need this information */
+	public $mapExtent;
+
 	public function __construct($jsonConf) {
 		$this->confPdf = $jsonConf;
 		if (!$this->confPdf->orientation ||	!$this->confPdf->units || !$this->confPdf->format) {
@@ -28,6 +31,9 @@
 					case "map":
 						$err = new mbMapDecorator($this->objPdf, $pageElementConf);
 						break;
+					case "overview":
+						$err = new mbOverviewDecorator($this->objPdf, $pageElementConf);
+						break;						
 				}
             }
             

Modified: branches/print_dev/http/print/classes/mbTemplatePdfDecorator.php
===================================================================
--- branches/print_dev/http/print/classes/mbTemplatePdfDecorator.php	2009-01-07 16:42:28 UTC (rev 3414)
+++ branches/print_dev/http/print/classes/mbTemplatePdfDecorator.php	2009-01-08 12:44:12 UTC (rev 3415)
@@ -2,7 +2,17 @@
 
 abstract class mbTemplatePdfDecorator extends mbTemplatePdf {
 
-	public function __construct() {}
+	/* the pdf object to decorate */
+	public $pdf;
+	/* the conf object for the desired decoration */
+	public $conf;
+	
+	public function __construct($pdfObj, $mapConf) {
+		$this->pdf = $pdfObj;
+		$this->conf = $mapConf;
+	}
+	
+	abstract public function decorate();
 
 }
 



More information about the Mapbender_commits mailing list