RequestOutputPlotParamsNodeClass.php
3.16 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?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");
define ("REQUESTOUTPUTPLOTCOLORSERIE_NAME", "colorserie");
define ("REQUESTOUTPUTPLOTCOLORSERIE_ID", "id");
define ("REQUESTOUTPUTPLOTCOLORSERIE_INDEX", "index");
define ("REQUESTOUTPUTPLOTSPECTRO_NAME", "spectro");
define ("REQUESTOUTPUTPLOTSPECTRO_YAXIS", "yAxis");
/**
* @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);
}
public function addYSerie($yAxis, $index, $xAxis = "", $colorSerieId = -1)
{
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);
if ($colorSerieId >= 0)
$ySerieNode->setColorSerieId($colorSerieId);
$this->addChild($ySerieNode);
return $ySerieNode;
}
public function addSpectro($yAxis)
{
$spectroNode = new NodeClass(REQUESTOUTPUTPLOTSPECTRO_NAME);
$spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_YAXIS, $yAxis);
$this->addChild($spectroNode);
return $spectroNode;
}
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;
}
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;
}
}
/**
* @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;
}
}
?>