Commit 870c9b421626021a1fa2a1ffd2d2f8d5a8a855bb
1 parent
fa465d7a
Exists in
master
and in
9 other branches
#11372 - Integration part for new histo1D functions - Done
Showing
2 changed files
with
38 additions
and
2 deletions
Show diff stats
src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
... | ... | @@ -651,7 +651,11 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
651 | 651 | break; |
652 | 652 | case 'histogram1d': |
653 | 653 | $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); |
654 | - $this->unmarshallHistogram1D($paramData, $requestParamsNode, $plotNode, $paramNode, $paramInfo['indexes']); | |
654 | + if(!empty($paramData->{'param-drawing-object'}->{'histotype-param'})) | |
655 | + $paramYInfo = $this->paramManager->addExistingParam($paramData->{'param-drawing-object'}->{'histotype-param'}, $this->paramsData); | |
656 | + else | |
657 | + $paramYInfo = NULL; | |
658 | + $this->unmarshallHistogram1D($paramData, $requestParamsNode, $plotNode, $paramNode, $paramInfo['indexes'],$paramYInfo); | |
655 | 659 | break; |
656 | 660 | case 'orbit-serie': |
657 | 661 | $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); |
... | ... | @@ -790,7 +794,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
790 | 794 | } |
791 | 795 | } |
792 | 796 | |
793 | - protected function unmarshallHistogram1D($paramData, $requestParamsNode, $plotNode, $paramNode, $indexes) | |
797 | + protected function unmarshallHistogram1D($paramData, $requestParamsNode, $plotNode, $paramNode, $indexes, $paramYInfo) | |
794 | 798 | { |
795 | 799 | $histogram1DNodes = array(); |
796 | 800 | if ($paramData->{'param-drawing-object'}->{'histo1d-color'} == "none") { |
... | ... | @@ -823,7 +827,23 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
823 | 827 | |
824 | 828 | // histotype, function |
825 | 829 | $histogram1DNode->getHistotype()->set1DFunction($paramData->{'param-drawing-object'}->{'histo1d-function'}); |
830 | + if(($paramData->{'param-drawing-object'}->{'histo1d-function'} != "density") && | |
831 | + ($paramData->{'param-drawing-object'}->{'histo1d-function'} != "normdensity")){ | |
832 | + // paramId | |
833 | + if (empty($paramYInfo['id'])) { | |
834 | + throw new Exception('Y parameter must be defined to apply function.'); | |
835 | + } | |
836 | + $requestParamsNode->addParam($paramYInfo['id']); | |
837 | + $histogram1DNode->getHistotype()->setParamId($paramYInfo['id']); | |
826 | 838 | |
839 | + // index | |
840 | + if (count($paramYInfo['indexes']) == 0) | |
841 | + $histogram1DNode->getHistotype()->setIndex(-1); | |
842 | + else if (count($paramYInfo['indexes']) == 1) | |
843 | + $histogram1DNode->getHistotype()->setIndex($paramYInfo['indexes'][0]); | |
844 | + else | |
845 | + throw new Exception('Y parameter for serie must be a component.'); | |
846 | + } | |
827 | 847 | } |
828 | 848 | } |
829 | 849 | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotHistogram1DSerieNodeClass.php
... | ... | @@ -14,6 +14,8 @@ define ("REQUESTOUTPUTPLOTBINS_STAIRS", "stairs"); |
14 | 14 | |
15 | 15 | define ("REQUESTOUTPUTPLOTHISTOTYPE_NAME", "histotype"); |
16 | 16 | define ("REQUESTOUTPUTPLOTHISTOTYPE_FUNCTION", "type"); |
17 | +define ("REQUESTOUTPUTPLOTHISTOTYPE_PARAMID", "paramId"); | |
18 | +define ("REQUESTOUTPUTPLOTHISTOTYPE_INDEX", "index"); | |
17 | 19 | /** |
18 | 20 | * @class RequestOutputPlotHistogram1DSerieNodeClass |
19 | 21 | * @brief Definition of a histogram1D for a plot of a plot request |
... | ... | @@ -57,6 +59,20 @@ class RequestOutputPlotHistotype1DNodeClass extends NodeClass |
57 | 59 | public function get1DFunction(){ |
58 | 60 | return $this->getAttribute(REQUESTOUTPUTPLOTHISTOTYPE_FUNCTION); |
59 | 61 | } |
62 | + | |
63 | + public function setParamId($paramId){ | |
64 | + $this->setAttribute(REQUESTOUTPUTPLOTHISTOTYPE_PARAMID, $paramId); | |
65 | + } | |
66 | + public function getParamId(){ | |
67 | + return $this->getAttribute(REQUESTOUTPUTPLOTHISTOTYPE_PARAMID); | |
68 | + } | |
69 | + | |
70 | + public function setIndex($index){ | |
71 | + $this->setAttribute(REQUESTOUTPUTPLOTHISTOTYPE_INDEX, $index); | |
72 | + } | |
73 | + public function getIndex(){ | |
74 | + return $this->getAttribute(REQUESTOUTPUTPLOTHISTOTYPE_INDEX); | |
75 | + } | |
60 | 76 | } |
61 | 77 | |
62 | 78 | class RequestOutputPlotHistogram1DSerieNodeClass extends RequestOutputPlotBaseSerieNodeClass | ... | ... |