Blame view

src/InputOutput/IHMImpl/ParamInfo/IHMInputOutputParamInfoClass.php 19.6 KB
966bd5f8   Benjamin Renard   Add request to ge...
1
2
3
4
5
6
7
8
9
10
<?php

/**
 * @class IHMInputOutputParamInfoClass
 * @brief Class that's implement an InputOutputInterface used to treat a get param info request
 * @details
 */
class IHMInputOutputParamInfoClass implements InputOutputInterface
{
	private $paramInfoData        = null;
dcdacd5c   Benjamin Renard   Fill plot type in...
11
	private $paramMgr             = null;
dcdacd5c   Benjamin Renard   Fill plot type in...
12
	private $paramImpexMgr        = null;
96c9cffa   Benjamin Renard   Keep expression p...
13
	private $userParamMgr         = null;
779e1758   Elena.Budnik   rm 8503
14
	private $paramTemplateMgr     = null;
966bd5f8   Benjamin Renard   Add request to ge...
15
16
17
18
19
20
	
	/*
	 * @brief Constructor
	*/
	function __construct()
	{
dcdacd5c   Benjamin Renard   Fill plot type in...
21
		$this->paramMgr = new IHMParamManagerClass();
779e1758   Elena.Budnik   rm 8503
22
        $this->paramTemplateMgr = new IHMParamTemplateClass();
966bd5f8   Benjamin Renard   Add request to ge...
23
24
25
26
27
28
29
30
31
32
33
	}

	/*
	 * @brief translate input data from IHM client to AMDA_Integration module for a get param info request
	*/
	public function getInputData($input,$function,$requestId="")
	{
		$this->paramInfoData = new ParamInfoRequestDataClass();
		
		switch ($input->type) {
			case 'plot_init' :
ffc5cb81   Elena.Budnik   temporary commit
34
			
966bd5f8   Benjamin Renard   Add request to ge...
35
				$this->paramInfoData->setType(ParamInfoTypeEnumClass::PLOTINIT);
f28f7c0e   Benjamin Renard   Add param info re...
36
37
38
				
				if (!isset($input->paramId) || empty($input->paramId))
					throw new Exception("Param info request need a param id as argument");
dcdacd5c   Benjamin Renard   Fill plot type in...
39
40

				if ($this->paramMgr->isUploadedParam($input->paramId)) {
96c9cffa   Benjamin Renard   Keep expression p...
41
42
43
					if (!isset($this->userParamMgr)) {
						$this->userParameterMgr = new IHMUserParamManagerClass();
					}
dcdacd5c   Benjamin Renard   Fill plot type in...
44
45

					//get uploaded parameter info
96c9cffa   Benjamin Renard   Keep expression p...
46
					$info = $this->userParameterMgr->getUploadedParameterFromName($input->paramId);
dcdacd5c   Benjamin Renard   Fill plot type in...
47
48
49
50
51
52
53
54
55
56
57
58
59
					if ($info['success'] && ($info["param"]["info"]["plotType"] == 'Spectra')) {
						$plot_init = array(
							'panel' => array(
								'plotType' => 'timePlot',
							),
							'draw' => array(
								'type' => 'spectro',
								'spectro-yaxis' => 'y-left',
							),
						);
						$this->paramInfoData->setInternalPlotInit($plot_init);
					}
				}
c3e6d894   Benjamin Renard   Init IHMParamTemp...
60
				else if ($this->paramMgr->getTemplateParamsManager()->isTemplatedParam($input->paramId)) {
4fe90834   Benjamin Renard   Fix bug with get ...
61
					//Use param template file
c3e6d894   Benjamin Renard   Init IHMParamTemp...
62
					$paramFilePath = $this->paramMgr->getTemplateParamsManager()->getTemplatePath($input->paramId);
dcdacd5c   Benjamin Renard   Fill plot type in...
63
64
65
66
67
68
69
70
71
72
					if (!file_exists($paramFilePath))
						throw new Exception("Cannot find parameter definition file");

					$this->paramInfoData->setFilePath($paramFilePath);
				}
				else {
					//Direct access to the parameter file
					$paramFilePath = IHMConfigClass::getLocalParamDBPath().$input->paramId.".xml";
					if (!file_exists($paramFilePath))
						throw new Exception("Cannot find parameter definition file");
f28f7c0e   Benjamin Renard   Add param info re...
73
				
dcdacd5c   Benjamin Renard   Fill plot type in...
74
75
					$this->paramInfoData->setFilePath($paramFilePath);
				}
ffc5cb81   Elena.Budnik   temporary commit
76
77
				break;
				
dcdacd5c   Benjamin Renard   Fill plot type in...
78
			case 'impex_plot_init' :
ffc5cb81   Elena.Budnik   temporary commit
79
80
81
82
83
84
85
86
87
88
89
90
91
92
			
				$this->paramInfoData->setType(ParamInfoTypeEnumClass::IMPEXPLOTINIT);
	 	
				if (!isset($input->paramId) || empty($input->paramId))
					throw new Exception("Param info request need a param id as argument");				
 
				if (!$this->paramImpexMgr)
				{
					$this->paramImpexMgr = new IHMImpexParamClass();					
				}
				
				$paramFilePath = $this->paramImpexMgr->getParamInfoPlotPath($input->paramId);
				
				if (!$paramFilePath || !file_exists($paramFilePath))
f28f7c0e   Benjamin Renard   Add param info re...
93
94
95
96
					throw new Exception("Cannot find parameter definition file");
				
				$this->paramInfoData->setFilePath($paramFilePath);
				break;
ffc5cb81   Elena.Budnik   temporary commit
97
				
f28f7c0e   Benjamin Renard   Add param info re...
98
			case 'param_info' :
ffc5cb81   Elena.Budnik   temporary commit
99
			
f28f7c0e   Benjamin Renard   Add param info re...
100
101
102
103
104
				$this->paramInfoData->setType(ParamInfoTypeEnumClass::PARAMINFO);
				
				if (!isset($input->paramId) || empty($input->paramId))
					throw new Exception("Param info request need a param id as argument");
				
c3e6d894   Benjamin Renard   Init IHMParamTemp...
105
				$templatedParams = $this->paramMgr->getTemplateParamsManager()->getParamTemplates();
bf27ba04   Benjamin Renard   Add templated par...
106
107
108
				
				if (array_key_exists($input->paramId, $templatedParams))
					$this->paramInfoData->setTemplateInfo($templatedParams[$input->paramId]);
f28f7c0e   Benjamin Renard   Add param info re...
109
110
111
112
				
				$paramInfoFilePath = IHMConfigClass::getLocalParamInfoPath().'info_'.$input->paramId.".xml";
				
				if (!file_exists($paramInfoFilePath))
9937b488   Benjamin Renard   Modify default pl...
113
					throw new Exception("Cannot find parameter info file");
f28f7c0e   Benjamin Renard   Add param info re...
114
115
				
				$this->paramInfoData->setFilePath($paramInfoFilePath);
966bd5f8   Benjamin Renard   Add request to ge...
116
				break;
ffc5cb81   Elena.Budnik   temporary commit
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
				
			case 'impex_param_info' :
				
				$this->paramInfoData->setType(ParamInfoTypeEnumClass::IMPEXINFO);				  
				if (!isset($input->paramId) || empty($input->paramId))
					throw new Exception("Param info request need a param id as argument");
				 
				if (!$this->paramImpexMgr)
				{
					$this->paramImpexMgr = new IHMImpexParamClass();					
				}
				$this->paramImpexMgr->setParamTemplateListFilePath($input->paramId);
				$templatedParams = $this->paramImpexMgr->getParamTemplates();

				$simRegion = $this->paramImpexMgr->getSimulationRegion($input->paramId);
577d5c04   Elena.Budnik   IMPEX integration
132
				
ffc5cb81   Elena.Budnik   temporary commit
133
134
135
136
137
138
139
				// No SimulationRuns (LESIA)
			 	if ($simRegion == "UNKNOWN")
					$simRegion = $this->paramImpexMgr->getResourceID($input->paramId);
				 
				$this->paramInfoData->setTemplateInfo($templatedParams[$simRegion]);

				break;
8c88a193   Benjamin Renard   Predefined templa...
140
141
142
143
144
			case 'param_parse_template':

				$this->paramInfoData->setType(ParamInfoTypeEnumClass::PARSETEMPLATEDPARAM);
				
				break;
966bd5f8   Benjamin Renard   Add request to ge...
145
			default :
ffc5cb81   Elena.Budnik   temporary commit
146
				throw new Exception("Param info request type '".$input->type."' not yet implemented");
966bd5f8   Benjamin Renard   Add request to ge...
147
		}
966bd5f8   Benjamin Renard   Add request to ge...
148
149
		
		$this->paramInfoData->setParamId($input->paramId);
966bd5f8   Benjamin Renard   Add request to ge...
150
151
152
153
154
155
156
157
158
		
		return $this->paramInfoData;
	}

	/*
	 * @brief translate output data from AMDA_Integration module to IHM client for a get param info request
	*/
	public function getOutput($data)
	{
966bd5f8   Benjamin Renard   Add request to ge...
159
160
		switch ($data->getType()) {
			case ParamInfoTypeEnumClass::PLOTINIT :
f28f7c0e   Benjamin Renard   Add param info re...
161
162
163
				$result = array("success" => false, "message" => "Cannot get plot init");
				$this->getOutputPlotInit($data, $result);
				break;
ffc5cb81   Elena.Budnik   temporary commit
164
165
166
167
			case ParamInfoTypeEnumClass::IMPEXPLOTINIT :
				$result = array("success" => false, "message" => "Cannot get impex plot init");
				$this->getOutputPlotInit($data, $result);
				break;
f28f7c0e   Benjamin Renard   Add param info re...
168
169
170
			case ParamInfoTypeEnumClass::PARAMINFO :
				$result = array("success" => false, "message" => "Cannot get param info");
				$this->getOutputParamInfo($data, $result);
966bd5f8   Benjamin Renard   Add request to ge...
171
				break;
ffc5cb81   Elena.Budnik   temporary commit
172
173
174
			case ParamInfoTypeEnumClass::IMPEXINFO :
				$result = array("success" => false, "message" => "Cannot get impex param info");
				$this->getOutputParamInfo($data, $result);
8c88a193   Benjamin Renard   Predefined templa...
175
176
177
178
				break;
			case ParamInfoTypeEnumClass::PARSETEMPLATEDPARAM :
				$result = array("success" => false, "message" => "Cannot parse templated param");
				$this->getOutputParseTemplatedParam($data, $result);
966bd5f8   Benjamin Renard   Add request to ge...
179
180
181
182
183
184
			default:
				//Nothing ToDo
		}
		
		return $result;
	}
8c88a193   Benjamin Renard   Predefined templa...
185

f28f7c0e   Benjamin Renard   Add param info re...
186
187
188
189
190
191
	private function getOutputParamInfo($data, &$result) {
		if (($data->getResult() != NULL)) {
			$result = array(
					"success" => true,
					"data" => $data->getResult()
			);
bf27ba04   Benjamin Renard   Add templated par...
192
193
194
			if ($data->getTemplateInfo() != NULL) {
				$result["template"] = $data->getTemplateInfo();
			}
f28f7c0e   Benjamin Renard   Add param info re...
195
196
		}
	}
8c88a193   Benjamin Renard   Predefined templa...
197
198
199
200
201
202
203
204
205

	private function getOutputParseTemplatedParam($data, &$result) {
		if ($info = $this->paramTemplateMgr->parseTemplatedParam($data->getParamId())) {
			$result = array(
				"success" => true,
				"info" => $info,
			);
		}
	}
f28f7c0e   Benjamin Renard   Add param info re...
206
207
	
	private function getOutputPlotInit($data, &$result) {
dcdacd5c   Benjamin Renard   Fill plot type in...
208
209
210
211
212
213
214
215
		$internal_info = $data->getInternalPlotInit();
		if (isset($internal_info)) {
			$result = array(
				"success" => true,
				"data" => $internal_info
			);
		}
		else if (($data->getResult() != NULL) && ($data->getResult()->getName() == "plot") && (count($data->getResult()->getChildren()) >= 1)) {
f28f7c0e   Benjamin Renard   Add param info re...
216
217
			$result_data = array();
				
f7093283   Benjamin Renard   Fix pb with PHP v...
218
219
			$panelNodes = $data->getResult()->getChildren();
			$panelNode = $panelNodes[0];
f28f7c0e   Benjamin Renard   Add param info re...
220
221
222
223
224
225
226
227
228
				
			$plotNode = NULL;
			if (count($panelNode->getChildren()) >= 1) {
				foreach ($panelNode->getChildren() as $crtNode) {
					if (!in_array($crtNode->getName(), array('timePlot', 'epochPlot', 'xyPlot', 'instantPlot', 'statusPlot', 'tickPlot')))
						continue;
					$plotNode = $crtNode;
					break;
				}
5e8f0c52   Hacene SI HADJ MOHAND   ppp ok
229
230
                       
 				if (isset($plotNode)) {
f28f7c0e   Benjamin Renard   Add param info re...
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
					$result_data['panel'] = array();
					switch ($plotNode->getName()) {
						case 'timePlot' :
							$result_data['panel']['plotType'] = 'timePlot';
		
							break;
						case 'epochPlot' :
							$result_data['panel']['plotType'] = 'epochPlot';
		
							break;
						case 'xyPlot' :
							$result_data['panel']['plotType'] = 'xyPlot';
							$result_data['panel']['isotropic'] = ($plotNode->getIsIsotropic() == "true");
							$result_data['additionalObjects'] = $this->unmarshallAdditionalObjectsData($plotNode);
							break;
						case 'instantPlot' :
							$result_data['panel']['plotType'] = 'instantPlot';
		
							break;
						case 'statusPlot' :
							$result_data['panel']['plotType'] = 'statusPlot';
		
							break;
						case 'tickPlot' :
							$result_data['panel']['plotType'] = 'tickPlot';
		
							break;
					}
						
					$result_data['draw'] = $this->unmarshallDrawData($plotNode, $data->getParamId());
				}
		
				$result = array(
						"success" => true,
						"data" => $result_data
				);
				//var_dump($result);
			}
				
			/*if (count($paramsNode->getChildren()) >= 1) {
			 $paramNode = $paramsNode->getChildren()[0];
			if (count($paramNode->getChildren()) >= 1) {
			$drawNode = $paramNode->getChildren()[0];
				
				
			switch ($drawNode->getName()) {
			case 'serie' :
			$data['drawType'] = 'serie';
			break;
			case 'orbitserie' :
			$data['drawType'] = 'orbit-serie';
			break;
			}
				
			$result = array(
					"success" => true,
					"data" => $data
			);
			}
			}*/
		}
	}
	
966bd5f8   Benjamin Renard   Add request to ge...
294
	private function unmarshallDrawData($plotNode, $paramId) {
5e8f0c52   Hacene SI HADJ MOHAND   ppp ok
295
                
966bd5f8   Benjamin Renard   Add request to ge...
296
297
298
299
300
301
302
303
304
		$result_data = array();
		
		if (!isset($plotNode))
			return $result_data;
		
		$paramsNode = $plotNode->getParams();
		
		if (!isset($paramsNode))
			return $result_data;
c3e6d894   Benjamin Renard   Init IHMParamTemp...
305
		if ($this->paramMgr->getTemplateParamsManager()->isTemplatedParam($paramId))
4fe90834   Benjamin Renard   Fix bug with get ...
306
			//Use templated parameter
c3e6d894   Benjamin Renard   Init IHMParamTemp...
307
			$realParamId = $this->paramMgr->getTemplateParamsManager()->getTemplateFileName($paramId);
4fe90834   Benjamin Renard   Fix bug with get ...
308
309
310
311
		else
			$realParamId = $paramId;
		
		$paramNode = $paramsNode->getParamById($realParamId);
5e8f0c52   Hacene SI HADJ MOHAND   ppp ok
312
313
                 
	
966bd5f8   Benjamin Renard   Add request to ge...
314
315
316
317
318
		if (!isset($paramNode) || (count($paramNode->getChildren()) < 1))
			return $result_data;
		
		$mainDrawNode = NULL;
		$otherDrawNodes = array();
966bd5f8   Benjamin Renard   Add request to ge...
319
320
321
322
323
324
325
326
327
		foreach ($paramNode->getChildren() as $crtDrawNode) {
			if (in_array($crtDrawNode->getName(), array('serie', 'spectro', 'yserie', 'orbitserie')))
				$mainDrawNode = $crtDrawNode;
			else
				$otherDrawNodes[$mainDrawNode->getName()] = $crtDrawNode;
		}
		
		if (!isset($mainDrawNode))
			return $result_data;
966bd5f8   Benjamin Renard   Add request to ge...
328
329
		switch ($mainDrawNode->getName()) {
			case 'serie' :
1627a2dd   Benjamin Renard   Add status bar de...
330
331
332
333
334
335
336
				if ($plotNode->getName() == 'statusPlot') {
					$result_data['type'] = 'status-bar';
				}
				else {
					$result_data['type'] = 'serie';
					$this->unmarshallBaseSerieData($mainDrawNode, $result_data);
				}
966bd5f8   Benjamin Renard   Add request to ge...
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
				//if (array_key_exists('colorserie', $otherDrawNodes))
				//	$this->unmarshallColorSerieData($mainDrawNode, $result_data);
				break;
			case 'spectro' :
				$result_data['type'] = 'spectro';
				$this->unmarshallSpectroData($mainDrawNode, $result_data);
				break;
			case 'yserie' :
				if (!array_key_exists('xserie', $otherDrawNodes))
					return $result_data;
				$this->unmarshallBaseSerieData($mainDrawNode, $result_data);
				//$this->unmarshallXSerieData($mainDrawNode, $result_data);
				//if (array_key_exists('colorserie', $otherDrawNodes))
				//	$this->unmarshallColorSerieData($mainDrawNode, $result_data);
				break;
			case 'orbitserie' :
				$result_data['type'] = 'orbit-serie';
				$result_data['serie-projection'] = $mainDrawNode->getProjection();
				$this->unmarshallBaseSerieData($mainDrawNode, $result_data);
				//if (array_key_exists('colorserie', $otherDrawNodes))
				//	$this->unmarshallColorSerieData($mainDrawNode, $result_data);
				break;
			default :
				return $result_data;
		}
		
71eaac9b   Benjamin Renard   Return default ax...
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
		$axesNode = $plotNode->getAxes();
		if (isset($axesNode)) {
			$result_data['axes'] = array();
			
			$colorAxis = $axesNode->getColorAxis();
			if (isset($colorAxis)) {
				$result_data['axes']['color'] = array();
				$this->unmarshallAxisData($colorAxis, $result_data['axes']['color']);
			}
			
			$xAxis = $axesNode->getDigitalAxis(RequestOutputPlotAxisTypeEnum::XAXIS, 'xaxis_id');
			if (isset($xAxis)) {
				$result_data['axes']['xaxis_id'] = array();
				$this->unmarshallAxisData($xAxis, $result_data['axes']['xaxis_id']);
			}
			
			$yLeftAxis = $axesNode->getDigitalAxis(RequestOutputPlotAxisTypeEnum::YAXIS, 'y-left');
			if (isset($yLeftAxis)) {
				$result_data['axes']['y-left'] = array();
				$this->unmarshallAxisData($yLeftAxis, $result_data['axes']['y-left']);
			}
			
			$yRightAxis = $axesNode->getDigitalAxis(RequestOutputPlotAxisTypeEnum::YAXIS, 'y-right');
			if (isset($yRightAxis)) {
				$result_data['axes']['y-right'] = array();
				$this->unmarshallAxisData($yRightAxis, $result_data['axes']['y-right']);
			}
		}
		
966bd5f8   Benjamin Renard   Add request to ge...
392
393
394
		return $result_data;
	}
	
71eaac9b   Benjamin Renard   Return default ax...
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
	private function unmarshallAxisData($axisNode, &$result_array) {
		if (!isset($axisNode))
			return;
		
		$scale = $axisNode->getScale();
		if (isset($scale))
			$result_array['axis-scale'] = $scale;
		$rangeNode = $axisNode->getRange();
		if (isset($rangeNode)) {
			$rangeMin = $rangeNode->getMin();
			if (isset($rangeMin))
				$result_array['axis-range-min'] = $rangeMin;
			$rangeMax = $rangeNode->getMax();
			if (isset($rangeMax))
				$result_array['axis-range-max'] = $rangeMax;
		}
	}
	
966bd5f8   Benjamin Renard   Add request to ge...
413
414
415
416
	private function unmarshallSpectroData($drawNode, &$result_array) {
		if (!isset($drawNode))
			return;
		
f7093283   Benjamin Renard   Fix pb with PHP v...
417
418
419
		$yAxis = $drawNode->getAttribute(REQUESTOUTPUTPLOTSPECTRO_YAXIS);
		if (!empty($yAxis))
			$result_array['spectro-yaxis'] = $yAxis;
966bd5f8   Benjamin Renard   Add request to ge...
420
		
f7093283   Benjamin Renard   Fix pb with PHP v...
421
422
423
		$min = $drawNode->getAttribute(REQUESTOUTPUTPLOTSPECTRO_MIN);
		if (!empty($min))
			$result_array['spectro-value-min'] = $min;
966bd5f8   Benjamin Renard   Add request to ge...
424
		
f7093283   Benjamin Renard   Fix pb with PHP v...
425
426
427
		$max = $drawNode->getAttribute(REQUESTOUTPUTPLOTSPECTRO_MAX);
		if (!empty($max))
			$result_array['spectro-value-max'] = $max;
0c1bcc5a   Benjamin Renard   Add option to sho...
428
429
430
431

		$uselog0asmin = $drawNode->getAttribute(REQUESTOUTPUTPLOTSPECTRO_USELOG0ASMIN);
		if (!empty($uselog0asmin))
			$result_array['spectro-log0-as-min'] = (strtolower($uselog0asmin) == "true");
cbe089e7   Hacene SI HADJ MOHAND   seems ok for spectro
432
433
434
435
436


		$resolution = $drawNode->getAttribute(REQUESTOUTPUTPLOTSPECTRO_RESOLUTION);
		if (!empty($resolution))
			$result_array['spectro-resolution'] = $resolution;
966bd5f8   Benjamin Renard   Add request to ge...
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
	}
	
	private function unmarshallAdditionalObjectsData($plotNode) {
		$result_data = array();
		
		if (!isset($plotNode))
			return $result_data;
		
		$additionalObjectsNode = $plotNode->getAdditionalObjects();
		
		//curvePlot
		$result_data['curves'] = array();
		$curveObjectsNode = $additionalObjectsNode->getCurveObjects();
		foreach ($curveObjectsNode as $curveNode) {
			$crt_curve_data = array();
			$crt_curve_data['curve-serie-id'] = $curveNode->getSerieId();
			$this->unmarshallLineData($curveNode, "curve-line-", $crt_curve_data);
			
			if ($curveNode->isFunctionDefined()) {
				$crt_curve_data['curve-name'] = $curveNode->getFunction()->getFunctionName();
				$crt_curve_data['curve-attributes'] = array();
				
				foreach ($curveNode->getFunction()->getAttributes()->getChildren() as $attributeNode) {
					$crt_attribute_data = array();
					
					$crt_attribute_data['curve-param-name'] = $attributeNode->getAttribute(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTENAME);
					$crt_attribute_data['curve-param-value'] = $attributeNode->getAttribute(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTEVALUE);
					
					$crt_curve_data['curve-attributes'][] = $crt_attribute_data;
				}
				
			}
			
			$result_data['curves'][] = $crt_curve_data;
		}
		
		return $result_data;
	}
	
	private function unmarshallBaseSerieData($drawNode, &$result_array) {
		if (!isset($drawNode))
			return;
5e8f0c52   Hacene SI HADJ MOHAND   ppp ok
479
	
966bd5f8   Benjamin Renard   Add request to ge...
480
481
482
		$result_array['serie-id'] = $drawNode->getId();
		
		$result_array['serie-yaxis'] = $drawNode->getYAxisId();
5e8f0c52   Hacene SI HADJ MOHAND   ppp ok
483
                $resolution = $drawNode->getResolution();
cbe089e7   Hacene SI HADJ MOHAND   seems ok for spectro
484
485
                if (!empty($resolution))
                        $result_array['serie-resolution'] = $resolution;
966bd5f8   Benjamin Renard   Add request to ge...
486
487
488
489
490
491
492
493
494
495
		if ($drawNode->isLineDefined()) {
			$result_array['serie-lines-activated'] = true;
			$this->unmarshallLineData($drawNode->getLine(), "serie-lines-", $result_array);
		}
		
		if ($drawNode->isSymbolDefined()) {
			$result_array['serie-symbols-activated'] = true;
			$this->unmarshallSymbolData($drawNode->getSymbol(), "serie-symbols-", $result_array);
		}
		
f7093283   Benjamin Renard   Fix pb with PHP v...
496
497
		$colorSerieId = $drawNode->getColorSerieId();
		if (!empty($colorSerieId)) {
966bd5f8   Benjamin Renard   Add request to ge...
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
			//ToDo
		}
		
		if ($drawNode->isTimeTicksDefined()) {
			$result_array['serie-timetick-activated'] = true;
			
			$result_array['serie-timetick-step'] = $drawNode->getTimeTicks()->getStep();
			$result_array['serie-timetick-nbmajor'] = $drawNode->getTimeTicks()->getNumber();
			$result_array['serie-timetick-nbminor'] = $drawNode->getTimeTicks()->getMinor();
			$result_array['serie-timetick-color'] = $this->toHexColor($drawNode->getTimeTicks()->getColor());
			
			if (!empty($result_array['serie-timetick-nbmajor']) && intval($result_array['serie-timetick-nbmajor']) > 0)
				$result_array['serie-timetick-type'] = 'nb-major';
			else if (!empty($result_array['serie-timetick-step']) && intval($result_array['serie-timetick-step']) > 0)
				$result_array['serie-timetick-type'] = 'time-step';
			else
				$result_array['serie-timetick-type'] = 'auto';
			
			if ($drawNode->getTimeTicks()->isSymbolDefined()) {
				$this->unmarshallSymbolData($drawNode->getTimeTicks()->getSymbol(), "serie-timetick-symbols-", $result_array);
			}
			
			if ($drawNode->getTimeTicks()->isFirstSymbolDefined()) {
				$result_array['serie-timetick-firstsymbols-activated'] = true;
				$this->unmarshallSymbolData($drawNode->getTimeTicks()->getFirstSymbol(), "serie-timetick-firstsymbols-", $result_array);
			}
			
			if ($drawNode->getTimeTicks()->isFontDefined()) {
				$result_array['serie-timetick-font-activated'] = true;
				$this->unmarshallFontData($drawNode->getTimeTicks()->getFont(), "serie-timetick-font-", $result_array);
			}
		}
		
		if ($drawNode->isIntervalTicksDefined()) {
			$result_array['serie-intervaltick-activated'] = true;
			
			$result_array['serie-intervaltick-mode'] =  $drawNode->getIntervalTicks()->getMode();
			$result_array['serie-intervaltick-color'] =  $this->toHexColor($drawNode->getIntervalTicks()->getColor());
			
			if ($drawNode->getIntervalTicks()->isSymbolDefined()) {
				$this->unmarshallSymbolData($drawNode->getIntervalTicks()->getSymbol(), "serie-intervaltick-", $result_array);
			}
			
			if ($drawNode->getIntervalTicks()->isFontDefined()) {
				$result_array['serie-intervaltick-font-activated'] = true;
				$this->unmarshallFontData($drawNode->getIntervalTicks()->getFont(), "serie-intervaltick-font-", $result_array);
			}
		}
	}
	
	private function unmarshallLineData($lineNode, $prefix, &$result_array) {
		$result_array[$prefix.'style'] = $lineNode->getStyle();
		$result_array[$prefix.'width'] = $lineNode->getWidth();
		$result_array[$prefix.'color'] = $this->toHexColor($lineNode->getColor());
	}
	
	private function unmarshallSymbolData($symbolNode, $prefix, &$result_array) {
		$result_array[$prefix.'type'] = $symbolNode->getType();
		$result_array[$prefix.'size'] = $symbolNode->getSize();
		$result_array[$prefix.'color'] = $this->toHexColor($symbolNode->getColor());
	}
	
	private function  unmarshallFontData($fontNode, $prefix, &$result_array) {
		$result_array[$prefix.'name'] = $fontNode->getFontName();
		$result_array[$prefix.'size'] = $fontNode->getSize();
		$result_array[$prefix.'bold'] = ($fontNode->getWeight() == RequestOutputPlotFontWeight::BOLD);
		$result_array[$prefix.'italic'] = ($fontNode->getStyle() == RequestOutputPlotFontStyle::ITALIC);
	}
	
	private function toHexColor($color) {
		$temp = str_replace(array('[', ']', ' '), '', $color);
		$arr = explode(',', $temp);
		if (count ($arr) != 3)
			return '#000000';
		return '#'.sprintf('%02x', $arr[0]).sprintf('%02x', $arr[1]).sprintf('%02x', $arr[2]);
	}
}

dcdacd5c   Benjamin Renard   Fill plot type in...
576
?>