xref: /webtrees/app/Report/ReportBaseLine.php (revision 0a016d046f63b3b1ece7ec913216782c17f0cbad)
1<?php
2/**
3 * webtrees: online genealogy
4 * Copyright (C) 2017 webtrees development team
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16namespace Fisharebest\Webtrees\Report;
17
18/**
19 * Class ReportBaseLine
20 */
21class ReportBaseLine extends ReportBaseElement {
22	/**
23	 * Start horizontal position, current position (default)
24	 *
25	 * @var mixed
26	 */
27	public $x1 = '.';
28	/**
29	 * Start vertical position, current position (default)
30	 *
31	 * @var mixed
32	 */
33	public $y1 = '.';
34	/**
35	 * End horizontal position, maximum width (default)
36	 *
37	 * @var mixed
38	 */
39	public $x2 = '.';
40	/**
41	 * End vertical position
42	 *
43	 * @var mixed
44	 */
45	public $y2 = '.';
46
47	/**
48	 * Create a line class - Base
49	 *
50	 * @param mixed $x1
51	 * @param mixed $y1
52	 * @param mixed $x2
53	 * @param mixed $y2
54	 */
55	public function __construct($x1, $y1, $x2, $y2) {
56		$this->x1 = $x1;
57		$this->y1 = $y1;
58		$this->x2 = $x2;
59		$this->y2 = $y2;
60
61		return 0;
62	}
63
64	/**
65	 * Get the height of the line.
66	 *
67	 * @param $renderer
68	 *
69	 * @return number
70	 */
71	public function getHeight($renderer) {
72		return abs($this->y2 - $this->y1);
73	}
74
75	/**
76	 * Get the width of the line.
77	 *
78	 * @param $renderer
79	 *
80	 * @return number
81	 */
82	public function getWidth($renderer) {
83		return abs($this->x2 - $this->x1);
84	}
85}
86