diff --git a/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php b/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php index c27eb21..42dede2 100644 --- a/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php +++ b/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php @@ -357,6 +357,10 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass throw new Exception('Plot type not implemented.'); } + //Params Legends + if (isset($panelData->{'panel-series-legend'}) && $panelData->{'panel-series-legend'}->{'legend-series-activated'}) + $this->unmarshallParamsLegend($panelData->{'panel-series-legend'}, $plotNode->getLegends()->getParamsLegend()); + return $plotNode; } @@ -687,6 +691,61 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass return false; } + protected function unmarshallParamsLegend($paramsLegendData, $paramsLegendNode) + { + //Legend type + switch ($paramsLegendData->{'legend-series-type'}) + { + case 'text-line-symbol' : + $paramsLegendNode->setType(RequestOutputPlotParamsLegendTypeEnum::TEXTLINESYMBOL); + break; + case 'text-only' : + default : + $paramsLegendNode->setType(RequestOutputPlotParamsLegendTypeEnum::TEXTONLY); + } + + //Show param legend + $paramsLegendNode->setShowParamInfo($paramsLegendData->{'legend-series-showparaminfo'} ? "true" : "false"); + + //Show interval legend + $paramsLegendNode->setShowIntervalInfo($paramsLegendData->{'legend-series-intervalinfo-activated'} ? "true" : "false"); + + //Interval info type + switch ($paramsLegendData->{'legend-series-intervalinfo-type'}) + { + case 'start-stop' : + $paramsLegendNode->setIntervalInfoType(RequestOutputPlotParamsLegendIntervalInfoTypeEnum::STARTSTOP); + break; + case 'index' : + default : + $paramsLegendNode->setIntervalInfoType(RequestOutputPlotParamsLegendIntervalInfoTypeEnum::INDEX); + } + + //Position + switch ($paramsLegendData->{'legend-series-position'}) + { + case 'inside' : + $paramsLegendNode->setPosition(RequestOutputPlotParamsLegendPositionEnum::INSIDE); + break; + case 'outside' : + default : + $paramsLegendNode->setPosition(RequestOutputPlotParamsLegendPositionEnum::OUTSIDE); + } + + //Default text color + $paramsLegendNode->setDefaultTextColor($this->hexColor2KernelColor($paramsLegendData->{'legend-series-defaulttextcolor'})); + + //Border visible + $paramsLegendNode->setBorderVisible($paramsLegendData->{'legend-series-border-activated'} ? "true" : "false"); + + //Border color + $paramsLegendNode->setBorderColor($this->hexColor2KernelColor($paramsLegendData->{'legend-series-border-color'})); + + //Font + if ($paramsLegendData->{'legend-series-font-activated'}) + $this->unmarshallFont($paramsLegendData, 'legend-series-font', $paramsLegendNode->getFont()); + } + protected function unmarshallTitle($inputData, $keyPrefix, $titleNode) { if ($inputData->{$keyPrefix.'-text'} != '') diff --git a/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotElementNodeClass.php b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotElementNodeClass.php index 9746e15..3da8701 100644 --- a/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotElementNodeClass.php +++ b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotElementNodeClass.php @@ -1,11 +1,13 @@ addChild($node); - }*/ + if ($defineLegends) + { + $node = new RequestOutputPlotLegendsNodeClass(REQUESTOUTPUTPLOTLEGENDS_NAME); + $this->addChild($node); + } //params $node = new RequestOutputPlotParamsNodeClass(); diff --git a/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotLegendsNodeClass.php b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotLegendsNodeClass.php new file mode 100644 index 0000000..398be82 --- /dev/null +++ b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotLegendsNodeClass.php @@ -0,0 +1,31 @@ +getFirstChildByName(REQUESTOUTPUTPLOTPARAMSLEGEND_NAME); + + if (!isset($node)) + { + $node = new RequestOutputPlotParamsLegendNodeClass(); + $this->addChild($node); + } + + return $node; + } +} + +?> \ No newline at end of file diff --git a/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotParamsLegendNodeClass.php b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotParamsLegendNodeClass.php new file mode 100644 index 0000000..aae2060 --- /dev/null +++ b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotParamsLegendNodeClass.php @@ -0,0 +1,137 @@ +setAttribute(REQUESTOUTPUTPLOTPARAMSLEGEND_TYPE, $type); + } + + public function getType() + { + return $this->getAttribute(REQUESTOUTPUTPLOTPARAMSLEGEND_TYPE); + } + + public function setShowParamInfo($show) + { + $this->setAttribute(REQUESTOUTPUTPLOTPARAMSLEGEND_SHOWPARAMINFO, $show); + } + + public function getShowParamInfo() + { + return $this->getAttribute(REQUESTOUTPUTPLOTPARAMSLEGEND_SHOWPARAMINFO); + } + + public function setShowIntervalInfo($show) + { + $this->setAttribute(REQUESTOUTPUTPLOTPARAMSLEGEND_SHOWINTERVALINFO, $show); + } + + public function getShowIntervalInfo() + { + return $this->getAttribute(REQUESTOUTPUTPLOTPARAMSLEGEND_SHOWINTERVALINFO); + } + + public function setIntervalInfoType($type) + { + $this->setAttribute(REQUESTOUTPUTPLOTPARAMSLEGEND_INTERVALINFOTYPE, $type); + } + + public function getIntervalInfoType() + { + return $this->getAttribute(REQUESTOUTPUTPLOTPARAMSLEGEND_INTERVALINFOTYPE); + } + + public function setPosition($position) + { + $this->setAttribute(REQUESTOUTPUTPLOTPARAMSLEGEND_POSITION, $position); + } + + public function getPosition() + { + return $this->getAttribute(REQUESTOUTPUTPLOTPARAMSLEGEND_POSITION); + } + + public function setDefaultTextColor($color) + { + $this->setAttribute(REQUESTOUTPUTPLOTPARAMSLEGEND_DEFAULTTEXTCOLOR, $color); + } + + public function getDefaultTextColor() + { + return $this->getAttribute(REQUESTOUTPUTPLOTPARAMSLEGEND_DEFAULTTEXTCOLOR); + } + + public function setBorderVisible($visible) + { + $this->setAttribute(REQUESTOUTPUTPLOTPARAMSLEGEND_BORDERVISIBLE, $visible); + } + + public function getBorderVisible() + { + return $this->getAttribute(REQUESTOUTPUTPLOTPARAMSLEGEND_BORDERVISIBLE); + } + + public function setBorderColor($color) + { + $this->setAttribute(REQUESTOUTPUTPLOTPARAMSLEGEND_BORDERCOLOR, $color); + } + + public function getBorderColor() + { + return $this->getAttribute(REQUESTOUTPUTPLOTPARAMSLEGEND_BORDERCOLOR); + } + + public function getFont() + { + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTPARAMSLEGEND_FONT); + + if (!isset($node)) + { + $node = new RequestOutputPlotFontNodeClass(); + $this->addChild($node); + } + + return $node; + } +} + +?> \ No newline at end of file -- libgit2 0.21.2