1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Grandstream-XMLApp |
4
|
|
|
* |
5
|
|
|
* Copyright (c) 2017 pudelek.org.pl |
6
|
|
|
* |
7
|
|
|
* @license MIT License (MIT) |
8
|
|
|
* |
9
|
|
|
* For the full copyright and license information, please view source file |
10
|
|
|
* that is bundled with this package in the file LICENSE |
11
|
|
|
* |
12
|
|
|
* @author Marcin Pudełek <[email protected]> |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace mrcnpdlk\Grandstream\XMLApp\Application\Model\Components; |
16
|
|
|
|
17
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Application\ModelInterface; |
18
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Helper\Color; |
19
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Helper\Point; |
20
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Helper\Rectangle; |
21
|
|
|
use mrcnpdlk\Grandstream\XMLApp\MyXML; |
22
|
|
|
|
23
|
|
|
class ElemRectangle extends ElemAbstract implements ModelInterface, ElemInterface |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* ElemRectangle constructor. |
27
|
|
|
* |
28
|
|
|
* @param int $iWidth |
29
|
|
|
* @param int $iHeight |
30
|
|
|
*/ |
31
|
|
|
public function __construct(int $iWidth, int $iHeight) |
32
|
|
|
{ |
33
|
|
|
parent::__construct(new Point(0, 0), new Rectangle($iWidth, $iHeight)); |
34
|
|
|
$this->setColorBorder(new Color(100)); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @return MyXML |
39
|
|
|
*/ |
40
|
|
|
public function getXml(): MyXML |
41
|
|
|
{ |
42
|
|
|
$oXml = new MyXML('DisplayRectangle'); |
43
|
|
|
|
44
|
|
|
$oXml->asObject()->addAttribute('x', $this->getPoint()->getX()); |
45
|
|
|
$oXml->asObject()->addAttribute('y', $this->getPoint()->getY()); |
46
|
|
|
$oXml->asObject()->addAttribute('width', $this->getRectangle()->getWidth()); |
47
|
|
|
$oXml->asObject()->addAttribute('height', $this->getRectangle()->getHeight()); |
48
|
|
|
$oXml->asObject()->addAttribute('bgcolor', $this->getColorBg()->get()); |
49
|
|
|
$oXml->asObject()->addAttribute('border-color', $this->getColorBorder()->get()); |
50
|
|
|
|
51
|
|
|
return $oXml; |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
|