Blame view

src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php 47.1 KB
22521f1c   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
<?php

define ("PLOT_RESULT_FILE_KEY","plot");

/**
 * @class IHMInputOutputParamsPlotClass
 * @brief Implementation of IHMInputOutputParamsAbstractClass to treat plot request
 * @details
*/
class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
{
98881737   Benjamin Renard   Add post processi...
12
13
	private $isInteractiveRequest = false;
	
22521f1c   Benjamin Renard   First commit
14
15
16
17
18
	/*
	 * @brief method to unmarshall a plot request
	*/
	protected function unmarshallRequest($input)
	{
db9b2cfe   Benjamin Renard   Zoom in interacti...
19
20
21
22
23
		if (isset($input->{'action'}))
			$input = $this->unmarshallActionRequest($input);
		else
			//save request
			$this->saveIHMRequest($input);
8c57155b   Benjamin Renard   Integration for t...
24
25
26
		
		//Request
		$requestIndex = 0;
98881737   Benjamin Renard   Add post processi...
27
28
		$this->isInteractiveRequest = ($input->{'file-output'} == 'INTERACTIVE');
		$postProcessCmd = "";
8c57155b   Benjamin Renard   Integration for t...
29
		foreach ($input->tabs as $tab)
22521f1c   Benjamin Renard   First commit
30
		{
8c57155b   Benjamin Renard   Integration for t...
31
32
			$requestNode = $this->paramsData->addRequestNode();
			$outputsNode = $requestNode->getOutputsNode();
4ede4320   Benjamin Renard   Integration for s...
33
			$paramsNode  = $requestNode->getParamsNode();
22521f1c   Benjamin Renard   First commit
34
			
8c57155b   Benjamin Renard   Integration for t...
35
			//unmarshall time definition
30a70818   Benjamin Renard   Multi plot mode f...
36
37
38
39
			if ($tab->{'multi-plot-linked'})
				$this->unmarshallTimeDefinition($input, $requestIndex, $this->isInteractiveRequest && !$tab->{'page-superpose-mode'});
			else
				$this->unmarshallTimeDefinition($tab, $requestIndex, $this->isInteractiveRequest && !$tab->{'page-superpose-mode'});
22521f1c   Benjamin Renard   First commit
40
			
8c57155b   Benjamin Renard   Integration for t...
41
42
			$plotOutputNode = $outputsNode->addNewOutput(RequestOutputTypeEnum::PLOT);
			
63412837   Benjamin Renard   Retrieve plot con...
43
44
			$plotOutputNode->setWriteContextFile($this->isInteractiveRequest ? "true" : "false");
			
98881737   Benjamin Renard   Add post processi...
45
46
			$compression = "";
			if (!$this->isInteractiveRequest)
22521f1c   Benjamin Renard   First commit
47
			{
98881737   Benjamin Renard   Add post processi...
48
49
50
51
52
53
54
55
56
57
58
59
60
61
				switch ($input->{'file-output'})
				{
					case 'TGZ' :
						$plotOutputNode->addPostProcessing(RequestOutputPostProcessingEnumClass::TAR);
						$plotOutputNode->addPostProcessing(RequestOutputPostProcessingEnumClass::GZIP);
						$compression = ".tar.gz";
						break;
					case 'ZIP' :
						$plotOutputNode->addPostProcessing(RequestOutputPostProcessingEnumClass::ZIP);
						$compression = ".zip";
						break;
					default:
						throw new Exception('Compression not implemented.');
				}
8c57155b   Benjamin Renard   Integration for t...
62
63
64
65
66
67
68
69
			}
			
			if ($input->{'one-file-per-interval'})
				$plotOutputNode->setStructure(RequestOutputPlotStructureEnum::ONE_FILE_PER_INTERVAL);
			else
				$plotOutputNode->setStructure(RequestOutputPlotStructureEnum::ONE_FILE);
			
			//prefix
98881737   Benjamin Renard   Add post processi...
70
71
			$filePrefix = "plot";
			if ($input->{'file-prefix'} && ($input->{'file-prefix'} != ""))
8c57155b   Benjamin Renard   Integration for t...
72
				$filePrefix = $input->{'file-prefix'};
db9b2cfe   Benjamin Renard   Zoom in interacti...
73
			$filePrefix .= $tab->{'id'};
8c57155b   Benjamin Renard   Integration for t...
74
75
76
77
78
79
80
			
			$plotOutputNode->setFilePrefix($filePrefix);
			
			//page
			$pageNode = $plotOutputNode->getPage();
			
			$fileFormat = RequestOutputPlotPageFormatEnum::PNG;
98881737   Benjamin Renard   Add post processi...
81
			$extension = ".png";
8c57155b   Benjamin Renard   Integration for t...
82
83
84
85
			switch ($input->{'file-format'})
			{
				case 'PNG' :
					$fileFormat = RequestOutputPlotPageFormatEnum::PNG;
98881737   Benjamin Renard   Add post processi...
86
					$extension = ".png";
22521f1c   Benjamin Renard   First commit
87
					break;
8c57155b   Benjamin Renard   Integration for t...
88
89
				case 'PDF' :
					$fileFormat = RequestOutputPlotPageFormatEnum::PDF;
98881737   Benjamin Renard   Add post processi...
90
					$extension = ".pdf";
22521f1c   Benjamin Renard   First commit
91
					break;
8c57155b   Benjamin Renard   Integration for t...
92
93
				case 'PS' :
					$fileFormat = RequestOutputPlotPageFormatEnum::PS;
98881737   Benjamin Renard   Add post processi...
94
					$extension = ".ps";
22521f1c   Benjamin Renard   First commit
95
					break;
8c57155b   Benjamin Renard   Integration for t...
96
97
				case 'SVG' :
					$fileFormat = RequestOutputPlotPageFormatEnum::SVG;
98881737   Benjamin Renard   Add post processi...
98
					$extension = ".svg";
8c57155b   Benjamin Renard   Integration for t...
99
100
101
					break;
				default:
					throw new Exception('File format not implemented.');
22521f1c   Benjamin Renard   First commit
102
			}
22521f1c   Benjamin Renard   First commit
103
			
8c57155b   Benjamin Renard   Integration for t...
104
105
106
107
			$pageNode->setFormat($fileFormat);
			
			$this->unmarshallTitle($tab, 'page-title', $pageNode->getTitle());
			
98881737   Benjamin Renard   Add post processi...
108
			$isPortrait = false;
8c57155b   Benjamin Renard   Integration for t...
109
			switch ($tab->{'page-orientation'})
22521f1c   Benjamin Renard   First commit
110
			{
8c57155b   Benjamin Renard   Integration for t...
111
112
				case 'landscape' :
					$pageNode->setOrientation(RequestOutputPlotPageOrientationEnum::LANDSCAPE);
22521f1c   Benjamin Renard   First commit
113
					break;
8c57155b   Benjamin Renard   Integration for t...
114
115
				case 'portrait' :
					$pageNode->setOrientation(RequestOutputPlotPageOrientationEnum::PORTRAIT);
98881737   Benjamin Renard   Add post processi...
116
					$isPortrait = true;
22521f1c   Benjamin Renard   First commit
117
118
					break;
			}
8c57155b   Benjamin Renard   Integration for t...
119
120
121
122
123
124
125
126
127
128
129
			
			switch ($tab->{'page-dimension'})
			{
				case 'ISO A4' :
					$pageNode->setDimension(RequestOutputPlotPageDimensionEnum::ISO_A4);
					break;
				case 'US letter' :
					$pageNode->setDimension(RequestOutputPlotPageDimensionEnum::US_LETTER);
					break;
				default:
					throw new Exception('Page dimension not implemented.');
22521f1c   Benjamin Renard   First commit
130
131
			}
			
8c57155b   Benjamin Renard   Integration for t...
132
			switch ($tab->{'page-mode'})
22521f1c   Benjamin Renard   First commit
133
			{
8c57155b   Benjamin Renard   Integration for t...
134
135
136
137
138
139
140
141
				case 'color' :
					$pageNode->setMode(RequestOutputPlotPageModeEnum::COLOR);
					break;
				case 'grayscale' :
					$pageNode->setMode(RequestOutputPlotPageModeEnum::GRAYSCALE);
					break;
				default:
					throw new Exception('Page mode not implemented.');
22521f1c   Benjamin Renard   First commit
142
			}
8c57155b   Benjamin Renard   Integration for t...
143
144
145
146
147
148
149
150
			
			if ($tab->{'page-margins-activated'})
			{
				$pageNode->getMargins()->setHorizontal($tab->{'page-margin-x'});
				$pageNode->getMargins()->setVertical($tab->{'page-margin-y'});
			}
			
			if ($tab->{'page-font-activated'})
f012b419   Benjamin Renard   Add integration f...
151
				$this->unmarshallFont($tab, 'page-font', $pageNode->getFont());
8c57155b   Benjamin Renard   Integration for t...
152
			
c0e7e5be   Benjamin Renard   Add integration f...
153
154
155
156
157
			//Superpose mode
			$pageNode->setSuperposeMode($tab->{'page-superpose-mode'} ? "true": "false");
			
			//Layout
			$this->unmarshallLayout($tab, $pageNode);
8c57155b   Benjamin Renard   Integration for t...
158
			
78a73e9a   Benjamin Renard   Integration for p...
159
			foreach ($tab->{'panels'} as $panelData)
4ede4320   Benjamin Renard   Integration for s...
160
				$this->unmarshallPanel($panelData, $pageNode, $paramsNode);
78a73e9a   Benjamin Renard   Integration for p...
161
			
98881737   Benjamin Renard   Add post processi...
162
163
164
165
166
167
168
169
170
171
172
			if ($this->isInteractiveRequest)
			{
				$resultFile = $filePrefix."_*".$extension;
				$waitingResultFile = $filePrefix.$extension;
			}
			else
			{
				$resultFile = $filePrefix."_*".$compression;
				$waitingResultFile = $filePrefix.$compression;
			}
			
db9b2cfe   Benjamin Renard   Zoom in interacti...
173
174
175
176
			if ($this->isInteractiveRequest)
				$this->paramsData->addWaitingResult(PLOT_RESULT_FILE_KEY."_".$tab->{'id'}, $waitingResultFile);
			else
				$this->paramsData->addWaitingResult(PLOT_RESULT_FILE_KEY, $waitingResultFile);
98881737   Benjamin Renard   Add post processi...
177
178
179
180
181
182
183
184
185
186
187
188
			
			//Remove old result files
			foreach (glob($this->paramsData->getWorkingPath().$resultFile) as $oldFile) {
				unlink($oldFile);
			}
			
			//Post process command to apply to the result file
			if ($postProcessCmd != "")
				$postProcessCmd .= " | ";
			$postProcessCmd .= "mv ".$resultFile." ".$waitingResultFile;
			
			if ($this->isInteractiveRequest && $isPortrait)
22a6206a   Benjamin Renard   Fix bug with imag...
189
				$postProcessCmd .= " | convert ".$waitingResultFile." -rotate -90 ".$waitingResultFile;
98881737   Benjamin Renard   Add post processi...
190
			
8c57155b   Benjamin Renard   Integration for t...
191
			++$requestIndex;
22521f1c   Benjamin Renard   First commit
192
		}
8c57155b   Benjamin Renard   Integration for t...
193
		
98881737   Benjamin Renard   Add post processi...
194
195
		$this->paramsData->setBatchEnable(!(($fileFormat == RequestOutputPlotPageFormatEnum::PNG) && $this->isInteractiveRequest));
		$this->paramsData->setPostCmd($postProcessCmd);
8c57155b   Benjamin Renard   Integration for t...
196
		
8c57155b   Benjamin Renard   Integration for t...
197
198
199
		return $this->paramsData;
	}
	
c0e7e5be   Benjamin Renard   Add integration f...
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
	protected function unmarshallLayout($tab, $pageNode)
	{
		switch ($tab->{'page-layout-type'})
		{
			case 'vertical' :
				$pageNode->getLayout()->setType(RequestOutputPlotLayoutTypeEnum::VERTICAL);
				$pageNode->getLayout()->setPanelHeight($tab->{'page-layout-object'}->{'layout-panel-height'});
				$pageNode->getLayout()->setPanelSpacing($tab->{'page-layout-object'}->{'layout-panel-spacing'});
				$pageNode->getLayout()->setExpand($tab->{'page-layout-object'}->{'layout-expand'} ? "true" : "false");
				//if ($tab->{'page-layout-object'}->{'layout-timeplot-width'} > 0)
				//	$pageNode->setDefaultTimePlotWidth($tab->{'page-layout-object'}->{'layout-timeplot-width'});
				if ($tab->{'page-layout-object'}->{'layout-timeplot-height'} > 0)
					$pageNode->setDefaultTimePlotHeight($tab->{'page-layout-object'}->{'layout-timeplot-height'});
				if ($tab->{'page-layout-object'}->{'layout-xyplot-width'} > 0)
					$pageNode->setDefaultXYPlotWidth($tab->{'page-layout-object'}->{'layout-xyplot-width'});
				if ($tab->{'page-layout-object'}->{'layout-xyplot-height'} > 0)
					$pageNode->setDefaultXYPlotHeight($tab->{'page-layout-object'}->{'layout-xyplot-height'});
				break;
			case 'auto' :
				$pageNode->getLayout()->setType(RequestOutputPlotLayoutTypeEnum::AUTO);
				$pageNode->getLayout()->setPanelHeight($tab->{'page-layout-object'}->{'layout-panel-height'});
				$pageNode->getLayout()->setPanelSpacing($tab->{'page-layout-object'}->{'layout-panel-spacing'});
				$pageNode->getLayout()->setExpand($tab->{'page-layout-object'}->{'layout-expand'} ? "true" : "false");
				break;
			case 'manual' :
				$pageNode->getLayout()->setType(RequestOutputPlotLayoutTypeEnum::MANUAL);
				$timePlotLeftMargin = $tab->{'page-layout-object'}->{'layout-timeplot-margin-left'} ? $tab->{'page-layout-object'}->{'layout-timeplot-margin-left'} : -1;
				$timePlotRightMargin = $tab->{'page-layout-object'}->{'layout-timeplot-margin-right'} ? $tab->{'page-layout-object'}->{'layout-timeplot-margin-right'} : -1;
				$pageNode->setDefaultTimePlotXMargin($timePlotLeftMargin, $timePlotRightMargin);
				$xyPlotLeftMargin = $tab->{'page-layout-object'}->{'layout-xyplot-margin-left'} ? $tab->{'page-layout-object'}->{'layout-xyplot-margin-left'} : -1;
				$xyPlotRightMargin = $tab->{'page-layout-object'}->{'layout-xyplot-margin-right'} ? $tab->{'page-layout-object'}->{'layout-xyplot-margin-right'} : -1;
				$pageNode->setDefaultXYPlotXMargin($xyPlotLeftMargin, $xyPlotRightMargin);
				break;
			default:
				throw new Exception('Layout type not implemented.');
		}
		
	}
		
4ede4320   Benjamin Renard   Integration for s...
239
	protected function unmarshallPanel($panelData, $pageNode, $paramsNode)
78a73e9a   Benjamin Renard   Integration for p...
240
241
242
	{
		$panelNode = $pageNode->addPanel();
		
c0e7e5be   Benjamin Renard   Add integration f...
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
		
		switch ($pageNode->getLayout()->getType())
		{
			case RequestOutputPlotLayoutTypeEnum::MANUAL :
				//Panel bounds
				$panelNode->getBounds()->setX($panelData->{'panel-bounds-x'});
				$panelNode->getBounds()->setY($panelData->{'panel-bounds-y'});
				$panelNode->getBounds()->setWidth($panelData->{'panel-bounds-width'});
				$panelNode->getBounds()->setHeight($panelData->{'panel-bounds-height'});
				//Panel margins
				$leftMargin = $panelData->{'panel-margin-left'} ? $panelData->{'panel-margin-left'} : -1;
				$rightMargin = $panelData->{'panel-margin-right'} ? $panelData->{'panel-margin-right'} : -1;
				$panelNode->setXMargin($leftMargin, $rightMargin);
				break;
			case RequestOutputPlotLayoutTypeEnum::VERTICAL :
				//Panel prefered dimensions
				if ($panelData->{'panel-prefered-width'} > 0)
					$panelNode->setPreferedWidth($panelData->{'panel-prefered-width'});
				if ($panelData->{'panel-prefered-height'} > 0)
					$panelNode->setPreferedHeight($panelData->{'panel-prefered-height'});
				break;
			default :
				//Nothing to do
		}
		
f7e9b9f1   Benjamin Renard   Complete plot con...
268
269
270
		//Panel id
		$panelNode->setId($panelData->{'id'});
		
78a73e9a   Benjamin Renard   Integration for p...
271
272
273
274
275
		//Panel background color
		if (($panelData->{'panel-background-color'} != 'none') && ($panelData->{'panel-background-color'} != ''))
			$panelNode->setBackgroundColor($this->hexColor2KernelColor($panelData->{'panel-background-color'}));
		
		//Panel font
f012b419   Benjamin Renard   Add integration f...
276
		$this->unmarshallFont($panelData, 'panel-font', $panelNode->getFont());
78a73e9a   Benjamin Renard   Integration for p...
277
278
279
280
281
		
		//Panel title
		$this->unmarshallTitle($panelData, 'panel-title', $panelNode->getTitle());
		
		//Plot type
4ede4320   Benjamin Renard   Integration for s...
282
283
		$plotNode = $this->unmarshallPlotType($panelData, $panelNode);
		
ab13f26c   Benjamin Renard   Add text object p...
284
285
		$isTimePlot = ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTTIME_NAME);
		
17f69bd1   Benjamin Renard   Add tick plot and...
286
287
		//Tick plot
		$tickPlotNode = NULL;
ab13f26c   Benjamin Renard   Add text object p...
288
		if ($isTimePlot)
17f69bd1   Benjamin Renard   Add tick plot and...
289
290
291
292
293
294
295
296
297
298
299
		{
			if ($this->hasTickBar($panelData->{'params'}))
			{
				$tickPlotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::TICKPLOT,true);
				if ($panelData->{'panel-tick-format'} != '')
					$tickPlotNode->setFormat($panelData->{'panel-tick-format'});
			}
		}
		
		//Status plot
		$statusPlotNode = NULL;
ab13f26c   Benjamin Renard   Add text object p...
300
		if ($isTimePlot)
17f69bd1   Benjamin Renard   Add tick plot and...
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
		{
			if ($this->hasStatusBar($panelData->{'params'}))
			{
				$statusPlotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::STATUSPLOT,true);
				switch ($panelData->{'panel-status-position'})
				{
					case 'top' :
						$statusPlotNode->setPosition(RequestOutputPlotElementStatusPosition::TOP);
						break;
					case 'bottom' :
						$statusPlotNode->setPosition(RequestOutputPlotElementStatusPosition::BOTTOM);
						break;
				}
				$statusPlotNode->setColorMap($panelData->{'panel-status-colormap'});
			}
		}
		
4ede4320   Benjamin Renard   Integration for s...
318
319
		//Axes
		foreach ($panelData->{'axes'} as $axisData)
51cbca5c   Benjamin Renard   Add constants def...
320
			$this->unmarshallAxis($axisData, $panelData->{'constants'}, $plotNode);
4ede4320   Benjamin Renard   Integration for s...
321
322
		
		//Params
17f69bd1   Benjamin Renard   Add tick plot and...
323
		$this->unmarshallParams($panelData->{'params'}, $paramsNode, $plotNode, $panelNode, $statusPlotNode, $tickPlotNode);
78a73e9a   Benjamin Renard   Integration for p...
324
		
ab13f26c   Benjamin Renard   Add text object p...
325
326
327
328
		//Additional objects
		if ($plotNode->getAdditionalObjects() != NULL)
			$this->unmarshallAdditionalObjects($panelData, $plotNode->getAdditionalObjects(), $isTimePlot);
		
bbe4d005   Benjamin Renard   Integration for f...
329
330
331
332
		//Fills
		if ($plotNode->getFills() != NULL)
			$this->unmarshallFills($panelData, $plotNode->getFills());
		
78a73e9a   Benjamin Renard   Integration for p...
333
334
335
336
337
338
339
340
341
342
343
344
		return $panelNode;
	}
	
	protected function unmarshallPlotType($panelData, $panelNode)
	{
		switch ($panelData->{'panel-plot-type'})
		{
			case 'timePlot' :
				$plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::TIMEPLOT);
				break;
			case 'xyPlot' :
				$plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::XYPLOT);
c0e7e5be   Benjamin Renard   Add integration f...
345
				$plotNode->setIsIsotropic($panelData->{'panel-scatter-isotropic'});
78a73e9a   Benjamin Renard   Integration for p...
346
				break;
17f69bd1   Benjamin Renard   Add tick plot and...
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
			case 'statusPlot' :
				$plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::STATUSPLOT);
				switch ($panelData->{'panel-status-position'})
				{
					case 'top' :
						$plotNode->setPosition(RequestOutputPlotElementStatusPosition::TOP);
						break;
					case 'bottom' :
						$plotNode->setPosition(RequestOutputPlotElementStatusPosition::BOTTOM);
						break;
				}
				$plotNode->setColorMap($panelData->{'panel-status-colormap'});
				break;
			case 'tickPlot' :
				$plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::TICKPLOT);
				if ($panelData->{'panel-tick-format'} != '')
					$plotNode->setFormat($panelData->{'panel-tick-format'});
				break;
c0e7e5be   Benjamin Renard   Add integration f...
365
366
367
368
369
370
			case 'epochPlot' :
				$plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::EPOCHPLOT);
				if ($panelData->{'panel-epoch-centertimeid'} == '')
					throw new Exception('Center Time Id not defined for an Epoch Plot.');
				$plotNode->setCenterTimeId($panelData->{'panel-epoch-centertimeid'});
				break;
b4ee5e62   Benjamin Renard   Add integration f...
371
372
373
374
375
376
377
			case 'instantPlot' :
				$plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::INSTANTPLOT);
				date_default_timezone_set('UTC');
				$timeStamp = strtotime($panelData->{'panel-instant-time'});
				$time = CommonClass::timeStampToDDTime($timeStamp);
				$plotNode->setTime($time);
				break;
78a73e9a   Benjamin Renard   Integration for p...
378
379
380
381
			default:
				throw new Exception('Plot type not implemented.');
		}
		
70646e70   Benjamin Renard   Add text legend d...
382
		//Params Legend
c958695a   Benjamin Renard   Add Params Legend...
383
384
385
		if (isset($panelData->{'panel-series-legend'}) && $panelData->{'panel-series-legend'}->{'legend-series-activated'})
			$this->unmarshallParamsLegend($panelData->{'panel-series-legend'}, $plotNode->getLegends()->getParamsLegend());
		
70646e70   Benjamin Renard   Add text legend d...
386
387
388
389
		//Text Legends
		foreach ($panelData->{'text-legends'} as $textLegendData)
			$this->unmarshallTextLegend($textLegendData, $plotNode->getLegends());
		
4ede4320   Benjamin Renard   Integration for s...
390
		return $plotNode;
78a73e9a   Benjamin Renard   Integration for p...
391
392
	}
	
51cbca5c   Benjamin Renard   Add constants def...
393
	protected function unmarshallAxis($axisData, $constantsData, $plotNode)
78a73e9a   Benjamin Renard   Integration for p...
394
395
	{
		//axis type
51cbca5c   Benjamin Renard   Add constants def...
396
		$constantAxisId = '';
78a73e9a   Benjamin Renard   Integration for p...
397
398
399
400
401
		switch ($axisData->{'axis-type'})
		{
			case 'time' :
				$axisNode = $plotNode->getTimeAxis();
				$axisNode->setFormat($axisData->{'axis-time-format'});
51cbca5c   Benjamin Renard   Add constants def...
402
				$constantAxisId = 'x';
78a73e9a   Benjamin Renard   Integration for p...
403
404
405
406
				break;
			case 'epoch' :
				$axisNode = $plotNode->getEpochAxis();
				$axisNode->setNormalized($axisData->{'axis-epoch-normalized'} ? "true" : "false");
51cbca5c   Benjamin Renard   Add constants def...
407
				$constantAxisId = 'x';
78a73e9a   Benjamin Renard   Integration for p...
408
409
410
				break;
			case 'x' :
				$axisNode = $plotNode->getXAxis();
51cbca5c   Benjamin Renard   Add constants def...
411
				$constantAxisId = 'x';
78a73e9a   Benjamin Renard   Integration for p...
412
413
				break;
			case 'y-left' :
4ede4320   Benjamin Renard   Integration for s...
414
				$axisNode = $plotNode->addYAxis('y-left');
51cbca5c   Benjamin Renard   Add constants def...
415
				$constantAxisId = 'y-left';
78a73e9a   Benjamin Renard   Integration for p...
416
417
				break;
			case 'y-right' :
4ede4320   Benjamin Renard   Integration for s...
418
419
				$axisNode = $plotNode->addYAxis('y-right');
				$axisNode->setPosition(RequestOutputPlotAxisElementPosition::RIGHT);
51cbca5c   Benjamin Renard   Add constants def...
420
				$constantAxisId = 'y-right';
78a73e9a   Benjamin Renard   Integration for p...
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
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
				break;
			case 'color' :
				$axisNode = $plotNode->getZAxis();
				$axisNode->setColorMapIndex($axisData->{'axis-color-map'});
				if ($axisData->{'axis-color-minval'} != 'none')
					$axisNode->setMinValColor($this->hexColor2KernelColor($axisData->{'axis-color-minval'}));
				if ($axisData->{'axis-color-maxval'} != 'none')
					$axisNode->setMaxValColor($this->hexColor2KernelColor($axisData->{'axis-color-maxval'}));
				break;
			default:
				throw new Exception('Axis type not implemented.');
		}
		
		//reverse axis
		$axisNode->setReverse($axisData->{'axis-reverse'} ? "true" : "false");
		
		//axis scale
		switch ($axisData->{'axis-scale'})
		{
			case 'logarithmic' :
				$axisNode->setScale(RequestOutputPlotAxisElementScale::LOGARITHMIC);
				break;
			default:
				$axisNode->setScale(RequestOutputPlotAxisElementScale::LINEAR);
		}
		
		//axis range
		if ($axisData->{'axis-range-min'} < $axisData->{'axis-range-max'})
			$axisNode->getRange()->setMinMax($axisData->{'axis-range-min'}, $axisData->{'axis-range-max'});
		$axisNode->getRange()->setExtend($axisData->{'axis-range-extend'} ? "true" : "false");
		
		//axis color
		$axisNode->setColor($this->hexColor2KernelColor($axisData->{'axis-color'}));
		
		//axis thickness
		$axisNode->setThickness($axisData->{'axis-thickness'});
		
		//axis ticks position
		switch ($axisData->{'axis-tick-position'})
		{
			case 'inwards' :
				$axisNode->getTick()->setPosition(RequestOutputPlotAxisElementTickPosition::INWARDS);
				break;
			default :
				$axisNode->getTick()->setPosition(RequestOutputPlotAxisElementTickPosition::OUTWARDS);
		}
		
		//axis minor and major grid
		$axisNode->getTick()->setMinorGrid($axisData->{'axis-grid-minor'} ? "true" : "false");
		$axisNode->getTick()->setMajorGrid($axisData->{'axis-grid-major'} ? "true" : "false");
		
		//legend
4ede4320   Benjamin Renard   Integration for s...
473
474
475
		if ($axisData->{'axis-legend-text'} != '')
			$axisNode->getLegend()->setText($axisData->{'axis-legend-text'});
		$axisNode->getLegend()->setColor($this->hexColor2KernelColor($axisData->{'axis-legend-color'}));
78a73e9a   Benjamin Renard   Integration for p...
476
		$this->unmarshallLabel($axisData, "axis-legend", $axisNode->getLegend());
f012b419   Benjamin Renard   Add integration f...
477
478
479
480
481
482
		
		//Show legend
		$axisNode->setShowLegend($axisData->{'axis-legend-activated'} ? "true" : "false");
		
		//Show tick marks
		$axisNode->setShowTickMarks($axisData->{'axis-tick-showmarks'} ? "true" : "false");
51cbca5c   Benjamin Renard   Add constants def...
483
484
485
486
487
488
489
490
		
		//Add constants
		if ($constantAxisId != '')
		{
			foreach ($constantsData as $constantData)
				if ($constantData->{'constant-axis-id'} == $constantAxisId)
					$this->unmarshallConstant($constantData,$axisNode);
		}
78a73e9a   Benjamin Renard   Integration for p...
491
492
	}
	
17f69bd1   Benjamin Renard   Add tick plot and...
493
	protected function unmarshallParams($paramsData, $requestParamsNode, $plotNode, $panelNode, $statusPlotNode, $tickPlotNode)
4ede4320   Benjamin Renard   Integration for s...
494
495
496
497
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
	{
		//X parameters
		$isScatter = ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTXY_NAME);
		if ($isScatter)
		{
			foreach ($paramsData as $paramData)
			{
				if ($paramData->{'param-drawing-object'}->{'serie-xaxis-param'} == '')
					continue;
				
				$paramXInfo = $this->paramManager->addExistingParam($paramData->{'param-drawing-object'}->{'serie-xaxis-param'},$this->paramsData);
				if ($paramXInfo['id'] == '')
					throw new Exception('Cannot retrieve X parameter.');
				$requestParamsNode->addParam($paramXInfo['id']);
				$xParamNode = $plotNode->getParams()->getParamById($paramXInfo['id']);
				switch ($paramData->{'param-drawing-type'})
				{
					case 'serie' :
						//Unmarshall x serie
						if (count($paramXInfo['indexes']) == 0)
							$xParamNode->addXSerie(REQUESTOUTPUTPLOTELEMENTXY_XAXISID, -1);
						else if (count($paramXInfo['indexes']) == 1)
							$xParamNode->addXSerie(REQUESTOUTPUTPLOTELEMENTXY_XAXISID, $paramXInfo['indexes'][0]);
						else
							throw new Exception('X parameter for serie must be a component.');
						break;
					default :
						throw new Exception('X parameter not allowed for this drawing type. ');
				}
			}
		}
		
		//Main drawing element parameter
		$drawingEltIndex = 0;
		foreach ($paramsData as $paramData)
		{
			//Param
			$paramInfo = $this->paramManager->addExistingParam($paramData->{'param-id'},$this->paramsData);
			$requestParamsNode->addParam($paramInfo['id']);
17f69bd1   Benjamin Renard   Add tick plot and...
533
			
4ede4320   Benjamin Renard   Integration for s...
534
535
536
537
538
539
540
541
			
			$colorSerieId = -1;
			if ($paramData->{'param-drawing-object'}->{'serie-colored-param'} != '')
				$colorSerieId = $drawingEltIndex;

			switch ($paramData->{'param-drawing-type'})
			{
				case 'serie' :
17f69bd1   Benjamin Renard   Add tick plot and...
542
					$paramNode = $plotNode->getParams()->getParamById($paramInfo['id']);
d7f73bcb   Benjamin Renard   Integration for c...
543
					$this->unmarshallYSerie($paramData, $plotNode, $paramNode, $paramInfo['indexes'], $isScatter && ($paramData->{'param-drawing-object'}->{'serie-xaxis-param'} != ''), $colorSerieId);
4ede4320   Benjamin Renard   Integration for s...
544
545
					break;
				case 'spectro' :
17f69bd1   Benjamin Renard   Add tick plot and...
546
					$paramNode = $plotNode->getParams()->getParamById($paramInfo['id']);
30a70818   Benjamin Renard   Multi plot mode f...
547
					$this->unmarshallSpectro($paramData->{'param-drawing-object'}, $plotNode, $paramNode, $paramInfo['indexes']);
4ede4320   Benjamin Renard   Integration for s...
548
					break;
17f69bd1   Benjamin Renard   Add tick plot and...
549
550
551
552
553
				case 'status-bar' :
					if (($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTSTATUS_NAME) && !isset($statusPlotNode))
						$paramNode = $plotNode->getParams()->getParamById($paramInfo['id']);
					else
						$paramNode = $statusPlotNode->getParams()->getParamById($paramInfo['id']);
17f69bd1   Benjamin Renard   Add tick plot and...
554
555
556
557
558
559
560
561
562
563
					$this->unmarshallStatusBar($paramData->{'param-drawing-object'}, $paramNode, $paramInfo['indexes']);
					break;
				case 'tick-bar' :
					if (($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTTICK_NAME) && !isset($tickPlotNode))
						$paramNode = $plotNode->getParams()->getParamById($paramInfo['id']);
					else
						$paramNode = $tickPlotNode->getParams()->getParamById($paramInfo['id']);
					
					$this->unmarshallTickBar($paramData->{'param-drawing-object'}, $paramNode, $paramInfo['indexes']);
					break;
b4ee5e62   Benjamin Renard   Add integration f...
564
565
566
567
				case 'iserie' :
					$paramNode = $plotNode->getParams()->getParamById($paramInfo['id']);
					$this->unmarshallInstantSerie($paramData->{'param-drawing-object'}, $plotNode, $paramNode);
					break;
4ede4320   Benjamin Renard   Integration for s...
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
				default :
					throw new Exception('Drawing type not implemented.');
			}
			++$drawingEltIndex;
		}
		
		//Colored parameter
		$drawingEltIndex = 0;
		foreach ($paramsData as $paramData)
		{
			if ($paramData->{'param-drawing-object'}->{'serie-colored-param'} == '')
			{
				++$drawingEltIndex;
				continue;
			}
			
			$paramColoredInfo = $this->paramManager->addExistingParam($paramData->{'param-drawing-object'}->{'serie-colored-param'},$this->paramsData);
			if ($paramColoredInfo['id'] == '')
				throw new Exception('Cannot retrieve colored parameter.');
			$requestParamsNode->addParam($paramColoredInfo['id']);
			$coloredParamNode = $plotNode->getParams()->getParamById($paramColoredInfo['id']);
			
			$colorSerieId = $drawingEltIndex;
			
			switch ($paramData->{'param-drawing-type'})
			{
				case 'serie' :
					//Unmarshall colored serie
					if (count($paramColoredInfo['indexes']) == 0)
						$coloredParamNode->addColorSerie($colorSerieId, -1);
					else if (count($paramColoredInfo['indexes']) == 1)
						$coloredParamNode->addColorSerie($colorSerieId, $paramColoredInfo['indexes'][0]);
					else
						throw new Exception('Colored parameter for serie must be a component.');
					break;
				default :
					throw new Exception('Colored parameter not allowed for this drawing type. ');
			}
			++$drawingEltIndex;
		}
	}
	
d7f73bcb   Benjamin Renard   Integration for c...
610
	protected function unmarshallYSerie($paramData, $plotNode, $paramNode, $indexes, $useXAxis, $colorSerieId)
4ede4320   Benjamin Renard   Integration for s...
611
612
613
614
	{
		$serieNodes = array();
		
		if (count($indexes) == 0)
d7f73bcb   Benjamin Renard   Integration for c...
615
616
617
618
619
		{
			$serieNode = $paramNode->addYSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, -1, $useXAxis ? REQUESTOUTPUTPLOTELEMENTXY_XAXISID : '', $colorSerieId);
			$serieNode->setId($paramData->{'id'});
			$serieNodes[] = $serieNode;
		}
4ede4320   Benjamin Renard   Integration for s...
620
		foreach ($indexes as $index)
d7f73bcb   Benjamin Renard   Integration for c...
621
622
623
624
625
626
627
		{
			$serieNode = $paramNode->addYSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, $index, $useXAxis ? REQUESTOUTPUTPLOTELEMENTXY_XAXISID : '', $colorSerieId);
			if (count($indexes) == 1)
				$serieNode->setId($paramData->{'id'});
			$serieNodes[] = $serieNode;
		}
			
4ede4320   Benjamin Renard   Integration for s...
628
629
		foreach ($serieNodes as $serieNode)
		{
c0e7e5be   Benjamin Renard   Add integration f...
630
631
632
			//Resampling
			if ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTXY_NAME)
			{
d7f73bcb   Benjamin Renard   Integration for c...
633
				switch ($paramData->{'param-drawing-object'}->{'serie-resampling-mode'})
c0e7e5be   Benjamin Renard   Add integration f...
634
635
636
637
638
639
640
641
642
				{
					case 'yparam' :
						$serieNode->getResampling()->setType(RequestOutputPlotResamplingTypeEnum::YPARAM);
						break;
					case 'xparam' :
					default :
						$serieNode->getResampling()->setType(RequestOutputPlotResamplingTypeEnum::XPARAM);
				}
			}
4ede4320   Benjamin Renard   Integration for s...
643
			//Line
d7f73bcb   Benjamin Renard   Integration for c...
644
			$this->unmarshallLine($paramData->{'param-drawing-object'}, 'serie', $serieNode->getLine(), $paramData->{'param-drawing-object'}->{"serie-lines-activated"} ? RequestOutputPlotLineTypeEnum::LINE : RequestOutputPlotLineTypeEnum::NO);
4ede4320   Benjamin Renard   Integration for s...
645
			//Symbol
d7f73bcb   Benjamin Renard   Integration for c...
646
			if (!$paramData->{'param-drawing-object'}->{"serie-symbols-activated"})
f012b419   Benjamin Renard   Add integration f...
647
648
				$serieNode->getSymbol()->setType(RequestOutputPlotSymbolTypeEnum::NO);
			else
d7f73bcb   Benjamin Renard   Integration for c...
649
				$this->unmarshallSymbol($paramData->{'param-drawing-object'}, 'serie-symbols', $serieNode->getSymbol());
f012b419   Benjamin Renard   Add integration f...
650
			//Time tick
d7f73bcb   Benjamin Renard   Integration for c...
651
652
			if (isset($paramData->{'param-drawing-object'}->{'serie-timetick'}))
				$this->unmarshallTimeTick($paramData->{'param-drawing-object'}->{'serie-timetick'}, $serieNode->getTimeTicks());
4ede4320   Benjamin Renard   Integration for s...
653
654
655
		}
	}
	
f012b419   Benjamin Renard   Add integration f...
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
	protected function unmarshallTimeTick($timeTickData, $timeTickNode)
	{
		//Font
		if ($timeTickData->{'serie-timetick-font-activated'})
			$this->unmarshallFont($timeTickData, 'serie-timetick-font', $timeTickNode->getFont());
		//First Symbol
		if ($timeTickData->{'serie-timetick-firstsymbols-activated'})
			$this->unmarshallSymbol($timeTickData, 'serie-timetick-firstsymbols', $timeTickNode->getFirstSymbol());
		//Symbol
		$this->unmarshallSymbol($timeTickData, 'serie-timetick-symbols', $timeTickNode->getSymbol());
		//Set options by type
		switch ($timeTickData->{'serie-timetick-type'})
		{
			case 'time-step' :
				$timeTickNode->setStep(CommonClass::timeStampToDDTime($timeTickData->{'serie-timetick-step'}));
				$timeTickNode->setNumber(0);
				break;
			case 'nb-major' :
				$timeTickNode->setStep(0);
				$timeTickNode->setNumber($timeTickData->{'serie-timetick-nbmajor'});
				break;
			case 'auto' :
			default :
				$timeTickNode->setStep('auto');
				$timeTickNode->setNumber(0);
		}
		//Minor
		$timeTickNode->setMinor($timeTickData->{'serie-timetick-nbminor'});
		//Color
		$timeTickNode->setColor($this->hexColor2KernelColor($timeTickData->{'serie-timetick-color'}));
	}
	
b4ee5e62   Benjamin Renard   Add integration f...
688
689
690
691
692
693
694
695
	protected function unmarshallInstantSerie($paramDrawingData, $plotNode, $paramNode)
	{
		$iserieNode = $paramNode->addInstantSerie(REQUESTOUTPUTPLOTELEMENTXY_XAXISID, 'y-left');
		
		//Table on X Axis
		$iserieNode->setTableOnXAxis($paramDrawingData->{'iserie-tableonx'} ? "true" : "false");
		
		//Line
51cbca5c   Benjamin Renard   Add constants def...
696
		$this->unmarshallLine($paramDrawingData, 'iserie', $iserieNode->getLine(), $paramDrawingData->{"iserie-lines-activated"} ? RequestOutputPlotLineTypeEnum::LINE : RequestOutputPlotLineTypeEnum::NO);
b4ee5e62   Benjamin Renard   Add integration f...
697
698

		//Symbol
f012b419   Benjamin Renard   Add integration f...
699
700
701
702
		if (!$paramDrawingData->{"iserie-symbols-activated"})
			$iserieNode->getSymbol()->setType(RequestOutputPlotSymbolTypeEnum::NO);
		else
			$this->unmarshallSymbol($paramDrawingData, 'iserie-symbols', $iserieNode->getSymbol());
b4ee5e62   Benjamin Renard   Add integration f...
703
704
	}
	
4ede4320   Benjamin Renard   Integration for s...
705
706
707
708
709
	protected function unmarshallSpectro($paramDrawingData, $plotNode, $paramNode, $indexes)
	{
		$spectroNode = $paramNode->addSpectro($paramDrawingData->{'spectro-yaxis'});
	}
	
17f69bd1   Benjamin Renard   Add tick plot and...
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
	protected function unmarshallStatusBar($paramDrawingData, $paramNode, $indexes)
	{
		if (count($indexes) == 0)
			$paramNode->addStatusBar(-1);
		foreach ($indexes as $index)
			$paramNode->addStatusBar($index);
	}
	
	protected function unmarshallTickBar($paramDrawingData, $paramNode, $indexes)
	{
		if (count($indexes) == 0)
			$paramNode->addTickBar(-1);
		foreach ($indexes as $index)
			$paramNode->addTickBar($index);
	}
	
	protected function hasStatusBar($paramsData)
	{
		foreach ($paramsData as $paramData)
			if ($paramData->{'param-drawing-type'} == 'status-bar')
				return true;
		return false;
	}
	
	protected function hasTickBar($paramsData)
	{
		foreach ($paramsData as $paramData)
			if ($paramData->{'param-drawing-type'} == 'tick-bar')
				return true;
		return false;
	}
	
c958695a   Benjamin Renard   Add Params Legend...
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
	protected function unmarshallParamsLegend($paramsLegendData, $paramsLegendNode)
	{
		//Legend type
		switch ($paramsLegendData->{'legend-series-type'})
		{
			case 'text-line-symbol' :
				$paramsLegendNode->setType(RequestOutputPlotParamsLegendTypeEnum::TEXTLINESYMBOL);
				break;
			case 'text-only' :
			default :
				$paramsLegendNode->setType(RequestOutputPlotParamsLegendTypeEnum::TEXTONLY);
		}
		
		//Show param legend
		$paramsLegendNode->setShowParamInfo($paramsLegendData->{'legend-series-showparaminfo'} ? "true" : "false");
		
		//Show interval legend
		$paramsLegendNode->setShowIntervalInfo($paramsLegendData->{'legend-series-intervalinfo-activated'} ? "true" : "false");
		
		//Interval info type
		switch ($paramsLegendData->{'legend-series-intervalinfo-type'})
		{
			case 'start-stop' :
				$paramsLegendNode->setIntervalInfoType(RequestOutputPlotParamsLegendIntervalInfoTypeEnum::STARTSTOP);
				break;
			case 'index' :
			default :
				$paramsLegendNode->setIntervalInfoType(RequestOutputPlotParamsLegendIntervalInfoTypeEnum::INDEX);
		}
		
		//Position
		switch ($paramsLegendData->{'legend-series-position'})
		{
			case 'inside' :
				$paramsLegendNode->setPosition(RequestOutputPlotParamsLegendPositionEnum::INSIDE);
				break;
			case 'outside' :
			default :
				$paramsLegendNode->setPosition(RequestOutputPlotParamsLegendPositionEnum::OUTSIDE);
		}
		
		//Default text color
		$paramsLegendNode->setDefaultTextColor($this->hexColor2KernelColor($paramsLegendData->{'legend-series-defaulttextcolor'}));
		
		//Border visible
		$paramsLegendNode->setBorderVisible($paramsLegendData->{'legend-series-border-activated'} ? "true" : "false");
		
		//Border color
		$paramsLegendNode->setBorderColor($this->hexColor2KernelColor($paramsLegendData->{'legend-series-border-color'}));
		
		//Font
		if ($paramsLegendData->{'legend-series-font-activated'})
			$this->unmarshallFont($paramsLegendData, 'legend-series-font', $paramsLegendNode->getFont());
	}
	
70646e70   Benjamin Renard   Add text legend d...
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
	protected function unmarshallTextLegend($textLegendData, $legendsNode)
	{
		$legendNode = $legendsNode->addTextLegend();
		
		//Legend text
		$legendNode->setText($textLegendData->{'legend-text-value'});
		
		//Legend position
		switch ($textLegendData->{'legend-text-position'})
		{
			case 'top' :
				$legendNode->setPosition(RequestOutputPlotTextLegendPositionEnum::TOP);
				break;
			case 'bottom' :
				$legendNode->setPosition(RequestOutputPlotTextLegendPositionEnum::BOTTOM);
				break;
			case 'left' :
				$legendNode->setPosition(RequestOutputPlotTextLegendPositionEnum::LEFT);
				break;
			case 'right' :
			default :
				$legendNode->setPosition(RequestOutputPlotTextLegendPositionEnum::RIGHT);
		}
		
		//Legend text color
		$legendNode->setColor($this->hexColor2KernelColor($textLegendData->{'legend-text-color'}));
	
		//Font
		if ($textLegendData->{'legend-text-font-activated'})
			$this->unmarshallFont($textLegendData, 'legend-text-font', $legendNode->getFont());
	}
	
51cbca5c   Benjamin Renard   Add constants def...
829
830
831
	protected function unmarshallConstant($constantData,$axisNode)
	{
		$constantNode = $axisNode->addConstant();
d7f73bcb   Benjamin Renard   Integration for c...
832
		$constantNode->setId($constantData->{'id'});
51cbca5c   Benjamin Renard   Add constants def...
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
		
		//Constant value
		switch ($axisNode->getName())
		{
			case REQUESTOUTPUTPLOTTIMEAXIS_NAME :
				date_default_timezone_set('UTC');
				$timeStamp = strtotime($constantData->{'constant-time-value'});
				$time = CommonClass::timeStampToDDTime($timeStamp);
				$constantNode->setConstantValue($time);
				break;
			default :
				$constantNode->setConstantValue($constantData->{'constant-float-value'});
		}
		
		//Curve options
		$this->unmarshallCurve($constantData, "constant-line", $constantNode);
	}
	
ab13f26c   Benjamin Renard   Add text object p...
851
852
853
854
	protected function unmarshallAdditionalObjects($panelData, $addObjectsNode, $isTimePlot)
	{
		foreach ($panelData->{'textObjs'} as $textData)
			$this->unmarshallTextObject($textData, $addObjectsNode, $isTimePlot);
d7f73bcb   Benjamin Renard   Integration for c...
855
856
		foreach ($panelData->{'curves'} as $curveData)
			$this->unmarshallCurveObject($curveData, $addObjectsNode);
ab13f26c   Benjamin Renard   Add text object p...
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
	}
	
	protected function unmarshallTextObject($textData, $addObjectsNode, $isTimePlot)
	{
		$textNode = $addObjectsNode->addTextObject();
		
		$textNode->setText($textData->{'text-value'});
		
		switch ($textData->{'text-y-axis'})
		{
			case 'y-right' :
				$textNode->setYAxis('y-right');
				break;
			case 'y-left' :
				$textNode->setYAxis('y-left');
				break;
		}
		
		if ($isTimePlot && !$textData->{'text-x-relative'})
		{
			date_default_timezone_set('UTC');
			$timeStamp = strtotime($textData->{'text-x-timevalue'});
			$time = CommonClass::timeStampToDDTime($timeStamp);
			$textNode->setX($time);
		}
		else if ($textData->{'text-x-relative'})
			$textNode->setX(($textData->{'text-x-floatvalue'}*100)."%");
		else
			$textNode->setX($textData->{'text-x-floatvalue'});
		
		if ($textData->{'text-y-relative'})
			$textNode->setY(($textData->{'text-y-value'}*100)."%");
		else
			$textNode->setY($textData->{'text-y-value'});
		
		$textNode->setAngle($textData->{'text-angle'});
		
		$textNode->setColor($this->hexColor2KernelColor($textData->{'text-color'}));
		
		switch ($textData->{'text-align'})
		{
			case 'center' :
				$textNode->setAlign(RequestOutputPlotTextAlign::CENTER);
				break;
			case 'right' :
				$textNode->setAlign(RequestOutputPlotTextAlign::RIGHT);
				break;
			case 'left' :
			default:
				$textNode->setAlign(RequestOutputPlotTextAlign::LEFT);
		}
		
		//Font
		if ($textData->{'text-font-activated'})
			$this->unmarshallFont($textData, 'text-font', $textNode->getFont());
	}
	
d7f73bcb   Benjamin Renard   Integration for c...
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
	protected function unmarshallCurveObject($curveData, $addObjectsNode)
	{
		if (($curveData->{'curve-name'} == '') || !isset($curveData->{'curve-serie-id'}))
			return;
		
		$curveNode = $addObjectsNode->addCurveObject();
		
		$curveNode->setSerieId($curveData->{'curve-serie-id'});
		
		$curveNode->getFunction()->setFunctionName($curveData->{'curve-name'});
		
		foreach ($curveData->{'params'} as $paramData)
			$curveNode->getFunction()->addAttribute($paramData->{'curve-param-name'}, $paramData->{'curve-param-value'});
		
		//Curve options
		$this->unmarshallCurve($curveData, "curve-line", $curveNode);
	}
	
bbe4d005   Benjamin Renard   Integration for f...
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
	protected function unmarshallFills($panelData, $fillsNode)
	{
		foreach ($panelData->{'fills'} as $fillData)
		{
			//Serie / Constant
			if ($fillData->{'fill-type'} == 'serie-constant')
			{
				$fillNode = $fillsNode->addFill(RequestOutputPlotFillTypeEnum::SERIECONSTANT);
				$fillNode->setSerieId($fillData->{'fill-firstserie-id'});
				$fillNode->setConstantId($fillData->{'fill-constant-id'});
				if ($fillData->{'fill-greater-color'} != 'none')
					$fillNode->setGreaterColor($this->hexColor2KernelColor($fillData->{'fill-greater-color'}));
				if ($fillData->{'fill-less-color'} != 'none')
					$fillNode->setLessColor($this->hexColor2KernelColor($fillData->{'fill-less-color'}));
			}
		}
		
		foreach ($panelData->{'fills'} as $fillData)
		{
			//Serie / Serie
			if ($fillData->{'fill-type'} == 'serie-serie')
			{
				$fillNode = $fillsNode->addFill(RequestOutputPlotFillTypeEnum::SERIESERIE);
				$fillNode->setFirstSerieId($fillData->{'fill-firstserie-id'});
				$fillNode->setSecondSerieId($fillData->{'fill-secondserie-id'});
				if ($fillData->{'fill-greater-color'} != 'none')
					$fillNode->setGreaterColor($this->hexColor2KernelColor($fillData->{'fill-greater-color'}));
				if ($fillData->{'fill-less-color'} != 'none')
					$fillNode->setLessColor($this->hexColor2KernelColor($fillData->{'fill-less-color'}));
			}
		}		
	}
	
8c57155b   Benjamin Renard   Integration for t...
965
966
967
	protected function unmarshallTitle($inputData, $keyPrefix, $titleNode)
	{
		if ($inputData->{$keyPrefix.'-text'} != '')
22521f1c   Benjamin Renard   First commit
968
		{
8c57155b   Benjamin Renard   Integration for t...
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
			$titleNode->setText($inputData->{$keyPrefix.'-text'});
		
			switch ($inputData->{$keyPrefix.'-position'})
			{
				case 'top' :
					$titleNode->setPosition(RequestOutputPlotTitlePosition::TOP);
					break;
				case 'bottom' :
					$titleNode->setPosition(RequestOutputPlotTitlePosition::BOTTOM);
					break;
			}
		
			switch ($inputData->{$keyPrefix.'-alignment'})
			{
				case 'center' :
					$titleNode->setAlign(RequestOutputPlotTitleAlign::CENTER);
					break;
				case 'left' :
					$titleNode->setAlign(RequestOutputPlotTitleAlign::LEFT);
					break;
				case 'right' :
					$titleNode->setAlign(RequestOutputPlotTitleAlign::RIGHT);
					break;
			}
			
			if ($inputData->{$keyPrefix.'-color'} != '')
				$titleNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix.'-color'}));
		
			$this->unmarshallLabel($inputData, $keyPrefix, $titleNode);
22521f1c   Benjamin Renard   First commit
998
		}
8c57155b   Benjamin Renard   Integration for t...
999
1000
1001
1002
1003
	}
	
	protected function unmarshallLabel($inputData, $keyPrefix, $labelNode)
	{
		if ($inputData->{$keyPrefix.'-font-activated'})
22521f1c   Benjamin Renard   First commit
1004
		{
8c57155b   Benjamin Renard   Integration for t...
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
			$labelNode->setFontName($inputData->{$keyPrefix.'-font-name'});
			$labelNode->setFontSize($inputData->{$keyPrefix.'-font-size'});
			$style = "";
			if ($inputData->{$keyPrefix.'-font-bold'})
			{
				if ($style != "")
					$style .= ",";
				$style .= "bold";
			}
			if ($inputData->{$keyPrefix.'-font-italic'})
			{
				if ($style != "")
					$style .= ",";
				$style .= "italic";
			}
			if ($style != "")
				$labelNode->setFontStyle($style);
22521f1c   Benjamin Renard   First commit
1022
		}
8c57155b   Benjamin Renard   Integration for t...
1023
1024
1025
1026
1027
		
	}
	
	protected function unmarshallFont($inputData, $keyPrefix, $fontNode)
	{
f012b419   Benjamin Renard   Add integration f...
1028
		if ($inputData->{$keyPrefix.'-activated'})
22521f1c   Benjamin Renard   First commit
1029
		{
f012b419   Benjamin Renard   Add integration f...
1030
1031
			$fontNode->setFontName($inputData->{$keyPrefix.'-name'});
			$fontNode->setSize($inputData->{$keyPrefix.'-size'});
8c57155b   Benjamin Renard   Integration for t...
1032
			
f012b419   Benjamin Renard   Add integration f...
1033
			if ($inputData->{$keyPrefix.'-italic'})
8c57155b   Benjamin Renard   Integration for t...
1034
1035
1036
1037
				$fontNode->setStyle(RequestOutputPlotFontStyle::ITALIC);
			else
				$fontNode->setStyle(RequestOutputPlotFontStyle::UPRIGHT);
			
f012b419   Benjamin Renard   Add integration f...
1038
			if ($inputData->{$keyPrefix.'-bold'})
8c57155b   Benjamin Renard   Integration for t...
1039
1040
1041
				$fontNode->setWeight(RequestOutputPlotFontWeight::BOLD);
			else
				$fontNode->setWeight(RequestOutputPlotFontWeight::MEDIUM);
22521f1c   Benjamin Renard   First commit
1042
		}
22521f1c   Benjamin Renard   First commit
1043
	}
4ede4320   Benjamin Renard   Integration for s...
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
	
	protected function unmarshallCurve($inputData, $keyPrefix, $curveNode)
	{
		switch ($inputData->{$keyPrefix.'-style'})
		{
			case 'plain'           :
				$curveNode->setStyle(RequestOutputPlotCurveStyleEnum::PLAIN);
				break;
			case 'dot'             :
				$curveNode->setStyle(RequestOutputPlotCurveStyleEnum::DOT);
				break;
			case 'long-spaced-dot' :
				$curveNode->setStyle(RequestOutputPlotCurveStyleEnum::LONGSPACEDDOT);
				break;
			case 'long-short-dot'  :
				$curveNode->setStyle(RequestOutputPlotCurveStyleEnum::LONGSHORTDOT);
				break;
			default :
				throw new Exception('Curve style not implemented.');
		}
			
		$curveNode->setWidth($inputData->{$keyPrefix.'-width'});
				
		if ($inputData->{$keyPrefix.'-color'} != 'auto')
			$curveNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix.'-color'}));
	}
	
51cbca5c   Benjamin Renard   Add constants def...
1071
	protected function unmarshallLine($inputData, $keyPrefix, $lineNode, $lineType)
4ede4320   Benjamin Renard   Integration for s...
1072
	{
51cbca5c   Benjamin Renard   Add constants def...
1073
1074
		$lineNode->setType($lineType);
		$this->unmarshallCurve($inputData, $keyPrefix."-lines", $lineNode);
4ede4320   Benjamin Renard   Integration for s...
1075
1076
1077
1078
	}
	
	protected function unmarshallSymbol($inputData, $keyPrefix, $symbolNode)
	{
f012b419   Benjamin Renard   Add integration f...
1079
		switch ($inputData->{$keyPrefix.'-type'})
4ede4320   Benjamin Renard   Integration for s...
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
		{
			case 'dot' :
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::DOT);
				break;
			case 'plus' :
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::PLUS);
				break;
			case 'wildcard' :
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::WILDCARD);
				break;
			case 'circle' :
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::CIRCLE);
				break;
			case 'crux' :
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::CRUX);
				break;
			case 'square' :
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::SQUARE);
				break;
			case 'triangle' :
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::TRIANGLE);
				break;
			case 'crux-in-circle' :
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::CRUXINCIRCLE);
				break;
			case 'dot-in-circle' :
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::DOTINCIRCLE);
				break;
			case 'diamond' :
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::DIAMOND);
				break;
			case 'star' :
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::STAR);
				break;
			case 'david-star' :
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::DAVIDSTAR);
				break;
			case 'full-square' :
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::FULLSQUARE);
				break;
			case 'full-circle' :
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::FULLCIRCLE);
				break;
			case 'full-star' :
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::FULLSTAR);
				break;
			default :
				throw new Exception('Symbol type not implemented.');
		}
			
f012b419   Benjamin Renard   Add integration f...
1130
		$symbolNode->setSize($inputData->{$keyPrefix.'-size'});
4ede4320   Benjamin Renard   Integration for s...
1131
				
f012b419   Benjamin Renard   Add integration f...
1132
1133
		if ($inputData->{$keyPrefix.'-color'} != 'auto')
			$symbolNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix.'-color'}));
4ede4320   Benjamin Renard   Integration for s...
1134
	}
22521f1c   Benjamin Renard   First commit
1135
1136
1137
1138
1139
1140

	/*
	 * @brief method to marshall the result of a download request
	*/
	protected function marshallResult($data)
	{
98881737   Benjamin Renard   Add post processi...
1141
		if (!$this->isInteractiveRequest)
22521f1c   Benjamin Renard   First commit
1142
1143
		{
			//add to job
db9b2cfe   Benjamin Renard   Zoom in interacti...
1144
			$commonRes = $this->commonMarshallResult($data,PLOT_RESULT_FILE_KEY);
22521f1c   Benjamin Renard   First commit
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
		
			return $commonRes;
		}
		
		if (!$data->getSuccess())
			return array(
					'success' => false,
					'message' => $data->getLastErrorMessage());
		
		switch ($data->getStatus())
		{
98881737   Benjamin Renard   Add post processi...
1156
			case ProcessStatusEnumClass::DONE :
63412837   Benjamin Renard   Retrieve plot con...
1157
1158
				
				$result = array();
9b4c17eb   Benjamin Renard   Add id for plot r...
1159
				foreach ($data->getWaitingResults() as $key => $waitingResult)
63412837   Benjamin Renard   Retrieve plot con...
1160
1161
1162
1163
				{
					$contextResult = str_replace(".png","_context.xml",$waitingResult);
					
					$result[] = array(
9b4c17eb   Benjamin Renard   Add id for plot r...
1164
						"id" => $key,
63412837   Benjamin Renard   Retrieve plot con...
1165
1166
1167
1168
1169
						"context" => IHMPlotContextFileClass::parse($this->getWorkingPath().$contextResult),
						"plot" => $waitingResult
					);
				}
				
22521f1c   Benjamin Renard   First commit
1170
1171
1172
1173
				return array(
					'success'     => true,
					'id'          => $data->getId(),
					'folder'      => $this->getWorkingDirName(),
63412837   Benjamin Renard   Retrieve plot con...
1174
					'result'      => $result
bda99a72   Benjamin Renard   Add kill plot req...
1175
1176
1177
1178
1179
				);
			case ProcessStatusEnumClass::KILLED :
				return array(
						'success'     => true,
						'killed'      => true);
22521f1c   Benjamin Renard   First commit
1180
1181
1182
1183
1184
1185
1186
			default :
				return array(
				'success' => false,
				'message'   => 'Error to process the interractive request');
		}
	}
	
8c57155b   Benjamin Renard   Integration for t...
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
	private function hexColor2KernelColor($hex) {
		$hex = str_replace("#", "", $hex);

		$r = hexdec(substr($hex,0,2));
		$g = hexdec(substr($hex,2,2));
		$b = hexdec(substr($hex,4,2));

		return "[".$r.",".$g.",".$b."]";
	}
	
22521f1c   Benjamin Renard   First commit
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
	private function saveIHMRequest($input)
	{
		$path = $this->getWorkingPath()."ihm.request";
		if (!is_dir($this->getWorkingPath()))
			mkdir($this->getWorkingPath(),0777);
		$file = fopen($path, 'w');
		fwrite($file, json_encode($input));
		fclose($file);
	}
	
	private function loadIHMRequest()
	{
		$path = $this->getWorkingPath()."ihm.request";
		if (!file_exists($path))
			return NULL;
		return json_decode(file_get_contents($path));
	}
db9b2cfe   Benjamin Renard   Zoom in interacti...
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
	
	private function unmarshallActionRequest($input)
	{
		$plotInput = $this->loadIHMRequest();
		
		if (!isset($plotInput))
			throw new Exception('Cannot retrieve request input for inetractive action.');
		
		switch ($input->{'action'})
		{
			case 'zoom' :
				return $this->unmarshallZoom($input, $plotInput);
ac88645b   Benjamin Renard   Plot navigation
1226
1227
1228
1229
1230
			case 'forward' :
			case 'halfforward' :
			case 'backward' :
			case 'halfbackward' :
				return $this->unmarshallNavigation($input, $plotInput);
db9b2cfe   Benjamin Renard   Zoom in interacti...
1231
1232
1233
1234
1235
1236
1237
1238
1239
			default :
				throw new Exception('Interactive action not implemented.');
		}
	}
	
	private function unmarshallZoom($input, $plotInput)
	{
		if ($input->{'axeId'} == 'timeAxis')
		{
30a70818   Benjamin Renard   Multi plot mode f...
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
			//Time Axis
			foreach ($plotInput->{'tabs'} as $tab)
			{
				if ($input->{'tabId'} == PLOT_RESULT_FILE_KEY."_".$tab->{'id'})
				{
					if ($tab->{'multi-plot-linked'})
					{
						//Update multi plot time definition
						$plotInput = $plotInput;
						$plotInput->{'timesrc'} = 'Interval';
						$plotInput->{'startDate'} = $input->{'min'};
						$plotInput->{'stopDate'} = $input->{'max'};
						
						$interactiveInput = clone $plotInput;
						$interactiveInput->{'tabs'} = array();
						//Execute only tabs linked to the multi plot mode
						foreach ($plotInput->{'tabs'} as $tab2)
						{
							if ($tab2->{'multi-plot-linked'})
								$interactiveInput->{'tabs'}[] = $tab2;
						}
						
						$this->saveIHMRequest($plotInput);
						return $interactiveInput;
					}
					else
					{
						//Update tab time definition
						$tab->{'timesrc'} = 'Interval';
						$tab->{'startDate'} = $input->{'min'};
						$tab->{'stopDate'} = $input->{'max'};
						//Execute only concerning plot tabs 
						$interactiveInput = clone $plotInput;
						$interactiveInput->{'tabs'} = array();
						$interactiveInput->{'tabs'}[] = $tab;
						$this->saveIHMRequest($plotInput);
						return $interactiveInput;
					}
				}
			}
			throw new Exception('Cannot retrieve plot tab for zoom action.');
db9b2cfe   Benjamin Renard   Zoom in interacti...
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
		}
		
		//Execute only concerning plot tabs
		$interactiveInput = clone $plotInput;
		$interactiveInput->{'tabs'} = array();
		foreach ($plotInput->{'tabs'} as $tab)
		{
			if ($input->{'tabId'} == PLOT_RESULT_FILE_KEY."_".$tab->{'id'})
			{
				//Add current tab to interactive input
				$interactiveInput->{'tabs'}[] = $tab;
				foreach ($interactiveInput->{'tabs'}[0]->{'panels'} as $panel)
				{
					if ($input->{'panelId'} == $panel->{'id'})
					{
						foreach ($panel->{'axes'} as $axis)
						{
							if ($input->{'axeId'} == $axis->{'id'})
							{
								$axis->{'axis-range-extend'} = false;
								$axis->{'axis-range-min'} = $input->{'min'};
								$axis->{'axis-range-max'} = $input->{'max'};
								$this->saveIHMRequest($plotInput);
								return $interactiveInput;
							}
						}
						throw new Exception('Cannot retrieve axis for zoom action.');
					}
				}
				throw new Exception('Cannot retrieve plot panel for zoom action.');
			}
		}
		throw new Exception('Cannot retrieve plot tab for zoom action.');
	}
ac88645b   Benjamin Renard   Plot navigation
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
	
	private function unmarshallNavigation($input, $plotInput)
	{
		//Find current tab
		$crtTab = NULL;
		foreach ($plotInput->{'tabs'} as $tab)
		{
			if ($input->{'tabId'} == PLOT_RESULT_FILE_KEY."_".$tab->{'id'})
			{
				$crtTab = $tab;
				break;
			}
		}
		
		if (!$crtTab)
			throw new Exception('Cannot retrieve plot tab for navigation action.');
		
		if ($crtTab->{'multi-plot-linked'})
		{
			$startTime = $plotInput->{'startDate'};
			$stopTime = $plotInput->{'stopDate'};
		}
		else
		{
			$startTime = $crtTab->{'startDate'};
			$stopTime = $crtTab->{'stopDate'};
		}
		
		//Compute new start / stop time
		date_default_timezone_set('UTC');
		$startTimeStamp = strtotime($startTime);
		$stopTimeStamp  = strtotime($stopTime);
		$duration = $stopTimeStamp - $startTimeStamp;
		
		switch ($input->{'action'})
		{
			case 'forward' :
				$startTimeStamp += $duration;
				$stopTimeStamp  += $duration;
				break;
			case 'halfforward' :
				$startTimeStamp += ($duration/2);
				$stopTimeStamp  += ($duration/2);
				break;
			case 'backward' :
				$startTimeStamp -= $duration;
				$stopTimeStamp  -= $duration;
				break;
			case 'halfbackward' :
				$startTimeStamp -= ($duration/2);
				$stopTimeStamp  -= ($duration/2);
				break;
		}
		
		$startTime = date("Y-m-d\TH:i:s",$startTimeStamp);
		$stopTime = date("Y-m-d\TH:i:s",$stopTimeStamp);
		
		//Update request
		if ($crtTab->{'multi-plot-linked'})
		{
			$plotInput->{'startDate'} = $startTime;
			$plotInput->{'stopDate'} = $stopTime;
			
			$interactiveInput = clone $plotInput;
			$interactiveInput->{'tabs'} = array();
			//Execute only tabs linked to the multi plot mode
			foreach ($plotInput->{'tabs'} as $tab)
			{
				if ($tab->{'multi-plot-linked'})
					$interactiveInput->{'tabs'}[] = $tab;
			}
			$this->saveIHMRequest($plotInput);
			return $interactiveInput;
		}
		else
		{
			$crtTab->{'startDate'} = $startTime;
			$crtTab->{'stopDate'} = $stopTime;
			
			$interactiveInput = clone $plotInput;
			$interactiveInput->{'tabs'} = array();
			//Execute only concerning plot tabs 
			$interactiveInput->{'tabs'}[] = $crtTab;
			$this->saveIHMRequest($plotInput);
			return $interactiveInput;
		}
	}
22521f1c   Benjamin Renard   First commit
1402
1403
}
?>