2013-09-21 17:35:18 +02:00
|
|
|
<?php
|
2015-02-04 10:46:36 +01:00
|
|
|
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
2013-09-21 17:35:18 +02:00
|
|
|
|
|
|
|
namespace Icinga\Chart\Primitive;
|
|
|
|
|
2014-07-09 18:04:03 +02:00
|
|
|
use DOMElement;
|
|
|
|
use Icinga\Chart\Render\RenderContext;
|
2013-09-21 17:35:18 +02:00
|
|
|
|
|
|
|
/**
|
2013-09-25 16:32:28 +02:00
|
|
|
* Base interface for animatable objects
|
2013-09-21 17:35:18 +02:00
|
|
|
*/
|
|
|
|
abstract class Animatable extends Styleable
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The animation object set
|
|
|
|
*
|
|
|
|
* @var Animation
|
|
|
|
*/
|
|
|
|
public $animation = null;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the animation for this object
|
|
|
|
*
|
2013-09-25 16:32:28 +02:00
|
|
|
* @param Animation $anim The animation to use
|
2013-09-21 17:35:18 +02:00
|
|
|
*/
|
|
|
|
public function setAnimation(Animation $anim)
|
|
|
|
{
|
|
|
|
$this->animation = $anim;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Append the animation to the given element
|
|
|
|
*
|
2013-09-25 16:32:28 +02:00
|
|
|
* @param DOMElement $dom The element to append the animation to
|
|
|
|
* @param RenderContext $ctx The context to use for rendering the animation object
|
2013-09-21 17:35:18 +02:00
|
|
|
*/
|
|
|
|
protected function appendAnimation(DOMElement $dom, RenderContext $ctx)
|
|
|
|
{
|
|
|
|
if ($this->animation) {
|
|
|
|
$dom->appendChild($this->animation->toSvg($ctx));
|
|
|
|
}
|
|
|
|
}
|
2013-09-23 12:09:40 +02:00
|
|
|
}
|