From 71eaac9bfece882188c27a29e3361fc56056aba2 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 8 Sep 2016 18:13:59 +0200 Subject: [PATCH] Return default axes options for a ParamInfo request --- src/InputOutput/IHMImpl/ParamInfo/IHMInputOutputParamInfoClass.php | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotAxesNodeClass.php | 5 +++-- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/InputOutput/IHMImpl/ParamInfo/IHMInputOutputParamInfoClass.php b/src/InputOutput/IHMImpl/ParamInfo/IHMInputOutputParamInfoClass.php index 08c17e2..568a95a 100644 --- a/src/InputOutput/IHMImpl/ParamInfo/IHMInputOutputParamInfoClass.php +++ b/src/InputOutput/IHMImpl/ParamInfo/IHMInputOutputParamInfoClass.php @@ -248,9 +248,56 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface return $result_data; } + $axesNode = $plotNode->getAxes(); + if (isset($axesNode)) { + $result_data['axes'] = array(); + + $colorAxis = $axesNode->getColorAxis(); + if (isset($colorAxis)) { + $result_data['axes']['color'] = array(); + $this->unmarshallAxisData($colorAxis, $result_data['axes']['color']); + } + + $xAxis = $axesNode->getDigitalAxis(RequestOutputPlotAxisTypeEnum::XAXIS, 'xaxis_id'); + if (isset($xAxis)) { + $result_data['axes']['xaxis_id'] = array(); + $this->unmarshallAxisData($xAxis, $result_data['axes']['xaxis_id']); + } + + $yLeftAxis = $axesNode->getDigitalAxis(RequestOutputPlotAxisTypeEnum::YAXIS, 'y-left'); + if (isset($yLeftAxis)) { + $result_data['axes']['y-left'] = array(); + $this->unmarshallAxisData($yLeftAxis, $result_data['axes']['y-left']); + } + + $yRightAxis = $axesNode->getDigitalAxis(RequestOutputPlotAxisTypeEnum::YAXIS, 'y-right'); + if (isset($yRightAxis)) { + $result_data['axes']['y-right'] = array(); + $this->unmarshallAxisData($yRightAxis, $result_data['axes']['y-right']); + } + } + return $result_data; } + private function unmarshallAxisData($axisNode, &$result_array) { + if (!isset($axisNode)) + return; + + $scale = $axisNode->getScale(); + if (isset($scale)) + $result_array['axis-scale'] = $scale; + $rangeNode = $axisNode->getRange(); + if (isset($rangeNode)) { + $rangeMin = $rangeNode->getMin(); + if (isset($rangeMin)) + $result_array['axis-range-min'] = $rangeMin; + $rangeMax = $rangeNode->getMax(); + if (isset($rangeMax)) + $result_array['axis-range-max'] = $rangeMax; + } + } + private function unmarshallSpectroData($drawNode, &$result_array) { if (!isset($drawNode)) return; diff --git a/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotAxesNodeClass.php b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotAxesNodeClass.php index e32be47..e3c5b57 100644 --- a/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotAxesNodeClass.php +++ b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotAxesNodeClass.php @@ -131,9 +131,10 @@ class RequestOutputPlotAxesNodeClass extends NodeClass $zaxisXmlNode = $this->getXmlNodeChildByTagName($xmlNode, REQUESTOUTPUTPLOTAXES_ZAXIS); if (isset($zaxisXmlNode)) { - $colorXmlNode = $this->getXmlNodeChildByTagName($xaxisXmlNode, REQUESTOUTPUTPLOTCOLORAXIS_NAME); - if (isset($colorXmlNode)) + $colorXmlNode = $this->getXmlNodeChildByTagName($zaxisXmlNode, REQUESTOUTPUTPLOTCOLORAXIS_NAME); + if (isset($colorXmlNode)) { $this->getColorAxis()->loadFromNode($colorXmlNode); + } } } } -- libgit2 0.21.2