Commit f012b419c12cb1605d798d67f503f9c694a2864e

Authored by Benjamin Renard
1 parent b4ee5e62

Add integration for time tick defintion

src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
... ... @@ -142,7 +142,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
142 142 }
143 143  
144 144 if ($tab->{'page-font-activated'})
145   - $this->unmarshallFont($tab, 'page', $pageNode->getFont());
  145 + $this->unmarshallFont($tab, 'page-font', $pageNode->getFont());
146 146  
147 147 //Superpose mode
148 148 $pageNode->setSuperposeMode($tab->{'page-superpose-mode'} ? "true": "false");
... ... @@ -261,7 +261,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
261 261 $panelNode->setBackgroundColor($this->hexColor2KernelColor($panelData->{'panel-background-color'}));
262 262  
263 263 //Panel font
264   - $this->unmarshallFont($panelData, 'panel', $panelNode->getFont());
  264 + $this->unmarshallFont($panelData, 'panel-font', $panelNode->getFont());
265 265  
266 266 //Panel title
267 267 $this->unmarshallTitle($panelData, 'panel-title', $panelNode->getTitle());
... ... @@ -438,6 +438,12 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
438 438 $axisNode->getLegend()->setText($axisData->{'axis-legend-text'});
439 439 $axisNode->getLegend()->setColor($this->hexColor2KernelColor($axisData->{'axis-legend-color'}));
440 440 $this->unmarshallLabel($axisData, "axis-legend", $axisNode->getLegend());
  441 +
  442 + //Show legend
  443 + $axisNode->setShowLegend($axisData->{'axis-legend-activated'} ? "true" : "false");
  444 +
  445 + //Show tick marks
  446 + $axisNode->setShowTickMarks($axisData->{'axis-tick-showmarks'} ? "true" : "false");
441 447 }
442 448  
443 449 protected function unmarshallParams($paramsData, $requestParamsNode, $plotNode, $panelNode, $statusPlotNode, $tickPlotNode)
... ... @@ -585,10 +591,48 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
585 591 //Line
586 592 $this->unmarshallLine($paramDrawingData, 'serie', $serieNode->getLine());
587 593 //Symbol
588   - $this->unmarshallSymbol($paramDrawingData, 'serie', $serieNode->getSymbol());
  594 + if (!$paramDrawingData->{"serie-symbols-activated"})
  595 + $serieNode->getSymbol()->setType(RequestOutputPlotSymbolTypeEnum::NO);
  596 + else
  597 + $this->unmarshallSymbol($paramDrawingData, 'serie-symbols', $serieNode->getSymbol());
  598 + //Time tick
  599 + if (isset($paramDrawingData->{'serie-timetick'}))
  600 + $this->unmarshallTimeTick($paramDrawingData->{'serie-timetick'}, $serieNode->getTimeTicks());
589 601 }
590 602 }
591 603  
  604 + protected function unmarshallTimeTick($timeTickData, $timeTickNode)
  605 + {
  606 + //Font
  607 + if ($timeTickData->{'serie-timetick-font-activated'})
  608 + $this->unmarshallFont($timeTickData, 'serie-timetick-font', $timeTickNode->getFont());
  609 + //First Symbol
  610 + if ($timeTickData->{'serie-timetick-firstsymbols-activated'})
  611 + $this->unmarshallSymbol($timeTickData, 'serie-timetick-firstsymbols', $timeTickNode->getFirstSymbol());
  612 + //Symbol
  613 + $this->unmarshallSymbol($timeTickData, 'serie-timetick-symbols', $timeTickNode->getSymbol());
  614 + //Set options by type
  615 + switch ($timeTickData->{'serie-timetick-type'})
  616 + {
  617 + case 'time-step' :
  618 + $timeTickNode->setStep(CommonClass::timeStampToDDTime($timeTickData->{'serie-timetick-step'}));
  619 + $timeTickNode->setNumber(0);
  620 + break;
  621 + case 'nb-major' :
  622 + $timeTickNode->setStep(0);
  623 + $timeTickNode->setNumber($timeTickData->{'serie-timetick-nbmajor'});
  624 + break;
  625 + case 'auto' :
  626 + default :
  627 + $timeTickNode->setStep('auto');
  628 + $timeTickNode->setNumber(0);
  629 + }
  630 + //Minor
  631 + $timeTickNode->setMinor($timeTickData->{'serie-timetick-nbminor'});
  632 + //Color
  633 + $timeTickNode->setColor($this->hexColor2KernelColor($timeTickData->{'serie-timetick-color'}));
  634 + }
  635 +
592 636 protected function unmarshallInstantSerie($paramDrawingData, $plotNode, $paramNode)
593 637 {
594 638 $iserieNode = $paramNode->addInstantSerie(REQUESTOUTPUTPLOTELEMENTXY_XAXISID, 'y-left');
... ... @@ -600,7 +644,10 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
600 644 $this->unmarshallLine($paramDrawingData, 'iserie', $iserieNode->getLine());
601 645  
602 646 //Symbol
603   - $this->unmarshallSymbol($paramDrawingData, 'iserie', $iserieNode->getSymbol());
  647 + if (!$paramDrawingData->{"iserie-symbols-activated"})
  648 + $iserieNode->getSymbol()->setType(RequestOutputPlotSymbolTypeEnum::NO);
  649 + else
  650 + $this->unmarshallSymbol($paramDrawingData, 'iserie-symbols', $iserieNode->getSymbol());
604 651 }
605 652  
606 653 protected function unmarshallSpectro($paramDrawingData, $plotNode, $paramNode, $indexes)
... ... @@ -703,17 +750,17 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
703 750  
704 751 protected function unmarshallFont($inputData, $keyPrefix, $fontNode)
705 752 {
706   - if ($inputData->{$keyPrefix.'-font-activated'})
  753 + if ($inputData->{$keyPrefix.'-activated'})
707 754 {
708   - $fontNode->setFontName($inputData->{$keyPrefix.'-font-name'});
709   - $fontNode->setSize($inputData->{$keyPrefix.'-font-size'});
  755 + $fontNode->setFontName($inputData->{$keyPrefix.'-name'});
  756 + $fontNode->setSize($inputData->{$keyPrefix.'-size'});
710 757  
711   - if ($inputData->{$keyPrefix.'-font-italic'})
  758 + if ($inputData->{$keyPrefix.'-italic'})
712 759 $fontNode->setStyle(RequestOutputPlotFontStyle::ITALIC);
713 760 else
714 761 $fontNode->setStyle(RequestOutputPlotFontStyle::UPRIGHT);
715 762  
716   - if ($inputData->{$keyPrefix.'-font-bold'})
  763 + if ($inputData->{$keyPrefix.'-bold'})
717 764 $fontNode->setWeight(RequestOutputPlotFontWeight::BOLD);
718 765 else
719 766 $fontNode->setWeight(RequestOutputPlotFontWeight::MEDIUM);
... ... @@ -759,13 +806,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
759 806  
760 807 protected function unmarshallSymbol($inputData, $keyPrefix, $symbolNode)
761 808 {
762   - if (!$inputData->{$keyPrefix."-symbols-activated"})
763   - {
764   - $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::NO);
765   - return;
766   - }
767   -
768   - switch ($inputData->{$keyPrefix.'-symbols-type'})
  809 + switch ($inputData->{$keyPrefix.'-type'})
769 810 {
770 811 case 'dot' :
771 812 $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::DOT);
... ... @@ -816,10 +857,10 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
816 857 throw new Exception('Symbol type not implemented.');
817 858 }
818 859  
819   - $symbolNode->setSize($inputData->{$keyPrefix.'-symbols-size'});
  860 + $symbolNode->setSize($inputData->{$keyPrefix.'-size'});
820 861  
821   - if ($inputData->{$keyPrefix.'-symbols-color'} != 'auto')
822   - $symbolNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix.'-symbols-color'}));
  862 + if ($inputData->{$keyPrefix.'-color'} != 'auto')
  863 + $symbolNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix.'-color'}));
823 864 }
824 865  
825 866 /*
... ...
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotAxisElementNodeClass.php
... ... @@ -6,6 +6,8 @@ define ("REQUESTOUTPUTPLOTAXISELEMENT_VISIBLE", "visible");
6 6 define ("REQUESTOUTPUTPLOTAXISELEMENT_SCALE", "scale");
7 7 define ("REQUESTOUTPUTPLOTAXISELEMENT_COLOR", "color");
8 8 define ("REQUESTOUTPUTPLOTAXISELEMENT_THICKNESS", "thickness");
  9 +define ("REQUESTOUTPUTPLOTAXISELEMENT_SHOWLEGEND", "showLegend");
  10 +define ("REQUESTOUTPUTPLOTAXISELEMENT_TICKMARKS", "showTickMark");
9 11  
10 12 define ("REQUESTOUTPUTPLOTAXISELEMENTRANGE_NAME", "range");
11 13 define ("REQUESTOUTPUTPLOTAXISELEMENTRANGE_MIN", "min");
... ... @@ -250,9 +252,25 @@ class RequestOutputPlotAxisElementNodeClass extends NodeClass
250 252 return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_SCALE);
251 253 }
252 254  
253   - /* ToDo showLegend */
254   -
255   - /* ToDo showTickMark */
  255 + public function setShowLegend($show)
  256 + {
  257 + $this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_SHOWLEGEND, $show);
  258 + }
  259 +
  260 + public function getShowLegend()
  261 + {
  262 + return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_SHOWLEGEND);
  263 + }
  264 +
  265 + public function setShowTickMarks($show)
  266 + {
  267 + $this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_TICKMARKS, $show);
  268 + }
  269 +
  270 + public function getShowTickMarks()
  271 + {
  272 + return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_TICKMARKS);
  273 + }
256 274 }
257 275  
258 276 ?>
259 277 \ No newline at end of file
... ...
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotYSerieNodeClass.php
... ... @@ -10,6 +10,7 @@ define ("REQUESTOUTPUTPLOTYSERIE_COLORSERIEID", "colorSerieId");
10 10 define ("REQUESTOUTPUTPLOTYSERIE_RESAMPLING", "resampling");
11 11 define ("REQUESTOUTPUTPLOTYSERIE_LINE", "line");
12 12 define ("REQUESTOUTPUTPLOTYSERIE_SYMBOL", "symbol");
  13 +define ("REQUESTOUTPUTPLOTYSERIE_TIMETICKS", "timeTick");
13 14  
14 15 /**
15 16 * @class RequestOutputPlotYSerieNodeClass
... ... @@ -101,6 +102,19 @@ class RequestOutputPlotYSerieNodeClass extends NodeClass
101 102  
102 103 return $node;
103 104 }
  105 +
  106 + public function getTimeTicks()
  107 + {
  108 + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTYSERIE_TIMETICKS);
  109 +
  110 + if (!isset($node))
  111 + {
  112 + $node = new RequestOutputPlotYSerieTimeTicksNodeClass(REQUESTOUTPUTPLOTYSERIE_TIMETICKS);
  113 + $this->addChild($node);
  114 + }
  115 +
  116 + return $node;
  117 + }
104 118 }
105 119  
106 120 ?>
107 121 \ No newline at end of file
... ...
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotYSerieTimeTicksNodeClass.php 0 โ†’ 100644
... ... @@ -0,0 +1,102 @@
  1 +<?php
  2 +
  3 +define ("REQUESTOUTPUTPLOTYSERIETIMETICKS_STEP", "step");
  4 +define ("REQUESTOUTPUTPLOTYSERIETIMETICKS_NUMBER", "number");
  5 +define ("REQUESTOUTPUTPLOTYSERIETIMETICKS_MINOR", "minor");
  6 +define ("REQUESTOUTPUTPLOTYSERIETIMETICKS_COLOR", "color");
  7 +define ("REQUESTOUTPUTPLOTYSERIETIMETICKS_SYMBOL", "symbol");
  8 +define ("REQUESTOUTPUTPLOTYSERIETIMETICKS_FIRSTSYMBOL", "firstSymbol");
  9 +
  10 +/**
  11 + * @class RequestOutputPlotYSerieTimeTicksNodeClass
  12 + * @brief Definition of time ticks element for a yserie of a plot
  13 + * @details
  14 + */
  15 +class RequestOutputPlotYSerieTimeTicksNodeClass extends NodeClass
  16 +{
  17 + public function __construct($name)
  18 + {
  19 + parent::__construct($name);
  20 + }
  21 +
  22 + public function getSymbol()
  23 + {
  24 + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTYSERIETIMETICKS_SYMBOL);
  25 +
  26 + if (!isset($node))
  27 + {
  28 + $node = new RequestOutputPlotSymbolNodeClass(REQUESTOUTPUTPLOTYSERIETIMETICKS_SYMBOL);
  29 + $this->addChild($node);
  30 + }
  31 +
  32 + return $node;
  33 + }
  34 +
  35 + public function getFirstSymbol()
  36 + {
  37 + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTYSERIETIMETICKS_FIRSTSYMBOL);
  38 +
  39 + if (!isset($node))
  40 + {
  41 + $node = new RequestOutputPlotSymbolNodeClass(REQUESTOUTPUTPLOTYSERIETIMETICKS_FIRSTSYMBOL);
  42 + $this->addChild($node);
  43 + }
  44 +
  45 + return $node;
  46 + }
  47 +
  48 + public function getFont()
  49 + {
  50 + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTFONT_NODENAME);
  51 +
  52 + if (!isset($node))
  53 + {
  54 + $node = new RequestOutputPlotFontNodeClass();
  55 + $this->addChild($node);
  56 + }
  57 +
  58 + return $node;
  59 + }
  60 +
  61 + public function setStep($step)
  62 + {
  63 + $this->setAttribute(REQUESTOUTPUTPLOTYSERIETIMETICKS_STEP, $step);
  64 + }
  65 +
  66 + public function getStep()
  67 + {
  68 + return $this->getAttribute(REQUESTOUTPUTPLOTYSERIETIMETICKS_STEP);
  69 + }
  70 +
  71 + public function setNumber($number)
  72 + {
  73 + $this->setAttribute(REQUESTOUTPUTPLOTYSERIETIMETICKS_NUMBER, $number);
  74 + }
  75 +
  76 + public function getNumber()
  77 + {
  78 + return $this->getAttribute(REQUESTOUTPUTPLOTYSERIETIMETICKS_NUMBER);
  79 + }
  80 +
  81 + public function setMinor($minor)
  82 + {
  83 + $this->setAttribute(REQUESTOUTPUTPLOTYSERIETIMETICKS_MINOR, $minor);
  84 + }
  85 +
  86 + public function getMinor()
  87 + {
  88 + return $this->getAttribute(REQUESTOUTPUTPLOTYSERIETIMETICKS_MINOR);
  89 + }
  90 +
  91 + public function setColor($color)
  92 + {
  93 + $this->setAttribute(REQUESTOUTPUTPLOTYSERIETIMETICKS_COLOR, $color);
  94 + }
  95 +
  96 + public function getColor()
  97 + {
  98 + return $this->getAttribute(REQUESTOUTPUTPLOTYSERIETIMETICKS_COLOR);
  99 + }
  100 +}
  101 +
  102 +?>
0 103 \ No newline at end of file
... ...