diff --git a/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php b/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php index be336fa..ad5c95c 100644 --- a/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php +++ b/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php @@ -93,8 +93,8 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass $ttIntIndex = -1; if ($this->isInteractiveRequest && !$isIntervalRequest && !$tab->{'page-superpose-mode'}) { - $ttFileIndex = !isset($activeTab->{'ttFileIndex'}) ? 0 : $activeTab->{'ttFileIndex'}; - $ttIntIndex = !isset($activeTab->{'intIndex'}) ? 0 : $activeTab->{'intIndex'}; + $ttFileIndex = !isset($input->{'ttFileIndex'}) ? 0 : $input->{'ttFileIndex'}; + $ttIntIndex = !isset($input->{'intIndex'}) ? 0 : $input->{'intIndex'}; } $this->unmarshallTimeDefinition($input, $requestIndexInParamData, $ttFileIndex, $ttIntIndex); } @@ -1436,24 +1436,39 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass private function unmarshallActionRequest($input) { + $actionInput = $input->{'action'}; + $multiPlotState = $input->{'multiPlotState'}; + $plotInput = $this->loadIHMRequest(); if (!isset($plotInput)) throw new Exception('Cannot retrieve request input for inetractive action.'); - switch ($input->{'action'}) + //Set interactive Multi Plot state + foreach ($multiPlotState as $key => $value) + { + foreach ($plotInput->{'tabs'} as $tab) + { + if (PLOT_RESULT_FILE_KEY."_".$tab->{'id'} == $key) + $tab->{'multi-plot-linked'} = $value; + } + } + + switch ($actionInput->{'action'}) { case 'zoom' : - return $this->unmarshallZoom($input, $plotInput); + return $this->unmarshallZoom($actionInput, $plotInput); case 'forward' : case 'halfforward' : case 'backward' : case 'halfbackward' : case 'extend' : case 'shift' : - return $this->unmarshallNavigation($input, $plotInput); + return $this->unmarshallNavigation($actionInput, $plotInput); case 'goto' : - return $this->unmarshallTTGoto($input, $plotInput); + return $this->unmarshallTTGoto($actionInput, $plotInput); + case 'synchronize' : + return $this->unmarshallSynchronize($actionInput, $plotInput); default : throw new Exception('Interactive action not implemented.'); } @@ -1491,7 +1506,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass $crtTab->{'startDate'} = $input->{'min'}; $crtTab->{'stopDate'} = $input->{'max'}; } - + $plotInput->{'last-plotted-tab'} = $crtTab->{'id'}; $this->saveIHMRequest($plotInput); return $plotInput; @@ -1623,8 +1638,52 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass throw new Exception('Cannot retrieve plot tab for navigation action.'); $plotInput->{'last-plotted-tab'} = $crtTab->{'id'}; - $crtTab->{'ttFileIndex'} = $input->{'ttFileIndex'}; - $crtTab->{'intIndex'} = $input->{'intIndex'}; + + if ($crtTab->{'multi-plot-linked'}) + { + $plotInput->{'ttFileIndex'} = $input->{'ttFileIndex'}; + $plotInput->{'intIndex'} = $input->{'intIndex'}; + } + else + { + $crtTab->{'ttFileIndex'} = $input->{'ttFileIndex'}; + $crtTab->{'intIndex'} = $input->{'intIndex'}; + } + + $this->saveIHMRequest($plotInput); + return $plotInput; + } + + private function unmarshallSynchronize($input, $plotInput) + { + //Find current tab + $crtTab = NULL; + foreach ($plotInput->{'tabs'} as $tab) + { + if ($input->{'tabId'} == PLOT_RESULT_FILE_KEY."_".$tab->{'id'}) + { + $crtTab = $tab; + break; + } + } + + if (!$crtTab) + throw new Exception('Cannot retrieve plot tab for synchronize action.'); + + if ($crtTab->{'multi-plot-linked'}) + { + + } + else + { + $plotInput->{'last-plotted-tab'} = $crtTab->{'id'}; + $crtTab->{'ttFileIndex'} = $plotInput->{'ttFileIndex'}; + $crtTab->{'intIndex'} = $plotInput->{'intIndex'}; + $crtTab->{'timesrc'} = $plotInput->{'timesrc'}; + $crtTab->{'timeTables'} = $plotInput->{'timeTables'}; + $crtTab->{'startDate'} = $plotInput->{'startDate'}; + $crtTab->{'stopDate'} = $plotInput->{'stopDate'}; + } $this->saveIHMRequest($plotInput); return $plotInput; -- libgit2 0.21.2