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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Jan 7 11:40:24 EST 2009


Author: mschulz
Date: 2009-01-07 11:40:24 -0500 (Wed, 07 Jan 2009)
New Revision: 3412

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:
start of map decorator implementation

Modified: branches/print_dev/http/print/classes/mbMapDecorator.php
===================================================================
--- branches/print_dev/http/print/classes/mbMapDecorator.php	2009-01-07 13:08:15 UTC (rev 3411)
+++ branches/print_dev/http/print/classes/mbMapDecorator.php	2009-01-07 16:40:24 UTC (rev 3412)
@@ -1,9 +1,35 @@
-<?php
+<?php
 
+include (dirname(__FILE__)."/../../classes/class_stripRequest.php");
+include (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;
+		$this->filename = TMPDIR."/".parent::generateOutputFileName("map","png");
+		$this->draw();	
+	}
+	
+	protected function draw() {
+		$urls = $_REQUEST["map_url"];
+		$array_urls = explode("___", $urls);
+		$myURL = new stripRequest($array_urls[0]);
+		$map_width = $this->conf->width;
+		$map_height = $this->conf->height;
+		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)));
+			$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');
 	}
 }
 

Modified: branches/print_dev/http/print/classes/mbPdf.php
===================================================================
--- branches/print_dev/http/print/classes/mbPdf.php	2009-01-07 13:08:15 UTC (rev 3411)
+++ branches/print_dev/http/print/classes/mbPdf.php	2009-01-07 16:40:24 UTC (rev 3412)
@@ -16,8 +16,8 @@
 	abstract public function render();
 	abstract public function save();
 	
-	public function generateOutputFileName() {
-		$this->outputFileName = "map_".substr(md5(uniqid(rand())),0,7).".pdf";
+	public function generateOutputFileName($prefix, $suffix) {
+		return $prefix."_".substr(md5(uniqid(rand())),0,7).".".$suffix;
 	}
 
 	public function returnURL() {

Modified: branches/print_dev/http/print/classes/mbTemplatePdf.php
===================================================================
--- branches/print_dev/http/print/classes/mbTemplatePdf.php	2009-01-07 13:08:15 UTC (rev 3411)
+++ branches/print_dev/http/print/classes/mbTemplatePdf.php	2009-01-07 16:40:24 UTC (rev 3412)
@@ -12,7 +12,7 @@
 		$this->objPdf = new mb_fpdi($this->confPdf->orientation,
 									$this->confPdf->units,
 									$this->confPdf->format);
-		$this->generateOutputFileName();
+		$this->outputFileName = $this->generateOutputFileName("map","pdf");
 	}
 
 	public function render() {
@@ -25,8 +25,8 @@
             
             foreach ($pageConf->elements as $pageElementId => $pageElementConf) {
 				switch ($pageElementId) {
-					case "map1":
-						#$this->objPdf = new mbMapDecorator($this->objPdf, $pageElementConf);
+					case "map":
+						$err = new mbMapDecorator($this->objPdf, $pageElementConf);
 						break;
 				}
             }

Modified: branches/print_dev/http/print/classes/mbTemplatePdfDecorator.php
===================================================================
--- branches/print_dev/http/print/classes/mbTemplatePdfDecorator.php	2009-01-07 13:08:15 UTC (rev 3411)
+++ branches/print_dev/http/print/classes/mbTemplatePdfDecorator.php	2009-01-07 16:40:24 UTC (rev 3412)
@@ -1,10 +1,8 @@
 <?php
 
-abstract class mbPdfDecorator extends mbPdf {
+abstract class mbTemplatePdfDecorator extends mbTemplatePdf {
 
-	protected $mbPdf;
-
-	public function __construct();
+	public function __construct() {}
 
 }
 



More information about the Mapbender_commits mailing list