xref: /webtrees/app/Report/ReportPdfLine.php (revision a25f0a04682c4c39c1947220c90af4118c713952)
1*a25f0a04SGreg Roach<?php
2*a25f0a04SGreg Roachnamespace Webtrees;
3*a25f0a04SGreg Roach
4*a25f0a04SGreg Roach/**
5*a25f0a04SGreg Roach * webtrees: online genealogy
6*a25f0a04SGreg Roach * Copyright (C) 2015 webtrees development team
7*a25f0a04SGreg Roach * This program is free software: you can redistribute it and/or modify
8*a25f0a04SGreg Roach * it under the terms of the GNU General Public License as published by
9*a25f0a04SGreg Roach * the Free Software Foundation, either version 3 of the License, or
10*a25f0a04SGreg Roach * (at your option) any later version.
11*a25f0a04SGreg Roach * This program is distributed in the hope that it will be useful,
12*a25f0a04SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
13*a25f0a04SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14*a25f0a04SGreg Roach * GNU General Public License for more details.
15*a25f0a04SGreg Roach * You should have received a copy of the GNU General Public License
16*a25f0a04SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
17*a25f0a04SGreg Roach */
18*a25f0a04SGreg Roach
19*a25f0a04SGreg Roach/**
20*a25f0a04SGreg Roach * Class ReportPdfLine
21*a25f0a04SGreg Roach */
22*a25f0a04SGreg Roachclass ReportPdfLine extends ReportBaseLine {
23*a25f0a04SGreg Roach	/**
24*a25f0a04SGreg Roach	 * PDF line renderer
25*a25f0a04SGreg Roach	 *
26*a25f0a04SGreg Roach	 * @param PDF $renderer
27*a25f0a04SGreg Roach	 *
28*a25f0a04SGreg Roach	 * @return void
29*a25f0a04SGreg Roach	 */
30*a25f0a04SGreg Roach	function render($renderer) {
31*a25f0a04SGreg Roach		if ($this->x1 == ".") {
32*a25f0a04SGreg Roach			$this->x1 = $renderer->GetX();
33*a25f0a04SGreg Roach		}
34*a25f0a04SGreg Roach		if ($this->y1 == ".") {
35*a25f0a04SGreg Roach			$this->y1 = $renderer->GetY();
36*a25f0a04SGreg Roach		}
37*a25f0a04SGreg Roach		if ($this->x2 == ".") {
38*a25f0a04SGreg Roach			$this->x2 = $renderer->getMaxLineWidth();
39*a25f0a04SGreg Roach		}
40*a25f0a04SGreg Roach		if ($this->y2 == ".") {
41*a25f0a04SGreg Roach			$this->y2 = $renderer->GetY();
42*a25f0a04SGreg Roach		}
43*a25f0a04SGreg Roach		if ($renderer->getRTL()) {
44*a25f0a04SGreg Roach			$renderer->Line($renderer->getPageWidth() - $this->x1, $this->y1, $renderer->getPageWidth() - $this->x2, $this->y2);
45*a25f0a04SGreg Roach		} else {
46*a25f0a04SGreg Roach			$renderer->Line($this->x1, $this->y1, $this->x2, $this->y2);
47*a25f0a04SGreg Roach		}
48*a25f0a04SGreg Roach	}
49*a25f0a04SGreg Roach}
50