Blame view

src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotTextLegendNodeClass.php 1.52 KB
70646e70   Benjamin Renard   Add text legend d...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?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;
	}
}

?>