[Mapbender-commits] r3568 - branches/print_dev/http/extensions/fpdf
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Feb 18 11:06:28 EST 2009
Author: mschulz
Date: 2009-02-18 11:06:28 -0500 (Wed, 18 Feb 2009)
New Revision: 3568
Modified:
branches/print_dev/http/extensions/fpdf/mb_fpdi.php
Log:
added simple mbMeasureDecorator, new Polygon function
Modified: branches/print_dev/http/extensions/fpdf/mb_fpdi.php
===================================================================
--- branches/print_dev/http/extensions/fpdf/mb_fpdi.php 2009-02-18 16:02:42 UTC (rev 3567)
+++ branches/print_dev/http/extensions/fpdf/mb_fpdi.php 2009-02-18 16:06:28 UTC (rev 3568)
@@ -373,6 +373,94 @@
$this->Text($x, $y, $txt);
$this->Rotate(0);
}
+
+ function Polygon($points, $style='D')
+ {
+ //Draw a polygon
+ if($style=='F')
+ $op='f';
+ elseif($style=='FD' or $style=='DF')
+ $op='b';
+ else
+ $op='s';
+
+ $h = $this->h;
+ $k = $this->k;
+
+ $points_string = '';
+ for($i=0; $i<count($points); $i+=2){
+ $points_string .= sprintf('%.2f %.2f', $points[$i]*$k, ($h-$points[$i+1])*$k);
+ if($i==0)
+ $points_string .= ' m ';
+ else
+ $points_string .= ' l ';
+ }
+ $this->_out($points_string . $op);
+ }
+
+ function ClippingText($x, $y, $txt, $outline=false)
+ {
+ $op=$outline ? 5 : 7;
+ $this->_out(sprintf('q BT %.2f %.2f Td %d Tr (%s) Tj 0 Tr ET',
+ $x*$this->k,
+ ($this->h-$y)*$this->k,
+ $op,
+ $this->_escape($txt)));
+ }
+
+ function ClippingRect($x, $y, $w, $h, $outline=false)
+ {
+ $op=$outline ? 'S' : 'n';
+ $this->_out(sprintf('q %.2f %.2f %.2f %.2f re W %s',
+ $x*$this->k,
+ ($this->h-$y)*$this->k,
+ $w*$this->k, -$h*$this->k,
+ $op));
+ }
+
+ function ClippingEllipse($x, $y, $rx, $ry, $outline=false)
+ {
+ $op=$outline ? 'S' : 'n';
+ $lx=4/3*(M_SQRT2-1)*$rx;
+ $ly=4/3*(M_SQRT2-1)*$ry;
+ $k=$this->k;
+ $h=$this->h;
+ $this->_out(sprintf('q %.2f %.2f m %.2f %.2f %.2f %.2f %.2f %.2f c',
+ ($x+$rx)*$k, ($h-$y)*$k,
+ ($x+$rx)*$k, ($h-($y-$ly))*$k,
+ ($x+$lx)*$k, ($h-($y-$ry))*$k,
+ $x*$k, ($h-($y-$ry))*$k));
+ $this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c',
+ ($x-$lx)*$k, ($h-($y-$ry))*$k,
+ ($x-$rx)*$k, ($h-($y-$ly))*$k,
+ ($x-$rx)*$k, ($h-$y)*$k));
+ $this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c',
+ ($x-$rx)*$k, ($h-($y+$ly))*$k,
+ ($x-$lx)*$k, ($h-($y+$ry))*$k,
+ $x*$k, ($h-($y+$ry))*$k));
+ $this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c W %s',
+ ($x+$lx)*$k, ($h-($y+$ry))*$k,
+ ($x+$rx)*$k, ($h-($y+$ly))*$k,
+ ($x+$rx)*$k, ($h-$y)*$k,
+ $op));
+ }
+
+ function UnsetClipping()
+ {
+ $this->_out('Q');
+ }
+
+ function ClippedCell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='')
+ {
+ if($border || $fill || $this->y+$h>$this->PageBreakTrigger)
+ {
+ $this->Cell($w, $h, '', $border, 0, '', $fill);
+ $this->x-=$w;
+ }
+ $this->ClippingRect($this->x, $this->y, $w, $h);
+ $this->Cell($w, $h, $txt, '', $ln, $align, 0, $link);
+ $this->UnsetClipping();
+ }
}
More information about the Mapbender_commits
mailing list