Commit 61e606085499155ebff845c471c1000f4e98cda1

Authored by Erdogan Furkan
1 parent 4f5b34a4

For now, histo1D working

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
... ... @@ -365,6 +364,9 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
365 364  
366 365 protected function unmarshallPlotType($panelData, $panelNode)
367 366 {
  367 +
  368 +
  369 + error_log($panelData->{'panel-plot-type'});
368 370 switch ($panelData->{'panel-plot-type'}) {
369 371 case 'timePlot':
370 372 $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::TIMEPLOT);
... ... @@ -373,6 +375,9 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
373 375 $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::XYPLOT);
374 376 $plotNode->setIsIsotropic($panelData->{'panel-scatter-isotropic'});
375 377 break;
  378 + case 'histoPlot':
  379 + $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::HISTOPLOT);
  380 + break;
376 381 case 'statusPlot':
377 382 $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::STATUSPLOT);
378 383 switch ($panelData->{'panel-status-position'}) {
... ... @@ -629,6 +634,10 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
629 634 $paramZInfo = NULL;
630 635 $this->unmarshallHistogram2D($paramData, $requestParamsNode, $plotNode, $paramNode, $paramInfo['indexes'], $xId, $paramZInfo,$axesData);
631 636 break;
  637 + case 'histogram1d':
  638 + $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']);
  639 + $this->unmarshallHistogram1D($paramData, $requestParamsNode, $plotNode, $paramNode, $paramInfo['indexes']);
  640 + break;
632 641 case 'orbit-serie':
633 642 $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']);
634 643 $this->unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, -1, $xId, $colorSerieId, true);
... ... @@ -766,6 +775,42 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
766 775 }
767 776 }
768 777  
  778 + protected function unmarshallHistogram1D($paramData, $requestParamsNode, $plotNode, $paramNode, $indexes)
  779 + {
  780 + $histogram1DNodes = array();
  781 + if ($paramData->{'param-drawing-object'}->{'histo1d-color'} == "none") {
  782 + $color = NULL;
  783 + } else {
  784 + $color = $this->hexColor2KernelColor($paramData->{'param-drawing-object'}->{'histo1d-color'});
  785 + }
  786 +
  787 + if (count($indexes) == 0) {
  788 + $histogram1DNode = $paramNode->addHistogram1DSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, -1, $color);
  789 + if (isset($histogram1DNode)) {
  790 + $histogram1DNode->setId($paramData->{'id'});
  791 + $histogram1DNodes[] = $histogram1DNode;
  792 + }
  793 + }
  794 + foreach ($indexes as $index) {
  795 + $histogram1DNode = $paramNode->addHistogram1DSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, $index, $color);
  796 + if (isset($histogram1DNode)) {
  797 + if (count($indexes) == 1)
  798 + $histogram1DNode->setId($paramData->{'id'});
  799 + $histogram1DNodes[] = $histogram1DNode;
  800 + }
  801 + }
  802 +
  803 + foreach ($histogram1DNodes as $histogram1DNode) {
  804 +
  805 + // xBinNumber
  806 + $histogram1DNode->getBins()->addManual1DBins($paramData->{'param-drawing-object'}->{'histo1d-xbinnumber'});
  807 +
  808 + // histotype, function
  809 + $histogram1DNode->getHistotype()->set1DFunction($paramData->{'param-drawing-object'}->{'histo1d-function'});
  810 +
  811 + }
  812 + }
  813 +
769 814 protected function unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, $indexes, $xId, $colorSerieId, $isOrbitSerie)
770 815 {
771 816 $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();
... ...