Blame view

src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotAxisElementNodeClass.php 9.42 KB
22521f1c   Benjamin Renard   First commit
1
2
<?php

966bd5f8   Benjamin Renard   Add request to ge...
3
4
require_once "RequestOutputPlotConstantNodeClass.php";

22521f1c   Benjamin Renard   First commit
5
define ("REQUESTOUTPUTPLOTAXISELEMENT_POSITION", "position");
78a73e9a   Benjamin Renard   Integration for p...
6
define ("REQUESTOUTPUTPLOTAXISELEMENT_REVERSE", "reverse");
4ede4320   Benjamin Renard   Integration for s...
7
define ("REQUESTOUTPUTPLOTAXISELEMENT_VISIBLE", "visible");
78a73e9a   Benjamin Renard   Integration for p...
8
9
10
define ("REQUESTOUTPUTPLOTAXISELEMENT_SCALE", "scale");
define ("REQUESTOUTPUTPLOTAXISELEMENT_COLOR", "color");
define ("REQUESTOUTPUTPLOTAXISELEMENT_THICKNESS", "thickness");
f012b419   Benjamin Renard   Add integration f...
11
12
define ("REQUESTOUTPUTPLOTAXISELEMENT_SHOWLEGEND", "showLegend");
define ("REQUESTOUTPUTPLOTAXISELEMENT_TICKMARKS", "showTickMark");
22521f1c   Benjamin Renard   First commit
13
14
15
16
17
18

define ("REQUESTOUTPUTPLOTAXISELEMENTRANGE_NAME", "range");
define ("REQUESTOUTPUTPLOTAXISELEMENTRANGE_MIN", "min");
define ("REQUESTOUTPUTPLOTAXISELEMENTRANGE_MAX", "max");
define ("REQUESTOUTPUTPLOTAXISELEMENTRANGE_EXTEND", "extend");

78a73e9a   Benjamin Renard   Integration for p...
19
20
21
22
23
define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_NAME", "tick");
define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_POSITION", "position");
define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_MINORGRID", "minorGrid");
define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRID", "majorGrid");

22521f1c   Benjamin Renard   First commit
24
25
26
define ("REQUESTOUTPUTPLOTAXISELEMENTLEGEND_NAME", "legend");
define ("REQUESTOUTPUTPLOTAXISELEMENTLEGEND_TEXT", "text");

78a73e9a   Benjamin Renard   Integration for p...
27
28
29
30
31
32
33
34
35
36
37
38
abstract class RequestOutputPlotAxisElementScale
{
	const LINEAR      = "linear";
	const LOGARITHMIC = "logarithmic";
}

abstract class RequestOutputPlotAxisElementTickPosition
{
	const INWARDS  = "inwards";
	const OUTWARDS = "outwards";
}

4ede4320   Benjamin Renard   Integration for s...
39
40
41
42
43
44
45
46
abstract class RequestOutputPlotAxisElementPosition
{
	const TOP    = "top";
	const BOTTOM = "bottom";
	const LEFT   = "bottom";
	const RIGHT  = "right";
}

22521f1c   Benjamin Renard   First commit
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
/**
 * @class RequestOutputPlotAxisElementRangeNodeClass
 * @brief Definition of range for an axis
 * @details
*/
class RequestOutputPlotAxisElementRangeNodeClass extends NodeClass
{
	public function __construct()
	{
		parent::__construct(REQUESTOUTPUTPLOTAXISELEMENTRANGE_NAME);
	}

	public function setMinMax($min, $max)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTRANGE_MIN, $min);
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTRANGE_MAX, $max);
	}

	public function getMin()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTRANGE_MIN);
	}

	public function getMax()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTRANGE_MAX);
	}

	public function setExtend($extend)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTRANGE_EXTEND, $extend);
	}

	public function getExtend()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTRANGE_EXTEND);
	}
966bd5f8   Benjamin Renard   Add request to ge...
84
85
86
87
88
89
	
	public function loadFromNode($xmlNode)
	{
		$this->setMinMax($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENTRANGE_MIN), $this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENTRANGE_MAX));
		$this->setExtend($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENTRANGE_EXTEND));
	}
22521f1c   Benjamin Renard   First commit
90
91
92
}

/**
78a73e9a   Benjamin Renard   Integration for p...
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
127
128
129
130
131
132
 * @class RequestOutputPlotAxisElementTickClass
 * @brief Definition of ticks for an axis
 * @details
 */
class RequestOutputPlotAxisElementTickClass extends NodeClass
{
	public function __construct()
	{
		parent::__construct(REQUESTOUTPUTPLOTAXISELEMENTTICK_NAME);
	}
	
	public function setPosition($position)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_POSITION, $position);
	}
	
	public function getPosition()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_POSITION);
	}
	
	public function setMinorGrid($minorGrid)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MINORGRID, $minorGrid);
	}
	
	public function getMinorGrid()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MINORGRID);
	}
	
	public function setMajorGrid($majorGrid)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRID, $majorGrid);
	}
	
	public function getMajorGrid()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRID);
	}
966bd5f8   Benjamin Renard   Add request to ge...
133
134
135
136
137
138
139
	
	public function loadFromNode($xmlNode)
	{
		$this->setPosition($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENTTICK_POSITION));
		$this->setMinorGrid($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENTTICK_MINORGRID));
		$this->setMajorGrid($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRID));
	}
78a73e9a   Benjamin Renard   Integration for p...
140
141
142
}

/**
22521f1c   Benjamin Renard   First commit
143
144
145
146
 * @class RequestOutputPlotAxisElementLegendNodeClass
 * @brief Definition of legend for an axis
 * @details
 */
78a73e9a   Benjamin Renard   Integration for p...
147
class RequestOutputPlotAxisElementLegendNodeClass extends RequestOutputPlotLabelNodeClass
22521f1c   Benjamin Renard   First commit
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
{
	public function __construct()
	{
		parent::__construct(REQUESTOUTPUTPLOTAXISELEMENTLEGEND_NAME);
	}

	public function setText($text)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTLEGEND_TEXT, $text);
	}

	public function getText()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTLEGEND_TEXT);
	}
966bd5f8   Benjamin Renard   Add request to ge...
163
164
165
166
167
168
	
	public function loadFromNode($xmlNode)
	{
		$this->setText($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENTLEGEND_TEXT));
		parent::loadFromNode($xmlNode);
	}
22521f1c   Benjamin Renard   First commit
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
}

/**
 * @class RequestOutputPlotAxisElementNodeClass
 * @brief Definition of a plot axis element for a plot element of a plot request
 * @details
 */
class RequestOutputPlotAxisElementNodeClass extends NodeClass
{
	public function __construct($axisElementName)
	{
		parent::__construct($axisElementName);

		//create axis element skeleton

		//range
		$node = new RequestOutputPlotAxisElementRangeNodeClass();
		$this->addChild($node);

78a73e9a   Benjamin Renard   Integration for p...
188
189
190
191
		//tick
		$node = new RequestOutputPlotAxisElementTickClass();
		$this->addChild($node);
		
22521f1c   Benjamin Renard   First commit
192
193
194
195
196
197
198
199
200
201
		//legend
		$node = new RequestOutputPlotAxisElementLegendNodeClass();
		$this->addChild($node);
	}

	public function getRange()
	{
		return $this->getFirstChildByName(REQUESTOUTPUTPLOTAXISELEMENTRANGE_NAME);
	}

78a73e9a   Benjamin Renard   Integration for p...
202
203
204
205
	public function getTick()
	{
		return $this->getFirstChildByName(REQUESTOUTPUTPLOTAXISELEMENTTICK_NAME);
	}
22521f1c   Benjamin Renard   First commit
206
207
208
209
210
211

	public function getLegend()
	{
		return $this->getFirstChildByName(REQUESTOUTPUTPLOTAXISELEMENTLEGEND_NAME);
	}

51cbca5c   Benjamin Renard   Add constants def...
212
213
214
215
216
217
	public function addConstant()
	{
		$node = new RequestOutputPlotConstantNodeClass();
		$this->addChild($node);
		return $node;
	}
22521f1c   Benjamin Renard   First commit
218
219
220
221
222
223
224
225
226
227
228
229
230

	/* ToDo origin */

	public function setPosition($position)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_POSITION, $position);
	}

	public function getPosition()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_POSITION);
	}

78a73e9a   Benjamin Renard   Integration for p...
231
232
233
234
	public function setThickness($thickness)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_THICKNESS, $thickness);
	}
22521f1c   Benjamin Renard   First commit
235

78a73e9a   Benjamin Renard   Integration for p...
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
	public function getThickness()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_THICKNESS);
	}
	
	public function setColor($color)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_COLOR, $color);
	}
	
	public function getColor()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_COLOR);
	}

	public function setReverse($reverse)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_REVERSE, $reverse);
	}
22521f1c   Benjamin Renard   First commit
255

78a73e9a   Benjamin Renard   Integration for p...
256
257
258
259
	public function getReverse()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_REVERSE);
	}
22521f1c   Benjamin Renard   First commit
260

4ede4320   Benjamin Renard   Integration for s...
261
262
263
264
265
266
267
268
269
	public function setVisible($visible)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_VISIBLE, $visible);
	}

	public function getVisible()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_VISIBLE);
	}
22521f1c   Benjamin Renard   First commit
270

78a73e9a   Benjamin Renard   Integration for p...
271
272
273
274
275
276
277
278
279
	public function setScale($scale)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_SCALE, $scale);
	}

	public function getScale()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_SCALE);
	}
22521f1c   Benjamin Renard   First commit
280

f012b419   Benjamin Renard   Add integration f...
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
	public function setShowLegend($show)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_SHOWLEGEND, $show);
	}
	
	public function getShowLegend()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_SHOWLEGEND);
	}
	
	public function setShowTickMarks($show)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_TICKMARKS, $show);
	}
	
	public function getShowTickMarks()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_TICKMARKS);
	}
966bd5f8   Benjamin Renard   Add request to ge...
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
	
	public function loadFromNode($xmlNode)
	{
		$rangeXmlNode = $this->getXmlNodeChildByTagName($xmlNode, REQUESTOUTPUTPLOTAXISELEMENTRANGE_NAME);
		if (isset($rangeXmlNode))
			$this->getRange()->loadFromNode($rangeXmlNode);
		
		$tickXmlNode = $this->getXmlNodeChildByTagName($xmlNode, REQUESTOUTPUTPLOTAXISELEMENTTICK_NAME);
		if (isset($tickXmlNode))
			$this->getTick()->loadFromNode($tickXmlNode);
		
		$legendXmlNode = $this->getXmlNodeChildByTagName($xmlNode, REQUESTOUTPUTPLOTAXISELEMENTLEGEND_NAME);
		if (isset($legendXmlNode))
			$this->getLegend()->loadFromNode($legendXmlNode);
		
		foreach ($this->getXmlNodeChildrenByTagName($xmlNode, REQUESTOUTPUTPLOTCONSTANT_NAME) as $constantXmlNode) {
			$this->addConstant()->loadFromNode($clbXmlNode);
		}
		
		$this->setPosition($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENT_POSITION));
		$this->setThickness($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENT_THICKNESS));
		$this->setColor($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENT_COLOR));
		$this->setReverse($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENT_REVERSE));
		$this->setVisible($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENT_VISIBLE));
		$this->setScale($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENT_SCALE));
		$this->setShowLegend($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENT_SHOWLEGEND));
		$this->setShowTickMarks($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENT_TICKMARKS));
	}
22521f1c   Benjamin Renard   First commit
328
329
330
}

?>