Commit e8cefd97288829a6867c31292d6d85f406283a8f
1 parent
c654ced3
Exists in
master
and in
66 other branches
Interactive attachment/detachment to the multi plot mode + Synchronization
Showing
1 changed file
with
68 additions
and
9 deletions
Show diff stats
src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
... | ... | @@ -93,8 +93,8 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
93 | 93 | $ttIntIndex = -1; |
94 | 94 | if ($this->isInteractiveRequest && !$isIntervalRequest && !$tab->{'page-superpose-mode'}) |
95 | 95 | { |
96 | - $ttFileIndex = !isset($activeTab->{'ttFileIndex'}) ? 0 : $activeTab->{'ttFileIndex'}; | |
97 | - $ttIntIndex = !isset($activeTab->{'intIndex'}) ? 0 : $activeTab->{'intIndex'}; | |
96 | + $ttFileIndex = !isset($input->{'ttFileIndex'}) ? 0 : $input->{'ttFileIndex'}; | |
97 | + $ttIntIndex = !isset($input->{'intIndex'}) ? 0 : $input->{'intIndex'}; | |
98 | 98 | } |
99 | 99 | $this->unmarshallTimeDefinition($input, $requestIndexInParamData, $ttFileIndex, $ttIntIndex); |
100 | 100 | } |
... | ... | @@ -1436,24 +1436,39 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
1436 | 1436 | |
1437 | 1437 | private function unmarshallActionRequest($input) |
1438 | 1438 | { |
1439 | + $actionInput = $input->{'action'}; | |
1440 | + $multiPlotState = $input->{'multiPlotState'}; | |
1441 | + | |
1439 | 1442 | $plotInput = $this->loadIHMRequest(); |
1440 | 1443 | |
1441 | 1444 | if (!isset($plotInput)) |
1442 | 1445 | throw new Exception('Cannot retrieve request input for inetractive action.'); |
1443 | 1446 | |
1444 | - switch ($input->{'action'}) | |
1447 | + //Set interactive Multi Plot state | |
1448 | + foreach ($multiPlotState as $key => $value) | |
1449 | + { | |
1450 | + foreach ($plotInput->{'tabs'} as $tab) | |
1451 | + { | |
1452 | + if (PLOT_RESULT_FILE_KEY."_".$tab->{'id'} == $key) | |
1453 | + $tab->{'multi-plot-linked'} = $value; | |
1454 | + } | |
1455 | + } | |
1456 | + | |
1457 | + switch ($actionInput->{'action'}) | |
1445 | 1458 | { |
1446 | 1459 | case 'zoom' : |
1447 | - return $this->unmarshallZoom($input, $plotInput); | |
1460 | + return $this->unmarshallZoom($actionInput, $plotInput); | |
1448 | 1461 | case 'forward' : |
1449 | 1462 | case 'halfforward' : |
1450 | 1463 | case 'backward' : |
1451 | 1464 | case 'halfbackward' : |
1452 | 1465 | case 'extend' : |
1453 | 1466 | case 'shift' : |
1454 | - return $this->unmarshallNavigation($input, $plotInput); | |
1467 | + return $this->unmarshallNavigation($actionInput, $plotInput); | |
1455 | 1468 | case 'goto' : |
1456 | - return $this->unmarshallTTGoto($input, $plotInput); | |
1469 | + return $this->unmarshallTTGoto($actionInput, $plotInput); | |
1470 | + case 'synchronize' : | |
1471 | + return $this->unmarshallSynchronize($actionInput, $plotInput); | |
1457 | 1472 | default : |
1458 | 1473 | throw new Exception('Interactive action not implemented.'); |
1459 | 1474 | } |
... | ... | @@ -1491,7 +1506,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
1491 | 1506 | $crtTab->{'startDate'} = $input->{'min'}; |
1492 | 1507 | $crtTab->{'stopDate'} = $input->{'max'}; |
1493 | 1508 | } |
1494 | - | |
1509 | + | |
1495 | 1510 | $plotInput->{'last-plotted-tab'} = $crtTab->{'id'}; |
1496 | 1511 | $this->saveIHMRequest($plotInput); |
1497 | 1512 | return $plotInput; |
... | ... | @@ -1623,8 +1638,52 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
1623 | 1638 | throw new Exception('Cannot retrieve plot tab for navigation action.'); |
1624 | 1639 | |
1625 | 1640 | $plotInput->{'last-plotted-tab'} = $crtTab->{'id'}; |
1626 | - $crtTab->{'ttFileIndex'} = $input->{'ttFileIndex'}; | |
1627 | - $crtTab->{'intIndex'} = $input->{'intIndex'}; | |
1641 | + | |
1642 | + if ($crtTab->{'multi-plot-linked'}) | |
1643 | + { | |
1644 | + $plotInput->{'ttFileIndex'} = $input->{'ttFileIndex'}; | |
1645 | + $plotInput->{'intIndex'} = $input->{'intIndex'}; | |
1646 | + } | |
1647 | + else | |
1648 | + { | |
1649 | + $crtTab->{'ttFileIndex'} = $input->{'ttFileIndex'}; | |
1650 | + $crtTab->{'intIndex'} = $input->{'intIndex'}; | |
1651 | + } | |
1652 | + | |
1653 | + $this->saveIHMRequest($plotInput); | |
1654 | + return $plotInput; | |
1655 | + } | |
1656 | + | |
1657 | + private function unmarshallSynchronize($input, $plotInput) | |
1658 | + { | |
1659 | + //Find current tab | |
1660 | + $crtTab = NULL; | |
1661 | + foreach ($plotInput->{'tabs'} as $tab) | |
1662 | + { | |
1663 | + if ($input->{'tabId'} == PLOT_RESULT_FILE_KEY."_".$tab->{'id'}) | |
1664 | + { | |
1665 | + $crtTab = $tab; | |
1666 | + break; | |
1667 | + } | |
1668 | + } | |
1669 | + | |
1670 | + if (!$crtTab) | |
1671 | + throw new Exception('Cannot retrieve plot tab for synchronize action.'); | |
1672 | + | |
1673 | + if ($crtTab->{'multi-plot-linked'}) | |
1674 | + { | |
1675 | + | |
1676 | + } | |
1677 | + else | |
1678 | + { | |
1679 | + $plotInput->{'last-plotted-tab'} = $crtTab->{'id'}; | |
1680 | + $crtTab->{'ttFileIndex'} = $plotInput->{'ttFileIndex'}; | |
1681 | + $crtTab->{'intIndex'} = $plotInput->{'intIndex'}; | |
1682 | + $crtTab->{'timesrc'} = $plotInput->{'timesrc'}; | |
1683 | + $crtTab->{'timeTables'} = $plotInput->{'timeTables'}; | |
1684 | + $crtTab->{'startDate'} = $plotInput->{'startDate'}; | |
1685 | + $crtTab->{'stopDate'} = $plotInput->{'stopDate'}; | |
1686 | + } | |
1628 | 1687 | |
1629 | 1688 | $this->saveIHMRequest($plotInput); |
1630 | 1689 | return $plotInput; | ... | ... |