Blame view

src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotParamsNodeClass.php 4.14 KB
22521f1c   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php

require_once("RequestOutputPlotYSerieNodeClass.php");

define ("REQUESTOUTPUTPLOTPARAMS_NAME", "params");

define ("REQUESTOUTPUTPLOTPARAM_NAME", "param");
define ("REQUESTOUTPUTPLOTPARAM_ID", "id");

define ("REQUESTOUTPUTPLOTXSERIE_NAME", "xserie");
define ("REQUESTOUTPUTPLOTXSERIE_XAXIS", "xAxis");
define ("REQUESTOUTPUTPLOTXSERIE_INDEX", "index");

4ede4320   Benjamin Renard   Integration for s...
14
15
16
17
define ("REQUESTOUTPUTPLOTCOLORSERIE_NAME", "colorserie");
define ("REQUESTOUTPUTPLOTCOLORSERIE_ID", "id");
define ("REQUESTOUTPUTPLOTCOLORSERIE_INDEX", "index");

944199fe   Benjamin Renard   Use table definit...
18
19
20
define ("REQUESTOUTPUTPLOTSPECTRO_NAME", "spectro");
define ("REQUESTOUTPUTPLOTSPECTRO_YAXIS", "yAxis");

17f69bd1   Benjamin Renard   Add tick plot and...
21
22
23
24
25
26
define ("REQUESTOUTPUTPLOTSTATUSBAR_NAME", "serie");
define ("REQUESTOUTPUTPLOTSTATUSBAR_INDEX", "index");

define ("REQUESTOUTPUTPLOTTICKBAR_NAME", "serie");
define ("REQUESTOUTPUTPLOTTICKBAR_INDEX", "index");

22521f1c   Benjamin Renard   First commit
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
 * @class RequestOutputPlotParamNodeClass
 * @brief Definition of a param for a plot of a plot request
 * @details
*/
class RequestOutputPlotParamNodeClass extends NodeClass
{
	public function __construct($id)
	{
		parent::__construct(REQUESTOUTPUTPLOTPARAM_NAME);
		$this->setAttribute(REQUESTOUTPUTPLOTPARAM_ID, $id);
	}

	public function getId()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTPARAM_ID);
	}

4ede4320   Benjamin Renard   Integration for s...
45
	public function addYSerie($yAxis, $index, $xAxis = "", $colorSerieId = -1)
22521f1c   Benjamin Renard   First commit
46
47
48
49
50
51
52
53
54
55
56
	{
		if ($xAxis != "")
		{
			$ySerieNode = new RequestOutputPlotYSerieNodeClass(REQUESTOUTPUTPLOTYSERIE_XYPLOT_NAME);
			$ySerieNode->setXAxisId($xAxis);
		}
		else
			$ySerieNode = new RequestOutputPlotYSerieNodeClass(REQUESTOUTPUTPLOTYSERIE_TIMEPLOT_NAME);
		$ySerieNode->setYAxisId($yAxis);
		if ($index >= 0)
			$ySerieNode->setIndex($index);
4ede4320   Benjamin Renard   Integration for s...
57
58
		if ($colorSerieId >= 0)
			$ySerieNode->setColorSerieId($colorSerieId);
22521f1c   Benjamin Renard   First commit
59
60
61
		$this->addChild($ySerieNode);
		return $ySerieNode;
	}
b4ee5e62   Benjamin Renard   Add integration f...
62
63
64
65
66
67
68
69
70
71
	
	public function addInstantSerie($xAxis, $yAxis)
	{
		$iserieNode = new RequestOutputPlotInstantSerieNodeClass();
		$iserieNode->setXAxisId($xAxis);
		$iserieNode->setYAxisId($yAxis);
		$this->addChild($iserieNode);
		return $iserieNode;
	}
	
944199fe   Benjamin Renard   Use table definit...
72
73
74
75
76
77
78
	public function addSpectro($yAxis)
	{
		$spectroNode = new NodeClass(REQUESTOUTPUTPLOTSPECTRO_NAME);
		$spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_YAXIS, $yAxis);
		$this->addChild($spectroNode);
		return $spectroNode;
	}
22521f1c   Benjamin Renard   First commit
79
80
81
82
83
84
85
86
87
88

	public function addXSerie($xAxis, $index)
	{
		$xSerieNode = new NodeClass(REQUESTOUTPUTPLOTXSERIE_NAME);
		$xSerieNode->setAttribute(REQUESTOUTPUTPLOTXSERIE_XAXIS, $xAxis);
		if ($index >= 0)
			$xSerieNode->setAttribute(REQUESTOUTPUTPLOTXSERIE_INDEX, $index);
		$this->addChild($xSerieNode);
		return $xSerieNode;
	}
4ede4320   Benjamin Renard   Integration for s...
89
90
91
92
93
94
95
96
97
98
	
	public function addColorSerie($id, $index)
	{
		$colorSerieNode = new NodeClass(REQUESTOUTPUTPLOTCOLORSERIE_NAME);
		$colorSerieNode->setAttribute(REQUESTOUTPUTPLOTCOLORSERIE_ID, $id);
		if ($index >= 0)
			$colorSerieNode->setAttribute(REQUESTOUTPUTPLOTCOLORSERIE_INDEX, $index);
		$this->addChild($colorSerieNode);
		return $colorSerieNode;
	}
17f69bd1   Benjamin Renard   Add tick plot and...
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
	
	public function addStatusBar($index)
	{
		$statusBarNode = new NodeClass(REQUESTOUTPUTPLOTSTATUSBAR_NAME);
		if ($index >= 0)
			$statusBarNode->setAttribute(REQUESTOUTPUTPLOTSTATUSBAR_INDEX, $index);
		$this->addChild($statusBarNode);
		return $statusBarNode;
	}
	
	public function addTickBar($index)
	{
		$tickBarNode = new NodeClass(REQUESTOUTPUTPLOTTICKBAR_NAME);
		if ($index >= 0)
			$tickBarNode->setAttribute(REQUESTOUTPUTPLOTTICKBAR_INDEX, $index);
		$this->addChild($tickBarNode);
		return $tickBarNode;
	}
22521f1c   Benjamin Renard   First commit
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
}

/**
 * @class RequestOutputPlotParamsNodeClass
 * @brief Definition of a params for a plot of a plot request
 * @details
 */
class RequestOutputPlotParamsNodeClass extends NodeClass
{
	public function __construct()
	{
		parent::__construct(REQUESTOUTPUTPLOTPARAMS_NAME);
	}

	public function getParamById($id)
	{
		$paramNodes = $this->getChildrenByName(REQUESTOUTPUTPLOTPARAM_NAME);
		foreach ($paramNodes as $paramNode)
		if ($paramNode->getId() == $id)
			return $paramNode;
		//create new param
		$paramNode = new RequestOutputPlotParamNodeClass($id);
		$this->addChild($paramNode);
		return $paramNode;
	}
}

?>