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