RequestOutputPlotSerieIntervalTicksNodeClass.php 2.5 KB
<?php

define ("REQUESTOUTPUTPLOTSERIEINTERVALTICKS_MODE", "mode");
define ("REQUESTOUTPUTPLOTSERIEINTERVALTICKS_COLOR", "color");
define ("REQUESTOUTPUTPLOTSERIEINTERVALTICKS_SYMBOL", "symbol");

abstract class RequestOutputPlotSerieIntervalTicksModeEnum
{
	const SYMBOLONLY    = "symbol-only";
	const INTERVALINDEX = "interval-index";
	const STARTTIME     = "start-time";
	const STARTSTOPTIME = "start-stop-time";
}
	
/**
 * @class RequestOutputPlotSerieIntervalTicksNodeClass
 * @brief Definition of interval ticks element for a serie of a plot
 * @details
 */
class RequestOutputPlotSerieIntervalTicksNodeClass extends NodeClass
{
	public function __construct($name)
	{
		parent::__construct($name);
	}

	public function setMode($mode)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTSERIEINTERVALTICKS_MODE, $mode);
	}
	
	public function getMode()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTSERIEINTERVALTICKS_MODE);
	}
	
	public function setColor($color)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTSERIEINTERVALTICKS_COLOR, $color);
	}
	
	public function getColor()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTSERIEINTERVALTICKS_COLOR);
	}
	
	public function isSymbolDefined()
	{
		$node = $this->getFirstChildByName(REQUESTOUTPUTPLOTSERIEINTERVALTICKS_SYMBOL);
		return isset($node);
	}
	
	public function getSymbol()
	{
		$node = $this->getFirstChildByName(REQUESTOUTPUTPLOTSERIEINTERVALTICKS_SYMBOL);
	
		if (!isset($node))
		{
			$node = new RequestOutputPlotSymbolNodeClass(REQUESTOUTPUTPLOTSERIEINTERVALTICKS_SYMBOL);
			$this->addChild($node);
		}
	
		return $node;
	}
	
	public function isFontDefined()
	{
		$node = $this->getFirstChildByName(REQUESTOUTPUTPLOTFONT_NODENAME);
		return isset($node);
	}
	
	public function getFont()
	{
		$node = $this->getFirstChildByName(REQUESTOUTPUTPLOTFONT_NODENAME);
	
		if (!isset($node))
		{
			$node = new RequestOutputPlotFontNodeClass();
			$this->addChild($node);
		}
	
		return $node;
	}
	
	public function loadFromNode($xmlNode)
	{
		$this->setMode($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTSERIEINTERVALTICKS_MODE));
		$this->setColor($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTSERIEINTERVALTICKS_COLOR));
		
		$symbolXmlNode = $this->getXmlNodeChildByTagName($xmlNode, REQUESTOUTPUTPLOTSERIEINTERVALTICKS_SYMBOL);
		if (isset($symbolXmlNode))
			$this->getSymbol()->loadFromNode($symbolXmlNode);
		
		$fontXmlNode = $this->getXmlNodeChildByTagName($xmlNode, REQUESTOUTPUTPLOTFONT_NODENAME);
		if (isset($fontXmlNode))
			$this->getFont()->loadFromNode($fontXmlNode);
	}
}

?>