RequestOutputPlotHistogram2DSerieNodeClass.php 4.66 KB
<?php

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

define ("REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_NAME", "histogram2d");
define ("REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_XID", "xId");
define ("REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_INDEX", "index");
define ("REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_RESAMPLING", "resampling");

define ("REQUESTOUTPUTPLOTBINS_NAME", "bins");
define ("REQUESTOUTPUTPLOTBINS_MANUAL", "manual");
define ("REQUESTOUTPUTPLOTBINS_XBINNUMBER", "xbinnumber");
define ("REQUESTOUTPUTPLOTBINS_YBINNUMBER", "ybinnumber");

define ("REQUESTOUTPUTPLOTHISTOTYPE_NAME", "histotype");
define ("REQUESTOUTPUTPLOTHISTOTYPE_FUNCTION", "type");
define ("REQUESTOUTPUTPLOTHISTOTYPE_SMOOTHFACTOR", "smoothfactor");
define ("REQUESTOUTPUTPLOTHISTOTYPE_PARAMID", "paramId");
define ("REQUESTOUTPUTPLOTHISTOTYPE_INDEX", "index");
/**
 * @class RequestOutputPlotHistogram2DSerieNodeClass
 * @brief Definition of a histogram2d for a plot of a plot request
 * @details
*/

class RequestOutputPlotBinsNodeClass extends NodeClass
{
	public function __construct($name)
	{
		parent::__construct($name);
	}

	public function addManualBins($xBinNumber, $yBinNumber)
	{
		$node = $this->getFirstChildByName(REQUESTOUTPUTPLOTBINS_MANUAL);
		
		if (!isset($node))
		{
			$node = new NodeClass(REQUESTOUTPUTPLOTBINS_MANUAL);
			$this->addChild($node);
		}
		
		$node->setAttribute(REQUESTOUTPUTPLOTBINS_XBINNUMBER, $xBinNumber);
		$node->setAttribute(REQUESTOUTPUTPLOTBINS_YBINNUMBER, $yBinNumber);
		return $node;
	}

}

class RequestOutputPlotHistotypeNodeClass extends NodeClass
{
	public function __construct($name)
	{
		parent::__construct($name);
	}

	public function setFunction($type){
		$this->setAttribute(REQUESTOUTPUTPLOTHISTOTYPE_FUNCTION, $type);
	}
	public function getFunction(){
		return $this->getAttribute(REQUESTOUTPUTPLOTHISTOTYPE_FUNCTION);
	}

	public function setSmoothFactor($smoothFactor){
		$this->setAttribute(REQUESTOUTPUTPLOTHISTOTYPE_SMOOTHFACTOR, $smoothFactor);
	}
	public function getSmoothFactor(){
		return $this->getAttribute(REQUESTOUTPUTPLOTHISTOTYPE_SMOOTHFACTOR);
	}

	public function setParamId($paramId){
		$this->setAttribute(REQUESTOUTPUTPLOTHISTOTYPE_PARAMID, $paramId);
	}
	public function getParamId(){
		return $this->getAttribute(REQUESTOUTPUTPLOTHISTOTYPE_PARAMID);
	}

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

}

class RequestOutputPlotHistogram2DSerieNodeClass extends RequestOutputPlotBaseSerieNodeClass
{
	public function __construct($name)
	{
		parent::__construct($name);
	}

	public function getBins()
	{
		$node = $this->getFirstChildByName(REQUESTOUTPUTPLOTBINS_NAME);
		
		if (!isset($node))
		{
			$node = new RequestOutputPlotBinsNodeClass(REQUESTOUTPUTPLOTBINS_NAME);
			$this->addChild($node);
		}
		
		return $node;
	}

	public function getHistotype()
	{
		$node = $this->getFirstChildByName(REQUESTOUTPUTPLOTHISTOTYPE_NAME);
		
		if (!isset($node))
		{
			$node = new RequestOutputPlotHistotypeNodeClass(REQUESTOUTPUTPLOTHISTOTYPE_NAME);
			$this->addChild($node);
		}
		
		return $node;
	}
	public function setIndex($index)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_INDEX, $index);
	}
	
	public function getIndex()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_INDEX);
	}

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

	public function getXId()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_XID);
	}
	
	public function getResampling()
	{
		$node = $this->getFirstChildByName(REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_RESAMPLING);
		
		if (!isset($node))
		{
			$node = new RequestOutputPlotResamplingNodeClass(REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_RESAMPLING);
			$this->addChild($node);
		}
		
		return $node;
	}
	
	
	public function loadFromNode($xmlNode)
	{
		$this->setIndex($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_INDEX));

		$xId = $this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_XID);
		if (!empty($xId))
			$this->setXId($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_XID));
		
		$resamplingXmlNode = $this->getXmlNodeChildByTagName($xmlNode, REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_RESAMPLING);
		if (isset($resamplingXmlNode))
			$this->getResampling()->loadFromNode($resamplingXmlNode);
		
		
		parent::loadFromNode($xmlNode);
	}
}

?>