xref: /webtrees/app/Report/ReportHtmlLine.php (revision 3976b4703df669696105ed6b024b96d433c8fbdb)
1a25f0a04SGreg Roach<?php
2*3976b470SGreg Roach
3a25f0a04SGreg Roach/**
4a25f0a04SGreg Roach * webtrees: online genealogy
58fcd0d32SGreg Roach * Copyright (C) 2019 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
15a25f0a04SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16a25f0a04SGreg Roach */
17e7f56f2aSGreg Roachdeclare(strict_types=1);
18e7f56f2aSGreg Roach
1976692c8bSGreg Roachnamespace Fisharebest\Webtrees\Report;
20a25f0a04SGreg Roach
21a25f0a04SGreg Roach/**
22a25f0a04SGreg Roach * Class ReportHtmlLine
23a25f0a04SGreg Roach */
24c1010edaSGreg Roachclass ReportHtmlLine extends ReportBaseLine
25c1010edaSGreg Roach{
26a25f0a04SGreg Roach    /**
27a25f0a04SGreg Roach     * HTML line renderer
28a25f0a04SGreg Roach     *
29a25f0a04SGreg Roach     * @param ReportHtml $renderer
30c7ff4153SGreg Roach     *
31c7ff4153SGreg Roach     * @return void
32a25f0a04SGreg Roach     */
33c1010edaSGreg Roach    public function render($renderer)
34c1010edaSGreg Roach    {
35c21bdddcSGreg Roach        if ($this->x1 === ReportBaseElement::CURRENT_POSITION) {
36a25f0a04SGreg Roach            $this->x1 = $renderer->getX();
37a25f0a04SGreg Roach        }
38c21bdddcSGreg Roach        if ($this->y1 === ReportBaseElement::CURRENT_POSITION) {
39a25f0a04SGreg Roach            $this->y1 = $renderer->getY();
40a25f0a04SGreg Roach        }
41c21bdddcSGreg Roach        if ($this->x2 === ReportBaseElement::CURRENT_POSITION) {
42a25f0a04SGreg Roach            $this->x2 = $renderer->getRemainingWidth();
43a25f0a04SGreg Roach        }
44c21bdddcSGreg Roach        if ($this->y2 === ReportBaseElement::CURRENT_POSITION) {
45a25f0a04SGreg Roach            $this->y2 = $renderer->getY();
46a25f0a04SGreg Roach        }
47a25f0a04SGreg Roach        // Vertical line
48a25f0a04SGreg Roach        if ($this->x1 == $this->x2) {
497a6ee1acSGreg Roach            echo '<div style="position:absolute;overflow:hidden;border-', $renderer->alignRTL, ':solid black 1pt;', $renderer->alignRTL, ':', $this->x1, 'pt;top:', $this->y1 + 1, 'pt;width:1pt;height:', $this->y2 - $this->y1, "pt;\"> </div>\n";
50a25f0a04SGreg Roach        }
51a25f0a04SGreg Roach        // Horizontal line
52a25f0a04SGreg Roach        if ($this->y1 == $this->y2) {
537a6ee1acSGreg Roach            echo '<div style="position:absolute;overflow:hidden;border-top:solid black 1pt;', $renderer->alignRTL, ':', $this->x1, 'pt;top:', $this->y1 + 1, 'pt;width:', $this->x2 - $this->x1, "pt;height:1pt;\"> </div>\n";
54a25f0a04SGreg Roach        }
55a25f0a04SGreg Roach        // Keep max Y updated
56a25f0a04SGreg Roach        // One or the other will be higher... lasy mans way...
57a25f0a04SGreg Roach        $renderer->addMaxY($this->y1);
58a25f0a04SGreg Roach        $renderer->addMaxY($this->y2);
59a25f0a04SGreg Roach    }
60a25f0a04SGreg Roach}
61