Blame view

src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotAxisElementNodeClass.php 11.5 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
define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_NAME", "tick");
define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_POSITION", "position");
define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_MINORGRID", "minorGrid");
define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRID", "majorGrid");
3741e4bb   Hacene SI HADJ MOHAND   6954 ok
23
24
25
26
define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRIDNUMBER", "majorNumber");
define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_MINORGRIDNUMBER", "minorNumber");
define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_MINORGRIDSPACE", "minorSpace");
define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRIDSPACE", "majorSpace");
78a73e9a   Benjamin Renard   Integration for p...
27

22521f1c   Benjamin Renard   First commit
28
29
30
define ("REQUESTOUTPUTPLOTAXISELEMENTLEGEND_NAME", "legend");
define ("REQUESTOUTPUTPLOTAXISELEMENTLEGEND_TEXT", "text");

78a73e9a   Benjamin Renard   Integration for p...
31
32
33
34
35
36
37
38
39
40
41
42
abstract class RequestOutputPlotAxisElementScale
{
	const LINEAR      = "linear";
	const LOGARITHMIC = "logarithmic";
}

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

4ede4320   Benjamin Renard   Integration for s...
43
44
45
46
47
48
49
50
abstract class RequestOutputPlotAxisElementPosition
{
	const TOP    = "top";
	const BOTTOM = "bottom";
	const LEFT   = "bottom";
	const RIGHT  = "right";
}

22521f1c   Benjamin Renard   First commit
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
/**
 * @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...
88
89
90
91
92
93
	
	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
94
95
96
}

/**
78a73e9a   Benjamin Renard   Integration for p...
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
133
134
135
136
 * @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);
	}
3741e4bb   Hacene SI HADJ MOHAND   6954 ok
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177

        public function getMajorGridNumber()
        {
                return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRIDNUMBER);
        }

        public function setMajorGridNumber($majorGridNumber)
        {
                $this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRIDNUMBER, $majorGridNumber);
        }

	public function getMinorGridNumber()
        {
                return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MINORGRIDNUMBER);
        }

        public function setMinorGridNumber($minorGridNumber)
        {
                $this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MINORGRIDNUMBER, $minorGridNumber);
        }

        public function getMajorGridSpace()
        {
                return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRIDSPACE);
        }

        public function setMajorGridSpace($majorGridSpace)
        {
                $this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRIDSPACE, $majorGridSpace);
        }

        public function getMinorGridSpace()
        {
                return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MINORGRIDSPACE);
        }
        
        public function setMinorGridSpace($minorGridSpace)
        {
                $this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MINORGRIDSPACE, $minorGridSpace);
        }

966bd5f8   Benjamin Renard   Add request to ge...
178
179
180
181
182
	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));
3741e4bb   Hacene SI HADJ MOHAND   6954 ok
183
184
185
186
		$this->setMajorGrid($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRIDNUMBER));
		$this->setMajorGrid($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRIDNUMBER));
		$this->setMajorGrid($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRIDSPACE));
		$this->setMajorGrid($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENTTICK_MINORGRIDSPACE));
966bd5f8   Benjamin Renard   Add request to ge...
187
	}
78a73e9a   Benjamin Renard   Integration for p...
188
189
190
}

/**
22521f1c   Benjamin Renard   First commit
191
192
193
194
 * @class RequestOutputPlotAxisElementLegendNodeClass
 * @brief Definition of legend for an axis
 * @details
 */
78a73e9a   Benjamin Renard   Integration for p...
195
class RequestOutputPlotAxisElementLegendNodeClass extends RequestOutputPlotLabelNodeClass
22521f1c   Benjamin Renard   First commit
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
{
	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...
211
212
213
214
215
216
	
	public function loadFromNode($xmlNode)
	{
		$this->setText($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTAXISELEMENTLEGEND_TEXT));
		parent::loadFromNode($xmlNode);
	}
22521f1c   Benjamin Renard   First commit
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
}

/**
 * @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...
236
237
238
239
		//tick
		$node = new RequestOutputPlotAxisElementTickClass();
		$this->addChild($node);
		
22521f1c   Benjamin Renard   First commit
240
241
242
243
244
245
246
247
248
249
		//legend
		$node = new RequestOutputPlotAxisElementLegendNodeClass();
		$this->addChild($node);
	}

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

78a73e9a   Benjamin Renard   Integration for p...
250
251
252
253
	public function getTick()
	{
		return $this->getFirstChildByName(REQUESTOUTPUTPLOTAXISELEMENTTICK_NAME);
	}
22521f1c   Benjamin Renard   First commit
254
255
256
257
258
259

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

51cbca5c   Benjamin Renard   Add constants def...
260
261
262
263
264
265
	public function addConstant()
	{
		$node = new RequestOutputPlotConstantNodeClass();
		$this->addChild($node);
		return $node;
	}
22521f1c   Benjamin Renard   First commit
266
267
268
269
270
271
272
273
274
275
276
277
278

	/* 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...
279
280
281
282
	public function setThickness($thickness)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_THICKNESS, $thickness);
	}
22521f1c   Benjamin Renard   First commit
283

78a73e9a   Benjamin Renard   Integration for p...
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
	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
303

78a73e9a   Benjamin Renard   Integration for p...
304
305
306
307
	public function getReverse()
	{
		return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_REVERSE);
	}
22521f1c   Benjamin Renard   First commit
308

4ede4320   Benjamin Renard   Integration for s...
309
310
311
312
313
314
315
316
317
	public function setVisible($visible)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_VISIBLE, $visible);
	}

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

78a73e9a   Benjamin Renard   Integration for p...
319
320
321
322
323
324
325
326
327
	public function setScale($scale)
	{
		$this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_SCALE, $scale);
	}

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

f012b419   Benjamin Renard   Add integration f...
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
	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...
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
	
	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
376
377
}

3741e4bb   Hacene SI HADJ MOHAND   6954 ok
378
?>