RequestOutputPlotCurveObjectNodeClass.php
3.73 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
define ("REQUESTOUTPUTPLOTCURVEOBJECT_NAME", "curvePlot");
define ("REQUESTOUTPUTPLOTCURVEOBJECT_SERIEID", "serieId");
define ("REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_NAME", "function");
define ("REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_FUNCTIONNAME", "name");
define ("REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTES", "attributes");
define ("REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTE", "attribute");
define ("REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTENAME", "name");
define ("REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTEVALUE", "value");
/**
* @class RequestOutputPlotCurveObjectFunctionNodeClass
* @brief Definition of a function for a curve object element of a plot
* @details
*/
class RequestOutputPlotCurveObjectFunctionNodeClass extends NodeClass
{
public function __construct()
{
parent::__construct(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_NAME);
}
public function setFunctionName($name)
{
$this->setAttribute(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_FUNCTIONNAME, $name);
}
public function getFunctionName()
{
return $this->getAttribute(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_FUNCTIONNAME);
}
public function getAttributes()
{
$node = $this->getFirstChildByName(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTES);
if (!isset($node))
{
$node = new NodeClass(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTES);
$this->addChild($node);
}
return $node;
}
public function addAttribute($name, $value)
{
$attributesNode = $this->getAttributes();
$node = new NodeClass(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTE);
$node->setAttribute(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTENAME, $name);
$node->setAttribute(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTEVALUE, $value);
$attributesNode->addChild($node);
return $node;
}
public function loadFromNode($xmlNode)
{
$this->setFunctionName($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_FUNCTIONNAME));
$attributesXmlNode = $this->getXmlNodeChildByTagName($xmlNode, REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTES);
if (isset($attributesXmlNode)) {
foreach ($this->getXmlNodeChildrenByTagName($attributesXmlNode, REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTE) as $attributeXmlNode) {
$this->addAttribute($this->getXmlNodeAttribute($attributeXmlNode, REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTENAME),$this->getXmlNodeAttribute($attributeXmlNode, REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTEVALUE));
}
}
}
}
/**
* @class RequestOutputPlotCurveObjectNodeClass
* @brief Definition of a curve object element for a plot
* @details
*/
class RequestOutputPlotCurveObjectNodeClass extends RequestOutputPlotCurveNodeClass
{
public function __construct()
{
parent::__construct(REQUESTOUTPUTPLOTCURVEOBJECT_NAME);
}
public function setSerieId($serieId)
{
$this->setAttribute(REQUESTOUTPUTPLOTCURVEOBJECT_SERIEID, $serieId);
}
public function getSerieId()
{
return $this->getAttribute(REQUESTOUTPUTPLOTCURVEOBJECT_SERIEID);
}
public function isFunctionDefined()
{
$node = $this->getFirstChildByName(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_NAME);
return isset($node);
}
public function getFunction()
{
$node = $this->getFirstChildByName(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_NAME);
if (!isset($node))
{
$node = new RequestOutputPlotCurveObjectFunctionNodeClass();
$this->addChild($node);
}
return $node;
}
public function loadFromNode($xmlNode)
{
$this->setSerieId($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTCURVEOBJECT_SERIEID));
$functionXmlNode = $this->getXmlNodeChildByTagName($xmlNode, REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_NAME);
if (isset($functionXmlNode))
$this->getFunction()->loadFromNode($functionXmlNode);
parent::loadFromNode($xmlNode);
}
}
?>