RequestOutputPlotAdditionalObjectsNodeClass.php 1.24 KB
<?php

require_once "RequestOutputPlotTextNodeClass.php";
require_once "RequestOutputPlotCurveObjectNodeClass.php";

define ("REQUESTOUTPUTPLOTADDITIONALOBJECTS_NAME", "additionalObjects");

/**
 * @class RequestOutputPlotAdditionalObjectsNodeClass
 * @brief Definition of additional objects for a plot
 * @details
 */
class RequestOutputPlotAdditionalObjectsNodeClass extends NodeClass
{
	public function __construct()
	{
		parent::__construct(REQUESTOUTPUTPLOTADDITIONALOBJECTS_NAME);
	}
	
	public function addTextObject()
	{
		$node = new RequestOutputPlotTextNodeClass();
		$this->addChild($node);
		return $node;
	}
	
	public function addCurveObject()
	{
		$node = new RequestOutputPlotCurveObjectNodeClass();
		$this->addChild($node);
		return $node;
	}
	
	public function getCurveObjects()
	{
		return $this->getChildrenByName(REQUESTOUTPUTPLOTCURVEOBJECT_NAME);
	}
	
	public function loadFromNode($xmlNode)
	{
		foreach ($this->getXmlNodeChildrenByTagName($xmlNode, REQUESTOUTPUTPLOTTEXT_NAME) as $plotTextXmlNode) {
			$this->addTextObject()->loadFromNode($plotTextXmlNode);
		}
		
		foreach ($this->getXmlNodeChildrenByTagName($xmlNode, REQUESTOUTPUTPLOTCURVEOBJECT_NAME) as $curveXmlNode) {
			$this->addCurveObject()->loadFromNode($curveXmlNode);
		}
	}
}

?>