RequestOutputPlotYSerieNodeClass.php 2.76 KB
<?php

require_once "RequestOutputPlotResamplingNodeClass.php";
require_once "RequestOutputPlotYSerieErrorBarNodeClass.php";

define ("REQUESTOUTPUTPLOTYSERIE_XYPLOT_NAME", "yserie");
define ("REQUESTOUTPUTPLOTYSERIE_TIMEPLOT_NAME", "serie");

define ("REQUESTOUTPUTPLOTYSERIE_XID", "xId");
define ("REQUESTOUTPUTPLOTYSERIE_INDEX", "index");
define ("REQUESTOUTPUTPLOTYSERIE_RESOLUTION", "resolution");
define ("REQUESTOUTPUTPLOTYSERIE_RESAMPLING", "resampling");
define ("REQUESTOUTPUTPLOTYSERIE_ERRORBAR", "errorBar");

/**
 * @class RequestOutputPlotYSerieNodeClass
 * @brief Definition of a yserie for a plot of a plot request
 * @details
*/
class RequestOutputPlotYSerieNodeClass extends RequestOutputPlotBaseSerieNodeClass
{
	public function __construct($name)
	{
		parent::__construct($name);
	}

	public function setIndex($index)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTYSERIE_INDEX, $index);
	}
	
	public function getIndex()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTYSERIE_INDEX);
	}

	public function setResolution($resolution)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTYSERIE_RESOLUTION, $resolution);
	}

	public function getResolution()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTYSERIE_RESOLUTION);
	}

	public function setXId($xId)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTYSERIE_XID, $xId);
	}

	public function getXId()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTYSERIE_XID);
	}
	
	public function getResampling()
	{
		$node = $this->getFirstChildByName(REQUESTOUTPUTPLOTYSERIE_RESAMPLING);
		
		if (!isset($node))
		{
			$node = new RequestOutputPlotResamplingNodeClass(REQUESTOUTPUTPLOTYSERIE_RESAMPLING);
			$this->addChild($node);
		}
		
		return $node;
	}
	
	public function getErrorBar()
	{
		$node = $this->getFirstChildByName(REQUESTOUTPUTPLOTYSERIE_ERRORBAR);
	
		if (!isset($node))
		{
			$node = new RequestOutputPlotYSerieErrorBarNodeClass(REQUESTOUTPUTPLOTYSERIE_ERRORBAR);
			$this->addChild($node);
		}
	
		return $node;
	}
	
	public function loadFromNode($xmlNode)
	{
		$this->setIndex($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTYSERIE_INDEX));

		$xId = $this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTYSERIE_XID);
		if (!empty($xId))
			$this->setXId($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTYSERIE_XID));
		
		$resamplingXmlNode = $this->getXmlNodeChildByTagName($xmlNode, REQUESTOUTPUTPLOTYSERIE_RESAMPLING);
		if (isset($resamplingXmlNode))
			$this->getResampling()->loadFromNode($resamplingXmlNode);
		
		$errorbarXmlNode = $this->getXmlNodeChildByTagName($xmlNode, REQUESTOUTPUTPLOTYSERIE_ERRORBAR);
		if (isset($errorbarXmlNode))
			$this->getErrorBar()->loadFromNode($errorbarXmlNode);
		
		parent::loadFromNode($xmlNode);
	}
}

?>