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 ReportHtmlLine 24a25f0a04SGreg Roach */ 25c1010edaSGreg Roachclass ReportHtmlLine extends ReportBaseLine 26c1010edaSGreg Roach{ 27a25f0a04SGreg Roach /** 28a25f0a04SGreg Roach * HTML line renderer 29a25f0a04SGreg Roach * 30b6f35a76SGreg Roach * @param HtmlRenderer $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) { 37a25f0a04SGreg Roach $this->x1 = $renderer->getX(); 38a25f0a04SGreg Roach } 39c21bdddcSGreg Roach if ($this->y1 === ReportBaseElement::CURRENT_POSITION) { 40a25f0a04SGreg Roach $this->y1 = $renderer->getY(); 41a25f0a04SGreg Roach } 42c21bdddcSGreg Roach if ($this->x2 === ReportBaseElement::CURRENT_POSITION) { 43a25f0a04SGreg Roach $this->x2 = $renderer->getRemainingWidth(); 44a25f0a04SGreg Roach } 45c21bdddcSGreg Roach if ($this->y2 === ReportBaseElement::CURRENT_POSITION) { 46a25f0a04SGreg Roach $this->y2 = $renderer->getY(); 47a25f0a04SGreg Roach } 48a25f0a04SGreg Roach // Vertical line 4977bab461SGreg Roach if ($this->x1 === $this->x2) { 507a6ee1acSGreg 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"; 51a25f0a04SGreg Roach } 52a25f0a04SGreg Roach // Horizontal line 5377bab461SGreg Roach if ($this->y1 === $this->y2) { 547a6ee1acSGreg 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"; 55a25f0a04SGreg Roach } 56a25f0a04SGreg Roach // Keep max Y updated 57a25f0a04SGreg Roach // One or the other will be higher... lasy mans way... 58a25f0a04SGreg Roach $renderer->addMaxY($this->y1); 59a25f0a04SGreg Roach $renderer->addMaxY($this->y2); 60a25f0a04SGreg Roach } 61a25f0a04SGreg Roach} 62