Commit 18a4a61bbde8e86aad71eea9d6fc9c28eba2d520
Exists in
master
and in
18 other branches
Merge branch 'density_maps' into amdadev
Showing
4 changed files
with
272 additions
and
4 deletions
Show diff stats
src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
... | ... | @@ -350,7 +350,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
350 | 350 | $this->unmarshallAxis($axisData, $panelData->{'constants'}, $plotNode); |
351 | 351 | |
352 | 352 | //Params |
353 | - $this->unmarshallParams($panelData->{'params'}, $paramsNode, $plotNode, $panelNode, $statusPlotNode, $tickPlotNode); | |
353 | + $this->unmarshallParams($panelData->{'params'}, $paramsNode, $plotNode, $panelNode, $statusPlotNode, $tickPlotNode, $panelData->{'axes'}); | |
354 | 354 | |
355 | 355 | //Additional objects |
356 | 356 | if ($plotNode->getAdditionalObjects() != NULL) |
... | ... | @@ -549,7 +549,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
549 | 549 | } |
550 | 550 | } |
551 | 551 | |
552 | - protected function unmarshallParams($paramsData, $requestParamsNode, $plotNode, $panelNode, $statusPlotNode, $tickPlotNode) | |
552 | + protected function unmarshallParams($paramsData, $requestParamsNode, $plotNode, $panelNode, $statusPlotNode, $tickPlotNode, $axesData) | |
553 | 553 | { |
554 | 554 | //X parameters |
555 | 555 | $isScatter = ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTXY_NAME); |
... | ... | @@ -570,6 +570,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
570 | 570 | $requestParamsNode->addParam($paramXInfo['id']); |
571 | 571 | $xParamNode = $plotNode->getParams()->getParamById($paramXInfo['id']); |
572 | 572 | switch ($paramData->{'param-drawing-type'}) { |
573 | + case 'histogram2d': | |
573 | 574 | case 'serie': |
574 | 575 | //Unmarshall x serie |
575 | 576 | if (count($paramXInfo['indexes']) == 0) |
... | ... | @@ -620,6 +621,14 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
620 | 621 | $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); |
621 | 622 | $this->unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, $paramInfo['indexes'], $xId, $colorSerieId, false); |
622 | 623 | break; |
624 | + case 'histogram2d': | |
625 | + $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); | |
626 | + if(!empty($paramData->{'param-drawing-object'}->{'histotype-param'})) | |
627 | + $paramZInfo = $this->paramManager->addExistingParam($paramData->{'param-drawing-object'}->{'histotype-param'}, $this->paramsData); | |
628 | + else | |
629 | + $paramZInfo = NULL; | |
630 | + $this->unmarshallHistogram2D($paramData, $requestParamsNode, $plotNode, $paramNode, $paramInfo['indexes'], $xId, $paramZInfo,$axesData); | |
631 | + break; | |
623 | 632 | case 'orbit-serie': |
624 | 633 | $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); |
625 | 634 | $this->unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, -1, $xId, $colorSerieId, true); |
... | ... | @@ -699,6 +708,79 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
699 | 708 | } |
700 | 709 | } |
701 | 710 | |
711 | + protected function unmarshallHistogram2D($paramData, $requestParamsNode, $plotNode, $paramNode, $indexes, $xId, $paramZInfo,$axesData) | |
712 | + { | |
713 | + $histogram2DNodes = array(); | |
714 | + if (count($indexes) == 0) { | |
715 | + $histogram2DNode = $paramNode->addHistogram2DSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, -1, $xId); | |
716 | + $histogram2DNode->setId($paramData->{'id'}); | |
717 | + $histogram2DNodes[] = $histogram2DNode; | |
718 | + } | |
719 | + foreach ($indexes as $index) { | |
720 | + $histogram2DNode = $paramNode->addHistogram2DSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, $index, $xId); | |
721 | + if (count($indexes) == 1) | |
722 | + $histogram2DNode->setId($paramData->{'id'}); | |
723 | + $histogram2DNodes[] = $histogram2DNode; | |
724 | + } | |
725 | + | |
726 | + // ranges | |
727 | + foreach($axesData as $axisData){ | |
728 | + if ($axisData->{'axis-type'} == "x"){ | |
729 | + $axisNode = $plotNode->getXAxis(); | |
730 | + $rangeNode = $axisNode->getRange(); | |
731 | + if($paramData->{'param-drawing-object'}->{'histo2d-xmin'} !== null | |
732 | + && $paramData->{'param-drawing-object'}->{'histo2d-xmax'} !== null) | |
733 | + { | |
734 | + $rangeNode->setMinMax($paramData->{'param-drawing-object'}->{'histo2d-xmin'}, | |
735 | + $paramData->{'param-drawing-object'}->{'histo2d-xmax'}); | |
736 | + } | |
737 | + } | |
738 | + else if ($axisData->{'axis-type'} == "y-left"){ | |
739 | + $axisNode = $plotNode->getYAxis('y-left'); | |
740 | + $rangeNode = $axisNode->getRange(); | |
741 | + if($paramData->{'param-drawing-object'}->{'histo2d-ymin'} !== null | |
742 | + && $paramData->{'param-drawing-object'}->{'histo2d-ymax'} !== null) | |
743 | + { | |
744 | + $rangeNode->setMinMax($paramData->{'param-drawing-object'}->{'histo2d-ymin'}, | |
745 | + $paramData->{'param-drawing-object'}->{'histo2d-ymax'}); | |
746 | + } | |
747 | + } | |
748 | + } | |
749 | + foreach ($histogram2DNodes as $histogram2DNode) { | |
750 | + // resampling | |
751 | + | |
752 | + switch ($paramData->{'param-drawing-object'}->{'serie-resampling-mode'}) { | |
753 | + case 'yparam': | |
754 | + $histogram2DNode->getResampling()->setType(RequestOutputPlotResamplingTypeEnum::YPARAM); | |
755 | + break; | |
756 | + case 'xparam': | |
757 | + default: | |
758 | + $histogram2DNode->getResampling()->setType(RequestOutputPlotResamplingTypeEnum::XPARAM); | |
759 | + } | |
760 | + // xBinNumber & yBinNumber | |
761 | + $histogram2DNode->getBins()->addManualBins($paramData->{'param-drawing-object'}->{'histo2d-xbinnumber'},$paramData->{'param-drawing-object'}->{'histo2d-ybinnumber'}); | |
762 | + | |
763 | + // histotype, function | |
764 | + $histogram2DNode->getHistotype()->setFunction($paramData->{'param-drawing-object'}->{'histo2d-function'}); | |
765 | + //smoothfactor | |
766 | + $histogram2DNode->getHistotype()->setSmoothFactor($paramData->{'param-drawing-object'}->{'histo2d-smoothfactor'}); | |
767 | + | |
768 | + if($paramData->{'param-drawing-object'}->{'histo2d-function'} != "density"){ | |
769 | + // paramId | |
770 | + $requestParamsNode->addParam($paramZInfo['id']); | |
771 | + $histogram2DNode->getHistotype()->setParamId($paramZInfo['id']); | |
772 | + | |
773 | + // index | |
774 | + if (count($paramZInfo['indexes']) == 0) | |
775 | + $histogram2DNode->getHistotype()->setIndex(-1); | |
776 | + else if (count($paramZInfo['indexes']) == 1) | |
777 | + $histogram2DNode->getHistotype()->setIndex($paramZInfo['indexes'][0]); | |
778 | + else | |
779 | + throw new Exception('Z parameter for serie must be a component.'); | |
780 | + } | |
781 | + } | |
782 | + } | |
783 | + | |
702 | 784 | protected function unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, $indexes, $xId, $colorSerieId, $isOrbitSerie) |
703 | 785 | { |
704 | 786 | $serieNodes = array(); |
... | ... |
src/InputOutput/WSImpl/Params/PlotImpl/WSInputOutputParamsPlotClass.php
... | ... | @@ -101,7 +101,7 @@ class WSInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
101 | 101 | $yAxisNode = $plotNode->addYAxis('y-left'); |
102 | 102 | |
103 | 103 | //Params |
104 | - $this->unmarshallParams($param, $paramsNode, $plotNode, $panelNode); | |
104 | + $this->unmarshallParams($param, $paramsNode, $plotNode, $panelNode, NULL); | |
105 | 105 | $panelN++; |
106 | 106 | } |
107 | 107 | |
... | ... | @@ -123,7 +123,7 @@ class WSInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
123 | 123 | } |
124 | 124 | |
125 | 125 | |
126 | - protected function unmarshallParams($paramData, $requestParamsNode, $plotNode, $panelNode) | |
126 | + protected function unmarshallParams($paramData, $requestParamsNode, $plotNode, $panelNode, $axes) | |
127 | 127 | { |
128 | 128 | //Main drawing element parameter |
129 | 129 | $paramInfo = $this->paramManager->addExistingParam($paramData->{'paramid'}, $this->paramsData, NULL); |
... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotHistogram2DSerieNodeClass.php
0 โ 100644
... | ... | @@ -0,0 +1,171 @@ |
1 | +<?php | |
2 | + | |
3 | +require_once "RequestOutputPlotResamplingNodeClass.php"; | |
4 | +require_once "RequestOutputPlotYSerieErrorBarNodeClass.php"; | |
5 | + | |
6 | +define ("REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_NAME", "histogram2d"); | |
7 | +define ("REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_XID", "xId"); | |
8 | +define ("REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_INDEX", "index"); | |
9 | +define ("REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_RESAMPLING", "resampling"); | |
10 | + | |
11 | +define ("REQUESTOUTPUTPLOTBINS_NAME", "bins"); | |
12 | +define ("REQUESTOUTPUTPLOTBINS_MANUAL", "manual"); | |
13 | +define ("REQUESTOUTPUTPLOTBINS_XBINNUMBER", "xbinnumber"); | |
14 | +define ("REQUESTOUTPUTPLOTBINS_YBINNUMBER", "ybinnumber"); | |
15 | + | |
16 | +define ("REQUESTOUTPUTPLOTHISTOTYPE_NAME", "histotype"); | |
17 | +define ("REQUESTOUTPUTPLOTHISTOTYPE_FUNCTION", "type"); | |
18 | +define ("REQUESTOUTPUTPLOTHISTOTYPE_SMOOTHFACTOR", "smoothfactor"); | |
19 | +define ("REQUESTOUTPUTPLOTHISTOTYPE_PARAMID", "paramId"); | |
20 | +define ("REQUESTOUTPUTPLOTHISTOTYPE_INDEX", "index"); | |
21 | +/** | |
22 | + * @class RequestOutputPlotHistogram2DSerieNodeClass | |
23 | + * @brief Definition of a histogram2d for a plot of a plot request | |
24 | + * @details | |
25 | +*/ | |
26 | + | |
27 | +class RequestOutputPlotBinsNodeClass extends NodeClass | |
28 | +{ | |
29 | + public function __construct($name) | |
30 | + { | |
31 | + parent::__construct($name); | |
32 | + } | |
33 | + | |
34 | + public function addManualBins($xBinNumber, $yBinNumber) | |
35 | + { | |
36 | + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTBINS_MANUAL); | |
37 | + | |
38 | + if (!isset($node)) | |
39 | + { | |
40 | + $node = new NodeClass(REQUESTOUTPUTPLOTBINS_MANUAL); | |
41 | + $this->addChild($node); | |
42 | + } | |
43 | + | |
44 | + $node->setAttribute(REQUESTOUTPUTPLOTBINS_XBINNUMBER, $xBinNumber); | |
45 | + $node->setAttribute(REQUESTOUTPUTPLOTBINS_YBINNUMBER, $yBinNumber); | |
46 | + return $node; | |
47 | + } | |
48 | + | |
49 | +} | |
50 | + | |
51 | +class RequestOutputPlotHistotypeNodeClass extends NodeClass | |
52 | +{ | |
53 | + public function __construct($name) | |
54 | + { | |
55 | + parent::__construct($name); | |
56 | + } | |
57 | + | |
58 | + public function setFunction($type){ | |
59 | + $this->setAttribute(REQUESTOUTPUTPLOTHISTOTYPE_FUNCTION, $type); | |
60 | + } | |
61 | + public function getFunction(){ | |
62 | + return $this->getAttribute(REQUESTOUTPUTPLOTHISTOTYPE_FUNCTION); | |
63 | + } | |
64 | + | |
65 | + public function setSmoothFactor($smoothFactor){ | |
66 | + $this->setAttribute(REQUESTOUTPUTPLOTHISTOTYPE_SMOOTHFACTOR, $smoothFactor); | |
67 | + } | |
68 | + public function getSmoothFactor(){ | |
69 | + return $this->getAttribute(REQUESTOUTPUTPLOTHISTOTYPE_SMOOTHFACTOR); | |
70 | + } | |
71 | + | |
72 | + public function setParamId($paramId){ | |
73 | + $this->setAttribute(REQUESTOUTPUTPLOTHISTOTYPE_PARAMID, $paramId); | |
74 | + } | |
75 | + public function getParamId(){ | |
76 | + return $this->getAttribute(REQUESTOUTPUTPLOTHISTOTYPE_PARAMID); | |
77 | + } | |
78 | + | |
79 | + public function setIndex($index){ | |
80 | + $this->setAttribute(REQUESTOUTPUTPLOTHISTOTYPE_INDEX, $index); | |
81 | + } | |
82 | + public function getIndex(){ | |
83 | + return $this->getAttribute(REQUESTOUTPUTPLOTHISTOTYPE_INDEX); | |
84 | + } | |
85 | + | |
86 | +} | |
87 | + | |
88 | +class RequestOutputPlotHistogram2DSerieNodeClass extends RequestOutputPlotBaseSerieNodeClass | |
89 | +{ | |
90 | + public function __construct($name) | |
91 | + { | |
92 | + parent::__construct($name); | |
93 | + } | |
94 | + | |
95 | + public function getBins() | |
96 | + { | |
97 | + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTBINS_NAME); | |
98 | + | |
99 | + if (!isset($node)) | |
100 | + { | |
101 | + $node = new RequestOutputPlotBinsNodeClass(REQUESTOUTPUTPLOTBINS_NAME); | |
102 | + $this->addChild($node); | |
103 | + } | |
104 | + | |
105 | + return $node; | |
106 | + } | |
107 | + | |
108 | + public function getHistotype() | |
109 | + { | |
110 | + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTHISTOTYPE_NAME); | |
111 | + | |
112 | + if (!isset($node)) | |
113 | + { | |
114 | + $node = new RequestOutputPlotHistotypeNodeClass(REQUESTOUTPUTPLOTHISTOTYPE_NAME); | |
115 | + $this->addChild($node); | |
116 | + } | |
117 | + | |
118 | + return $node; | |
119 | + } | |
120 | + public function setIndex($index) | |
121 | + { | |
122 | + $this->setAttribute(REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_INDEX, $index); | |
123 | + } | |
124 | + | |
125 | + public function getIndex() | |
126 | + { | |
127 | + return $this->getAttribute(REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_INDEX); | |
128 | + } | |
129 | + | |
130 | + public function setXId($xId) | |
131 | + { | |
132 | + $this->setAttribute(REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_XID, $xId); | |
133 | + } | |
134 | + | |
135 | + public function getXId() | |
136 | + { | |
137 | + return $this->getAttribute(REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_XID); | |
138 | + } | |
139 | + | |
140 | + public function getResampling() | |
141 | + { | |
142 | + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_RESAMPLING); | |
143 | + | |
144 | + if (!isset($node)) | |
145 | + { | |
146 | + $node = new RequestOutputPlotResamplingNodeClass(REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_RESAMPLING); | |
147 | + $this->addChild($node); | |
148 | + } | |
149 | + | |
150 | + return $node; | |
151 | + } | |
152 | + | |
153 | + | |
154 | + public function loadFromNode($xmlNode) | |
155 | + { | |
156 | + $this->setIndex($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_INDEX)); | |
157 | + | |
158 | + $xId = $this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_XID); | |
159 | + if (!empty($xId)) | |
160 | + $this->setXId($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_XID)); | |
161 | + | |
162 | + $resamplingXmlNode = $this->getXmlNodeChildByTagName($xmlNode, REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_RESAMPLING); | |
163 | + if (isset($resamplingXmlNode)) | |
164 | + $this->getResampling()->loadFromNode($resamplingXmlNode); | |
165 | + | |
166 | + | |
167 | + parent::loadFromNode($xmlNode); | |
168 | + } | |
169 | +} | |
170 | + | |
171 | +?> | |
... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotParamsNodeClass.php
1 | 1 | <?php |
2 | 2 | |
3 | 3 | require_once("RequestOutputPlotYSerieNodeClass.php"); |
4 | +require_once("RequestOutputPlotHistogram2DSerieNodeClass.php"); | |
4 | 5 | require_once "RequestOutputPlotOrbitSerieNodeClass.php"; |
5 | 6 | require_once "RequestOutputPlotInstantSerieNodeClass.php"; |
6 | 7 | |
... | ... | @@ -99,6 +100,20 @@ class RequestOutputPlotParamNodeClass extends NodeClass |
99 | 100 | return $ySerieNode; |
100 | 101 | } |
101 | 102 | |
103 | + public function addHistogram2DSerie($yAxis, $index, $xId = -1) | |
104 | + { | |
105 | + if ($xId != -1) { | |
106 | + $histogram2dNode = new RequestOutputPlotHistogram2DSerieNodeClass(REQUESTOUTPUTPLOTHISTOGRAM2DSERIE_NAME); | |
107 | + $histogram2dNode->setXId($xId); | |
108 | + $histogram2dNode->setXAxisId(REQUESTOUTPUTPLOTELEMENTXY_XAXISID); | |
109 | + } | |
110 | + $histogram2dNode->setYAxisId($yAxis); | |
111 | + if ($index >= 0) | |
112 | + $histogram2dNode->setIndex($index); | |
113 | + $this->addChild($histogram2dNode); | |
114 | + return $histogram2dNode; | |
115 | + } | |
116 | + | |
102 | 117 | public function addOrbitSerie($yAxis, $colorSerieId = -1) |
103 | 118 | { |
104 | 119 | $orbitSerieNode = new RequestOutputPlotOrbitSerieNodeClass(); |
... | ... |