Commit bbe4d005c1fdc8ba887f0737e6157e4b640c17b7

Authored by Benjamin Renard
1 parent d7f73bcb

Integration for fill elements

src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
... ... @@ -314,6 +314,10 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
314 314 if ($plotNode->getAdditionalObjects() != NULL)
315 315 $this->unmarshallAdditionalObjects($panelData, $plotNode->getAdditionalObjects(), $isTimePlot);
316 316  
  317 + //Fills
  318 + if ($plotNode->getFills() != NULL)
  319 + $this->unmarshallFills($panelData, $plotNode->getFills());
  320 +
317 321 return $panelNode;
318 322 }
319 323  
... ... @@ -914,6 +918,39 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
914 918 $this->unmarshallCurve($curveData, "curve-line", $curveNode);
915 919 }
916 920  
  921 + protected function unmarshallFills($panelData, $fillsNode)
  922 + {
  923 + foreach ($panelData->{'fills'} as $fillData)
  924 + {
  925 + //Serie / Constant
  926 + if ($fillData->{'fill-type'} == 'serie-constant')
  927 + {
  928 + $fillNode = $fillsNode->addFill(RequestOutputPlotFillTypeEnum::SERIECONSTANT);
  929 + $fillNode->setSerieId($fillData->{'fill-firstserie-id'});
  930 + $fillNode->setConstantId($fillData->{'fill-constant-id'});
  931 + if ($fillData->{'fill-greater-color'} != 'none')
  932 + $fillNode->setGreaterColor($this->hexColor2KernelColor($fillData->{'fill-greater-color'}));
  933 + if ($fillData->{'fill-less-color'} != 'none')
  934 + $fillNode->setLessColor($this->hexColor2KernelColor($fillData->{'fill-less-color'}));
  935 + }
  936 + }
  937 +
  938 + foreach ($panelData->{'fills'} as $fillData)
  939 + {
  940 + //Serie / Serie
  941 + if ($fillData->{'fill-type'} == 'serie-serie')
  942 + {
  943 + $fillNode = $fillsNode->addFill(RequestOutputPlotFillTypeEnum::SERIESERIE);
  944 + $fillNode->setFirstSerieId($fillData->{'fill-firstserie-id'});
  945 + $fillNode->setSecondSerieId($fillData->{'fill-secondserie-id'});
  946 + if ($fillData->{'fill-greater-color'} != 'none')
  947 + $fillNode->setGreaterColor($this->hexColor2KernelColor($fillData->{'fill-greater-color'}));
  948 + if ($fillData->{'fill-less-color'} != 'none')
  949 + $fillNode->setLessColor($this->hexColor2KernelColor($fillData->{'fill-less-color'}));
  950 + }
  951 + }
  952 + }
  953 +
917 954 protected function unmarshallTitle($inputData, $keyPrefix, $titleNode)
918 955 {
919 956 if ($inputData->{$keyPrefix.'-text'} != '')
... ...
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotElementNodeClass.php
... ... @@ -44,12 +44,12 @@ class RequestOutputPlotElementNodeClass extends NodeClass
44 44 $this->addChild($node);
45 45 }
46 46  
47   - //ToDo fills
48   - /*if ($defineFills)
  47 + //fills
  48 + if ($defineFills)
49 49 {
50   - $node = new RequestOutputPlotFillsNodeClass();
51   - $this->addChild($node);
52   - }*/
  50 + $node = new RequestOutputPlotFillsNodeClass();
  51 + $this->addChild($node);
  52 + }
53 53 }
54 54  
55 55 public function getLegends()
... ...
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotFillNodeClass.php 0 → 100644
... ... @@ -0,0 +1,39 @@
  1 +<?php
  2 +
  3 +define ("REQUESTOUTPUTPLOTFILL_GREATERCOLOR", "colorGreater");
  4 +define ("REQUESTOUTPUTPLOTFILL_LESSCOLOR", "colorLess");
  5 +
  6 +/**
  7 + * @class RequestOutputPlotFillNodeClass
  8 + * @brief Definition of fill for a plot
  9 + * @details
  10 + */
  11 +class RequestOutputPlotFillNodeClass extends NodeClass
  12 +{
  13 + public function __construct($name)
  14 + {
  15 + parent::__construct($name);
  16 + }
  17 +
  18 + public function setGreaterColor($color)
  19 + {
  20 + $this->setAttribute(REQUESTOUTPUTPLOTFILL_GREATERCOLOR, $color);
  21 + }
  22 +
  23 + public function getGreaterColor()
  24 + {
  25 + return $this->getAttribute(REQUESTOUTPUTPLOTFILL_GREATERCOLOR);
  26 + }
  27 +
  28 + public function setLessColor($color)
  29 + {
  30 + $this->setAttribute(REQUESTOUTPUTPLOTFILL_LESSCOLOR, $color);
  31 + }
  32 +
  33 + public function getLessColor()
  34 + {
  35 + return $this->getAttribute(REQUESTOUTPUTPLOTFILL_LESSCOLOR);
  36 + }
  37 +}
  38 +
  39 +?>
0 40 \ No newline at end of file
... ...
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotFillSerieConstantNodeClass.php 0 → 100644
... ... @@ -0,0 +1,40 @@
  1 +<?php
  2 +
  3 +define ("REQUESTOUTPUTPLOTFILLSERIECONSTANT_NAME", "fillSerieConstant");
  4 +define ("REQUESTOUTPUTPLOTFILLSERIECONSTANT_SERIEID", "serieId");
  5 +define ("REQUESTOUTPUTPLOTFILLSERIECONSTANT_CONSTANTID", "constantId");
  6 +
  7 +/**
  8 + * @class RequestOutputPlotFillSerieConstantNodeClass
  9 + * @brief Definition of fill serie/constant for a plot
  10 + * @details
  11 + */
  12 +class RequestOutputPlotFillSerieConstantNodeClass extends RequestOutputPlotFillNodeClass
  13 +{
  14 + public function __construct()
  15 + {
  16 + parent::__construct(REQUESTOUTPUTPLOTFILLSERIECONSTANT_NAME);
  17 + }
  18 +
  19 + public function setSerieId($id)
  20 + {
  21 + $this->setAttribute(REQUESTOUTPUTPLOTFILLSERIECONSTANT_SERIEID, $id);
  22 + }
  23 +
  24 + public function getSerieId()
  25 + {
  26 + return $this->getAttribute(REQUESTOUTPUTPLOTFILLSERIECONSTANT_SERIEID);
  27 + }
  28 +
  29 + public function setConstantId($id)
  30 + {
  31 + $this->setAttribute(REQUESTOUTPUTPLOTFILLSERIECONSTANT_CONSTANTID, $id);
  32 + }
  33 +
  34 + public function getConstantId()
  35 + {
  36 + return $this->getAttribute(REQUESTOUTPUTPLOTFILLSERIECONSTANT_CONSTANTID);
  37 + }
  38 +}
  39 +
  40 +?>
0 41 \ No newline at end of file
... ...
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotFillSerieSerieNodeClass.php 0 → 100644
... ... @@ -0,0 +1,40 @@
  1 +<?php
  2 +
  3 +define ("REQUESTOUTPUTPLOTFILLSERIESERIE_NAME", "fillSerieSerie");
  4 +define ("REQUESTOUTPUTPLOTFILLSERIESERIE_FIRSTSERIEID", "firstSerieId");
  5 +define ("REQUESTOUTPUTPLOTFILLSERIESERIE_SECONDSERIEID", "secondSerieId");
  6 +
  7 +/**
  8 + * @class RequestOutputPlotFillSerieSerieNodeClass
  9 + * @brief Definition of fill serie/serie for a plot
  10 + * @details
  11 + */
  12 +class RequestOutputPlotFillSerieSerieNodeClass extends RequestOutputPlotFillNodeClass
  13 +{
  14 + public function __construct()
  15 + {
  16 + parent::__construct(REQUESTOUTPUTPLOTFILLSERIESERIE_NAME);
  17 + }
  18 +
  19 + public function setFirstSerieId($id)
  20 + {
  21 + $this->setAttribute(REQUESTOUTPUTPLOTFILLSERIESERIE_FIRSTSERIEID, $id);
  22 + }
  23 +
  24 + public function getFirstSerieId()
  25 + {
  26 + return $this->getAttribute(REQUESTOUTPUTPLOTFILLSERIESERIE_FIRSTSERIEID);
  27 + }
  28 +
  29 + public function setSecondSerieId($id)
  30 + {
  31 + $this->setAttribute(REQUESTOUTPUTPLOTFILLSERIESERIE_SECONDSERIEID, $id);
  32 + }
  33 +
  34 + public function getSecondSerieId()
  35 + {
  36 + return $this->getAttribute(REQUESTOUTPUTPLOTFILLSERIESERIE_SECONDSERIEID);
  37 + }
  38 +}
  39 +
  40 +?>
0 41 \ No newline at end of file
... ...
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotFillsNodeClass.php 0 → 100644
... ... @@ -0,0 +1,41 @@
  1 +<?php
  2 +
  3 +define ("REQUESTOUTPUTPLOTFILLS_NAME", "fills");
  4 +
  5 +abstract class RequestOutputPlotFillTypeEnum
  6 +{
  7 + const SERIESERIE = "serie-serie";
  8 + const SERIECONSTANT = "serie-constant";
  9 +}
  10 +
  11 +/**
  12 + * @class RequestOutputPlotFillsNodeClass
  13 + * @brief Definition of fills for a plot
  14 + * @details
  15 + */
  16 +class RequestOutputPlotFillsNodeClass extends NodeClass
  17 +{
  18 + public function __construct()
  19 + {
  20 + parent::__construct(REQUESTOUTPUTPLOTFILLS_NAME);
  21 + }
  22 +
  23 + public function addFill($type)
  24 + {
  25 + switch ($type)
  26 + {
  27 + case RequestOutputPlotFillTypeEnum::SERIECONSTANT :
  28 + $node = new RequestOutputPlotFillSerieConstantNodeClass();
  29 + break;
  30 + case RequestOutputPlotFillTypeEnum::SERIESERIE :
  31 + default :
  32 + $node = new RequestOutputPlotFillSerieSerieNodeClass();
  33 + break;
  34 + }
  35 +
  36 + $this->addChild($node);
  37 + return $node;
  38 + }
  39 +}
  40 +
  41 +?>
0 42 \ No newline at end of file
... ...