Commit f27db60ab21feff1ee899172add6a52a413e9341

Authored by Benjamin Renard
2 parents 144c7611 e8002665

Merge branch 'FER_11100' into amdadev

config/kernel/plotConfig.xml
... ... @@ -34,6 +34,8 @@
34 34 <symbol type="circle" size="5" color="[120,120,0]" />
35 35 </timeTick>
36 36 </xyPlot>
  37 + <histoPlot zAxis="colorAxis">
  38 + </histoPlot>
37 39 <instantPlot zAxis="colorAxis">
38 40 <line type="no" style="plain" color="[255,0,0]" width="1" />
39 41 <symbol type="dot" size="4" color="[0,0,255]" />
... ...
src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
... ... @@ -315,7 +315,6 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
315 315 //Plot type
316 316 $this->isInstantPlot = false;
317 317 $plotNode = $this->unmarshallPlotType($panelData, $panelNode);
318   -
319 318 $isTimePlot = ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTTIME_NAME);
320 319  
321 320 //Tick plot
... ... @@ -373,6 +372,9 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
373 372 $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::XYPLOT);
374 373 $plotNode->setIsIsotropic($panelData->{'panel-scatter-isotropic'});
375 374 break;
  375 + case 'histoPlot':
  376 + $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::HISTOPLOT);
  377 + break;
376 378 case 'statusPlot':
377 379 $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::STATUSPLOT);
378 380 switch ($panelData->{'panel-status-position'}) {
... ... @@ -571,8 +573,9 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
571 573 {
572 574 //X parameters
573 575 $isScatter = ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTXY_NAME);
  576 + $isHisto = ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTHISTO_NAME);
574 577 $xIds = array();
575   - if ($isScatter) {
  578 + if ($isScatter || $isHisto) {
576 579 $crtXId = 0;
577 580 foreach ($paramsData as $paramData) {
578 581 if ($paramData->{'param-drawing-object'}->{'serie-xaxis-param'} == '')
... ... @@ -632,7 +635,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
632 635 if (!empty($paramData->{'param-drawing-object'}->{'serie-colored-param'}))
633 636 $colorSerieId = $drawingEltIndex;
634 637  
635   - $xId = ($isScatter && !empty($paramData->{'param-drawing-object'}->{'serie-xaxis-param'})) ? $xIds[$paramData->{'param-drawing-object'}->{'serie-xaxis-param'}] : -1;
  638 + $xId = (($isScatter || $isHisto) && !empty($paramData->{'param-drawing-object'}->{'serie-xaxis-param'})) ? $xIds[$paramData->{'param-drawing-object'}->{'serie-xaxis-param'}] : -1;
636 639  
637 640 switch ($paramData->{'param-drawing-type'}) {
638 641 case 'serie':
... ... @@ -647,6 +650,10 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
647 650 $paramZInfo = NULL;
648 651 $this->unmarshallHistogram2D($paramData, $requestParamsNode, $plotNode, $paramNode, $paramInfo['indexes'], $xId, $paramZInfo,$axesData);
649 652 break;
  653 + case 'histogram1d':
  654 + $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']);
  655 + $this->unmarshallHistogram1D($paramData, $requestParamsNode, $plotNode, $paramNode, $paramInfo['indexes']);
  656 + break;
650 657 case 'orbit-serie':
651 658 $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']);
652 659 $this->unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, -1, $xId, $colorSerieId, true);
... ... @@ -784,6 +791,42 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
784 791 }
785 792 }
786 793  
  794 + protected function unmarshallHistogram1D($paramData, $requestParamsNode, $plotNode, $paramNode, $indexes)
  795 + {
  796 + $histogram1DNodes = array();
  797 + if ($paramData->{'param-drawing-object'}->{'histo1d-color'} == "none") {
  798 + $color = NULL;
  799 + } else {
  800 + $color = $this->hexColor2KernelColor($paramData->{'param-drawing-object'}->{'histo1d-color'});
  801 + }
  802 +
  803 + if (count($indexes) == 0) {
  804 + $histogram1DNode = $paramNode->addHistogram1DSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, -1, $color);
  805 + if (isset($histogram1DNode)) {
  806 + $histogram1DNode->setId($paramData->{'id'});
  807 + $histogram1DNodes[] = $histogram1DNode;
  808 + }
  809 + }
  810 + foreach ($indexes as $index) {
  811 + $histogram1DNode = $paramNode->addHistogram1DSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, $index, $color);
  812 + if (isset($histogram1DNode)) {
  813 + if (count($indexes) == 1)
  814 + $histogram1DNode->setId($paramData->{'id'});
  815 + $histogram1DNodes[] = $histogram1DNode;
  816 + }
  817 + }
  818 +
  819 + foreach ($histogram1DNodes as $histogram1DNode) {
  820 +
  821 + // xBinNumber
  822 + $histogram1DNode->getBins()->addManual1DBins($paramData->{'param-drawing-object'}->{'histo1d-xbinnumber'});
  823 +
  824 + // histotype, function
  825 + $histogram1DNode->getHistotype()->set1DFunction($paramData->{'param-drawing-object'}->{'histo1d-function'});
  826 +
  827 + }
  828 + }
  829 +
787 830 protected function unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, $indexes, $xId, $colorSerieId, $isOrbitSerie)
788 831 {
789 832 $serieNodes = array();
... ...
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotElementHistoNodeClass.php 0 โ†’ 100644
... ... @@ -0,0 +1,50 @@
  1 +<?php
  2 +
  3 +require_once("RequestOutputPlotElementNodeClass.php");
  4 +
  5 +define ("REQUESTOUTPUTPLOTELEMENTHISTO_NAME", "histoPlot");
  6 +define ("REQUESTOUTPUTPLOTELEMENTHISTO_XAXISID", "xaxis_id");
  7 +
  8 +/**
  9 + * @class RequestOutputPlotElementXYNodeClass
  10 + * @brief Definition of a histogram plot element for a panel of a plot request
  11 + * @details
  12 +*/
  13 +class RequestOutputPlotElementHistoNodeClass extends RequestOutputPlotElementNodeClass
  14 +{
  15 + public function __construct()
  16 + {
  17 + parent::__construct(REQUESTOUTPUTPLOTELEMENTHISTO_NAME,true,false,false,false,false,false);
  18 + //create x axis
  19 + $this->getAxes()->addDigitalAxis(RequestOutputPlotAxisTypeEnum::XAXIS,REQUESTOUTPUTPLOTELEMENTHISTO_XAXISID);
  20 + //force color axis creation
  21 + $this->getAxes()->getColorAxis();
  22 + }
  23 +
  24 + public function getXAxis()
  25 + {
  26 + return $this->getAxes()->getDigitalAxis(RequestOutputPlotAxisTypeEnum::XAXIS,REQUESTOUTPUTPLOTELEMENTHISTO_XAXISID);
  27 + }
  28 +
  29 + public function addYAxis($id)
  30 + {
  31 + return $this->getAxes()->addDigitalAxis(RequestOutputPlotAxisTypeEnum::YAXIS,$id);
  32 + }
  33 +
  34 + public function getYAxis($id)
  35 + {
  36 + return $this->getAxes()->getDigitalAxis(RequestOutputPlotAxisTypeEnum::YAXIS,$id);
  37 + }
  38 +
  39 + public function getZAxis()
  40 + {
  41 + return $this->getAxes()->getColorAxis();
  42 + }
  43 +
  44 + public function loadFromNode($xmlNode)
  45 + {
  46 + parent::loadFromNode($xmlNode);
  47 + }
  48 +}
  49 +
  50 +?>
0 51 \ No newline at end of file
... ...
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotHistogram1DSerieNodeClass.php 0 โ†’ 100644
... ... @@ -0,0 +1,120 @@
  1 +<?php
  2 +
  3 +require_once "RequestOutputPlotResamplingNodeClass.php";
  4 +require_once "RequestOutputPlotYSerieErrorBarNodeClass.php";
  5 +
  6 +define ("REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_NAME", "histogram1d");
  7 +define ("REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_INDEX", "index");
  8 +define ("REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_COLOR", "color");
  9 +
  10 +define ("REQUESTOUTPUTPLOTBINS_NAME", "bins");
  11 +define ("REQUESTOUTPUTPLOTBINS_MANUAL", "manual");
  12 +define ("REQUESTOUTPUTPLOTBINS_XBINNUMBER", "xbinnumber");
  13 +
  14 +define ("REQUESTOUTPUTPLOTHISTOTYPE_NAME", "histotype");
  15 +define ("REQUESTOUTPUTPLOTHISTOTYPE_FUNCTION", "type");
  16 +/**
  17 + * @class RequestOutputPlotHistogram1DSerieNodeClass
  18 + * @brief Definition of a histogram1D for a plot of a plot request
  19 + * @details
  20 +*/
  21 +
  22 +class RequestOutputPlotBins1DNodeClass extends NodeClass
  23 +{
  24 + public function __construct($name)
  25 + {
  26 + parent::__construct($name);
  27 + }
  28 +
  29 + public function addManual1DBins($xBinNumber)
  30 + {
  31 + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTBINS_MANUAL);
  32 +
  33 + if (!isset($node))
  34 + {
  35 + $node = new NodeClass(REQUESTOUTPUTPLOTBINS_MANUAL);
  36 + $this->addChild($node);
  37 + }
  38 +
  39 + $node->setAttribute(REQUESTOUTPUTPLOTBINS_XBINNUMBER, $xBinNumber);
  40 + return $node;
  41 + }
  42 +
  43 +}
  44 +
  45 +class RequestOutputPlotHistotype1DNodeClass extends NodeClass
  46 +{
  47 + public function __construct($name)
  48 + {
  49 + parent::__construct($name);
  50 + }
  51 +
  52 + public function set1DFunction($type){
  53 + $this->setAttribute(REQUESTOUTPUTPLOTHISTOTYPE_FUNCTION, $type);
  54 + }
  55 + public function get1DFunction(){
  56 + return $this->getAttribute(REQUESTOUTPUTPLOTHISTOTYPE_FUNCTION);
  57 + }
  58 +}
  59 +
  60 +class RequestOutputPlotHistogram1DSerieNodeClass extends RequestOutputPlotBaseSerieNodeClass
  61 +{
  62 + public function __construct($name)
  63 + {
  64 + parent::__construct($name);
  65 + }
  66 +
  67 + public function getBins()
  68 + {
  69 + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTBINS_NAME);
  70 +
  71 + if (!isset($node))
  72 + {
  73 + $node = new RequestOutputPlotBins1DNodeClass(REQUESTOUTPUTPLOTBINS_NAME);
  74 + $this->addChild($node);
  75 + }
  76 +
  77 + return $node;
  78 + }
  79 +
  80 + public function getHistotype()
  81 + {
  82 + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTHISTOTYPE_NAME);
  83 +
  84 + if (!isset($node))
  85 + {
  86 + $node = new RequestOutputPlotHistotype1DNodeClass(REQUESTOUTPUTPLOTHISTOTYPE_NAME);
  87 + $this->addChild($node);
  88 + }
  89 +
  90 + return $node;
  91 + }
  92 +
  93 + public function setColor($color)
  94 + {
  95 + $this->setAttribute(REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_COLOR, $color);
  96 + }
  97 +
  98 + public function getColor()
  99 + {
  100 + return $this->getAttribute(REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_COLOR);
  101 + }
  102 +
  103 + public function setIndex($index)
  104 + {
  105 + $this->setAttribute(REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_INDEX, $index);
  106 + }
  107 +
  108 + public function getIndex()
  109 + {
  110 + return $this->getAttribute(REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_INDEX);
  111 + }
  112 +
  113 + public function loadFromNode($xmlNode)
  114 + {
  115 + $this->setIndex($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_INDEX));
  116 + parent::loadFromNode($xmlNode);
  117 + }
  118 +}
  119 +
  120 +?>
... ...
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotPanelNodeClass.php
... ... @@ -23,6 +23,7 @@ abstract class RequestOutputPlotElementTypeEnum
23 23 {
24 24 const TIMEPLOT = "TimePlot";
25 25 const XYPLOT = "XYPlot";
  26 + const HISTOPLOT = "HistoPlot";
26 27 const STATUSPLOT = "StatusPlot";
27 28 const TICKPLOT = "TickPlot";
28 29 const EPOCHPLOT = "EpochPlot";
... ... @@ -107,6 +108,9 @@ class RequestOutputPlotPanelNodeClass extends NodeClass
107 108 case RequestOutputPlotElementTypeEnum::XYPLOT:
108 109 $node = new RequestOutputPlotElementXYNodeClass();
109 110 break;
  111 + case RequestOutputPlotElementTypeEnum::HISTOPLOT:
  112 + $node = new RequestOutputPlotElementHistoNodeClass();
  113 + break;
110 114 case RequestOutputPlotElementTypeEnum::STATUSPLOT:
111 115 $node = new RequestOutputPlotElementStatusNodeClass($noAxes);
112 116 break;
... ...
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotParamsNodeClass.php
... ... @@ -115,6 +115,18 @@ class RequestOutputPlotParamNodeClass extends NodeClass
115 115 return $histogram2dNode;
116 116 }
117 117  
  118 + public function addHistogram1DSerie($yAxis, $index, $color)
  119 + {
  120 + $histogram1dNode = new RequestOutputPlotHistogram1DSerieNodeClass(REQUESTOUTPUTPLOTHISTOGRAM1DSERIE_NAME);
  121 + $histogram1dNode->setColor($color);
  122 + $histogram1dNode->setXAxisId(REQUESTOUTPUTPLOTELEMENTXY_XAXISID);
  123 + $histogram1dNode->setYAxisId($yAxis);
  124 + if ($index >= 0)
  125 + $histogram1dNode->setIndex($index);
  126 + $this->addChild($histogram1dNode);
  127 + return $histogram1dNode;
  128 + }
  129 +
118 130 public function addOrbitSerie($yAxis, $colorSerieId = -1)
119 131 {
120 132 $orbitSerieNode = new RequestOutputPlotOrbitSerieNodeClass();
... ...