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