From ec574794db6cb3a13ae0842aef105bae47ed6fe6 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Tue, 24 Nov 2020 14:54:22 +0100 Subject: [PATCH] Implements multiplot (#8314) --- src/InputOutput/IHMImpl/IHMInputOutputClass.php | 13 ++++++++++++- src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsMultiPlotClass.php | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php | 9 ++++++--- 3 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsMultiPlotClass.php diff --git a/src/InputOutput/IHMImpl/IHMInputOutputClass.php b/src/InputOutput/IHMImpl/IHMInputOutputClass.php index cc7f37e..00f3584 100644 --- a/src/InputOutput/IHMImpl/IHMInputOutputClass.php +++ b/src/InputOutput/IHMImpl/IHMInputOutputClass.php @@ -49,6 +49,12 @@ class IHMInputOutputClass implements InputOutputInterface } $this->inputOutput = new IHMInputOutputParamsPlotClass(); break; + case 'multiplot' : + //multiplot + $this->inputOutput = new IHMInputOutputParamsMultiPlotClass(); + //set working dir for interactive plot + $requestId = "Plot"; + break; case 'statistics' : //catalog generation $this->inputOutput = new IHMInputOutputParamsStatisticsClass(); @@ -70,7 +76,12 @@ class IHMInputOutputClass implements InputOutputInterface $requestId = "ParamInfoGen"; break; case FunctionTypeEnumClass::ACTION : - $this->inputOutput = new IHMInputOutputParamsPlotClass(); + if (!$input->action->multiplot) { + $this->inputOutput = new IHMInputOutputParamsPlotClass(); + } + else { + $this->inputOutput = new IHMInputOutputParamsMultiPlotClass(); + } $requestId = "Plot"; break; case FunctionTypeEnumClass::PROCESSDELETE : diff --git a/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsMultiPlotClass.php b/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsMultiPlotClass.php new file mode 100644 index 0000000..4afcf42 --- /dev/null +++ b/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsMultiPlotClass.php @@ -0,0 +1,45 @@ +isMultiPlot = TRUE; + + $isAction = isset($input->{'action'}); + + if ($isAction) { + $multiplotInput = $this->loadIHMRequest('multiplot'); + } + else { + $multiplotInput = $input; + } + + foreach ($multiplotInput->plots as $index => $plot) { + if ($isAction) { + $request = clone $input; + $request->action->interactiveId = PLOT_RESULT_FILE_KEY."_".$plot->{'tab-index'}; + parent::unmarshallRequest($request); + } + else { + $plot->{'file-output'} = 'INTERACTIVE'; + $plot->timesrc = $multiplotInput->timesrc; + $plot->timeTables = $multiplotInput->timeTables; + $plot->startDate = $multiplotInput->startDate; + $plot->stopDate = $multiplotInput->stopDate; + parent::unmarshallRequest($plot); + } + } + + $this->saveIHMRequest('multiplot', $multiplotInput); + } +} + +?> diff --git a/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php b/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php index aa912c6..c5eed66 100644 --- a/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php +++ b/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php @@ -20,6 +20,8 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass private $interactivePlotIndex = array(); private $interactiveCrtTTFileIndex = -1; private $interactivePreview = false; + + protected $isMultiPlot = FALSE; /* * @brief method to unmarshall a plot request @@ -44,7 +46,6 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass //Request $this->isInteractiveRequest = ($input->{'file-output'} == 'INTERACTIVE'); $this->isFromWS = ($input->{'file-output'} == 'WS'); - $postProcessCmd = ""; if ($resetZoom || $forceTimeZoomReset) $this->resetZoomList(PLOT_RESULT_FILE_KEY."_".$input->{'tab-index'}, $forceTimeZoomReset); @@ -215,6 +216,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass } //Post process command to apply to the result file + $postProcessCmd = $this->paramsData->getPostCmd(); if ($postProcessCmd != "") $postProcessCmd .= " | "; $postProcessCmd .= "mv ".$resultFile." ".$waitingResultFile; @@ -1419,6 +1421,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass "context" => IHMPlotContextFileClass::parse($this->getWorkingPath().$contextResult), "plot" => $waitingResult, "exectime" => $data->getExecTime(), + "multiplot" => $this->isMultiPlot, ); } @@ -1450,7 +1453,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass return "[".$r.",".$g.",".$b."]"; } - private function saveIHMRequest($interactiveId, $input) + protected function saveIHMRequest($interactiveId, $input) { $path = $this->getWorkingPath()."ihm.request.".$interactiveId; if (!is_dir($this->getWorkingPath())) @@ -1460,7 +1463,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass fclose($file); } - private function loadIHMRequest($interactiveId) + protected function loadIHMRequest($interactiveId) { $path = $this->getWorkingPath()."ihm.request.".$interactiveId; if (!file_exists($path)) -- libgit2 0.21.2