* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @author Icinga Development Team */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart\Primitive; use Icinga\Chart\Render\RenderContext; class Rect extends Styleable implements Drawable { private $x; private $y; private $width; private $height; public function __construct($x, $y, $width, $height) { $this->x = $x; $this->y = $y; $this->width = $width; $this->height = $height; } public function toSvg(RenderContext $ctx) { $doc = $ctx->getDocument(); $rect = $doc->createElement('rect'); list($x, $y) = $ctx->toAbsolute($this->x, $this->y); list($width, $height) = $ctx->toAbsolute($this->width, $this->height); $rect->setAttribute('x', $x); $rect->setAttribute('y', $y); $rect->setAttribute('width', $width); $rect->setAttribute('height', $height); $rect->setAttribute('style', $this->getStyle()); return $rect; } }