[Mapbender-commits] r3650 - in branches/print_dev/http/print: .
classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Mar 9 07:16:06 EDT 2009
Author: mschulz
Date: 2009-03-09 07:16:06 -0400 (Mon, 09 Mar 2009)
New Revision: 3650
Added:
branches/print_dev/http/print/classes/mbImageDecorator.php
Modified:
branches/print_dev/http/print/classes/mbMapDecorator.php
branches/print_dev/http/print/classes/mbOverviewDecorator.php
branches/print_dev/http/print/classes/mbTemplatePdf.php
branches/print_dev/http/print/testConfigTemplate.json
Log:
added image decorator class (logo, northarrow), fixed bug in mbOverviewDecorator
Added: branches/print_dev/http/print/classes/mbImageDecorator.php
===================================================================
--- branches/print_dev/http/print/classes/mbImageDecorator.php (rev 0)
+++ branches/print_dev/http/print/classes/mbImageDecorator.php 2009-03-09 11:16:06 UTC (rev 3650)
@@ -0,0 +1,27 @@
+<?php
+
+class mbImageDecorator extends mbTemplatePdfDecorator {
+
+ protected $pageElementType = "image";
+ protected $elementId;
+
+ public function __construct($pdfObj, $elementId, $mapConf, $controls) {
+ parent::__construct($pdfObj, $mapConf, $controls);
+ $this->elementId = $elementId;
+ $this->override();
+ $this->decorate();
+ }
+
+ public function override() {}
+
+ public function decorate() {
+ $width = $this->conf->width;
+ $height = $this->conf->height;
+ $filename = $this->conf->filename;
+
+ $this->pdf->objPdf->Image($this->conf->filename, $this->conf->x_ul, $this->conf->y_ul);
+ }
+}
+
+
+?>
Modified: branches/print_dev/http/print/classes/mbMapDecorator.php
===================================================================
--- branches/print_dev/http/print/classes/mbMapDecorator.php 2009-03-09 09:08:08 UTC (rev 3649)
+++ branches/print_dev/http/print/classes/mbMapDecorator.php 2009-03-09 11:16:06 UTC (rev 3650)
@@ -53,8 +53,7 @@
$res = $this->pdf->objPdf->k * ($this->res_dpi/72);
$myURL = new stripRequest($array_urls[0]);
$e = new mb_notice("mbMapDecorator: original bbox: ".$myURL->get('BBOX'));
- #$this->pdf->setMapExtent($this->adjustBbox(explode(",",$myURL->get('BBOX')), $myURL->get('srs')));
- $this->pdf->setMapInfo($this->conf->x_ul, $this->conf->y_ul, $width, $height, $this->adjustBbox(explode(",",$myURL->get('BBOX')), $myURL->get('srs')));
+ $this->pdf->setMapInfo($this->conf->x_ul, $this->conf->y_ul, $width, $height, $this->pdf->adjustBbox($this->conf, explode(",",$myURL->get('BBOX')), $myURL->get('srs')));
$e = new mb_notice("mbMapDecorator: adjusted bbox: ".$this->pdf->getMapExtent());
for($i=0; $i<count($array_urls); $i++){
$m = new stripRequest($array_urls[$i]);
@@ -67,16 +66,7 @@
$i = new weldMaps2PNG(implode("___",$array_urls), $this->filename);
$this->pdf->objPdf->Image($this->filename, $this->conf->x_ul, $this->conf->y_ul, $width, $height,'png');
}
-
- protected function adjustBbox($aBboxArray, $aSrsString) {
- $aMbBbox = new Mapbender_bbox($aBboxArray[0],$aBboxArray[1],$aBboxArray[2],$aBboxArray[3],$aSrsString);
- $aMap = new Map();
- $aMap->setWidth($this->conf->width);
- $aMap->setHeight($this->conf->height);
- $aMap->calculateExtent($aMbBbox);
- $adjustedMapExt = $aMap->getExtentInfo();
- return implode(",",$adjustedMapExt);
- }
+
}
?>
\ No newline at end of file
Modified: branches/print_dev/http/print/classes/mbOverviewDecorator.php
===================================================================
--- branches/print_dev/http/print/classes/mbOverviewDecorator.php 2009-03-09 09:08:08 UTC (rev 3649)
+++ branches/print_dev/http/print/classes/mbOverviewDecorator.php 2009-03-09 11:16:06 UTC (rev 3650)
@@ -27,6 +27,7 @@
$res = $this->pdf->objPdf->k*($this->conf->res_dpi/72);
$o_url->set('width',intval($width*$res));
$o_url->set('height',intval($height*$res));
+ $o_url->set('bbox', $this->pdf->adjustBbox($this->conf, explode(",",$o_url->get('BBOX')), $o_url->get('srs')));
$overview_url = $o_url->url;
$urls = $_REQUEST["map_url"];
Modified: branches/print_dev/http/print/classes/mbTemplatePdf.php
===================================================================
--- branches/print_dev/http/print/classes/mbTemplatePdf.php 2009-03-09 09:08:08 UTC (rev 3649)
+++ branches/print_dev/http/print/classes/mbTemplatePdf.php 2009-03-09 11:16:06 UTC (rev 3650)
@@ -41,6 +41,16 @@
$e = new mb_notice("mbTemplatePdf: getting mapExtent as ".$this->mapinfo["extent"]);
return $this->mapinfo["extent"];
}
+
+ public function adjustBbox($elementConf, $aBboxArray, $aSrsString) {
+ $aMbBbox = new Mapbender_bbox($aBboxArray[0],$aBboxArray[1],$aBboxArray[2],$aBboxArray[3],$aSrsString);
+ $aMap = new Map();
+ $aMap->setWidth($elementConf->width);
+ $aMap->setHeight($elementConf->height);
+ $aMap->calculateExtent($aMbBbox);
+ $adjustedMapExt = $aMap->getExtentInfo();
+ return implode(",",$adjustedMapExt);
+ }
public function render() {
foreach ($this->confPdf->pages as $pageConf) {
@@ -67,7 +77,10 @@
break;
case "measure":
$err = new mbMeasureDecorator($this, $pageElementId, $pageElementConf, $controls);
- break;
+ break;
+ case "image":
+ $err = new mbImageDecorator($this, $pageElementId, $pageElementConf, $controls);
+ break;
}
}
Modified: branches/print_dev/http/print/testConfigTemplate.json
===================================================================
--- branches/print_dev/http/print/testConfigTemplate.json 2009-03-09 09:08:08 UTC (rev 3649)
+++ branches/print_dev/http/print/testConfigTemplate.json 2009-03-09 11:16:06 UTC (rev 3650)
@@ -102,6 +102,14 @@
"border" : 1,
"fill" : 1,
"border_width" : 0.5
+ },
+ "nordpfeil" : {
+ "type" : "image",
+ "x_ul" : 270.1,
+ "y_ul" : 15.2,
+ "width" : 37,
+ "height" : 76,
+ "filename" : "./img/northarrow.png"
}
}
}
More information about the Mapbender_commits
mailing list