Blame view

src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php 71.5 KB
26a23052   Benjamin Renard   Add Interval Tick...
1
2
<?php

95ab3cf6   Menouard AZIB   Prise en compte d...
3
define("PLOT_RESULT_FILE_KEY", "plot");
26a23052   Benjamin Renard   Add Interval Tick...
4
5
6
7
8

/**
 * @class IHMInputOutputParamsPlotClass
 * @brief Implementation of IHMInputOutputParamsAbstractClass to treat plot request
 * @details
95ab3cf6   Menouard AZIB   Prise en compte d...
9
 */
26a23052   Benjamin Renard   Add Interval Tick...
10
11
12
class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
{
	private $isInteractiveRequest = false;
95ab3cf6   Menouard AZIB   Prise en compte d...
13

02abc780   Benjamin Renard   Support request f...
14
	private $isFromWS = false;
95ab3cf6   Menouard AZIB   Prise en compte d...
15

40624062   Elena.Budnik   no total_2D if in...
16
	private $isInstantPlot = false;
95ab3cf6   Menouard AZIB   Prise en compte d...
17

26a23052   Benjamin Renard   Add Interval Tick...
18
	private $interactiveTimeSelectionState = array();
95ab3cf6   Menouard AZIB   Prise en compte d...
19
20
	private $interactivePlotTitle = array();
	private $interactivePlotIndex = array();
26a23052   Benjamin Renard   Add Interval Tick...
21
	private $interactiveCrtTTFileIndex = -1;
05da1b4d   Benjamin Renard   Draw instant plot...
22
	private $interactivePreview = false;
ec574794   Benjamin Renard   Implements multip...
23
24

	protected $isMultiPlot = FALSE;
95ab3cf6   Menouard AZIB   Prise en compte d...
25

26a23052   Benjamin Renard   Add Interval Tick...
26
27
28
29
30
	/*
	 * @brief method to unmarshall a plot request
	*/
	protected function unmarshallRequest($input)
	{
97a69b20   Benjamin Renard   Fix most of error...
31
		$forceTimeZoomReset = false;
22253da3   Benjamin Renard   Fix zoom reset
32
		$resetZoom = false;
95ab3cf6   Menouard AZIB   Prise en compte d...
33
34

		if (isset($input->{'action'})) {
26a23052   Benjamin Renard   Add Interval Tick...
35
			$input = $this->unmarshallActionRequest($input);
d3c3608d   Benjamin Renard   Add undo zoom
36
			$forceTimeZoomReset = isset($input->{'force-time-zoom-reset'}) ? $input->{'force-time-zoom-reset'} : false;
95ab3cf6   Menouard AZIB   Prise en compte d...
37
		} else {
d3c3608d   Benjamin Renard   Add undo zoom
38
			$resetZoom = true;
26a23052   Benjamin Renard   Add Interval Tick...
39
			//save request
95ab3cf6   Menouard AZIB   Prise en compte d...
40
			$this->saveIHMRequest(PLOT_RESULT_FILE_KEY . "_" . $input->{'tab-index'}, $input);
d3c3608d   Benjamin Renard   Add undo zoom
41
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
42

26a23052   Benjamin Renard   Add Interval Tick...
43
		//Request
26a23052   Benjamin Renard   Add Interval Tick...
44
		$this->isInteractiveRequest = ($input->{'file-output'} == 'INTERACTIVE');
02abc780   Benjamin Renard   Support request f...
45
		$this->isFromWS = ($input->{'file-output'} == 'WS');
7d84634e   Benjamin Renard   Fix plot request ...
46

22253da3   Benjamin Renard   Fix zoom reset
47
		if ($resetZoom || $forceTimeZoomReset)
95ab3cf6   Menouard AZIB   Prise en compte d...
48
49
			$this->resetZoomList(PLOT_RESULT_FILE_KEY . "_" . $input->{'tab-index'}, $forceTimeZoomReset);

7d14181a   Benjamin Renard   Fix multi-request...
50
		$requestNode = $this->paramsData->addRequestNode($input->{'tab-index'});
7d84634e   Benjamin Renard   Fix plot request ...
51
52
		$outputsNode = $requestNode->getOutputsNode();
		$paramsNode  = $requestNode->getParamsNode();
95ab3cf6   Menouard AZIB   Prise en compte d...
53

7d84634e   Benjamin Renard   Fix plot request ...
54
55
56
57
		//unmarshall time definition
		$isIntervalRequest = ($input->timesrc == 'Interval');
		$ttFileIndex = -1;
		$ttIntIndex  = -1;
95ab3cf6   Menouard AZIB   Prise en compte d...
58
		if ($this->isInteractiveRequest && !$isIntervalRequest && !$input->{'page-superpose-mode'}) {
7d84634e   Benjamin Renard   Fix plot request ...
59
60
61
			$ttFileIndex = !isset($input->{'ttFileIndex'}) ? 0 : $input->{'ttFileIndex'};
			$ttIntIndex = !isset($input->{'intIndex'}) ? 0 : $input->{'intIndex'};
		}
7d14181a   Benjamin Renard   Fix multi-request...
62
		$this->unmarshallTimeDefinition($input, $input->{'tab-index'}, $ttFileIndex, $ttIntIndex);
95ab3cf6   Menouard AZIB   Prise en compte d...
63

7d84634e   Benjamin Renard   Fix plot request ...
64
		$this->interactiveCrtTTFileIndex = $ttFileIndex;
95ab3cf6   Menouard AZIB   Prise en compte d...
65

7d84634e   Benjamin Renard   Fix plot request ...
66
		$plotOutputNode = $outputsNode->addNewOutput(RequestOutputTypeEnum::PLOT);
95ab3cf6   Menouard AZIB   Prise en compte d...
67

7d84634e   Benjamin Renard   Fix plot request ...
68
		$plotOutputNode->setWriteContextFile($this->isInteractiveRequest ? "true" : "false");
95ab3cf6   Menouard AZIB   Prise en compte d...
69

7d84634e   Benjamin Renard   Fix plot request ...
70
		$compression = "";
95ab3cf6   Menouard AZIB   Prise en compte d...
71
72
73
		if (!$this->isInteractiveRequest && !$this->isFromWS) {
			switch ($input->{'file-output'}) {
				case 'TGZ':
7d84634e   Benjamin Renard   Fix plot request ...
74
75
76
77
					$plotOutputNode->addPostProcessing(RequestOutputPostProcessingEnumClass::TAR);
					$plotOutputNode->addPostProcessing(RequestOutputPostProcessingEnumClass::GZIP);
					$compression = ".tar.gz";
					break;
95ab3cf6   Menouard AZIB   Prise en compte d...
78
				case 'ZIP':
7d84634e   Benjamin Renard   Fix plot request ...
79
80
81
82
83
					$plotOutputNode->addPostProcessing(RequestOutputPostProcessingEnumClass::ZIP);
					$compression = ".zip";
					break;
				default:
					throw new Exception('Compression not implemented.');
26a23052   Benjamin Renard   Add Interval Tick...
84
			}
7d84634e   Benjamin Renard   Fix plot request ...
85
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
86

7d84634e   Benjamin Renard   Fix plot request ...
87
88
89
90
		if ($input->{'one-file-per-interval'})
			$plotOutputNode->setStructure(RequestOutputPlotStructureEnum::ONE_FILE_PER_INTERVAL);
		else
			$plotOutputNode->setStructure(RequestOutputPlotStructureEnum::ONE_FILE);
95ab3cf6   Menouard AZIB   Prise en compte d...
91

7d84634e   Benjamin Renard   Fix plot request ...
92
93
94
95
		//prefix
		$filePrefix = "plot_";
		if ($input->{'file-prefix'} && ($input->{'file-prefix'} != ""))
			$filePrefix = $input->{'file-prefix'};
70e82c1f   Benjamin Renard   Fix doPlot
96
		$filePrefix .= $input->{'tab-index'};
95ab3cf6   Menouard AZIB   Prise en compte d...
97

7d84634e   Benjamin Renard   Fix plot request ...
98
		$plotOutputNode->setFilePrefix($filePrefix);
95ab3cf6   Menouard AZIB   Prise en compte d...
99

7d84634e   Benjamin Renard   Fix plot request ...
100
101
		//page
		$pageNode = $plotOutputNode->getPage();
95ab3cf6   Menouard AZIB   Prise en compte d...
102

7d84634e   Benjamin Renard   Fix plot request ...
103
104
		$fileFormat = RequestOutputPlotPageFormatEnum::PNG;
		$extension = ".png";
95ab3cf6   Menouard AZIB   Prise en compte d...
105
106
		switch ($input->{'file-format'}) {
			case 'PNG':
7d84634e   Benjamin Renard   Fix plot request ...
107
108
109
				$fileFormat = RequestOutputPlotPageFormatEnum::PNG;
				$extension = ".png";
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
110
			case 'PDF':
7d84634e   Benjamin Renard   Fix plot request ...
111
112
113
				$fileFormat = RequestOutputPlotPageFormatEnum::PDF;
				$extension = ".pdf";
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
114
			case 'PS':
7d84634e   Benjamin Renard   Fix plot request ...
115
116
117
				$fileFormat = RequestOutputPlotPageFormatEnum::PS;
				$extension = ".ps";
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
118
			case 'SVG':
7d84634e   Benjamin Renard   Fix plot request ...
119
120
121
122
123
124
				$fileFormat = RequestOutputPlotPageFormatEnum::SVG;
				$extension = ".svg";
				break;
			default:
				throw new Exception('File format not implemented.');
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
125

7d84634e   Benjamin Renard   Fix plot request ...
126
		$pageNode->setFormat($fileFormat);
95ab3cf6   Menouard AZIB   Prise en compte d...
127

7d84634e   Benjamin Renard   Fix plot request ...
128
		$this->unmarshallTitle($input, 'page-title', $pageNode->getTitle());
95ab3cf6   Menouard AZIB   Prise en compte d...
129

7d84634e   Benjamin Renard   Fix plot request ...
130
		$isPortrait = false;
95ab3cf6   Menouard AZIB   Prise en compte d...
131
132
		switch ($input->{'page-orientation'}) {
			case 'landscape':
7d84634e   Benjamin Renard   Fix plot request ...
133
134
				$pageNode->setOrientation(RequestOutputPlotPageOrientationEnum::LANDSCAPE);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
135
			case 'portrait':
7d84634e   Benjamin Renard   Fix plot request ...
136
137
138
139
				$pageNode->setOrientation(RequestOutputPlotPageOrientationEnum::PORTRAIT);
				$isPortrait = true;
				break;
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
140
141
142

		switch ($input->{'page-dimension'}) {
			case 'ISO A4':
7d84634e   Benjamin Renard   Fix plot request ...
143
144
				$pageNode->setDimension(RequestOutputPlotPageDimensionEnum::ISO_A4);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
145
			case 'US letter':
7d84634e   Benjamin Renard   Fix plot request ...
146
147
148
149
150
				$pageNode->setDimension(RequestOutputPlotPageDimensionEnum::US_LETTER);
				break;
			default:
				throw new Exception('Page dimension not implemented.');
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
151
152
153
154

		switch ($input->{'page-mode'}) {

			case 'grayscale':
7d84634e   Benjamin Renard   Fix plot request ...
155
156
				$pageNode->setMode(RequestOutputPlotPageModeEnum::GRAYSCALE);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
157
			case 'color':
7d84634e   Benjamin Renard   Fix plot request ...
158
159
160
161
			default:
				$pageNode->setMode(RequestOutputPlotPageModeEnum::COLOR);
				break;
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
162
163

		if ($input->{'page-margins-activated'}) {
7d84634e   Benjamin Renard   Fix plot request ...
164
165
166
			$pageNode->getMargins()->setHorizontal($input->{'page-margin-x'});
			$pageNode->getMargins()->setVertical($input->{'page-margin-y'});
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
167

7d84634e   Benjamin Renard   Fix plot request ...
168
169
		if ($input->{'page-font-activated'})
			$this->unmarshallFont($input, 'page-font', $pageNode->getFont());
95ab3cf6   Menouard AZIB   Prise en compte d...
170

7d84634e   Benjamin Renard   Fix plot request ...
171
		//Superpose mode
95ab3cf6   Menouard AZIB   Prise en compte d...
172
173
		$pageNode->setSuperposeMode($input->{'page-superpose-mode'} ? "true" : "false");

7d84634e   Benjamin Renard   Fix plot request ...
174
175
		//Layout
		$this->unmarshallLayout($input, $pageNode);
95ab3cf6   Menouard AZIB   Prise en compte d...
176

7d84634e   Benjamin Renard   Fix plot request ...
177
178
		foreach ($input->{'panels'} as $panelData)
			$this->unmarshallPanel($panelData, $pageNode, $paramsNode);
95ab3cf6   Menouard AZIB   Prise en compte d...
179
180
181
182
183
184
185

		if ($this->isInteractiveRequest || $this->isFromWS) {
			$resultFile = $filePrefix . "_*" . $extension;
			$waitingResultFile = $filePrefix . $extension;
		} else {
			$resultFile = $filePrefix . "_*" . $compression;
			$waitingResultFile = $filePrefix . $compression;
7d84634e   Benjamin Renard   Fix plot request ...
186
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
187
188
189
190
191

		if ($this->isInteractiveRequest) {
			$this->interactiveTimeSelectionState[PLOT_RESULT_FILE_KEY . "_" . $input->{'tab-index'}] = $isIntervalRequest;
			$this->interactivePlotTitle[PLOT_RESULT_FILE_KEY . "_" . $input->{'tab-index'}] = $input->{'tab-title'};
			$this->interactivePlotIndex[PLOT_RESULT_FILE_KEY . "_" . $input->{'tab-index'}] = $input->{'tab-index'};
7d84634e   Benjamin Renard   Fix plot request ...
192
			$this->interactivePreview = isset($input->{'interactive-preview'}) && ($input->{'interactive-preview'});
95ab3cf6   Menouard AZIB   Prise en compte d...
193
194
			$this->paramsData->addWaitingResult(PLOT_RESULT_FILE_KEY . "_" . $input->{'tab-index'}, $waitingResultFile);
		} else
7d84634e   Benjamin Renard   Fix plot request ...
195
			$this->paramsData->addWaitingResult(PLOT_RESULT_FILE_KEY, $waitingResultFile);
95ab3cf6   Menouard AZIB   Prise en compte d...
196

7d84634e   Benjamin Renard   Fix plot request ...
197
		//Remove old result files
95ab3cf6   Menouard AZIB   Prise en compte d...
198
		foreach (glob($this->paramsData->getWorkingPath() . $resultFile) as $oldFile) {
7d84634e   Benjamin Renard   Fix plot request ...
199
200
			unlink($oldFile);
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
201

7d84634e   Benjamin Renard   Fix plot request ...
202
		//Post process command to apply to the result file
ec574794   Benjamin Renard   Implements multip...
203
		$postProcessCmd = $this->paramsData->getPostCmd();
7d84634e   Benjamin Renard   Fix plot request ...
204
205
		if ($postProcessCmd != "")
			$postProcessCmd .= " | ";
95ab3cf6   Menouard AZIB   Prise en compte d...
206
207
		$postProcessCmd .= "mv " . $resultFile . " " . $waitingResultFile;

7d84634e   Benjamin Renard   Fix plot request ...
208
		if (($this->isInteractiveRequest) && $isPortrait)
95ab3cf6   Menouard AZIB   Prise en compte d...
209
210
			$postProcessCmd .= " | convert " . $waitingResultFile . " -rotate -90 " . $waitingResultFile;
		else if ($this->isFromWS) {
7d84634e   Benjamin Renard   Fix plot request ...
211
			if ($isPortrait)
95ab3cf6   Menouard AZIB   Prise en compte d...
212
				$postProcessCmd .= " | convert " . $waitingResultFile . " -rotate -90 " . $input->{"ws-result-file"};
7d84634e   Benjamin Renard   Fix plot request ...
213
			else
95ab3cf6   Menouard AZIB   Prise en compte d...
214
				$postProcessCmd .= " | mv " . $waitingResultFile . " " . $input->{"ws-result-file"};
26a23052   Benjamin Renard   Add Interval Tick...
215
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
216

26a23052   Benjamin Renard   Add Interval Tick...
217
218
		$this->paramsData->setBatchEnable(!(($fileFormat == RequestOutputPlotPageFormatEnum::PNG) && $this->isInteractiveRequest));
		$this->paramsData->setPostCmd($postProcessCmd);
26a23052   Benjamin Renard   Add Interval Tick...
219
220
		return $this->paramsData;
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
221

7d84634e   Benjamin Renard   Fix plot request ...
222
	protected function unmarshallLayout($request, $pageNode)
26a23052   Benjamin Renard   Add Interval Tick...
223
	{
95ab3cf6   Menouard AZIB   Prise en compte d...
224
225
		switch ($request->{'page-layout-type'}) {
			case 'vertical':
26a23052   Benjamin Renard   Add Interval Tick...
226
				$pageNode->getLayout()->setType(RequestOutputPlotLayoutTypeEnum::VERTICAL);
7d84634e   Benjamin Renard   Fix plot request ...
227
228
229
230
231
232
233
234
235
236
237
238
				$pageNode->getLayout()->setPanelHeight($request->{'page-layout-object'}->{'layout-panel-height'});
				$pageNode->getLayout()->setPanelSpacing($request->{'page-layout-object'}->{'layout-panel-spacing'});
				$pageNode->getLayout()->setExpand($request->{'page-layout-object'}->{'layout-expand'} ? "true" : "false");
				$pageNode->getLayout()->setOnlyLowerTimeAxesLegend($request->{'page-layout-object'}->{'layout-timeaxes-legend-lowerone'} ? "true" : "false");
				//if ($request->{'page-layout-object'}->{'layout-timeplot-width'} > 0)
				//	$pageNode->setDefaultTimePlotWidth($request->{'page-layout-object'}->{'layout-timeplot-width'});
				if ($request->{'page-layout-object'}->{'layout-timeplot-height'} > 0)
					$pageNode->setDefaultTimePlotHeight($request->{'page-layout-object'}->{'layout-timeplot-height'});
				if ($request->{'page-layout-object'}->{'layout-xyplot-width'} > 0)
					$pageNode->setDefaultXYPlotWidth($request->{'page-layout-object'}->{'layout-xyplot-width'});
				if ($request->{'page-layout-object'}->{'layout-xyplot-height'} > 0)
					$pageNode->setDefaultXYPlotHeight($request->{'page-layout-object'}->{'layout-xyplot-height'});
26a23052   Benjamin Renard   Add Interval Tick...
239
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
240
			case 'auto':
26a23052   Benjamin Renard   Add Interval Tick...
241
				$pageNode->getLayout()->setType(RequestOutputPlotLayoutTypeEnum::AUTO);
7d84634e   Benjamin Renard   Fix plot request ...
242
243
244
245
				$pageNode->getLayout()->setPanelHeight($request->{'page-layout-object'}->{'layout-panel-height'});
				$pageNode->getLayout()->setPanelSpacing($request->{'page-layout-object'}->{'layout-panel-spacing'});
				$pageNode->getLayout()->setExpand($request->{'page-layout-object'}->{'layout-expand'} ? "true" : "false");
				$pageNode->getLayout()->setOnlyLowerTimeAxesLegend($request->{'page-layout-object'}->{'layout-timeaxes-legend-lowerone'} ? "true" : "false");
26a23052   Benjamin Renard   Add Interval Tick...
246
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
247
			case 'manual':
26a23052   Benjamin Renard   Add Interval Tick...
248
				$pageNode->getLayout()->setType(RequestOutputPlotLayoutTypeEnum::MANUAL);
7d84634e   Benjamin Renard   Fix plot request ...
249
250
				$timePlotLeftMargin = $request->{'page-layout-object'}->{'layout-timeplot-margin-left'} ? $request->{'page-layout-object'}->{'layout-timeplot-margin-left'} : -1;
				$timePlotRightMargin = $request->{'page-layout-object'}->{'layout-timeplot-margin-right'} ? $request->{'page-layout-object'}->{'layout-timeplot-margin-right'} : -1;
26a23052   Benjamin Renard   Add Interval Tick...
251
				$pageNode->setDefaultTimePlotXMargin($timePlotLeftMargin, $timePlotRightMargin);
7d84634e   Benjamin Renard   Fix plot request ...
252
253
				$xyPlotLeftMargin = $request->{'page-layout-object'}->{'layout-xyplot-margin-left'} ? $request->{'page-layout-object'}->{'layout-xyplot-margin-left'} : -1;
				$xyPlotRightMargin = $request->{'page-layout-object'}->{'layout-xyplot-margin-right'} ? $request->{'page-layout-object'}->{'layout-xyplot-margin-right'} : -1;
26a23052   Benjamin Renard   Add Interval Tick...
254
255
256
257
258
				$pageNode->setDefaultXYPlotXMargin($xyPlotLeftMargin, $xyPlotRightMargin);
				break;
			default:
				throw new Exception('Layout type not implemented.');
		}
26a23052   Benjamin Renard   Add Interval Tick...
259
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
260

26a23052   Benjamin Renard   Add Interval Tick...
261
262
263
	protected function unmarshallPanel($panelData, $pageNode, $paramsNode)
	{
		$panelNode = $pageNode->addPanel();
95ab3cf6   Menouard AZIB   Prise en compte d...
264
265
266
267


		switch ($pageNode->getLayout()->getType()) {
			case RequestOutputPlotLayoutTypeEnum::MANUAL:
26a23052   Benjamin Renard   Add Interval Tick...
268
269
270
271
272
273
274
275
276
277
				//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;
95ab3cf6   Menouard AZIB   Prise en compte d...
278
			case RequestOutputPlotLayoutTypeEnum::VERTICAL:
26a23052   Benjamin Renard   Add Interval Tick...
279
280
281
282
283
284
				//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;
95ab3cf6   Menouard AZIB   Prise en compte d...
285
			default:
26a23052   Benjamin Renard   Add Interval Tick...
286
287
				//Nothing to do
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
288

26a23052   Benjamin Renard   Add Interval Tick...
289
		//Panel id
02abc780   Benjamin Renard   Support request f...
290
291
		if (isset($panelData->{'id'}))
			$panelNode->setId($panelData->{'id'});
0a87e436   Hacene SI HADJ MOHAND   parameters resolue
292

95ab3cf6   Menouard AZIB   Prise en compte d...
293
294
295
296
297
		//Panel id
		if (isset($panelData->{'panel-index'}))
			$panelNode->setIndex($panelData->{'panel-index'});


26a23052   Benjamin Renard   Add Interval Tick...
298
299
300
		//Panel background color
		if (($panelData->{'panel-background-color'} != 'none') && ($panelData->{'panel-background-color'} != ''))
			$panelNode->setBackgroundColor($this->hexColor2KernelColor($panelData->{'panel-background-color'}));
60a1a563   Benjamin Renard   Add the possibili...
301

1514ed12   Erdogan Furkan   #5390 - Integrati...
302
303
304
305
306
		//Plot Area background color
		if (($panelData->{'panel-plotareabackground-color'} != 'none') && ($panelData->{'panel-plotareabackground-color'} != '')) {
			$panelNode->setPlotAreaBackgroundColor($this->hexColor2KernelColor($panelData->{'panel-plotareabackground-color'}));
		}

26a23052   Benjamin Renard   Add Interval Tick...
307
308
		//Panel font
		$this->unmarshallFont($panelData, 'panel-font', $panelNode->getFont());
95ab3cf6   Menouard AZIB   Prise en compte d...
309

26a23052   Benjamin Renard   Add Interval Tick...
310
311
		//Panel title
		$this->unmarshallTitle($panelData, 'panel-title', $panelNode->getTitle());
95ab3cf6   Menouard AZIB   Prise en compte d...
312

26a23052   Benjamin Renard   Add Interval Tick...
313
		//Plot type
40624062   Elena.Budnik   no total_2D if in...
314
		$this->isInstantPlot = false;
26a23052   Benjamin Renard   Add Interval Tick...
315
		$plotNode = $this->unmarshallPlotType($panelData, $panelNode);
95ab3cf6   Menouard AZIB   Prise en compte d...
316

26a23052   Benjamin Renard   Add Interval Tick...
317
		$isTimePlot = ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTTIME_NAME);
95ab3cf6   Menouard AZIB   Prise en compte d...
318

26a23052   Benjamin Renard   Add Interval Tick...
319
320
		//Tick plot
		$tickPlotNode = NULL;
95ab3cf6   Menouard AZIB   Prise en compte d...
321
322
323
		if ($isTimePlot) {
			if ($this->hasTickBar($panelData->{'params'})) {
				$tickPlotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::TICKPLOT, true);
26a23052   Benjamin Renard   Add Interval Tick...
324
325
326
327
				if ($panelData->{'panel-tick-format'} != '')
					$tickPlotNode->setFormat($panelData->{'panel-tick-format'});
			}
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
328

26a23052   Benjamin Renard   Add Interval Tick...
329
330
		//Status plot
		$statusPlotNode = NULL;
95ab3cf6   Menouard AZIB   Prise en compte d...
331
332
333
334
335
		if ($isTimePlot) {
			if ($this->hasStatusBar($panelData->{'params'})) {
				$statusPlotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::STATUSPLOT, true);
				switch ($panelData->{'panel-status-position'}) {
					case 'top':
26a23052   Benjamin Renard   Add Interval Tick...
336
337
						$statusPlotNode->setPosition(RequestOutputPlotElementStatusPosition::TOP);
						break;
95ab3cf6   Menouard AZIB   Prise en compte d...
338
					case 'bottom':
26a23052   Benjamin Renard   Add Interval Tick...
339
340
341
342
343
344
						$statusPlotNode->setPosition(RequestOutputPlotElementStatusPosition::BOTTOM);
						break;
				}
				$statusPlotNode->setColorMap($panelData->{'panel-status-colormap'});
			}
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
345

26a23052   Benjamin Renard   Add Interval Tick...
346
347
348
		//Axes
		foreach ($panelData->{'axes'} as $axisData)
			$this->unmarshallAxis($axisData, $panelData->{'constants'}, $plotNode);
95ab3cf6   Menouard AZIB   Prise en compte d...
349

26a23052   Benjamin Renard   Add Interval Tick...
350
351
		//Params
		$this->unmarshallParams($panelData->{'params'}, $paramsNode, $plotNode, $panelNode, $statusPlotNode, $tickPlotNode);
95ab3cf6   Menouard AZIB   Prise en compte d...
352

26a23052   Benjamin Renard   Add Interval Tick...
353
354
355
		//Additional objects
		if ($plotNode->getAdditionalObjects() != NULL)
			$this->unmarshallAdditionalObjects($panelData, $plotNode->getAdditionalObjects(), $isTimePlot);
95ab3cf6   Menouard AZIB   Prise en compte d...
356

26a23052   Benjamin Renard   Add Interval Tick...
357
358
359
		//Fills
		if ($plotNode->getFills() != NULL)
			$this->unmarshallFills($panelData, $plotNode->getFills());
95ab3cf6   Menouard AZIB   Prise en compte d...
360

26a23052   Benjamin Renard   Add Interval Tick...
361
362
		return $panelNode;
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
363

26a23052   Benjamin Renard   Add Interval Tick...
364
365
	protected function unmarshallPlotType($panelData, $panelNode)
	{
95ab3cf6   Menouard AZIB   Prise en compte d...
366
367
		switch ($panelData->{'panel-plot-type'}) {
			case 'timePlot':
26a23052   Benjamin Renard   Add Interval Tick...
368
369
				$plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::TIMEPLOT);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
370
			case 'xyPlot':
26a23052   Benjamin Renard   Add Interval Tick...
371
372
373
				$plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::XYPLOT);
				$plotNode->setIsIsotropic($panelData->{'panel-scatter-isotropic'});
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
374
			case 'statusPlot':
26a23052   Benjamin Renard   Add Interval Tick...
375
				$plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::STATUSPLOT);
95ab3cf6   Menouard AZIB   Prise en compte d...
376
377
				switch ($panelData->{'panel-status-position'}) {
					case 'top':
26a23052   Benjamin Renard   Add Interval Tick...
378
379
						$plotNode->setPosition(RequestOutputPlotElementStatusPosition::TOP);
						break;
95ab3cf6   Menouard AZIB   Prise en compte d...
380
					case 'bottom':
26a23052   Benjamin Renard   Add Interval Tick...
381
382
383
384
385
						$plotNode->setPosition(RequestOutputPlotElementStatusPosition::BOTTOM);
						break;
				}
				$plotNode->setColorMap($panelData->{'panel-status-colormap'});
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
386
			case 'tickPlot':
26a23052   Benjamin Renard   Add Interval Tick...
387
388
389
390
				$plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::TICKPLOT);
				if ($panelData->{'panel-tick-format'} != '')
					$plotNode->setFormat($panelData->{'panel-tick-format'});
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
391
			case 'epochPlot':
26a23052   Benjamin Renard   Add Interval Tick...
392
				$plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::EPOCHPLOT);
d6bf6ef5   Benjamin Renard   Get the possibili...
393
394
				if ($panelData->{'panel-epoch-centertimeid'} != '')
					$plotNode->setCenterTimeId($panelData->{'panel-epoch-centertimeid'});
26a23052   Benjamin Renard   Add Interval Tick...
395
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
396
			case 'instantPlot':
26a23052   Benjamin Renard   Add Interval Tick...
397
398
				$plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::INSTANTPLOT);
				date_default_timezone_set('UTC');
74fd500a   Hacene SI HADJ MOHAND   us #9874 ms zoo...
399
				$time = CommonClass::strTimeToDDTime($panelData->{'panel-instant-time'});
26a23052   Benjamin Renard   Add Interval Tick...
400
				$plotNode->setTime($time);
40624062   Elena.Budnik   no total_2D if in...
401
				$this->isInstantPlot = true;
26a23052   Benjamin Renard   Add Interval Tick...
402
403
404
405
				break;
			default:
				throw new Exception('Plot type not implemented.');
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
406

26a23052   Benjamin Renard   Add Interval Tick...
407
408
409
		//Params Legend
		if (isset($panelData->{'panel-series-legend'}) && $panelData->{'panel-series-legend'}->{'legend-series-activated'})
			$this->unmarshallParamsLegend($panelData->{'panel-series-legend'}, $plotNode->getLegends()->getParamsLegend());
95ab3cf6   Menouard AZIB   Prise en compte d...
410

26a23052   Benjamin Renard   Add Interval Tick...
411
		//Text Legends
fe1a8ddd   Erdogan Furkan   Modifications for...
412
413
414
415
		foreach ($panelData->{'text-legends'} as $textLegendData) {
			$legendNode = $plotNode->getLegends()->addTextLegend();
			$this->unmarshallTextLegend($textLegendData, $legendNode);
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
416

26a23052   Benjamin Renard   Add Interval Tick...
417
418
		return $plotNode;
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
419

26a23052   Benjamin Renard   Add Interval Tick...
420
421
422
423
	protected function unmarshallAxis($axisData, $constantsData, $plotNode)
	{
		//axis type
		$constantAxisId = '';
95ab3cf6   Menouard AZIB   Prise en compte d...
424
425
		switch ($axisData->{'axis-type'}) {
			case 'time':
26a23052   Benjamin Renard   Add Interval Tick...
426
427
428
429
				$axisNode = $plotNode->getTimeAxis();
				$axisNode->setFormat($axisData->{'axis-time-format'});
				$constantAxisId = 'x';
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
430
			case 'epoch':
26a23052   Benjamin Renard   Add Interval Tick...
431
432
433
434
				$axisNode = $plotNode->getEpochAxis();
				$axisNode->setNormalized($axisData->{'axis-epoch-normalized'} ? "true" : "false");
				$constantAxisId = 'x';
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
435
			case 'x':
26a23052   Benjamin Renard   Add Interval Tick...
436
437
438
				$axisNode = $plotNode->getXAxis();
				$constantAxisId = 'x';
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
439
			case 'y-left':
26a23052   Benjamin Renard   Add Interval Tick...
440
441
442
				$axisNode = $plotNode->addYAxis('y-left');
				$constantAxisId = 'y-left';
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
443
			case 'y-right':
26a23052   Benjamin Renard   Add Interval Tick...
444
445
446
447
				$axisNode = $plotNode->addYAxis('y-right');
				$axisNode->setPosition(RequestOutputPlotAxisElementPosition::RIGHT);
				$constantAxisId = 'y-right';
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
448
			case 'color':
26a23052   Benjamin Renard   Add Interval Tick...
449
450
451
452
453
454
455
456
457
458
				$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.');
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
459

26a23052   Benjamin Renard   Add Interval Tick...
460
		//reverse axis
05da1b4d   Benjamin Renard   Draw instant plot...
461
462
		if (isset($axisData->{'axis-reverse'}))
			$axisNode->setReverse($axisData->{'axis-reverse'} ? "true" : "false");
95ab3cf6   Menouard AZIB   Prise en compte d...
463

26a23052   Benjamin Renard   Add Interval Tick...
464
		//axis scale
95ab3cf6   Menouard AZIB   Prise en compte d...
465
466
		switch ($axisData->{'axis-scale'}) {
			case 'logarithmic':
26a23052   Benjamin Renard   Add Interval Tick...
467
468
469
470
471
				$axisNode->setScale(RequestOutputPlotAxisElementScale::LOGARITHMIC);
				break;
			default:
				$axisNode->setScale(RequestOutputPlotAxisElementScale::LINEAR);
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
472

26a23052   Benjamin Renard   Add Interval Tick...
473
474
475
		//axis range
		if ($axisData->{'axis-range-min'} < $axisData->{'axis-range-max'})
			$axisNode->getRange()->setMinMax($axisData->{'axis-range-min'}, $axisData->{'axis-range-max'});
05da1b4d   Benjamin Renard   Draw instant plot...
476
477
		if (isset($axisData->{'axis-range-extend'}))
			$axisNode->getRange()->setExtend($axisData->{'axis-range-extend'} ? "true" : "false");
95ab3cf6   Menouard AZIB   Prise en compte d...
478

26a23052   Benjamin Renard   Add Interval Tick...
479
		//axis color
02abc780   Benjamin Renard   Support request f...
480
481
		if (isset($axisData->{'axis-color'}))
			$axisNode->setColor($this->hexColor2KernelColor($axisData->{'axis-color'}));
95ab3cf6   Menouard AZIB   Prise en compte d...
482

26a23052   Benjamin Renard   Add Interval Tick...
483
		//axis thickness
02abc780   Benjamin Renard   Support request f...
484
485
		if (isset($axisData->{'axis-thickness'}))
			$axisNode->setThickness($axisData->{'axis-thickness'});
95ab3cf6   Menouard AZIB   Prise en compte d...
486

26a23052   Benjamin Renard   Add Interval Tick...
487
		//axis ticks position
95ab3cf6   Menouard AZIB   Prise en compte d...
488
489
		switch ($axisData->{'axis-tick-position'}) {
			case 'inwards':
26a23052   Benjamin Renard   Add Interval Tick...
490
491
				$axisNode->getTick()->setPosition(RequestOutputPlotAxisElementTickPosition::INWARDS);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
492
			default:
26a23052   Benjamin Renard   Add Interval Tick...
493
494
				$axisNode->getTick()->setPosition(RequestOutputPlotAxisElementTickPosition::OUTWARDS);
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
495

26a23052   Benjamin Renard   Add Interval Tick...
496
		//axis minor and major grid
05da1b4d   Benjamin Renard   Draw instant plot...
497
498
		if (isset($axisData->{'axis-grid-minor'}))
			$axisNode->getTick()->setMinorGrid($axisData->{'axis-grid-minor'} ? "true" : "false");
3741e4bb   Hacene SI HADJ MOHAND   6954 ok
499

05da1b4d   Benjamin Renard   Draw instant plot...
500
501
		if (isset($axisData->{'axis-grid-major'}))
			$axisNode->getTick()->setMajorGrid($axisData->{'axis-grid-major'} ? "true" : "false");
95ab3cf6   Menouard AZIB   Prise en compte d...
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
		if ($axisData->{'axis-grid-specify-ticks-number'}) {

			if (isset($axisData->{'axis-grid-minor-number'}) && $axisData->{'axis-grid-minor-number'} != 0)
				$axisNode->getTick()->setMinorGridNumber($axisData->{'axis-grid-minor-number'});

			if (isset($axisData->{'axis-grid-major-number'}) && $axisData->{'axis-grid-major-number'} != 0)
				$axisNode->getTick()->setMajorGridNumber($axisData->{'axis-grid-major-number'});
		} elseif ($axisData->{'axis-grid-specify-ticks-spacing'}) {

			if (isset($axisData->{'axis-grid-major-space'}) && $axisData->{'axis-grid-major-space'} != 0)
				$axisNode->getTick()->setMajorGridSpace($axisData->{'axis-grid-major-space'});

			if (isset($axisData->{'axis-grid-minor-space'}) && $axisData->{'axis-grid-minor-space'} != 0)
				$axisNode->getTick()->setMinorGridSpace($axisData->{'axis-grid-minor-space'});
		}


		//legend
		if (isset($axisData->{'axis-legend-text'}) && $axisData->{'axis-legend-text'} != '') {
26a23052   Benjamin Renard   Add Interval Tick...
521
			$axisNode->getLegend()->setText($axisData->{'axis-legend-text'});
05da1b4d   Benjamin Renard   Draw instant plot...
522
		}
27317777   Menouard AZIB   J'ai ajouté la fo...
523
524
		$axisNode->getLegend()->setColor($this->hexColor2KernelColor($axisData->{'axis-legend-color'}));
		$this->unmarshallLabel($axisData, "axis-legend", $axisNode->getLegend());
d62f9945   Benjamin Renard   Improve instant c...
525

26a23052   Benjamin Renard   Add Interval Tick...
526
		//Show legend
05da1b4d   Benjamin Renard   Draw instant plot...
527
528
		if (isset($axisData->{'axis-legend-activated'}))
			$axisNode->setShowLegend($axisData->{'axis-legend-activated'} ? "true" : "false");
95ab3cf6   Menouard AZIB   Prise en compte d...
529

26a23052   Benjamin Renard   Add Interval Tick...
530
		//Show tick marks
05da1b4d   Benjamin Renard   Draw instant plot...
531
532
		if (isset($axisData->{'axis-tick-showmarks'}))
			$axisNode->setShowTickMarks($axisData->{'axis-tick-showmarks'} ? "true" : "false");
95ab3cf6   Menouard AZIB   Prise en compte d...
533

26a23052   Benjamin Renard   Add Interval Tick...
534
		//Add constants
95ab3cf6   Menouard AZIB   Prise en compte d...
535
		if ($constantAxisId != '') {
26a23052   Benjamin Renard   Add Interval Tick...
536
537
			foreach ($constantsData as $constantData)
				if ($constantData->{'constant-axis-id'} == $constantAxisId)
95ab3cf6   Menouard AZIB   Prise en compte d...
538
					$this->unmarshallConstant($constantData, $axisNode);
26a23052   Benjamin Renard   Add Interval Tick...
539
540
		}
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
541

26a23052   Benjamin Renard   Add Interval Tick...
542
543
544
545
	protected function unmarshallParams($paramsData, $requestParamsNode, $plotNode, $panelNode, $statusPlotNode, $tickPlotNode)
	{
		//X parameters
		$isScatter = ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTXY_NAME);
f822811a   Benjamin Renard   Implements multi ...
546
		$xIds = array();
95ab3cf6   Menouard AZIB   Prise en compte d...
547
		if ($isScatter) {
f822811a   Benjamin Renard   Implements multi ...
548
			$crtXId = 0;
95ab3cf6   Menouard AZIB   Prise en compte d...
549
			foreach ($paramsData as $paramData) {
26a23052   Benjamin Renard   Add Interval Tick...
550
551
				if ($paramData->{'param-drawing-object'}->{'serie-xaxis-param'} == '')
					continue;
f822811a   Benjamin Renard   Implements multi ...
552
553
554
555
				if (array_key_exists($paramData->{'param-drawing-object'}->{'serie-xaxis-param'}, $xIds)) {
					//x param already exists
					continue;
				}
95ab3cf6   Menouard AZIB   Prise en compte d...
556

bf27ba04   Benjamin Renard   Add templated par...
557
				$paramXInfo = $this->paramManager->addExistingParam($paramData->{'param-drawing-object'}->{'serie-xaxis-param'}, $this->paramsData);
26a23052   Benjamin Renard   Add Interval Tick...
558
559
560
561
				if ($paramXInfo['id'] == '')
					throw new Exception('Cannot retrieve X parameter.');
				$requestParamsNode->addParam($paramXInfo['id']);
				$xParamNode = $plotNode->getParams()->getParamById($paramXInfo['id']);
95ab3cf6   Menouard AZIB   Prise en compte d...
562
563
				switch ($paramData->{'param-drawing-type'}) {
					case 'serie':
26a23052   Benjamin Renard   Add Interval Tick...
564
565
						//Unmarshall x serie
						if (count($paramXInfo['indexes']) == 0)
f822811a   Benjamin Renard   Implements multi ...
566
							$xParamNode->addXSerie(-1, $crtXId, $paramData->{'param-drawing-object'}->{'serie-xvalue-min'}, $paramData->{'param-drawing-object'}->{'serie-xvalue-max'});
26a23052   Benjamin Renard   Add Interval Tick...
567
						else if (count($paramXInfo['indexes']) == 1)
f822811a   Benjamin Renard   Implements multi ...
568
							$xParamNode->addXSerie($paramXInfo['indexes'][0], $crtXId, $paramData->{'param-drawing-object'}->{'serie-xvalue-min'}, $paramData->{'param-drawing-object'}->{'serie-xvalue-max'});
26a23052   Benjamin Renard   Add Interval Tick...
569
570
571
						else
							throw new Exception('X parameter for serie must be a component.');
						break;
95ab3cf6   Menouard AZIB   Prise en compte d...
572
					default:
26a23052   Benjamin Renard   Add Interval Tick...
573
574
						throw new Exception('X parameter not allowed for this drawing type. ');
				}
f822811a   Benjamin Renard   Implements multi ...
575
576
				$xIds[$paramData->{'param-drawing-object'}->{'serie-xaxis-param'}] = $crtXId;
				++$crtXId;
26a23052   Benjamin Renard   Add Interval Tick...
577
578
			}
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
579

26a23052   Benjamin Renard   Add Interval Tick...
580
581
		//Main drawing element parameter
		$drawingEltIndex = 0;
95ab3cf6   Menouard AZIB   Prise en compte d...
582
		foreach ($paramsData as $paramData) {
52c1e291   Benjamin Renard   Generate TT and c...
583
584
			$isTTCat = ($paramData->{'param-type'} == 'ttcat');

26a23052   Benjamin Renard   Add Interval Tick...
585
			//Param
52c1e291   Benjamin Renard   Generate TT and c...
586
587
			if (!$isTTCat) {
				$paramInfo = $this->paramManager->addExistingParam($paramData->{'paramid'}, $this->paramsData, isset($paramData->{'template_args'}) ? $paramData->{'template_args'} : NULL);
95ab3cf6   Menouard AZIB   Prise en compte d...
588
			} else {
52c1e291   Benjamin Renard   Generate TT and c...
589
590
				$paramInfo = $this->paramManager->addTTCatParam($paramData->{'paramid'}, $this->paramsData);
			}
95ab3cf6   Menouard AZIB   Prise en compte d...
591

3182799a   Benjamin Renard   Use param indexes...
592
			$paramInfo['indexes'] = array();
27317777   Menouard AZIB   J'ai ajouté la fo...
593
594
595
596
597
			if ($paramData->{'param-drawing-type'} == 'sauvaud') {
				$this->paramManager->applyRangesAndIndexes($this->paramsData, $paramData, false, $paramInfo);
			} else {
				$this->paramManager->applyRangesAndIndexes($this->paramsData, $paramData, !$this->isInstantPlot, $paramInfo);
			}
95ab3cf6   Menouard AZIB   Prise en compte d...
598
599
			$this->paramManager->applyFilter($this->paramsData, $paramData, $paramInfo);

26a23052   Benjamin Renard   Add Interval Tick...
600
			$requestParamsNode->addParam($paramInfo['id']);
95ab3cf6   Menouard AZIB   Prise en compte d...
601

26a23052   Benjamin Renard   Add Interval Tick...
602
			$colorSerieId = -1;
8ade06fe   Benjamin Renard   Improve config load
603
			if (!empty($paramData->{'param-drawing-object'}->{'serie-colored-param'}))
26a23052   Benjamin Renard   Add Interval Tick...
604
605
				$colorSerieId = $drawingEltIndex;

f822811a   Benjamin Renard   Implements multi ...
606
			$xId = ($isScatter && !empty($paramData->{'param-drawing-object'}->{'serie-xaxis-param'})) ? $xIds[$paramData->{'param-drawing-object'}->{'serie-xaxis-param'}] : -1;
95ab3cf6   Menouard AZIB   Prise en compte d...
607
608
609

			switch ($paramData->{'param-drawing-type'}) {
				case 'serie':
26a23052   Benjamin Renard   Add Interval Tick...
610
					$paramNode = $plotNode->getParams()->getParamById($paramInfo['id']);
f822811a   Benjamin Renard   Implements multi ...
611
					$this->unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, $paramInfo['indexes'], $xId, $colorSerieId, false);
26a23052   Benjamin Renard   Add Interval Tick...
612
					break;
95ab3cf6   Menouard AZIB   Prise en compte d...
613
				case 'orbit-serie':
26a23052   Benjamin Renard   Add Interval Tick...
614
					$paramNode = $plotNode->getParams()->getParamById($paramInfo['id']);
f822811a   Benjamin Renard   Implements multi ...
615
					$this->unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, -1, $xId, $colorSerieId, true);
26a23052   Benjamin Renard   Add Interval Tick...
616
					break;
95ab3cf6   Menouard AZIB   Prise en compte d...
617
				case 'spectro':
26a23052   Benjamin Renard   Add Interval Tick...
618
619
620
					$paramNode = $plotNode->getParams()->getParamById($paramInfo['id']);
					$this->unmarshallSpectro($paramData->{'param-drawing-object'}, $plotNode, $paramNode, $paramInfo['indexes']);
					break;
27317777   Menouard AZIB   J'ai ajouté la fo...
621
622
623
				case 'sauvaud':
					$paramNode = $plotNode->getParams()->getParamById($paramInfo['id']);
					$this->unmarshallSauvaud($paramData->{'param-drawing-object'}, $plotNode, $paramNode, $paramInfo['indexes']);
3dcf7710   Hacene SI HADJ MOHAND   us ok
624
					break;
95ab3cf6   Menouard AZIB   Prise en compte d...
625
				case 'status-bar':
26a23052   Benjamin Renard   Add Interval Tick...
626
627
628
629
630
631
					if (($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTSTATUS_NAME) && !isset($statusPlotNode))
						$paramNode = $plotNode->getParams()->getParamById($paramInfo['id']);
					else
						$paramNode = $statusPlotNode->getParams()->getParamById($paramInfo['id']);
					$this->unmarshallStatusBar($paramData->{'param-drawing-object'}, $paramNode, $paramInfo['indexes']);
					break;
95ab3cf6   Menouard AZIB   Prise en compte d...
632
				case 'tick-bar':
26a23052   Benjamin Renard   Add Interval Tick...
633
634
635
636
					if (($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTTICK_NAME) && !isset($tickPlotNode))
						$paramNode = $plotNode->getParams()->getParamById($paramInfo['id']);
					else
						$paramNode = $tickPlotNode->getParams()->getParamById($paramInfo['id']);
95ab3cf6   Menouard AZIB   Prise en compte d...
637

26a23052   Benjamin Renard   Add Interval Tick...
638
639
					$this->unmarshallTickBar($paramData->{'param-drawing-object'}, $paramNode, $paramInfo['indexes']);
					break;
95ab3cf6   Menouard AZIB   Prise en compte d...
640
				case 'iserie':
26a23052   Benjamin Renard   Add Interval Tick...
641
642
643
					$paramNode = $plotNode->getParams()->getParamById($paramInfo['id']);
					$this->unmarshallInstantSerie($paramData->{'param-drawing-object'}, $plotNode, $paramNode);
					break;
95ab3cf6   Menouard AZIB   Prise en compte d...
644
				case 'ispectro':
fc153c1c   Elena.Budnik   ispectro added
645
646
					$paramNode = $plotNode->getParams()->getParamById($paramInfo['id']);
					$this->unmarshallInstantSpectro($paramData->{'param-drawing-object'}, $plotNode, $paramNode, $paramInfo['indexes']);
044a9305   Benjamin Renard   Add intervals dra...
647
					break;
95ab3cf6   Menouard AZIB   Prise en compte d...
648
				case 'intervals':
044a9305   Benjamin Renard   Add intervals dra...
649
650
651
					$paramNode = $plotNode->getParams()->getParamById($paramInfo['id']);
					$this->unmarshallIntervals($paramData->{'param-drawing-object'}, $paramNode);
					break;
95ab3cf6   Menouard AZIB   Prise en compte d...
652
				default:
26a23052   Benjamin Renard   Add Interval Tick...
653
654
655
656
					throw new Exception('Drawing type not implemented.');
			}
			++$drawingEltIndex;
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
657

26a23052   Benjamin Renard   Add Interval Tick...
658
659
		//Colored parameter
		$drawingEltIndex = 0;
95ab3cf6   Menouard AZIB   Prise en compte d...
660
661
		foreach ($paramsData as $paramData) {
			if (empty($paramData->{'param-drawing-object'}->{'serie-colored-param'})) {
26a23052   Benjamin Renard   Add Interval Tick...
662
663
664
				++$drawingEltIndex;
				continue;
			}
95ab3cf6   Menouard AZIB   Prise en compte d...
665

bf27ba04   Benjamin Renard   Add templated par...
666
			$paramColoredInfo = $this->paramManager->addExistingParam($paramData->{'param-drawing-object'}->{'serie-colored-param'}, $this->paramsData);
26a23052   Benjamin Renard   Add Interval Tick...
667
668
669
670
			if ($paramColoredInfo['id'] == '')
				throw new Exception('Cannot retrieve colored parameter.');
			$requestParamsNode->addParam($paramColoredInfo['id']);
			$coloredParamNode = $plotNode->getParams()->getParamById($paramColoredInfo['id']);
95ab3cf6   Menouard AZIB   Prise en compte d...
671

26a23052   Benjamin Renard   Add Interval Tick...
672
			$colorSerieId = $drawingEltIndex;
95ab3cf6   Menouard AZIB   Prise en compte d...
673
674
675
676

			switch ($paramData->{'param-drawing-type'}) {
				case 'serie':
				case 'orbit-serie':
26a23052   Benjamin Renard   Add Interval Tick...
677
678
679
680
681
682
683
684
					//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;
95ab3cf6   Menouard AZIB   Prise en compte d...
685
				default:
26a23052   Benjamin Renard   Add Interval Tick...
686
687
688
689
690
					throw new Exception('Colored parameter not allowed for this drawing type. ');
			}
			++$drawingEltIndex;
		}
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
691

f822811a   Benjamin Renard   Implements multi ...
692
	protected function unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, $indexes, $xId, $colorSerieId, $isOrbitSerie)
26a23052   Benjamin Renard   Add Interval Tick...
693
694
	{
		$serieNodes = array();
95ab3cf6   Menouard AZIB   Prise en compte d...
695
696
697

		if (!$isOrbitSerie) {
			if (count($indexes) == 0) {
f822811a   Benjamin Renard   Implements multi ...
698
				$serieNode = $paramNode->addYSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, -1, $xId, $colorSerieId, $paramData->{'param-drawing-object'}->{'serie-value-min'}, $paramData->{'param-drawing-object'}->{'serie-value-max'});
26a23052   Benjamin Renard   Add Interval Tick...
699
				$serieNode->setId($paramData->{'id'});
60a1a563   Benjamin Renard   Add the possibili...
700
701
				if (!empty($paramData->{'param-drawing-object'}->{'serie-resolution'}))
					$serieNode->setResolution($paramData->{'param-drawing-object'}->{'serie-resolution'});
26a23052   Benjamin Renard   Add Interval Tick...
702
703
				$serieNodes[] = $serieNode;
			}
95ab3cf6   Menouard AZIB   Prise en compte d...
704
			foreach ($indexes as $index) {
f822811a   Benjamin Renard   Implements multi ...
705
				$serieNode = $paramNode->addYSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, $index, $xId, $colorSerieId, $paramData->{'param-drawing-object'}->{'serie-value-min'}, $paramData->{'param-drawing-object'}->{'serie-value-max'});
26a23052   Benjamin Renard   Add Interval Tick...
706
707
				if (count($indexes) == 1)
					$serieNode->setId($paramData->{'id'});
60a1a563   Benjamin Renard   Add the possibili...
708
709
				if (!empty($paramData->{'param-drawing-object'}->{'serie-resolution'}))
					$serieNode->setResolution($paramData->{'param-drawing-object'}->{'serie-resolution'});
26a23052   Benjamin Renard   Add Interval Tick...
710
711
				$serieNodes[] = $serieNode;
			}
95ab3cf6   Menouard AZIB   Prise en compte d...
712
		} else {
cb46dfbf   Benjamin Renard   Fix orbit serie a...
713
			$orbitSerie = $paramNode->addOrbitSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, $colorSerieId);
26a23052   Benjamin Renard   Add Interval Tick...
714
715
716
			$orbitSerie->setId($paramData->{'id'});
			$serieNodes[] = $orbitSerie;
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
717
718
719

		foreach ($serieNodes as $serieNode) {
			if (!$isOrbitSerie) {
26a23052   Benjamin Renard   Add Interval Tick...
720
				//Resampling
95ab3cf6   Menouard AZIB   Prise en compte d...
721
722
723
				if ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTXY_NAME) {
					switch ($paramData->{'param-drawing-object'}->{'serie-resampling-mode'}) {
						case 'yparam':
26a23052   Benjamin Renard   Add Interval Tick...
724
725
							$serieNode->getResampling()->setType(RequestOutputPlotResamplingTypeEnum::YPARAM);
							break;
95ab3cf6   Menouard AZIB   Prise en compte d...
726
727
						case 'xparam':
						default:
26a23052   Benjamin Renard   Add Interval Tick...
728
729
730
							$serieNode->getResampling()->setType(RequestOutputPlotResamplingTypeEnum::XPARAM);
					}
				}
95ab3cf6   Menouard AZIB   Prise en compte d...
731
			} else {
26a23052   Benjamin Renard   Add Interval Tick...
732
				//Projection
95ab3cf6   Menouard AZIB   Prise en compte d...
733
734
				switch ($paramData->{'param-drawing-object'}->{'serie-projection'}) {
					case 'XY':
26a23052   Benjamin Renard   Add Interval Tick...
735
736
						$serieNode->setProjection(RequestOutputPlotOrbitSerieProjectionEnum::XY);
						break;
95ab3cf6   Menouard AZIB   Prise en compte d...
737
					case 'XZ':
26a23052   Benjamin Renard   Add Interval Tick...
738
739
						$serieNode->setProjection(RequestOutputPlotOrbitSerieProjectionEnum::XZ);
						break;
95ab3cf6   Menouard AZIB   Prise en compte d...
740
					case 'YZ':
26a23052   Benjamin Renard   Add Interval Tick...
741
742
						$serieNode->setProjection(RequestOutputPlotOrbitSerieProjectionEnum::YZ);
						break;
95ab3cf6   Menouard AZIB   Prise en compte d...
743
					case 'XR':
26a23052   Benjamin Renard   Add Interval Tick...
744
745
						$serieNode->setProjection(RequestOutputPlotOrbitSerieProjectionEnum::XR);
						break;
95ab3cf6   Menouard AZIB   Prise en compte d...
746
					case 'YR':
26a23052   Benjamin Renard   Add Interval Tick...
747
748
						$serieNode->setProjection(RequestOutputPlotOrbitSerieProjectionEnum::YR);
						break;
95ab3cf6   Menouard AZIB   Prise en compte d...
749
					case 'ZR':
26a23052   Benjamin Renard   Add Interval Tick...
750
751
						$serieNode->setProjection(RequestOutputPlotOrbitSerieProjectionEnum::ZR);
						break;
95ab3cf6   Menouard AZIB   Prise en compte d...
752
					default:
26a23052   Benjamin Renard   Add Interval Tick...
753
754
755
						throw new Exception('Projection not allowed for the orbit serie');
				}
			}
95ab3cf6   Menouard AZIB   Prise en compte d...
756

26a23052   Benjamin Renard   Add Interval Tick...
757
758
759
760
761
762
763
764
765
766
767
768
769
			//Line
			$this->unmarshallLine($paramData->{'param-drawing-object'}, 'serie', $serieNode->getLine(), $paramData->{'param-drawing-object'}->{"serie-lines-activated"} ? RequestOutputPlotLineTypeEnum::LINE : RequestOutputPlotLineTypeEnum::NO);
			//Symbol
			if (!$paramData->{'param-drawing-object'}->{"serie-symbols-activated"})
				$serieNode->getSymbol()->setType(RequestOutputPlotSymbolTypeEnum::NO);
			else
				$this->unmarshallSymbol($paramData->{'param-drawing-object'}, 'serie-symbols', $serieNode->getSymbol());
			//Time tick
			if ($paramData->{'param-drawing-object'}->{'serie-timetick-activated'})
				$this->unmarshallTimeTick($paramData->{'param-drawing-object'}, $serieNode->getTimeTicks());
			//Interval tick
			if ($paramData->{'param-drawing-object'}->{'serie-intervaltick-activated'})
				$this->unmarshallIntervalTick($paramData->{'param-drawing-object'}, $serieNode->getIntervalTicks());
95ab3cf6   Menouard AZIB   Prise en compte d...
770
			if (!$isOrbitSerie) {
26a23052   Benjamin Renard   Add Interval Tick...
771
772
773
774
775
776
				//Error bar
				if ($paramData->{'param-drawing-object'}->{'serie-errorbar-activated'})
					$this->unmarshallErrorBar($paramData->{'param-drawing-object'}, $requestParamsNode, $serieNode->getErrorBar());
			}
		}
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
777

26a23052   Benjamin Renard   Add Interval Tick...
778
779
780
781
782
783
784
785
786
787
788
	protected function unmarshallTimeTick($serieData, $timeTickNode)
	{
		//Font
		if ($serieData->{'serie-timetick-font-activated'})
			$this->unmarshallFont($serieData, 'serie-timetick-font', $timeTickNode->getFont());
		//First Symbol
		if ($serieData->{'serie-timetick-firstsymbols-activated'})
			$this->unmarshallSymbol($serieData, 'serie-timetick-firstsymbols', $timeTickNode->getFirstSymbol());
		//Symbol
		$this->unmarshallSymbol($serieData, 'serie-timetick-symbols', $timeTickNode->getSymbol());
		//Set options by type
95ab3cf6   Menouard AZIB   Prise en compte d...
789
790
		switch ($serieData->{'serie-timetick-type'}) {
			case 'time-step':
26a23052   Benjamin Renard   Add Interval Tick...
791
792
793
				$timeTickNode->setStep(CommonClass::timeStampToDDTime($serieData->{'serie-timetick-step'}));
				$timeTickNode->setNumber(0);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
794
			case 'nb-major':
26a23052   Benjamin Renard   Add Interval Tick...
795
796
797
				$timeTickNode->setStep(0);
				$timeTickNode->setNumber($serieData->{'serie-timetick-nbmajor'});
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
798
799
			case 'auto':
			default:
26a23052   Benjamin Renard   Add Interval Tick...
800
801
802
803
804
805
806
807
				$timeTickNode->setStep('auto');
				$timeTickNode->setNumber(0);
		}
		//Minor
		$timeTickNode->setMinor($serieData->{'serie-timetick-nbminor'});
		//Color
		$timeTickNode->setColor($this->hexColor2KernelColor($serieData->{'serie-timetick-color'}));
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
808

26a23052   Benjamin Renard   Add Interval Tick...
809
810
811
	protected function unmarshallIntervalTick($serieData, $intervalTickNode)
	{
		//Mode
95ab3cf6   Menouard AZIB   Prise en compte d...
812
		switch ($serieData->{'serie-intervaltick-mode'}) {
26a23052   Benjamin Renard   Add Interval Tick...
813
			case 'symbol-only':
4f9a8e36   Benjamin Renard   Min/Max value def...
814
				$intervalTickNode->setMode(RequestOutputPlotSerieIntervalTicksModeEnum::SYMBOLONLY);
26a23052   Benjamin Renard   Add Interval Tick...
815
816
				break;
			case 'interval-index':
4f9a8e36   Benjamin Renard   Min/Max value def...
817
				$intervalTickNode->setMode(RequestOutputPlotSerieIntervalTicksModeEnum::INTERVALINDEX);
26a23052   Benjamin Renard   Add Interval Tick...
818
819
				break;
			case 'start-stop-time':
4f9a8e36   Benjamin Renard   Min/Max value def...
820
				$intervalTickNode->setMode(RequestOutputPlotSerieIntervalTicksModeEnum::STARTSTOPTIME);
26a23052   Benjamin Renard   Add Interval Tick...
821
822
				break;
			case 'start-time':
95ab3cf6   Menouard AZIB   Prise en compte d...
823
			default:
4f9a8e36   Benjamin Renard   Min/Max value def...
824
				$intervalTickNode->setMode(RequestOutputPlotSerieIntervalTicksModeEnum::STARTTIME);
26a23052   Benjamin Renard   Add Interval Tick...
825
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
826

26a23052   Benjamin Renard   Add Interval Tick...
827
828
		//Color
		$intervalTickNode->setColor($this->hexColor2KernelColor($serieData->{'serie-intervaltick-color'}));
95ab3cf6   Menouard AZIB   Prise en compte d...
829

26a23052   Benjamin Renard   Add Interval Tick...
830
831
		//Symbol
		$this->unmarshallSymbol($serieData, 'serie-intervaltick-symbols', $intervalTickNode->getSymbol());
95ab3cf6   Menouard AZIB   Prise en compte d...
832

26a23052   Benjamin Renard   Add Interval Tick...
833
834
835
836
		//Font
		if ($serieData->{'serie-intervaltick-font-activated'})
			$this->unmarshallFont($serieData, 'serie-intervaltick-font', $intervalTickNode->getFont());
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
837

26a23052   Benjamin Renard   Add Interval Tick...
838
839
840
	protected function unmarshallErrorBar($serieData, $requestParamsNode, $errorBarNode)
	{
		//Type
95ab3cf6   Menouard AZIB   Prise en compte d...
841
		switch ($serieData->{'serie-errorbar-type'}) {
26a23052   Benjamin Renard   Add Interval Tick...
842
843
			case 'min-max':
				$errorBarTypeNode = $errorBarNode->getBarByType(RequestOutputPlotYSerieErrorBarTypeEnum::MINMAX);
95ab3cf6   Menouard AZIB   Prise en compte d...
844

bf27ba04   Benjamin Renard   Add templated par...
845
				$minParamInfo = $this->paramManager->addExistingParam($serieData->{'serie-errorbar-minparam'}, $this->paramsData);
26a23052   Benjamin Renard   Add Interval Tick...
846
847
848
849
850
851
852
853
854
				if ($minParamInfo['id'] == '')
					throw new Exception('Cannot retrieve min. error parameter.');
				$requestParamsNode->addParam($minParamInfo['id']);
				if (count($minParamInfo['indexes']) == 0)
					$errorBarTypeNode->setMinParam($minParamInfo['id'], -1);
				else if (count($minParamInfo['indexes']) == 1)
					$errorBarTypeNode->setMinParam($minParamInfo['id'], $minParamInfo['indexes'][0]);
				else
					throw new Exception('Min parameter for error bar must be a component.');
95ab3cf6   Menouard AZIB   Prise en compte d...
855

bf27ba04   Benjamin Renard   Add templated par...
856
				$maxParamInfo = $this->paramManager->addExistingParam($serieData->{'serie-errorbar-maxparam'}, $this->paramsData);
26a23052   Benjamin Renard   Add Interval Tick...
857
858
859
860
861
862
863
864
865
866
867
868
				if ($maxParamInfo['id'] == '')
					throw new Exception('Cannot retrieve max. error parameter.');
				$requestParamsNode->addParam($maxParamInfo['id']);
				if (count($maxParamInfo['indexes']) == 0)
					$errorBarTypeNode->setMaxParam($maxParamInfo['id'], -1);
				else if (count($maxParamInfo['indexes']) == 1)
					$errorBarTypeNode->setMaxParam($maxParamInfo['id'], $maxParamInfo['indexes'][0]);
				else
					throw new Exception('Max parameter for error bar must be a component.');
				break;
			case 'delta':
				$errorBarTypeNode = $errorBarNode->getBarByType(RequestOutputPlotYSerieErrorBarTypeEnum::DELTA);
95ab3cf6   Menouard AZIB   Prise en compte d...
869

bf27ba04   Benjamin Renard   Add templated par...
870
				$deltaParamInfo = $this->paramManager->addExistingParam($serieData->{'serie-errorbar-deltaparam'}, $this->paramsData);
26a23052   Benjamin Renard   Add Interval Tick...
871
872
873
874
875
876
877
878
879
880
				if ($deltaParamInfo['id'] == '')
					throw new Exception('Cannot retrieve delta error parameter.');
				$requestParamsNode->addParam($deltaParamInfo['id']);
				if (count($deltaParamInfo['indexes']) == 0)
					$errorBarTypeNode->setDeltaParam($deltaParamInfo['id'], -1);
				else if (count($deltaParamInfo['indexes']) == 1)
					$errorBarTypeNode->setDeltaParam($deltaParamInfo['id'], $deltaParamInfo['indexes'][0]);
				else
					throw new Exception('Delta parameter for error bar must be a component.');
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
881
			default:
26a23052   Benjamin Renard   Add Interval Tick...
882
883
				throw new Exception('Unknown error bar type.');
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
884

26a23052   Benjamin Renard   Add Interval Tick...
885
886
887
		//Line
		$this->unmarshallLine($serieData, 'serie-errorbar', $errorBarNode->getLine(), RequestOutputPlotLineTypeEnum::LINE);
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
888

26a23052   Benjamin Renard   Add Interval Tick...
889
890
	protected function unmarshallInstantSerie($paramDrawingData, $plotNode, $paramNode)
	{
cb46dfbf   Benjamin Renard   Fix orbit serie a...
891
		$iserieNode = $paramNode->addInstantSerie('y-left');
95ab3cf6   Menouard AZIB   Prise en compte d...
892

26a23052   Benjamin Renard   Add Interval Tick...
893
894
		//Table on X Axis
		$iserieNode->setTableOnXAxis($paramDrawingData->{'iserie-tableonx'} ? "true" : "false");
95ab3cf6   Menouard AZIB   Prise en compte d...
895

26a23052   Benjamin Renard   Add Interval Tick...
896
897
898
899
900
901
902
903
904
		//Line
		$this->unmarshallLine($paramDrawingData, 'iserie', $iserieNode->getLine(), $paramDrawingData->{"iserie-lines-activated"} ? RequestOutputPlotLineTypeEnum::LINE : RequestOutputPlotLineTypeEnum::NO);

		//Symbol
		if (!$paramDrawingData->{"iserie-symbols-activated"})
			$iserieNode->getSymbol()->setType(RequestOutputPlotSymbolTypeEnum::NO);
		else
			$this->unmarshallSymbol($paramDrawingData, 'iserie-symbols', $iserieNode->getSymbol());
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
905

26a23052   Benjamin Renard   Add Interval Tick...
906
907
	protected function unmarshallSpectro($paramDrawingData, $plotNode, $paramNode, $indexes)
	{
95ab3cf6   Menouard AZIB   Prise en compte d...
908
909
910
911
912
913
914
915
916
917
		$spectroNode = $paramNode->addSpectro(
			$paramDrawingData->{'spectro-yaxis'},
			empty($paramDrawingData->{'spectro-resolution'}) ? NULL : $paramDrawingData->{'spectro-resolution'},
			count($indexes) > 0 ? $indexes[0] : NULL,
			$paramDrawingData->{'spectro-value-min'},
			$paramDrawingData->{'spectro-value-max'},
			isset($paramDrawingData->{'spectro-log0-as-min'}) ? $paramDrawingData->{'spectro-log0-as-min'} : false,
			empty($paramDrawingData->{'spectro-normalization'}) ? NULL : $paramDrawingData->{'spectro-normalization'},
			empty($paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE}) ? NULL : $paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE},
			!isset($paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE}) ? NULL : $paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE},
7c2e29e9   Myriam Bouchemit   Fix
918
			!isset($paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_DIM}) || ($paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_DIM} == "") ? NULL : $paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_DIM}
95ab3cf6   Menouard AZIB   Prise en compte d...
919
		);
26a23052   Benjamin Renard   Add Interval Tick...
920
	}
27317777   Menouard AZIB   J'ai ajouté la fo...
921
	protected function unmarshallSauvaud($paramDrawingData, $plotNode, $paramNode, $indexes)
3dcf7710   Hacene SI HADJ MOHAND   us ok
922
923
924
925
926
927
928
929
930
931
932
	{
		$spectroNode = $paramNode->addSauvaud(
			$paramDrawingData->{'spectro-yaxis'},
			empty($paramDrawingData->{'spectro-resolution'}) ? NULL : $paramDrawingData->{'spectro-resolution'},
			count($indexes) > 0 ? $indexes[0] : NULL,
			$paramDrawingData->{'spectro-value-min'},
			$paramDrawingData->{'spectro-value-max'},
			isset($paramDrawingData->{'spectro-log0-as-min'}) ? $paramDrawingData->{'spectro-log0-as-min'} : false,
			empty($paramDrawingData->{'spectro-normalization'}) ? NULL : $paramDrawingData->{'spectro-normalization'},
			empty($paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE}) ? NULL : $paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE},
			!isset($paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE}) ? NULL : $paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE},
27317777   Menouard AZIB   J'ai ajouté la fo...
933
934
			!isset($paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_DIM}) ? NULL : $paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_DIM},
			$paramDrawingData->{'right_dim'}
3dcf7710   Hacene SI HADJ MOHAND   us ok
935
936
		);
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
937

fc153c1c   Elena.Budnik   ispectro added
938
939
	protected function unmarshallInstantSpectro($paramDrawingData, $plotNode, $paramNode, $indexes)
	{
95ab3cf6   Menouard AZIB   Prise en compte d...
940
		//TBD how to process inexes if they are defined ? 
cb46dfbf   Benjamin Renard   Fix orbit serie a...
941
		$spectroNode = $paramNode->addInstantSpectro('y-left', $paramDrawingData->{'ispectro-dimonxaxis'});
fc153c1c   Elena.Budnik   ispectro added
942
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
943

26a23052   Benjamin Renard   Add Interval Tick...
944
945
	protected function unmarshallStatusBar($paramDrawingData, $paramNode, $indexes)
	{
25a38537   Erdogan Furkan   7616 - Adding col...
946
947
948
949
950
		if ($paramDrawingData->{'statusbar-color'} == "none") {
			$color = NULL;
		} else {
			$color = $this->hexColor2KernelColor($paramDrawingData->{'statusbar-color'});
		}
26a23052   Benjamin Renard   Add Interval Tick...
951
		if (count($indexes) == 0)
25a38537   Erdogan Furkan   7616 - Adding col...
952
953
954
955
956
			$paramNode->addStatusBar(-1, $color);
		else {
			foreach ($indexes as $index)
				$paramNode->addStatusBar($index, $color);
		}
26a23052   Benjamin Renard   Add Interval Tick...
957
	}
044a9305   Benjamin Renard   Add intervals dra...
958
959
960

	protected function unmarshallIntervals($paramDrawingData, $paramNode)
	{
25a38537   Erdogan Furkan   7616 - Adding col...
961
962
963
964
965
		if ($paramDrawingData->{'intervals-color'} == "none") {
			$color = NULL;
		} else {
			$color = $this->hexColor2KernelColor($paramDrawingData->{'intervals-color'});
		}
fe1a8ddd   Erdogan Furkan   Modifications for...
966
967
968
969
970

		$intervalsNode = $paramNode->addIntervals($color);
		$textLegendNode = $intervalsNode->addTextLegend();

		$this->unmarshallTextLegend($paramDrawingData, $textLegendNode);
044a9305   Benjamin Renard   Add intervals dra...
971
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
972

26a23052   Benjamin Renard   Add Interval Tick...
973
974
975
976
977
978
979
	protected function unmarshallTickBar($paramDrawingData, $paramNode, $indexes)
	{
		if (count($indexes) == 0)
			$paramNode->addTickBar(-1);
		foreach ($indexes as $index)
			$paramNode->addTickBar($index);
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
980

26a23052   Benjamin Renard   Add Interval Tick...
981
982
983
984
985
986
987
	protected function hasStatusBar($paramsData)
	{
		foreach ($paramsData as $paramData)
			if ($paramData->{'param-drawing-type'} == 'status-bar')
				return true;
		return false;
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
988

26a23052   Benjamin Renard   Add Interval Tick...
989
990
991
992
993
994
995
	protected function hasTickBar($paramsData)
	{
		foreach ($paramsData as $paramData)
			if ($paramData->{'param-drawing-type'} == 'tick-bar')
				return true;
		return false;
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
996

26a23052   Benjamin Renard   Add Interval Tick...
997
998
999
	protected function unmarshallParamsLegend($paramsLegendData, $paramsLegendNode)
	{
		//Legend type
95ab3cf6   Menouard AZIB   Prise en compte d...
1000
1001
		switch ($paramsLegendData->{'legend-series-type'}) {
			case 'text-line-symbol':
26a23052   Benjamin Renard   Add Interval Tick...
1002
1003
				$paramsLegendNode->setType(RequestOutputPlotParamsLegendTypeEnum::TEXTLINESYMBOL);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1004
1005
			case 'text-only':
			default:
26a23052   Benjamin Renard   Add Interval Tick...
1006
1007
				$paramsLegendNode->setType(RequestOutputPlotParamsLegendTypeEnum::TEXTONLY);
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
1008

26a23052   Benjamin Renard   Add Interval Tick...
1009
1010
		//Show param legend
		$paramsLegendNode->setShowParamInfo($paramsLegendData->{'legend-series-showparaminfo'} ? "true" : "false");
95ab3cf6   Menouard AZIB   Prise en compte d...
1011

26a23052   Benjamin Renard   Add Interval Tick...
1012
1013
		//Show interval legend
		$paramsLegendNode->setShowIntervalInfo($paramsLegendData->{'legend-series-intervalinfo-activated'} ? "true" : "false");
95ab3cf6   Menouard AZIB   Prise en compte d...
1014

26a23052   Benjamin Renard   Add Interval Tick...
1015
		//Interval info type
95ab3cf6   Menouard AZIB   Prise en compte d...
1016
1017
		switch ($paramsLegendData->{'legend-series-intervalinfo-type'}) {
			case 'start-stop':
26a23052   Benjamin Renard   Add Interval Tick...
1018
1019
				$paramsLegendNode->setIntervalInfoType(RequestOutputPlotParamsLegendIntervalInfoTypeEnum::STARTSTOP);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1020
1021
			case 'index':
			default:
26a23052   Benjamin Renard   Add Interval Tick...
1022
1023
				$paramsLegendNode->setIntervalInfoType(RequestOutputPlotParamsLegendIntervalInfoTypeEnum::INDEX);
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
1024

26a23052   Benjamin Renard   Add Interval Tick...
1025
		//Position
95ab3cf6   Menouard AZIB   Prise en compte d...
1026
1027
		switch ($paramsLegendData->{'legend-series-position'}) {
			case 'inside':
26a23052   Benjamin Renard   Add Interval Tick...
1028
1029
				$paramsLegendNode->setPosition(RequestOutputPlotParamsLegendPositionEnum::INSIDE);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1030
1031
			case 'outside':
			default:
26a23052   Benjamin Renard   Add Interval Tick...
1032
1033
				$paramsLegendNode->setPosition(RequestOutputPlotParamsLegendPositionEnum::OUTSIDE);
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
1034

26a23052   Benjamin Renard   Add Interval Tick...
1035
1036
		//Default text color
		$paramsLegendNode->setDefaultTextColor($this->hexColor2KernelColor($paramsLegendData->{'legend-series-defaulttextcolor'}));
95ab3cf6   Menouard AZIB   Prise en compte d...
1037

26a23052   Benjamin Renard   Add Interval Tick...
1038
1039
		//Border visible
		$paramsLegendNode->setBorderVisible($paramsLegendData->{'legend-series-border-activated'} ? "true" : "false");
95ab3cf6   Menouard AZIB   Prise en compte d...
1040

26a23052   Benjamin Renard   Add Interval Tick...
1041
1042
		//Border color
		$paramsLegendNode->setBorderColor($this->hexColor2KernelColor($paramsLegendData->{'legend-series-border-color'}));
95ab3cf6   Menouard AZIB   Prise en compte d...
1043

26a23052   Benjamin Renard   Add Interval Tick...
1044
1045
1046
1047
		//Font
		if ($paramsLegendData->{'legend-series-font-activated'})
			$this->unmarshallFont($paramsLegendData, 'legend-series-font', $paramsLegendNode->getFont());
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1048

fe1a8ddd   Erdogan Furkan   Modifications for...
1049
	protected function unmarshallTextLegend($textLegendData, $parentNode)
26a23052   Benjamin Renard   Add Interval Tick...
1050
	{
95ab3cf6   Menouard AZIB   Prise en compte d...
1051

26a23052   Benjamin Renard   Add Interval Tick...
1052
		//Legend text
fe1a8ddd   Erdogan Furkan   Modifications for...
1053
		$parentNode->setText($textLegendData->{'legend-text-value'});
95ab3cf6   Menouard AZIB   Prise en compte d...
1054

26a23052   Benjamin Renard   Add Interval Tick...
1055
		//Legend position
95ab3cf6   Menouard AZIB   Prise en compte d...
1056
1057
		switch ($textLegendData->{'legend-text-position'}) {
			case 'top':
fe1a8ddd   Erdogan Furkan   Modifications for...
1058
				$parentNode->setPosition(RequestOutputPlotTextLegendPositionEnum::TOP);
26a23052   Benjamin Renard   Add Interval Tick...
1059
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1060
			case 'bottom':
fe1a8ddd   Erdogan Furkan   Modifications for...
1061
				$parentNode->setPosition(RequestOutputPlotTextLegendPositionEnum::BOTTOM);
26a23052   Benjamin Renard   Add Interval Tick...
1062
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1063
			case 'left':
fe1a8ddd   Erdogan Furkan   Modifications for...
1064
				$parentNode->setPosition(RequestOutputPlotTextLegendPositionEnum::LEFT);
26a23052   Benjamin Renard   Add Interval Tick...
1065
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1066
1067
			case 'right':
			default:
fe1a8ddd   Erdogan Furkan   Modifications for...
1068
				$parentNode->setPosition(RequestOutputPlotTextLegendPositionEnum::RIGHT);
26a23052   Benjamin Renard   Add Interval Tick...
1069
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
1070

26a23052   Benjamin Renard   Add Interval Tick...
1071
		//Legend text color
fe1a8ddd   Erdogan Furkan   Modifications for...
1072
		$parentNode->setColor($this->hexColor2KernelColor($textLegendData->{'legend-text-color'}));
95ab3cf6   Menouard AZIB   Prise en compte d...
1073

26a23052   Benjamin Renard   Add Interval Tick...
1074
		//Font
fe1a8ddd   Erdogan Furkan   Modifications for...
1075
1076
1077
		if ($textLegendData->{'legend-text-font-activated'}) {
			$this->unmarshallFont($textLegendData, 'legend-text-font', $parentNode->getFont());
		}
26a23052   Benjamin Renard   Add Interval Tick...
1078
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1079
1080

	protected function unmarshallConstant($constantData, $axisNode)
26a23052   Benjamin Renard   Add Interval Tick...
1081
1082
1083
	{
		$constantNode = $axisNode->addConstant();
		$constantNode->setId($constantData->{'id'});
95ab3cf6   Menouard AZIB   Prise en compte d...
1084

26a23052   Benjamin Renard   Add Interval Tick...
1085
		//Constant value
95ab3cf6   Menouard AZIB   Prise en compte d...
1086
1087
		switch ($axisNode->getName()) {
			case REQUESTOUTPUTPLOTTIMEAXIS_NAME:
26a23052   Benjamin Renard   Add Interval Tick...
1088
				date_default_timezone_set('UTC');
74fd500a   Hacene SI HADJ MOHAND   us #9874 ms zoo...
1089
				$time = CommonClass::strTimeToDDTime($constantData->{'constant-time-value'});
26a23052   Benjamin Renard   Add Interval Tick...
1090
1091
				$constantNode->setConstantValue($time);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1092
			default:
26a23052   Benjamin Renard   Add Interval Tick...
1093
1094
				$constantNode->setConstantValue($constantData->{'constant-float-value'});
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
1095

26a23052   Benjamin Renard   Add Interval Tick...
1096
1097
1098
		//Curve options
		$this->unmarshallCurve($constantData, "constant-line", $constantNode);
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1099

26a23052   Benjamin Renard   Add Interval Tick...
1100
1101
1102
1103
1104
1105
1106
	protected function unmarshallAdditionalObjects($panelData, $addObjectsNode, $isTimePlot)
	{
		foreach ($panelData->{'textObjs'} as $textData)
			$this->unmarshallTextObject($textData, $addObjectsNode, $isTimePlot);
		foreach ($panelData->{'curves'} as $curveData)
			$this->unmarshallCurveObject($curveData, $addObjectsNode);
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1107

26a23052   Benjamin Renard   Add Interval Tick...
1108
1109
1110
	protected function unmarshallTextObject($textData, $addObjectsNode, $isTimePlot)
	{
		$textNode = $addObjectsNode->addTextObject();
95ab3cf6   Menouard AZIB   Prise en compte d...
1111

26a23052   Benjamin Renard   Add Interval Tick...
1112
		$textNode->setText($textData->{'text-value'});
95ab3cf6   Menouard AZIB   Prise en compte d...
1113
1114
1115

		switch ($textData->{'text-y-axis'}) {
			case 'y-right':
26a23052   Benjamin Renard   Add Interval Tick...
1116
1117
				$textNode->setYAxis('y-right');
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1118
			case 'y-left':
26a23052   Benjamin Renard   Add Interval Tick...
1119
1120
1121
				$textNode->setYAxis('y-left');
				break;
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
1122
1123

		if ($isTimePlot && !$textData->{'text-x-relative'}) {
26a23052   Benjamin Renard   Add Interval Tick...
1124
			date_default_timezone_set('UTC');
74fd500a   Hacene SI HADJ MOHAND   us #9874 ms zoo...
1125
			$time = CommonClass::strTimeToDDTime($textData->{'text-x-timevalue'});
26a23052   Benjamin Renard   Add Interval Tick...
1126
			$textNode->setX($time);
95ab3cf6   Menouard AZIB   Prise en compte d...
1127
1128
		} else if ($textData->{'text-x-relative'})
			$textNode->setX(($textData->{'text-x-floatvalue'} * 100) . "%");
26a23052   Benjamin Renard   Add Interval Tick...
1129
1130
		else
			$textNode->setX($textData->{'text-x-floatvalue'});
95ab3cf6   Menouard AZIB   Prise en compte d...
1131

26a23052   Benjamin Renard   Add Interval Tick...
1132
		if ($textData->{'text-y-relative'})
95ab3cf6   Menouard AZIB   Prise en compte d...
1133
			$textNode->setY(($textData->{'text-y-value'} * 100) . "%");
26a23052   Benjamin Renard   Add Interval Tick...
1134
1135
		else
			$textNode->setY($textData->{'text-y-value'});
95ab3cf6   Menouard AZIB   Prise en compte d...
1136

26a23052   Benjamin Renard   Add Interval Tick...
1137
		$textNode->setAngle($textData->{'text-angle'});
95ab3cf6   Menouard AZIB   Prise en compte d...
1138

26a23052   Benjamin Renard   Add Interval Tick...
1139
		$textNode->setColor($this->hexColor2KernelColor($textData->{'text-color'}));
95ab3cf6   Menouard AZIB   Prise en compte d...
1140
1141
1142

		switch ($textData->{'text-align'}) {
			case 'center':
26a23052   Benjamin Renard   Add Interval Tick...
1143
1144
				$textNode->setAlign(RequestOutputPlotTextAlign::CENTER);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1145
			case 'right':
26a23052   Benjamin Renard   Add Interval Tick...
1146
1147
				$textNode->setAlign(RequestOutputPlotTextAlign::RIGHT);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1148
			case 'left':
26a23052   Benjamin Renard   Add Interval Tick...
1149
1150
1151
			default:
				$textNode->setAlign(RequestOutputPlotTextAlign::LEFT);
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
1152

26a23052   Benjamin Renard   Add Interval Tick...
1153
1154
1155
1156
		//Font
		if ($textData->{'text-font-activated'})
			$this->unmarshallFont($textData, 'text-font', $textNode->getFont());
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1157

26a23052   Benjamin Renard   Add Interval Tick...
1158
1159
1160
1161
	protected function unmarshallCurveObject($curveData, $addObjectsNode)
	{
		if (($curveData->{'curve-name'} == '') || !isset($curveData->{'curve-serie-id'}))
			return;
95ab3cf6   Menouard AZIB   Prise en compte d...
1162

26a23052   Benjamin Renard   Add Interval Tick...
1163
		$curveNode = $addObjectsNode->addCurveObject();
95ab3cf6   Menouard AZIB   Prise en compte d...
1164

26a23052   Benjamin Renard   Add Interval Tick...
1165
		$curveNode->setSerieId($curveData->{'curve-serie-id'});
95ab3cf6   Menouard AZIB   Prise en compte d...
1166

26a23052   Benjamin Renard   Add Interval Tick...
1167
		$curveNode->getFunction()->setFunctionName($curveData->{'curve-name'});
95ab3cf6   Menouard AZIB   Prise en compte d...
1168

26a23052   Benjamin Renard   Add Interval Tick...
1169
1170
		foreach ($curveData->{'params'} as $paramData)
			$curveNode->getFunction()->addAttribute($paramData->{'curve-param-name'}, $paramData->{'curve-param-value'});
95ab3cf6   Menouard AZIB   Prise en compte d...
1171

26a23052   Benjamin Renard   Add Interval Tick...
1172
1173
1174
		//Curve options
		$this->unmarshallCurve($curveData, "curve-line", $curveNode);
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1175

26a23052   Benjamin Renard   Add Interval Tick...
1176
1177
	protected function unmarshallFills($panelData, $fillsNode)
	{
95ab3cf6   Menouard AZIB   Prise en compte d...
1178
		foreach ($panelData->{'fills'} as $fillData) {
26a23052   Benjamin Renard   Add Interval Tick...
1179
			//Serie / Constant
95ab3cf6   Menouard AZIB   Prise en compte d...
1180
			if ($fillData->{'fill-type'} == 'serie-constant') {
26a23052   Benjamin Renard   Add Interval Tick...
1181
1182
1183
1184
1185
1186
1187
1188
1189
				$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'}));
			}
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
1190
1191

		foreach ($panelData->{'fills'} as $fillData) {
26a23052   Benjamin Renard   Add Interval Tick...
1192
			//Serie / Serie
95ab3cf6   Menouard AZIB   Prise en compte d...
1193
			if ($fillData->{'fill-type'} == 'serie-serie') {
26a23052   Benjamin Renard   Add Interval Tick...
1194
1195
1196
1197
1198
1199
1200
1201
				$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'}));
			}
95ab3cf6   Menouard AZIB   Prise en compte d...
1202
		}
26a23052   Benjamin Renard   Add Interval Tick...
1203
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1204

26a23052   Benjamin Renard   Add Interval Tick...
1205
1206
	protected function unmarshallTitle($inputData, $keyPrefix, $titleNode)
	{
27317777   Menouard AZIB   J'ai ajouté la fo...
1207
1208
1209
1210
1211
1212
		if ($inputData->{$keyPrefix . '-text'} != '') {
			$titleNode->setText($inputData->{$keyPrefix . '-text'});
		}

		switch ($inputData->{$keyPrefix . '-position'}) {
			case 'top':
d62f9945   Benjamin Renard   Improve instant c...
1213
1214
				$titleNode->setPosition(RequestOutputPlotTitlePosition::TOP);
				break;
27317777   Menouard AZIB   J'ai ajouté la fo...
1215
			case 'bottom':
d62f9945   Benjamin Renard   Improve instant c...
1216
1217
1218
				$titleNode->setPosition(RequestOutputPlotTitlePosition::BOTTOM);
				break;
		}
27317777   Menouard AZIB   J'ai ajouté la fo...
1219
1220
1221

		switch ($inputData->{$keyPrefix . '-alignment'}) {
			case 'center':
d62f9945   Benjamin Renard   Improve instant c...
1222
1223
				$titleNode->setAlign(RequestOutputPlotTitleAlign::CENTER);
				break;
27317777   Menouard AZIB   J'ai ajouté la fo...
1224
			case 'left':
d62f9945   Benjamin Renard   Improve instant c...
1225
1226
				$titleNode->setAlign(RequestOutputPlotTitleAlign::LEFT);
				break;
27317777   Menouard AZIB   J'ai ajouté la fo...
1227
			case 'right':
d62f9945   Benjamin Renard   Improve instant c...
1228
1229
				$titleNode->setAlign(RequestOutputPlotTitleAlign::RIGHT);
				break;
26a23052   Benjamin Renard   Add Interval Tick...
1230
		}
27317777   Menouard AZIB   J'ai ajouté la fo...
1231
1232
1233

		if ($inputData->{$keyPrefix . '-color'} != '')
			$titleNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix . '-color'}));
d62f9945   Benjamin Renard   Improve instant c...
1234
1235

		$this->unmarshallLabel($inputData, $keyPrefix, $titleNode);
26a23052   Benjamin Renard   Add Interval Tick...
1236
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1237

26a23052   Benjamin Renard   Add Interval Tick...
1238
1239
	protected function unmarshallLabel($inputData, $keyPrefix, $labelNode)
	{
95ab3cf6   Menouard AZIB   Prise en compte d...
1240
1241
1242
1243
		if ($inputData->{$keyPrefix . '-font-activated'}) {
			$labelNode->setFontName($inputData->{$keyPrefix . '-font-name'});
			$labelNode->setFontSize($inputData->{$keyPrefix . '-font-size'});
			if ($inputData->{$keyPrefix . '-font-bold'}) {
20e36076   Benjamin Renard   Update interface ...
1244
				$labelNode->setFontWeight("bold");
26a23052   Benjamin Renard   Add Interval Tick...
1245
			}
95ab3cf6   Menouard AZIB   Prise en compte d...
1246
1247
			if ($inputData->{$keyPrefix . '-font-italic'}) {
				$labelNode->setFontStyle("italic");
26a23052   Benjamin Renard   Add Interval Tick...
1248
			}
26a23052   Benjamin Renard   Add Interval Tick...
1249
		}
26a23052   Benjamin Renard   Add Interval Tick...
1250
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1251

26a23052   Benjamin Renard   Add Interval Tick...
1252
1253
	protected function unmarshallFont($inputData, $keyPrefix, $fontNode)
	{
95ab3cf6   Menouard AZIB   Prise en compte d...
1254
1255
1256
1257
1258
		if ($inputData->{$keyPrefix . '-activated'}) {
			$fontNode->setFontName($inputData->{$keyPrefix . '-name'});
			$fontNode->setSize($inputData->{$keyPrefix . '-size'});

			if ($inputData->{$keyPrefix . '-italic'})
26a23052   Benjamin Renard   Add Interval Tick...
1259
1260
1261
				$fontNode->setStyle(RequestOutputPlotFontStyle::ITALIC);
			else
				$fontNode->setStyle(RequestOutputPlotFontStyle::UPRIGHT);
95ab3cf6   Menouard AZIB   Prise en compte d...
1262
1263

			if ($inputData->{$keyPrefix . '-bold'})
26a23052   Benjamin Renard   Add Interval Tick...
1264
1265
1266
1267
1268
				$fontNode->setWeight(RequestOutputPlotFontWeight::BOLD);
			else
				$fontNode->setWeight(RequestOutputPlotFontWeight::MEDIUM);
		}
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1269

26a23052   Benjamin Renard   Add Interval Tick...
1270
1271
	protected function unmarshallCurve($inputData, $keyPrefix, $curveNode)
	{
95ab3cf6   Menouard AZIB   Prise en compte d...
1272
1273
1274
		switch ($inputData->{$keyPrefix . '-style'}) {

			case 'dot':
26a23052   Benjamin Renard   Add Interval Tick...
1275
1276
				$curveNode->setStyle(RequestOutputPlotCurveStyleEnum::DOT);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1277
			case 'long-spaced-dot':
26a23052   Benjamin Renard   Add Interval Tick...
1278
1279
				$curveNode->setStyle(RequestOutputPlotCurveStyleEnum::LONGSPACEDDOT);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1280
			case 'long-short-dot':
26a23052   Benjamin Renard   Add Interval Tick...
1281
1282
				$curveNode->setStyle(RequestOutputPlotCurveStyleEnum::LONGSHORTDOT);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1283
1284
			case 'plain':
			default:
02abc780   Benjamin Renard   Support request f...
1285
1286
				$curveNode->setStyle(RequestOutputPlotCurveStyleEnum::PLAIN);
				break;
26a23052   Benjamin Renard   Add Interval Tick...
1287
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
1288
1289
1290
1291
1292
1293

		if (isset($inputData->{$keyPrefix . '-width'}))
			$curveNode->setWidth($inputData->{$keyPrefix . '-width'});

		if (isset($inputData->{$keyPrefix . '-color'}) && ($inputData->{$keyPrefix . '-color'} != 'auto'))
			$curveNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix . '-color'}));
26a23052   Benjamin Renard   Add Interval Tick...
1294
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1295

26a23052   Benjamin Renard   Add Interval Tick...
1296
1297
1298
	protected function unmarshallLine($inputData, $keyPrefix, $lineNode, $lineType)
	{
		$lineNode->setType($lineType);
95ab3cf6   Menouard AZIB   Prise en compte d...
1299
		$this->unmarshallCurve($inputData, $keyPrefix . "-lines", $lineNode);
26a23052   Benjamin Renard   Add Interval Tick...
1300
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1301

26a23052   Benjamin Renard   Add Interval Tick...
1302
1303
	protected function unmarshallSymbol($inputData, $keyPrefix, $symbolNode)
	{
95ab3cf6   Menouard AZIB   Prise en compte d...
1304
1305
		switch ($inputData->{$keyPrefix . '-type'}) {
			case 'dot':
26a23052   Benjamin Renard   Add Interval Tick...
1306
1307
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::DOT);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1308
			case 'plus':
26a23052   Benjamin Renard   Add Interval Tick...
1309
1310
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::PLUS);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1311
			case 'wildcard':
26a23052   Benjamin Renard   Add Interval Tick...
1312
1313
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::WILDCARD);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1314
			case 'circle':
26a23052   Benjamin Renard   Add Interval Tick...
1315
1316
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::CIRCLE);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1317
			case 'crux':
26a23052   Benjamin Renard   Add Interval Tick...
1318
1319
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::CRUX);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1320
			case 'square':
26a23052   Benjamin Renard   Add Interval Tick...
1321
1322
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::SQUARE);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1323
			case 'triangle':
26a23052   Benjamin Renard   Add Interval Tick...
1324
1325
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::TRIANGLE);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1326
			case 'crux-in-circle':
26a23052   Benjamin Renard   Add Interval Tick...
1327
1328
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::CRUXINCIRCLE);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1329
			case 'dot-in-circle':
26a23052   Benjamin Renard   Add Interval Tick...
1330
1331
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::DOTINCIRCLE);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1332
			case 'diamond':
26a23052   Benjamin Renard   Add Interval Tick...
1333
1334
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::DIAMOND);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1335
			case 'star':
26a23052   Benjamin Renard   Add Interval Tick...
1336
1337
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::STAR);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1338
			case 'david-star':
26a23052   Benjamin Renard   Add Interval Tick...
1339
1340
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::DAVIDSTAR);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1341
			case 'full-square':
26a23052   Benjamin Renard   Add Interval Tick...
1342
1343
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::FULLSQUARE);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1344
			case 'full-circle':
26a23052   Benjamin Renard   Add Interval Tick...
1345
1346
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::FULLCIRCLE);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1347
			case 'full-star':
26a23052   Benjamin Renard   Add Interval Tick...
1348
1349
				$symbolNode->setType(RequestOutputPlotSymbolTypeEnum::FULLSTAR);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1350
			default:
26a23052   Benjamin Renard   Add Interval Tick...
1351
1352
				throw new Exception('Symbol type not implemented.');
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
1353
1354
1355
1356
1357

		$symbolNode->setSize($inputData->{$keyPrefix . '-size'});

		if ($inputData->{$keyPrefix . '-color'} != 'auto')
			$symbolNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix . '-color'}));
26a23052   Benjamin Renard   Add Interval Tick...
1358
1359
1360
1361
1362
1363
1364
	}

	/*
	 * @brief method to marshall the result of a download request
	*/
	protected function marshallResult($data)
	{
95ab3cf6   Menouard AZIB   Prise en compte d...
1365
		if (!$this->isInteractiveRequest) {
26a23052   Benjamin Renard   Add Interval Tick...
1366
			//add to job
95ab3cf6   Menouard AZIB   Prise en compte d...
1367
1368
			$commonRes = $this->commonMarshallResult($data, PLOT_RESULT_FILE_KEY);

26a23052   Benjamin Renard   Add Interval Tick...
1369
1370
			return $commonRes;
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
1371

26a23052   Benjamin Renard   Add Interval Tick...
1372
		//Interactive request
22521f1c   Benjamin Renard   First commit
1373
1374
		if (!$data->getSuccess())
			return array(
95ab3cf6   Menouard AZIB   Prise en compte d...
1375
1376
1377
1378
1379
1380
1381
				'success' => false,
				'message' => $data->getLastErrorMessage()
			);

		switch ($data->getStatus()) {
			case ProcessStatusEnumClass::DONE:

26a23052   Benjamin Renard   Add Interval Tick...
1382
				$result = array();
95ab3cf6   Menouard AZIB   Prise en compte d...
1383
1384
1385
				foreach ($data->getWaitingResults() as $key => $waitingResult) {
					$contextResult = str_replace(".png", "_context.xml", $waitingResult);

26a23052   Benjamin Renard   Add Interval Tick...
1386
1387
					$result[] = array(
						"id" => $key,
70e82c1f   Benjamin Renard   Fix doPlot
1388
						"title" => $this->interactivePlotTitle[$key],
05da1b4d   Benjamin Renard   Draw instant plot...
1389
						"preview" => $this->interactivePreview,
26a23052   Benjamin Renard   Add Interval Tick...
1390
						"isInterval" => $this->interactiveTimeSelectionState[$key],
70e82c1f   Benjamin Renard   Fix doPlot
1391
						"index" => $this->interactivePlotIndex[$key],
26a23052   Benjamin Renard   Add Interval Tick...
1392
						"ttFileIndex" => $this->interactiveCrtTTFileIndex,
95ab3cf6   Menouard AZIB   Prise en compte d...
1393
						"context" => IHMPlotContextFileClass::parse($this->getWorkingPath() . $contextResult),
ba82a624   Benjamin Renard   Get kernel execut...
1394
1395
						"plot" => $waitingResult,
						"exectime" => $data->getExecTime(),
ec574794   Benjamin Renard   Implements multip...
1396
						"multiplot" => $this->isMultiPlot,
26a23052   Benjamin Renard   Add Interval Tick...
1397
1398
					);
				}
95ab3cf6   Menouard AZIB   Prise en compte d...
1399

26a23052   Benjamin Renard   Add Interval Tick...
1400
1401
1402
1403
1404
1405
				return array(
					'success'     => true,
					'id'          => $data->getId(),
					'folder'      => $this->getWorkingDirName(),
					'result'      => $result
				);
95ab3cf6   Menouard AZIB   Prise en compte d...
1406
			case ProcessStatusEnumClass::KILLED:
26a23052   Benjamin Renard   Add Interval Tick...
1407
				return array(
95ab3cf6   Menouard AZIB   Prise en compte d...
1408
1409
1410
1411
					'success'     => true,
					'killed'      => true
				);
			default:
e4eba677   Benjamin Renard   Get error message...
1412
				$errorMsg = $data->getErrorMsg();
22521f1c   Benjamin Renard   First commit
1413
				return array(
95ab3cf6   Menouard AZIB   Prise en compte d...
1414
1415
1416
					'success' => false,
					'message'   => 'Request processing error' . (!empty($errorMsg) ? "<br>(" . $errorMsg . ")" : "")
				);
26a23052   Benjamin Renard   Add Interval Tick...
1417
1418
		}
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1419
1420
1421

	private function hexColor2KernelColor($hex)
	{
26a23052   Benjamin Renard   Add Interval Tick...
1422
1423
		$hex = str_replace("#", "", $hex);

95ab3cf6   Menouard AZIB   Prise en compte d...
1424
1425
1426
		$r = hexdec(substr($hex, 0, 2));
		$g = hexdec(substr($hex, 2, 2));
		$b = hexdec(substr($hex, 4, 2));
26a23052   Benjamin Renard   Add Interval Tick...
1427

95ab3cf6   Menouard AZIB   Prise en compte d...
1428
		return "[" . $r . "," . $g . "," . $b . "]";
26a23052   Benjamin Renard   Add Interval Tick...
1429
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1430

ec574794   Benjamin Renard   Implements multip...
1431
	protected function saveIHMRequest($interactiveId, $input)
26a23052   Benjamin Renard   Add Interval Tick...
1432
	{
95ab3cf6   Menouard AZIB   Prise en compte d...
1433
		$path = $this->getWorkingPath() . "ihm.request." . $interactiveId;
26a23052   Benjamin Renard   Add Interval Tick...
1434
		if (!is_dir($this->getWorkingPath()))
95ab3cf6   Menouard AZIB   Prise en compte d...
1435
			mkdir($this->getWorkingPath(), 0777);
22521f1c   Benjamin Renard   First commit
1436
1437
		$file = fopen($path, 'w');
		fwrite($file, json_encode($input));
26a23052   Benjamin Renard   Add Interval Tick...
1438
1439
		fclose($file);
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1440

ec574794   Benjamin Renard   Implements multip...
1441
	protected function loadIHMRequest($interactiveId)
26a23052   Benjamin Renard   Add Interval Tick...
1442
	{
95ab3cf6   Menouard AZIB   Prise en compte d...
1443
		$path = $this->getWorkingPath() . "ihm.request." . $interactiveId;
22521f1c   Benjamin Renard   First commit
1444
		if (!file_exists($path))
26a23052   Benjamin Renard   Add Interval Tick...
1445
1446
1447
			return NULL;
		return json_decode(file_get_contents($path));
	}
a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1448

95ab3cf6   Menouard AZIB   Prise en compte d...
1449

a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1450
1451
1452

	private function loadZoomList($interactiveId)
	{
95ab3cf6   Menouard AZIB   Prise en compte d...
1453
		$path = $this->getWorkingPath() . "zoom.list." . $interactiveId;
a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1454
1455
1456
1457
1458
1459
1460
		if (!file_exists($path))
			return NULL;
		return json_decode(file_get_contents($path));
	}

	private function saveZoomList($interactiveId, $zoomList)
	{
95ab3cf6   Menouard AZIB   Prise en compte d...
1461
		$path = $this->getWorkingPath() . "zoom.list." . $interactiveId;
a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1462
		if (!is_dir($this->getWorkingPath()))
95ab3cf6   Menouard AZIB   Prise en compte d...
1463
			mkdir($this->getWorkingPath(), 0777);
a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1464
1465
1466
1467
		$file = fopen($path, 'w');
		fwrite($file, json_encode($zoomList));
		fclose($file);
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1468

26a23052   Benjamin Renard   Add Interval Tick...
1469
1470
	private function unmarshallActionRequest($input)
	{
e8cefd97   Benjamin Renard   Interactive attac...
1471
		$actionInput    = $input->{'action'};
95ab3cf6   Menouard AZIB   Prise en compte d...
1472

4a7023e8   Benjamin Renard   Fix interactive n...
1473
		$plotInput = $this->loadIHMRequest($actionInput->{'interactiveId'});
95ab3cf6   Menouard AZIB   Prise en compte d...
1474

26a23052   Benjamin Renard   Add Interval Tick...
1475
		if (!isset($plotInput))
86756f46   Benjamin Renard   Remove multi plot...
1476
			throw new Exception('Cannot retrieve request input for interactive action.');
95ab3cf6   Menouard AZIB   Prise en compte d...
1477
1478
1479

		switch ($actionInput->{'action'}) {
			case 'zoom':
e8cefd97   Benjamin Renard   Interactive attac...
1480
				return $this->unmarshallZoom($actionInput, $plotInput);
95ab3cf6   Menouard AZIB   Prise en compte d...
1481
1482
			case 'forward':
			case 'halfforward':
2366956c   Erdogan Furkan   10312 - Navigatio...
1483
			case 'quarterforward':
95ab3cf6   Menouard AZIB   Prise en compte d...
1484
1485
			case 'backward':
			case 'halfbackward':
2366956c   Erdogan Furkan   10312 - Navigatio...
1486
			case 'quarterbackward':
95ab3cf6   Menouard AZIB   Prise en compte d...
1487
1488
			case 'extend':
			case 'shift':
e8cefd97   Benjamin Renard   Interactive attac...
1489
				return $this->unmarshallNavigation($actionInput, $plotInput);
95ab3cf6   Menouard AZIB   Prise en compte d...
1490
			case 'goto':
e8cefd97   Benjamin Renard   Interactive attac...
1491
				return $this->unmarshallTTGoto($actionInput, $plotInput);
95ab3cf6   Menouard AZIB   Prise en compte d...
1492
			case 'instant':
05da1b4d   Benjamin Renard   Draw instant plot...
1493
				return $this->unmarshallInstant($actionInput, $plotInput);
95ab3cf6   Menouard AZIB   Prise en compte d...
1494
			case 'undozoom':
d3c3608d   Benjamin Renard   Add undo zoom
1495
				return $this->unmarshallUndoZoom($actionInput, $plotInput);
ff8f5cff   Menouard AZIB   Une petite refact...
1496
			case RequestOutPutPlotElementPlotFunctionNodeClass::REQUESTOUTPUTPLOTELEMENT_PLOTFUNCTION_NAME:
27317777   Menouard AZIB   J'ai ajouté la fo...
1497
				return $this->unmarshallPlotFunction($actionInput, $plotInput);
95ab3cf6   Menouard AZIB   Prise en compte d...
1498
			default:
26a23052   Benjamin Renard   Add Interval Tick...
1499
1500
1501
				throw new Exception('Interactive action not implemented.');
		}
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1502

d3c3608d   Benjamin Renard   Add undo zoom
1503
1504
1505
1506
	private function addZoomInList($input, $isInterval, $minOrFileIndex, $maxOrIntervalIndex)
	{
		//if $isInterval == true, $minOrFileIndex is the min and $maxOrInetrvalIndex is the max
		//if $isInterval == false, $minOrFileIndex is the fileIndex and $maxOrInetrvalIndex is the intervalIndex
95ab3cf6   Menouard AZIB   Prise en compte d...
1507

a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1508
		$zoomList = $this->loadZoomList($input->interactiveId);
95ab3cf6   Menouard AZIB   Prise en compte d...
1509
1510

		if (!isset($zoomList)) {
d3c3608d   Benjamin Renard   Add undo zoom
1511
			//Init zoom list
95ab3cf6   Menouard AZIB   Prise en compte d...
1512
			$zoomList = (object)array(
a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1513
				'times' => array(),
95ab3cf6   Menouard AZIB   Prise en compte d...
1514
				'panels' => (object)array()
d3c3608d   Benjamin Renard   Add undo zoom
1515
1516
			);
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
1517
1518

		if ($input->{'axeId'} == 'timeAxis') {
d3c3608d   Benjamin Renard   Add undo zoom
1519
			if ($isInterval)
95ab3cf6   Menouard AZIB   Prise en compte d...
1520
				array_push($zoomList->times, (object)array(
d3c3608d   Benjamin Renard   Add undo zoom
1521
1522
1523
1524
1525
					'isInterval' => true,
					'min' => $minOrFileIndex,
					'max'  => $maxOrIntervalIndex
				));
			else
95ab3cf6   Menouard AZIB   Prise en compte d...
1526
1527
1528
1529
				array_push($zoomList->times, (object)array(
					'isInterval' => false,
					'ttFileIndex' => $minOrFileIndex,
					'intIndex'  => $maxOrIntervalIndex
d3c3608d   Benjamin Renard   Add undo zoom
1530
				));
95ab3cf6   Menouard AZIB   Prise en compte d...
1531
1532
1533
1534
		} else {
			if (!isset($zoomList->panels->{$input->{'panelId'}})) {
				$zoomList->panels->{$input->{'panelId'}} = (object) array(
					'axes' => (object)array()
d3c3608d   Benjamin Renard   Add undo zoom
1535
1536
				);
			}
95ab3cf6   Menouard AZIB   Prise en compte d...
1537
1538

			if (!isset($zoomList->panels->{$input->{'panelId'}}->axes->{$input->{'axeId'}})) {
a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1539
				$zoomList->panels->{$input->{'panelId'}}->axes->{$input->{'axeId'}} = array();
d3c3608d   Benjamin Renard   Add undo zoom
1540
			}
95ab3cf6   Menouard AZIB   Prise en compte d...
1541
1542
1543
1544

			array_push($zoomList->panels->{$input->{'panelId'}}->axes->{$input->{'axeId'}}, (object)array(
				'min' => $minOrFileIndex,
				'max'  => $maxOrIntervalIndex
d3c3608d   Benjamin Renard   Add undo zoom
1545
1546
			));
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
1547

a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1548
		$this->saveZoomList($input->interactiveId, $zoomList);
d3c3608d   Benjamin Renard   Add undo zoom
1549
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1550

a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1551
	private function resetZoomList($interactiveId, $resetOnlyTimeZoom = false)
d3c3608d   Benjamin Renard   Add undo zoom
1552
	{
a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1553
		if (!$resetOnlyTimeZoom) {
95ab3cf6   Menouard AZIB   Prise en compte d...
1554
			$zoomList = (object)array(
a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1555
				'times' => array(),
95ab3cf6   Menouard AZIB   Prise en compte d...
1556
				'panels' => (object)array()
a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1557
			);
95ab3cf6   Menouard AZIB   Prise en compte d...
1558
		} else {
a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1559
1560
1561
1562
1563
			$zoomList = $this->loadZoomList($interactiveId);
			$zoomList->times = array();
		}

		$this->saveZoomList($interactiveId, $zoomList);
d3c3608d   Benjamin Renard   Add undo zoom
1564
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1565

d3c3608d   Benjamin Renard   Add undo zoom
1566
1567
	private function undoZoomInList($input)
	{
a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1568
		$zoomList = $this->loadZoomList($input->interactiveId);
95ab3cf6   Menouard AZIB   Prise en compte d...
1569

d3c3608d   Benjamin Renard   Add undo zoom
1570
		$result = NULL;
95ab3cf6   Menouard AZIB   Prise en compte d...
1571
1572
		if ($zoomList) {
			if ($input->{'axeId'} == 'timeAxis') {
a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1573
				if (count($zoomList->times) <= 0)
d3c3608d   Benjamin Renard   Add undo zoom
1574
					return NULL;
95ab3cf6   Menouard AZIB   Prise en compte d...
1575
1576
				$result = array_pop($zoomList->times);
			} else {
a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1577
				if (!isset($zoomList->panels->{$input->{'panelId'}}))
d3c3608d   Benjamin Renard   Add undo zoom
1578
					return NULL;
95ab3cf6   Menouard AZIB   Prise en compte d...
1579

a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1580
				if (!isset($zoomList->panels->{$input->{'panelId'}}->axes->{$input->{'axeId'}}))
d3c3608d   Benjamin Renard   Add undo zoom
1581
					return NULL;
95ab3cf6   Menouard AZIB   Prise en compte d...
1582

a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1583
				$result = array_pop($zoomList->panels->{$input->{'panelId'}}->axes->{$input->{'axeId'}});
d3c3608d   Benjamin Renard   Add undo zoom
1584
			}
95ab3cf6   Menouard AZIB   Prise en compte d...
1585
		} else
d3c3608d   Benjamin Renard   Add undo zoom
1586
			return NULL;
95ab3cf6   Menouard AZIB   Prise en compte d...
1587

a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1588
		$this->saveZoomList($input->interactiveId, $zoomList);
95ab3cf6   Menouard AZIB   Prise en compte d...
1589

d3c3608d   Benjamin Renard   Add undo zoom
1590
1591
		return $result;
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1592

d3c3608d   Benjamin Renard   Add undo zoom
1593
	private function unmarshallZoom($input, $plotInput, $isUndo = false)
26a23052   Benjamin Renard   Add Interval Tick...
1594
	{
95ab3cf6   Menouard AZIB   Prise en compte d...
1595
		if ($input->{'axeId'} == 'timeAxis') {
26a23052   Benjamin Renard   Add Interval Tick...
1596
			//Zoom on Time Axis
95ab3cf6   Menouard AZIB   Prise en compte d...
1597
			if ($plotInput->{'timesrc'} != 'Interval') {
a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1598
				$plotInput->{'timesrc'} = 'Interval';
7d84634e   Benjamin Renard   Fix plot request ...
1599
				if (!$isUndo)
95ab3cf6   Menouard AZIB   Prise en compte d...
1600
1601
1602
1603
1604
1605
1606
					$this->addZoomInList(
						$input,
						false,
						isset($plotInput->{'ttFileIndex'}) ? $plotInput->{'ttFileIndex'} : 0,
						isset($plotInput->{'intIndex'}) ? $plotInput->{'intIndex'} : 0
					);
			} else {
7d84634e   Benjamin Renard   Fix plot request ...
1607
				if (!$isUndo)
95ab3cf6   Menouard AZIB   Prise en compte d...
1608
					$this->addZoomInList($input, true, $plotInput->{'startDate'}, $plotInput->{'stopDate'});
26a23052   Benjamin Renard   Add Interval Tick...
1609
			}
a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1610
1611
			$plotInput->{'startDate'} = $input->{'min'};
			$plotInput->{'stopDate'} = $input->{'max'};
95ab3cf6   Menouard AZIB   Prise en compte d...
1612

d3c3608d   Benjamin Renard   Add undo zoom
1613
			$plotInput->{'force-time-zoom-reset'} = false;
a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1614
			$this->saveIHMRequest($input->interactiveId, $plotInput);
26a23052   Benjamin Renard   Add Interval Tick...
1615
1616
			return $plotInput;
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
1617

26a23052   Benjamin Renard   Add Interval Tick...
1618
		//Digital axis zoom
95ab3cf6   Menouard AZIB   Prise en compte d...
1619
1620
1621
1622
		foreach ($plotInput->{'panels'} as $panel) {
			if ($input->{'panelId'} == $panel->{'id'}) {
				foreach ($panel->{'axes'} as $axis) {
					if ($input->{'axeId'} == $axis->{'id'}) {
26a23052   Benjamin Renard   Add Interval Tick...
1623
						$axis->{'axis-range-extend'} = false;
d3c3608d   Benjamin Renard   Add undo zoom
1624
1625
						$oldMin = $axis->{'axis-range-min'};
						$oldMax = $axis->{'axis-range-max'};
26a23052   Benjamin Renard   Add Interval Tick...
1626
1627
						$axis->{'axis-range-min'} = $input->{'min'};
						$axis->{'axis-range-max'} = $input->{'max'};
a9d86eaa   Benjamin Renard   Fix zoom / unzoom
1628
						$this->saveIHMRequest($input->interactiveId, $plotInput);
26a23052   Benjamin Renard   Add Interval Tick...
1629
1630
						//Do not save 'force-single-replot' in request file!
						$plotInput->{'force-single-replot'} = true;
d3c3608d   Benjamin Renard   Add undo zoom
1631
1632
						$plotInput->{'force-time-zoom-reset'} = false;
						if (!$isUndo)
95ab3cf6   Menouard AZIB   Prise en compte d...
1633
							$this->addZoomInList($input, true, $oldMin, $oldMax);
26a23052   Benjamin Renard   Add Interval Tick...
1634
1635
1636
1637
1638
1639
1640
1641
						return $plotInput;
					}
				}
				throw new Exception('Cannot retrieve axis for zoom action.');
			}
		}
		throw new Exception('Cannot retrieve plot panel for zoom action.');
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1642

d3c3608d   Benjamin Renard   Add undo zoom
1643
1644
1645
	private function unmarshallUndoZoom($input, $plotInput)
	{
		$result = $this->undoZoomInList($input);
95ab3cf6   Menouard AZIB   Prise en compte d...
1646
1647
1648
		if ($result != NULL) {
			if (isset($result->isInterval)) {
				if (!$result->isInterval) {
d3c3608d   Benjamin Renard   Add undo zoom
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
					$input->ttFileIndex = $result->ttFileIndex;
					$input->intIndex = $result->intIndex;
					return $this->unmarshallTTGoto($input, $plotInput);
				}
			}
			$input->min = $result->min;
			$input->max = $result->max;
			return $this->unmarshallZoom($input, $plotInput, true);
		}
		throw new Exception('No undo zoom to apply.');
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1660

26a23052   Benjamin Renard   Add Interval Tick...
1661
1662
	private function unmarshallNavigation($input, $plotInput)
	{
4a7023e8   Benjamin Renard   Fix interactive n...
1663
1664
		$startTime = $plotInput->{'startDate'};
		$stopTime = $plotInput->{'stopDate'};
95ab3cf6   Menouard AZIB   Prise en compte d...
1665

26a23052   Benjamin Renard   Add Interval Tick...
1666
1667
1668
1669
1670
		//Compute new start / stop time
		date_default_timezone_set('UTC');
		$startTimeStamp = strtotime($startTime);
		$stopTimeStamp  = strtotime($stopTime);
		$duration = $stopTimeStamp - $startTimeStamp;
95ab3cf6   Menouard AZIB   Prise en compte d...
1671
1672
1673

		switch ($input->{'action'}) {
			case 'forward':
26a23052   Benjamin Renard   Add Interval Tick...
1674
1675
1676
				$startTimeStamp += $duration;
				$stopTimeStamp  += $duration;
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1677
1678
1679
			case 'halfforward':
				$startTimeStamp += ($duration / 2);
				$stopTimeStamp  += ($duration / 2);
26a23052   Benjamin Renard   Add Interval Tick...
1680
				break;
2366956c   Erdogan Furkan   10312 - Navigatio...
1681
1682
1683
1684
			case 'quarterforward':
				$startTimeStamp += ($duration / 4);
				$stopTimeStamp  += ($duration / 4);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1685
			case 'backward':
26a23052   Benjamin Renard   Add Interval Tick...
1686
1687
1688
				$startTimeStamp -= $duration;
				$stopTimeStamp  -= $duration;
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1689
1690
1691
			case 'halfbackward':
				$startTimeStamp -= ($duration / 2);
				$stopTimeStamp  -= ($duration / 2);
26a23052   Benjamin Renard   Add Interval Tick...
1692
				break;
2366956c   Erdogan Furkan   10312 - Navigatio...
1693
1694
1695
1696
			case 'quarterbackward':
				$startTimeStamp -= ($duration / 4);
				$stopTimeStamp  -= ($duration / 4);
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1697
			case 'extend':
26a23052   Benjamin Renard   Add Interval Tick...
1698
1699
1700
				$startTimeStamp -= $input->{'duration'};
				$stopTimeStamp  += $input->{'duration'};
				break;
95ab3cf6   Menouard AZIB   Prise en compte d...
1701
			case 'shift':
26a23052   Benjamin Renard   Add Interval Tick...
1702
1703
1704
1705
				$startTimeStamp += $input->{'duration'};
				$stopTimeStamp  += $input->{'duration'};
				break;
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
1706

26a23052   Benjamin Renard   Add Interval Tick...
1707
1708
		if ($stopTimeStamp - $startTimeStamp <= 0)
			throw new Exception('New duration is lower than 0.');
95ab3cf6   Menouard AZIB   Prise en compte d...
1709
1710
1711
1712

		$startTime = date("Y-m-d\TH:i:s", $startTimeStamp);
		$stopTime = date("Y-m-d\TH:i:s", $stopTimeStamp);

26a23052   Benjamin Renard   Add Interval Tick...
1713
		//Update request
4a7023e8   Benjamin Renard   Fix interactive n...
1714
1715
		$plotInput->{'startDate'} = $startTime;
		$plotInput->{'stopDate'} = $stopTime;
95ab3cf6   Menouard AZIB   Prise en compte d...
1716

d3c3608d   Benjamin Renard   Add undo zoom
1717
		$plotInput->{'force-time-zoom-reset'} = true;
4a7023e8   Benjamin Renard   Fix interactive n...
1718
		$this->saveIHMRequest($input->interactiveId, $plotInput);
26a23052   Benjamin Renard   Add Interval Tick...
1719
1720
		return $plotInput;
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1721

26a23052   Benjamin Renard   Add Interval Tick...
1722
1723
	private function unmarshallTTGoto($input, $plotInput)
	{
419a700b   Benjamin Renard   Fix TT goto
1724
1725
1726
		$plotInput->{'timesrc'} = 'TimeTable';
		$plotInput->{'ttFileIndex'} = $input->{'ttFileIndex'};
		$plotInput->{'intIndex'} = $input->{'intIndex'};
95ab3cf6   Menouard AZIB   Prise en compte d...
1727

d3c3608d   Benjamin Renard   Add undo zoom
1728
		$plotInput->{'force-time-zoom-reset'} = true;
419a700b   Benjamin Renard   Fix TT goto
1729
		$this->saveIHMRequest($input->interactiveId, $plotInput);
e8cefd97   Benjamin Renard   Interactive attac...
1730
1731
		return $plotInput;
	}
95ab3cf6   Menouard AZIB   Prise en compte d...
1732

05da1b4d   Benjamin Renard   Draw instant plot...
1733
1734
	private function unmarshallInstant($input, $plotInput)
	{
05da1b4d   Benjamin Renard   Draw instant plot...
1735
1736
		//Find current panel
		$crtPanel = NULL;
95ab3cf6   Menouard AZIB   Prise en compte d...
1737
1738
		foreach ($plotInput->{'panels'} as $panel) {
			if ($input->{'panelId'} == $panel->{'id'}) {
05da1b4d   Benjamin Renard   Draw instant plot...
1739
1740
1741
1742
				$crtPanel = $panel;
				break;
			}
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
1743

05da1b4d   Benjamin Renard   Draw instant plot...
1744
1745
		if (!$crtPanel)
			throw new Exception('Cannot retrieve plot panel for instant plot.');
95ab3cf6   Menouard AZIB   Prise en compte d...
1746

05da1b4d   Benjamin Renard   Draw instant plot...
1747
1748
		if ($crtPanel->{'panel-plot-type'} != 'timePlot')
			throw new Exception('Instant plot action only available for Time plot.');
95ab3cf6   Menouard AZIB   Prise en compte d...
1749

05da1b4d   Benjamin Renard   Draw instant plot...
1750
1751
		//Find spectra parameter
		$crtParam = NULL;
95ab3cf6   Menouard AZIB   Prise en compte d...
1752
1753
1754
		foreach ($crtPanel->{'params'} as $param) {
			if ($param->{'param-drawing-type'} == 'spectro') {
				$crtParam = $param;
05da1b4d   Benjamin Renard   Draw instant plot...
1755
1756
1757
				break;
			}
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
1758

05da1b4d   Benjamin Renard   Draw instant plot...
1759
1760
		if (!$crtParam)
			throw new Exception('Cannot retrieve plot param for instant plot.');
95ab3cf6   Menouard AZIB   Prise en compte d...
1761

05da1b4d   Benjamin Renard   Draw instant plot...
1762
1763
		//Find table Y-axis
		$crtYAxis = NULL;
95ab3cf6   Menouard AZIB   Prise en compte d...
1764
1765
		foreach ($crtPanel->{'axes'} as $axis) {
			if ($crtParam->{'param-drawing-object'}->{'spectro-yaxis'} == $axis->{'id'}) {
05da1b4d   Benjamin Renard   Draw instant plot...
1766
1767
1768
1769
				$crtYAxis = $axis;
				break;
			}
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
1770

05da1b4d   Benjamin Renard   Draw instant plot...
1771
1772
		if (!$crtYAxis)
			throw new Exception('Cannot retrieve plot y Axis for instant plot.');
95ab3cf6   Menouard AZIB   Prise en compte d...
1773

05da1b4d   Benjamin Renard   Draw instant plot...
1774
1775
		//Find color Z-axis
		$crtColorAxis = NULL;
95ab3cf6   Menouard AZIB   Prise en compte d...
1776
1777
		foreach ($crtPanel->{'axes'} as $axis) {
			if ($axis->{'id'} == 'color') {
05da1b4d   Benjamin Renard   Draw instant plot...
1778
1779
1780
1781
				$crtColorAxis = $axis;
				break;
			}
		}
95ab3cf6   Menouard AZIB   Prise en compte d...
1782

05da1b4d   Benjamin Renard   Draw instant plot...
1783
1784
		if (!$crtColorAxis)
			throw new Exception('Cannot retrieve plot color Axis for instant plot.');
95ab3cf6   Menouard AZIB   Prise en compte d...
1785

05da1b4d   Benjamin Renard   Draw instant plot...
1786
1787
		date_default_timezone_set('UTC');
		$timeStamp = strtotime($input->time);
95ab3cf6   Menouard AZIB   Prise en compte d...
1788
1789

		$instantPlotInput = (object)array(
05da1b4d   Benjamin Renard   Draw instant plot...
1790
1791
1792
1793
			"interactive-preview" => true,
			"file-format" => "PNG",
			"file-output" => "INTERACTIVE",
			"file-prefix" => "instant",
05da1b4d   Benjamin Renard   Draw instant plot...
1794
1795
1796
			"timesrc" => "Interval",
			"startDate" => date("Y-m-dTH:i:s", $timeStamp - 3600),
			"stopDate" => date("Y-m-dTH:i:s", $timeStamp + 3600),
05da1b4d   Benjamin Renard   Draw instant plot...
1797
			"id" => 1,
c2d88cc5   Benjamin Renard   Fix instant plot
1798
1799
1800
1801
1802
			"page-margins-activated" => $plotInput->{"page-margins-activated"},
			"page-margin-x" => $plotInput->{"page-margin-x"},
			"page-margin-y" => $plotInput->{"page-margin-y"},
			"page-orientation" => $plotInput->{"page-orientation"},
			"page-dimension" => $plotInput->{"page-dimension"},
05da1b4d   Benjamin Renard   Draw instant plot...
1803
			"page-layout-type" => "vertical",
95ab3cf6   Menouard AZIB   Prise en compte d...
1804
			"page-layout-object" => (object)array(
05da1b4d   Benjamin Renard   Draw instant plot...
1805
				"layout-expand" => true,
95ab3cf6   Menouard AZIB   Prise en compte d...
1806
				"layout-panel-height" => 0.5,
05da1b4d   Benjamin Renard   Draw instant plot...
1807
1808
1809
1810
				"layout-panel-spacing" => 0.05
			),
			"panels" => array()
		);
27317777   Menouard AZIB   J'ai ajouté la fo...
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834

		$instantPanel = (object)array(
			"id" => "1",
			"panel-plot-type" => "instantPlot",
			"panel-instant-time" => $input->time,
			"panel-title-font-activated" => TRUE,
			"panel-title-font-size" => 12,
			"panel-title-font-bold" => TRUE,
			"axes" => array(),
			"params" => array(),

		);

		$instantXAxis = (object)array(
			"id"         => "xaxis_id",
			"axis-type"  => "x",
			"axis-scale" => $crtYAxis->{"axis-scale"},
			"axis-thickness" => 1,
			"axis-legend-font-activated" => TRUE,
			"axis-legend-font-size" => 12,
			"axis-legend-font-bold" => TRUE,
			"axis-range-min" => $crtYAxis->{"axis-range-min"},
			"axis-range-max" => $crtYAxis->{"axis-range-max"},
			"axis-reverse" => $crtYAxis->{"axis-reverse"},
05da1b4d   Benjamin Renard   Draw instant plot...
1835
		);
27317777   Menouard AZIB   J'ai ajouté la fo...
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847

		$instantYAxis = (object)array(
			"id"         => "y-left",
			"axis-type"  => "y-left",
			"axis-scale" => $crtColorAxis->{"axis-scale"},
			"axis-thickness" => 1,
			"axis-legend-font-activated" => TRUE,
			"axis-legend-font-size" => 12,
			"axis-legend-font-bold" => TRUE,
			"axis-range-min" => $crtColorAxis->{"axis-range-min"},
			"axis-range-max" => $crtColorAxis->{"axis-range-max"},
			"axis-reverse" => $crtColorAxis->{"axis-reverse"},
05da1b4d   Benjamin Renard   Draw instant plot...
1848
1849
1850
		);
		$instantPanel->{"axes"}[] = $instantXAxis;
		$instantPanel->{"axes"}[] = $instantYAxis;
95ab3cf6   Menouard AZIB   Prise en compte d...
1851
1852

		$instantParam = (object)array(
05da1b4d   Benjamin Renard   Draw instant plot...
1853
			"id" => 1,
e4545ed5   Benjamin Renard   Implement templat...
1854
			"paramid" => $crtParam->{'paramid'},
8d780912   Benjamin Renard   Keep template arg...
1855
			"template_args" => $crtParam->{'template_args'},
05da1b4d   Benjamin Renard   Draw instant plot...
1856
			"param-drawing-type" => "iserie",
27317777   Menouard AZIB   J'ai ajouté la fo...
1857
1858
1859
1860
1861
1862
			"param-drawing-object" => (object)array(
				"iserie-tableonx" => true,
				"iserie-lines-activated" => true,
				"iserie-lines-style" => "plain",
				"iserie-lines-width" => 3,
				"iserie-lines-color" => "#0000ff"
0a87e436   Hacene SI HADJ MOHAND   parameters resolue
1863
			),
95ab3cf6   Menouard AZIB   Prise en compte d...
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
			"dim1-index"     => $crtParam->{'dim1-index'},
			"dim1-sum-type"  => $crtParam->{'dim1-sum-type'},
			"dim1-min-value" => $crtParam->{'dim1-min-value'},
			"dim1-max-value" => $crtParam->{'dim1-max-value'},
			"dim1-min-index" => $crtParam->{'dim1-min-index'},
			"dim1-max-index" => $crtParam->{'dim1-max-index'},

			"dim2-index"     => $crtParam->{'dim2-index'},
			"dim2-sum-type"  => $crtParam->{'dim2-sum-type'},
			"dim2-min-value" => $crtParam->{'dim2-min-value'},
			"dim2-max-value" => $crtParam->{'dim2-max-value'},
			"dim2-min-index" => $crtParam->{'dim2-min-index'},
			"dim2-max-index" => $crtParam->{'dim2-max-index'},

			"type" => $crtParam->{'type'}
0a87e436   Hacene SI HADJ MOHAND   parameters resolue
1879

05da1b4d   Benjamin Renard   Draw instant plot...
1880
		);
95ab3cf6   Menouard AZIB   Prise en compte d...
1881
1882
		$instantPanel->{"params"}[] = $instantParam;

0a87e436   Hacene SI HADJ MOHAND   parameters resolue
1883

c2d88cc5   Benjamin Renard   Fix instant plot
1884
		$instantPlotInput->{"panels"}[] = $instantPanel;
95ab3cf6   Menouard AZIB   Prise en compte d...
1885
1886


05da1b4d   Benjamin Renard   Draw instant plot...
1887
1888
		return $instantPlotInput;
	}
27317777   Menouard AZIB   J'ai ajouté la fo...
1889
1890
1891

	private function unmarshallPlotFunction($input, $plotInput)
	{
27317777   Menouard AZIB   J'ai ajouté la fo...
1892
1893
1894
1895
1896
1897
1898
1899
		date_default_timezone_set('UTC');
		$timeStamp = strtotime($input->starttime);
		$DATE_TYPE = "Y-m-dTH:i:s";
		$start_time_plotfunction = date($DATE_TYPE, $timeStamp);
		$timestamp_stop_plotfunction  = strtotime($input->stoptime);
		$stop_time_plotfunction = date($DATE_TYPE, $timestamp_stop_plotfunction);
		$plotInput->{"startDate"} = $start_time_plotfunction;
		$plotInput->{"stopDate"} = $stop_time_plotfunction;
ff8f5cff   Menouard AZIB   Une petite refact...
1900
		$plotInput->{"file-prefix"}  = RequestOutPutPlotElementPlotFunctionNodeClass::REQUESTOUTPUTPLOTELEMENT_PLOTFUNCTION_NAME;
27317777   Menouard AZIB   J'ai ajouté la fo...
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917


		//Find current panel
		$crtPanel = NULL;
		foreach ($plotInput->{'panels'} as $panel) {
			if ($input->{'panelId'} == $panel->{'id'}) {

				if ($panel->{'panel-plot-type'} != 'timePlot')
					throw new Exception('Plot Function action only available for Time plot.');

				$panel->{"abscisse"} = $input->abscisse;
				$panel->{"type"} = $input->type;
				$panel->{"scale_abscisse"} = $input->scale_abscisse;
				$panel->{"scale_ordonnee"} = $input->scale_ordonnee;
				$panel->{"nb_Echantillons"} = $input->nb_Echantillons;
				$panel->{'panel-plot-type'} = 'plotFunction';
				$panel->{"axes"} = [];
27317777   Menouard AZIB   J'ai ajouté la fo...
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
				break;
			}
		}

		return $plotInput;
		if (!$crtPanel)
			throw new Exception('Cannot retrieve plot panel for Plot Function.');

		//Find serie parameter
		$crtParam = NULL;

		foreach ($crtPanel->{'params'} as $param) {
			$crtParam = $param;
		}

		if (!$crtParam)
			throw new Exception('Cannot retrieve plot param for Plot Function.');

		date_default_timezone_set('UTC');
		$timeStamp = strtotime($input->starttime);
		$DATE_TYPE = "Y-m-dTH:i:s";
		$start_time_plotfunction = date($DATE_TYPE, $timeStamp);
		$timestamp_stop_plotfunction  = strtotime($input->stoptime);
		$stop_time_plotfunction = date($DATE_TYPE, $timestamp_stop_plotfunction);

		$plotFunctionPlotInput = (object)array(
			"interactive-preview" => true,
			"file-format" => "PNG",
			"file-output" => "INTERACTIVE",
			"file-prefix" => "plotFunction",
			"timesrc" => "Interval",
			"startDate" => $start_time_plotfunction,
			"stopDate" => $stop_time_plotfunction,

			"id" => 1,
			"page-margins-activated" => $plotInput->{"page-margins-activated"},
			"page-margin-x" => $plotInput->{"page-margin-x"},
			"page-margin-y" => $plotInput->{"page-margin-y"},
			"page-orientation" => $plotInput->{"page-orientation"},
			"page-dimension" => $plotInput->{"page-dimension"},
			"page-layout-type" => "vertical",
			"page-layout-object" => (object)array(
				"layout-expand" => true,
				"layout-panel-height" => 0.5,
				"layout-panel-spacing" => 0.05
			),
			"panels" => array()
		);

		$plotPanel = (object)array(
			"id" => "1",
			"panel-plot-type" => 'plotFunction',
			"abscisse" => $input->abscisse,
			"type" => $input->type,
			"scale_abscisse" => $input->scale_abscisse,
			"scale_ordonnee" => $input->scale_ordonnee,
			"nb_Echantillons" => $input->nb_Echantillons,
			"axes" => array(),
			"params" => array(),
		);

		$plotFunctionParam = (object)array(
			"id" => 1,
			"paramid" => $crtParam->{'paramid'},
			"template_args" => $crtParam->{'template_args'},
			"param-drawing-type" => "serie",
			"param-drawing-object" => (object)array(
				"serie-lines-activated" => $crtParam->{'param-drawing-object'}->{'serie-lines-activated'},
				"serie-lines-style" => $crtParam->{'param-drawing-object'}->{'serie-lines-style'},
				"serie-lines-width" => $crtParam->{'param-drawing-object'}->{'serie-lines-width'},
				"serie-lines-color" => $crtParam->{'param-drawing-object'}->{'serie-lines-color'}
			),
		);
		/*
		$plotFunctionParam1 = (object)array(
			"id" => 2,
			"paramid" => "imf_gsm",
			"template_args" => $crtParam->{'template_args'},
			"param-drawing-type" => "serie",
			"param-drawing-object" => (object)array(
				"serie-lines-activated" => $crtParam->{'param-drawing-object'}->{'serie-lines-activated'},
				"serie-lines-style" => $crtParam->{'param-drawing-object'}->{'serie-lines-style'},
				"serie-lines-width" => $crtParam->{'param-drawing-object'}->{'serie-lines-width'},
				"serie-lines-color" => $crtParam->{'param-drawing-object'}->{'serie-lines-color'}
			),
		);

		//$plotPanel->{"params"}[] = [$plotFunctionParam, $plotFunctionParam1];
		*/
		$plotPanel->{"params"}[] = $plotFunctionParam;
		$plotFunctionPlotInput->{"panels"}[] = $plotPanel;

		return $plotFunctionPlotInput;
	}
26a23052   Benjamin Renard   Add Interval Tick...
2012
}