RequestOutputPlotHistogram1DSerieNodeClass.php 3.03 KB
<?php

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

define ("REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_NAME", "histogram1d");
define ("REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_INDEX", "index");
define ("REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_COLOR", "color");

define ("REQUESTOUTPUTPLOTBINS_NAME", "bins");
define ("REQUESTOUTPUTPLOTBINS_MANUAL", "manual");
define ("REQUESTOUTPUTPLOTBINS_XBINNUMBER", "xbinnumber");
define ("REQUESTOUTPUTPLOTBINS_STARES", "stares");

define ("REQUESTOUTPUTPLOTHISTOTYPE_NAME", "histotype");
define ("REQUESTOUTPUTPLOTHISTOTYPE_FUNCTION", "type");
/**
 * @class RequestOutputPlotHistogram1DSerieNodeClass
 * @brief Definition of a histogram1D for a plot of a plot request
 * @details
*/

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

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

}

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

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

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

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

	public function getHistotype()
	{
		$node = $this->getFirstChildByName(REQUESTOUTPUTPLOTHISTOTYPE_NAME);
		
		if (!isset($node))
		{
			$node = new RequestOutputPlotHistotype1DNodeClass(REQUESTOUTPUTPLOTHISTOTYPE_NAME);
			$this->addChild($node);
		}
		
		return $node;
	}

	public function setColor($color)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_COLOR, $color);
	}
	
	public function getColor()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_COLOR);
	}

	public function setIndex($index)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_INDEX, $index);
	}
	
	public function getIndex()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_INDEX);
	}	
	
	public function loadFromNode($xmlNode)
	{
		$this->setIndex($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_INDEX));
		parent::loadFromNode($xmlNode);
	}
}

?>