RequestOutputPlotTextLegendNodeClass.php 1.52 KB
<?php

define ("REQUESTOUTPUTPLOTTEXTLEGEND_NAME", "textLegend");
define ("REQUESTOUTPUTPLOTTEXTLEGEND_TEXT", "text");
define ("REQUESTOUTPUTPLOTTEXTLEGEND_POSITION", "position");
define ("REQUESTOUTPUTPLOTTEXTLEGEND_COLOR", "color");

abstract class RequestOutputPlotTextLegendPositionEnum
{
	const LEFT   = "left";
	const RIGHT  = "right";
	const BOTTOM = "bottom";
	const TOP    = "top";
}

/**
 * @class RequestOutputPlotTextLegendNodeClass
 * @brief Definition of a "text legend" element for a plot
 * @details
 */
class RequestOutputPlotTextLegendNodeClass extends NodeClass
{
	public function __construct()
	{
		parent::__construct(REQUESTOUTPUTPLOTTEXTLEGEND_NAME);
	}
	
	public function setText($text)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTTEXTLEGEND_TEXT, $text);
	}
	
	public function getText()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTTEXTLEGEND_TEXT);
	}
	
	public function setPosition($position)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTTEXTLEGEND_POSITION, $position);
	}
	
	public function getPosition()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTTEXTLEGEND_POSITION);
	}
	
	public function setColor($color)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTTEXTLEGEND_COLOR, $color);
	}
	
	public function getColor()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTTEXTLEGEND_COLOR);
	}
	
	public function getFont()
	{
		$node = $this->getFirstChildByName(REQUESTOUTPUTPLOTPARAMSLEGEND_FONT);
	
		if (!isset($node))
		{
			$node = new RequestOutputPlotFontNodeClass();
			$this->addChild($node);
		}
	
		return $node;
	}
}

?>