Commit ec574794db6cb3a13ae0842aef105bae47ed6fe6

Authored by Benjamin Renard
1 parent 7d14181a

Implements multiplot (#8314)

src/InputOutput/IHMImpl/IHMInputOutputClass.php
@@ -49,6 +49,12 @@ class IHMInputOutputClass implements InputOutputInterface @@ -49,6 +49,12 @@ class IHMInputOutputClass implements InputOutputInterface
49 } 49 }
50 $this->inputOutput = new IHMInputOutputParamsPlotClass(); 50 $this->inputOutput = new IHMInputOutputParamsPlotClass();
51 break; 51 break;
  52 + case 'multiplot' :
  53 + //multiplot
  54 + $this->inputOutput = new IHMInputOutputParamsMultiPlotClass();
  55 + //set working dir for interactive plot
  56 + $requestId = "Plot";
  57 + break;
52 case 'statistics' : 58 case 'statistics' :
53 //catalog generation 59 //catalog generation
54 $this->inputOutput = new IHMInputOutputParamsStatisticsClass(); 60 $this->inputOutput = new IHMInputOutputParamsStatisticsClass();
@@ -70,7 +76,12 @@ class IHMInputOutputClass implements InputOutputInterface @@ -70,7 +76,12 @@ class IHMInputOutputClass implements InputOutputInterface
70 $requestId = "ParamInfoGen"; 76 $requestId = "ParamInfoGen";
71 break; 77 break;
72 case FunctionTypeEnumClass::ACTION : 78 case FunctionTypeEnumClass::ACTION :
73 - $this->inputOutput = new IHMInputOutputParamsPlotClass(); 79 + if (!$input->action->multiplot) {
  80 + $this->inputOutput = new IHMInputOutputParamsPlotClass();
  81 + }
  82 + else {
  83 + $this->inputOutput = new IHMInputOutputParamsMultiPlotClass();
  84 + }
74 $requestId = "Plot"; 85 $requestId = "Plot";
75 break; 86 break;
76 case FunctionTypeEnumClass::PROCESSDELETE : 87 case FunctionTypeEnumClass::PROCESSDELETE :
src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsMultiPlotClass.php 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  1 +<?php
  2 +
  3 +/**
  4 + * @class IHMInputOutputParamsMultiPlotClass
  5 + * @brief Class that's implement an IHMInputOutputParamsPlotClass used to treat input/output of a "multiplot" request
  6 + * @details
  7 + */
  8 +class IHMInputOutputParamsMultiPlotClass extends IHMInputOutputParamsPlotClass
  9 +{
  10 + /*
  11 + * @brief method to unmarshall a plot request
  12 + */
  13 + public function unmarshallRequest($input) {
  14 + $this->isMultiPlot = TRUE;
  15 +
  16 + $isAction = isset($input->{'action'});
  17 +
  18 + if ($isAction) {
  19 + $multiplotInput = $this->loadIHMRequest('multiplot');
  20 + }
  21 + else {
  22 + $multiplotInput = $input;
  23 + }
  24 +
  25 + foreach ($multiplotInput->plots as $index => $plot) {
  26 + if ($isAction) {
  27 + $request = clone $input;
  28 + $request->action->interactiveId = PLOT_RESULT_FILE_KEY."_".$plot->{'tab-index'};
  29 + parent::unmarshallRequest($request);
  30 + }
  31 + else {
  32 + $plot->{'file-output'} = 'INTERACTIVE';
  33 + $plot->timesrc = $multiplotInput->timesrc;
  34 + $plot->timeTables = $multiplotInput->timeTables;
  35 + $plot->startDate = $multiplotInput->startDate;
  36 + $plot->stopDate = $multiplotInput->stopDate;
  37 + parent::unmarshallRequest($plot);
  38 + }
  39 + }
  40 +
  41 + $this->saveIHMRequest('multiplot', $multiplotInput);
  42 + }
  43 +}
  44 +
  45 +?>
src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
@@ -20,6 +20,8 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass @@ -20,6 +20,8 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
20 private $interactivePlotIndex = array(); 20 private $interactivePlotIndex = array();
21 private $interactiveCrtTTFileIndex = -1; 21 private $interactiveCrtTTFileIndex = -1;
22 private $interactivePreview = false; 22 private $interactivePreview = false;
  23 +
  24 + protected $isMultiPlot = FALSE;
23 25
24 /* 26 /*
25 * @brief method to unmarshall a plot request 27 * @brief method to unmarshall a plot request
@@ -44,7 +46,6 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass @@ -44,7 +46,6 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
44 //Request 46 //Request
45 $this->isInteractiveRequest = ($input->{'file-output'} == 'INTERACTIVE'); 47 $this->isInteractiveRequest = ($input->{'file-output'} == 'INTERACTIVE');
46 $this->isFromWS = ($input->{'file-output'} == 'WS'); 48 $this->isFromWS = ($input->{'file-output'} == 'WS');
47 - $postProcessCmd = "";  
48 49
49 if ($resetZoom || $forceTimeZoomReset) 50 if ($resetZoom || $forceTimeZoomReset)
50 $this->resetZoomList(PLOT_RESULT_FILE_KEY."_".$input->{'tab-index'}, $forceTimeZoomReset); 51 $this->resetZoomList(PLOT_RESULT_FILE_KEY."_".$input->{'tab-index'}, $forceTimeZoomReset);
@@ -215,6 +216,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass @@ -215,6 +216,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
215 } 216 }
216 217
217 //Post process command to apply to the result file 218 //Post process command to apply to the result file
  219 + $postProcessCmd = $this->paramsData->getPostCmd();
218 if ($postProcessCmd != "") 220 if ($postProcessCmd != "")
219 $postProcessCmd .= " | "; 221 $postProcessCmd .= " | ";
220 $postProcessCmd .= "mv ".$resultFile." ".$waitingResultFile; 222 $postProcessCmd .= "mv ".$resultFile." ".$waitingResultFile;
@@ -1419,6 +1421,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass @@ -1419,6 +1421,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
1419 "context" => IHMPlotContextFileClass::parse($this->getWorkingPath().$contextResult), 1421 "context" => IHMPlotContextFileClass::parse($this->getWorkingPath().$contextResult),
1420 "plot" => $waitingResult, 1422 "plot" => $waitingResult,
1421 "exectime" => $data->getExecTime(), 1423 "exectime" => $data->getExecTime(),
  1424 + "multiplot" => $this->isMultiPlot,
1422 ); 1425 );
1423 } 1426 }
1424 1427
@@ -1450,7 +1453,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass @@ -1450,7 +1453,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
1450 return "[".$r.",".$g.",".$b."]"; 1453 return "[".$r.",".$g.",".$b."]";
1451 } 1454 }
1452 1455
1453 - private function saveIHMRequest($interactiveId, $input) 1456 + protected function saveIHMRequest($interactiveId, $input)
1454 { 1457 {
1455 $path = $this->getWorkingPath()."ihm.request.".$interactiveId; 1458 $path = $this->getWorkingPath()."ihm.request.".$interactiveId;
1456 if (!is_dir($this->getWorkingPath())) 1459 if (!is_dir($this->getWorkingPath()))
@@ -1460,7 +1463,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass @@ -1460,7 +1463,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
1460 fclose($file); 1463 fclose($file);
1461 } 1464 }
1462 1465
1463 - private function loadIHMRequest($interactiveId) 1466 + protected function loadIHMRequest($interactiveId)
1464 { 1467 {
1465 $path = $this->getWorkingPath()."ihm.request.".$interactiveId; 1468 $path = $this->getWorkingPath()."ihm.request.".$interactiveId;
1466 if (!file_exists($path)) 1469 if (!file_exists($path))