From 95ab3cf6b101abfdf7d3ca9ec4543af7aff1ebbf Mon Sep 17 00:00:00 2001 From: Menouar AZIB Date: Thu, 25 Nov 2021 09:28:44 +0100 Subject: [PATCH] Prise en compte des paramètres de BS coté AMDA intégration --- config/kernel/plugins.xml | 2 ++ src/InputOutput/IHMImpl/ParamInfo/IHMInputOutputParamInfoClass.php | 409 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php | 1363 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotParamsNodeClass.php | 148 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------- 4 files changed, 930 insertions(+), 992 deletions(-) create mode 100644 config/kernel/plugins.xml diff --git a/config/kernel/plugins.xml b/config/kernel/plugins.xml new file mode 100644 index 0000000..1096f40 --- /dev/null +++ b/config/kernel/plugins.xml @@ -0,0 +1,2 @@ + +/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libConstantInterface.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libDDServerInterface.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libLocalFileInterface.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libParamOutputDataMiningImpl.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libParamOutputImpl.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libParamOutputIntervalTrueImpl.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libParamOutputStatisticImpl.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libFramesTransformation.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libFramesTransformation.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libtsyganenko96.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libtsyganenko96.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libCain_2003Process.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libBoxcar.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libDeriv.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libEnergy_Bounds.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libdataFiltring.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libFramesTransformation.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libGetClbInfo.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libGetClbInfoByIndex.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libGetJunoJediEnergy.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libGetMavenStaticEnergy.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libJupeter_JRM09_CAN_81Process.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libJupeter_JRM09_CAN_81Process.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libJupeter_JRM09_CAN_81Process.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libmaglibProcess.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libmaglibProcess.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libmaglibProcess.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libMerge.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libmexvex_els_decode.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libMorschhauserProcess.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libMorschhauserProcess.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libInternLib.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libInternLib.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libshue.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libSlidingAverage.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libInternLib.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libsum_into_table_indexes.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libsum_into_table_range.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libtsyganenko96.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libTime_Shifted.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libtsyganenko96.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libtsyganenko96.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libTTCatToParam.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libmexvex_els_decode.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so diff --git a/src/InputOutput/IHMImpl/ParamInfo/IHMInputOutputParamInfoClass.php b/src/InputOutput/IHMImpl/ParamInfo/IHMInputOutputParamInfoClass.php index 522d0c5..0856a10 100644 --- a/src/InputOutput/IHMImpl/ParamInfo/IHMInputOutputParamInfoClass.php +++ b/src/InputOutput/IHMImpl/ParamInfo/IHMInputOutputParamInfoClass.php @@ -12,28 +12,28 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface private $paramImpexMgr = null; private $userParamMgr = null; private $paramTemplateMgr = null; - + /* * @brief Constructor */ function __construct() { $this->paramMgr = new IHMParamManagerClass(); - $this->paramTemplateMgr = new IHMParamTemplateClass(); + $this->paramTemplateMgr = new IHMParamTemplateClass(); } /* * @brief translate input data from IHM client to AMDA_Integration module for a get param info request */ - public function getInputData($input,$function,$requestId="") + public function getInputData($input, $function, $requestId = "") { $this->paramInfoData = new ParamInfoRequestDataClass(); - + switch ($input->type) { - case 'plot_init' : - + case 'plot_init': + $this->paramInfoData->setType(ParamInfoTypeEnumClass::PLOTINIT); - + if (!isset($input->paramId) || empty($input->paramId)) throw new Exception("Param info request need a param id as argument"); @@ -56,98 +56,94 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface ); $this->paramInfoData->setInternalPlotInit($plot_init); } - } - else if ($this->paramMgr->getTemplateParamsManager()->isTemplatedParam($input->paramId)) { + } else if ($this->paramMgr->getTemplateParamsManager()->isTemplatedParam($input->paramId)) { //Use param template file $paramFilePath = $this->paramMgr->getTemplateParamsManager()->getTemplatePath($input->paramId); if (!file_exists($paramFilePath)) throw new Exception("Cannot find parameter definition file"); $this->paramInfoData->setFilePath($paramFilePath); - } - else { + } else { //Direct access to the parameter file - $paramFilePath = IHMConfigClass::getLocalParamDBPath().$input->paramId.".xml"; + $paramFilePath = IHMConfigClass::getLocalParamDBPath() . $input->paramId . ".xml"; if (!file_exists($paramFilePath)) throw new Exception("Cannot find parameter definition file"); - + $this->paramInfoData->setFilePath($paramFilePath); } break; - - case 'impex_plot_init' : - + + case 'impex_plot_init': + $this->paramInfoData->setType(ParamInfoTypeEnumClass::IMPEXPLOTINIT); - + if (!isset($input->paramId) || empty($input->paramId)) - throw new Exception("Param info request need a param id as argument"); - - if (!$this->paramImpexMgr) - { - $this->paramImpexMgr = new IHMImpexParamClass(); + throw new Exception("Param info request need a param id as argument"); + + if (!$this->paramImpexMgr) { + $this->paramImpexMgr = new IHMImpexParamClass(); } - + $paramFilePath = $this->paramImpexMgr->getParamInfoPlotPath($input->paramId); - + if (!$paramFilePath || !file_exists($paramFilePath)) throw new Exception("Cannot find parameter definition file"); - + $this->paramInfoData->setFilePath($paramFilePath); break; - - case 'param_info' : - + + case 'param_info': + $this->paramInfoData->setType(ParamInfoTypeEnumClass::PARAMINFO); - + if (!isset($input->paramId) || empty($input->paramId)) throw new Exception("Param info request need a param id as argument"); - + $templatedParams = $this->paramMgr->getTemplateParamsManager()->getParamTemplates(); - + if (array_key_exists($input->paramId, $templatedParams)) $this->paramInfoData->setTemplateInfo($templatedParams[$input->paramId]); - - $paramInfoFilePath = IHMConfigClass::getLocalParamInfoPath().'info_'.$input->paramId.".xml"; - + + $paramInfoFilePath = IHMConfigClass::getLocalParamInfoPath() . 'info_' . $input->paramId . ".xml"; + if (!file_exists($paramInfoFilePath)) throw new Exception("Cannot find parameter info file"); - + $this->paramInfoData->setFilePath($paramInfoFilePath); break; - - case 'impex_param_info' : - - $this->paramInfoData->setType(ParamInfoTypeEnumClass::IMPEXINFO); + + case 'impex_param_info': + + $this->paramInfoData->setType(ParamInfoTypeEnumClass::IMPEXINFO); if (!isset($input->paramId) || empty($input->paramId)) throw new Exception("Param info request need a param id as argument"); - - if (!$this->paramImpexMgr) - { - $this->paramImpexMgr = new IHMImpexParamClass(); + + if (!$this->paramImpexMgr) { + $this->paramImpexMgr = new IHMImpexParamClass(); } $this->paramImpexMgr->setParamTemplateListFilePath($input->paramId); $templatedParams = $this->paramImpexMgr->getParamTemplates(); $simRegion = $this->paramImpexMgr->getSimulationRegion($input->paramId); - + // No SimulationRuns (LESIA) - if ($simRegion == "UNKNOWN") + if ($simRegion == "UNKNOWN") $simRegion = $this->paramImpexMgr->getResourceID($input->paramId); - + $this->paramInfoData->setTemplateInfo($templatedParams[$simRegion]); break; case 'param_parse_template': $this->paramInfoData->setType(ParamInfoTypeEnumClass::PARSETEMPLATEDPARAM); - + break; - default : - throw new Exception("Param info request type '".$input->type."' not yet implemented"); + default: + throw new Exception("Param info request type '" . $input->type . "' not yet implemented"); } - + $this->paramInfoData->setParamId($input->paramId); - + return $this->paramInfoData; } @@ -157,37 +153,38 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface public function getOutput($data) { switch ($data->getType()) { - case ParamInfoTypeEnumClass::PLOTINIT : + case ParamInfoTypeEnumClass::PLOTINIT: $result = array("success" => false, "message" => "Cannot get plot init"); $this->getOutputPlotInit($data, $result); break; - case ParamInfoTypeEnumClass::IMPEXPLOTINIT : + case ParamInfoTypeEnumClass::IMPEXPLOTINIT: $result = array("success" => false, "message" => "Cannot get impex plot init"); $this->getOutputPlotInit($data, $result); break; - case ParamInfoTypeEnumClass::PARAMINFO : + case ParamInfoTypeEnumClass::PARAMINFO: $result = array("success" => false, "message" => "Cannot get param info"); $this->getOutputParamInfo($data, $result); break; - case ParamInfoTypeEnumClass::IMPEXINFO : + case ParamInfoTypeEnumClass::IMPEXINFO: $result = array("success" => false, "message" => "Cannot get impex param info"); $this->getOutputParamInfo($data, $result); break; - case ParamInfoTypeEnumClass::PARSETEMPLATEDPARAM : + case ParamInfoTypeEnumClass::PARSETEMPLATEDPARAM: $result = array("success" => false, "message" => "Cannot parse templated param"); $this->getOutputParseTemplatedParam($data, $result); default: //Nothing ToDo } - + return $result; } - private function getOutputParamInfo($data, &$result) { + private function getOutputParamInfo($data, &$result) + { if (($data->getResult() != NULL)) { $result = array( - "success" => true, - "data" => $data->getResult() + "success" => true, + "data" => $data->getResult() ); if ($data->getTemplateInfo() != NULL) { $result["template"] = $data->getTemplateInfo(); @@ -195,7 +192,8 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface } } - private function getOutputParseTemplatedParam($data, &$result) { + private function getOutputParseTemplatedParam($data, &$result) + { if ($info = $this->paramTemplateMgr->parseTemplatedParam($data->getParamId())) { $result = array( "success" => true, @@ -203,21 +201,21 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface ); } } - - private function getOutputPlotInit($data, &$result) { + + private function getOutputPlotInit($data, &$result) + { $internal_info = $data->getInternalPlotInit(); if (isset($internal_info)) { $result = array( "success" => true, "data" => $internal_info ); - } - else if (($data->getResult() != NULL) && ($data->getResult()->getName() == "plot") && (count($data->getResult()->getChildren()) >= 1)) { + } else if (($data->getResult() != NULL) && ($data->getResult()->getName() == "plot") && (count($data->getResult()->getChildren()) >= 1)) { $result_data = array(); - + $panelNodes = $data->getResult()->getChildren(); $panelNode = $panelNodes[0]; - + $plotNode = NULL; if (count($panelNode->getChildren()) >= 1) { foreach ($panelNode->getChildren() as $crtNode) { @@ -226,47 +224,47 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface $plotNode = $crtNode; break; } - - if (isset($plotNode)) { + + if (isset($plotNode)) { $result_data['panel'] = array(); switch ($plotNode->getName()) { - case 'timePlot' : + case 'timePlot': $result_data['panel']['plotType'] = 'timePlot'; - + break; - case 'epochPlot' : + case 'epochPlot': $result_data['panel']['plotType'] = 'epochPlot'; - + break; - case 'xyPlot' : + case 'xyPlot': $result_data['panel']['plotType'] = 'xyPlot'; $result_data['panel']['isotropic'] = ($plotNode->getIsIsotropic() == "true"); $result_data['additionalObjects'] = $this->unmarshallAdditionalObjectsData($plotNode); break; - case 'instantPlot' : + case 'instantPlot': $result_data['panel']['plotType'] = 'instantPlot'; - + break; - case 'statusPlot' : + case 'statusPlot': $result_data['panel']['plotType'] = 'statusPlot'; - + break; - case 'tickPlot' : + case 'tickPlot': $result_data['panel']['plotType'] = 'tickPlot'; - + break; } - + $result_data['draw'] = $this->unmarshallDrawData($plotNode, $data->getParamId()); } - + $result = array( - "success" => true, - "data" => $result_data + "success" => true, + "data" => $result_data ); //var_dump($result); } - + /*if (count($paramsNode->getChildren()) >= 1) { $paramNode = $paramsNode->getChildren()[0]; if (count($paramNode->getChildren()) >= 1) { @@ -290,16 +288,17 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface }*/ } } - - private function unmarshallDrawData($plotNode, $paramId) { - + + private function unmarshallDrawData($plotNode, $paramId) + { + $result_data = array(); - + if (!isset($plotNode)) return $result_data; - + $paramsNode = $plotNode->getParams(); - + if (!isset($paramsNode)) return $result_data; if ($this->paramMgr->getTemplateParamsManager()->isTemplatedParam($paramId)) @@ -307,13 +306,13 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface $realParamId = $this->paramMgr->getTemplateParamsManager()->getTemplateFileName($paramId); else $realParamId = $paramId; - + $paramNode = $paramsNode->getParamById($realParamId); - - + + if (!isset($paramNode) || (count($paramNode->getChildren()) < 1)) return $result_data; - + $mainDrawNode = NULL; $otherDrawNodes = array(); foreach ($paramNode->getChildren() as $crtDrawNode) { @@ -322,26 +321,25 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface else $otherDrawNodes[$mainDrawNode->getName()] = $crtDrawNode; } - + if (!isset($mainDrawNode)) return $result_data; switch ($mainDrawNode->getName()) { - case 'serie' : + case 'serie': if ($plotNode->getName() == 'statusPlot') { $result_data['type'] = 'status-bar'; - } - else { + } else { $result_data['type'] = 'serie'; $this->unmarshallBaseSerieData($mainDrawNode, $result_data); } //if (array_key_exists('colorserie', $otherDrawNodes)) // $this->unmarshallColorSerieData($mainDrawNode, $result_data); break; - case 'spectro' : + case 'spectro': $result_data['type'] = 'spectro'; $this->unmarshallSpectroData($mainDrawNode, $result_data); break; - case 'yserie' : + case 'yserie': if (!array_key_exists('xserie', $otherDrawNodes)) return $result_data; $this->unmarshallBaseSerieData($mainDrawNode, $result_data); @@ -349,60 +347,61 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface //if (array_key_exists('colorserie', $otherDrawNodes)) // $this->unmarshallColorSerieData($mainDrawNode, $result_data); break; - case 'orbitserie' : + case 'orbitserie': $result_data['type'] = 'orbit-serie'; $result_data['serie-projection'] = $mainDrawNode->getProjection(); $this->unmarshallBaseSerieData($mainDrawNode, $result_data); //if (array_key_exists('colorserie', $otherDrawNodes)) // $this->unmarshallColorSerieData($mainDrawNode, $result_data); break; - default : + default: 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) { + + private function unmarshallAxisData($axisNode, &$result_array) + { if (!isset($axisNode)) return; - + $scale = $axisNode->getScale(); if (isset($scale)) $result_array['axis-scale'] = $scale; - $showLegend = $axisNode->getShowLegend(); - if (!empty($showLegend)) - $result_array['axis-legend-activated'] = ($showLegend == "true"); + $showLegend = $axisNode->getShowLegend(); + if (!empty($showLegend)) + $result_array['axis-legend-activated'] = ($showLegend == "true"); $rangeNode = $axisNode->getRange(); if (isset($rangeNode)) { @@ -413,25 +412,25 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface $rangeMax = $rangeNode->getMax(); if (!empty($rangeMax)) $result_array['axis-range-max'] = $rangeMax; - $extend = $rangeNode->getExtend(); - if (!empty($extend)) - $result_array['axis-range-extend'] = ($extend == "true"); - + $extend = $rangeNode->getExtend(); + if (!empty($extend)) + $result_array['axis-range-extend'] = ($extend == "true"); } } - - private function unmarshallSpectroData($drawNode, &$result_array) { + + private function unmarshallSpectroData($drawNode, &$result_array) + { if (!isset($drawNode)) return; - + $yAxis = $drawNode->getAttribute(REQUESTOUTPUTPLOTSPECTRO_YAXIS); if (!empty($yAxis)) $result_array['spectro-yaxis'] = $yAxis; - + $min = $drawNode->getAttribute(REQUESTOUTPUTPLOTSPECTRO_MIN); if (!empty($min)) $result_array['spectro-value-min'] = $min; - + $max = $drawNode->getAttribute(REQUESTOUTPUTPLOTSPECTRO_MAX); if (!empty($max)) $result_array['spectro-value-max'] = $max; @@ -448,16 +447,29 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface $normalization = $drawNode->getAttribute(REQUESTOUTPUTPLOTSPECTRO_NORMALISATION); if (!empty($normalization)) $result_array['spectro-normalization'] = $normalization; + + $bgs_type = $drawNode->getAttribute(REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE); + if (!empty($bgs_type)) + $result_array[REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE] = $bgs_type; + + $bgs_value = $drawNode->getAttribute(REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE); + if (!empty($bgs_value)) + $result_array[REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE] = $bgs_value; + + $bgs_dim = $drawNode->getAttribute(REQUESTOUTPUTPLOTSPECTRO_BGS_DIM); + if (!empty($bgs_dim)) + $result_array[REQUESTOUTPUTPLOTSPECTRO_BGS_DIM] = $bgs_dim; } - - private function unmarshallAdditionalObjectsData($plotNode) { + + private function unmarshallAdditionalObjectsData($plotNode) + { $result_data = array(); - + if (!isset($plotNode)) return $result_data; - + $additionalObjectsNode = $plotNode->getAdditionalObjects(); - + //curvePlot $result_data['curves'] = array(); $curveObjectsNode = $additionalObjectsNode->getCurveObjects(); @@ -465,147 +477,148 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface $crt_curve_data = array(); $crt_curve_data['curve-serie-id'] = $curveNode->getSerieId(); $this->unmarshallLineData($curveNode, "curve-line-", $crt_curve_data); - + if ($curveNode->isFunctionDefined()) { $crt_curve_data['curve-name'] = $curveNode->getFunction()->getFunctionName(); $crt_curve_data['curve-attributes'] = array(); - + foreach ($curveNode->getFunction()->getAttributes()->getChildren() as $attributeNode) { $crt_attribute_data = array(); - + $crt_attribute_data['curve-param-name'] = $attributeNode->getAttribute(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTENAME); $crt_attribute_data['curve-param-value'] = $attributeNode->getAttribute(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTEVALUE); - + $crt_curve_data['curve-attributes'][] = $crt_attribute_data; } - } - + $result_data['curves'][] = $crt_curve_data; } - + return $result_data; } - - private function unmarshallBaseSerieData($drawNode, &$result_array) { + + private function unmarshallBaseSerieData($drawNode, &$result_array) + { if (!isset($drawNode)) return; - + $result_array['serie-id'] = $drawNode->getId(); - + $result_array['serie-yaxis'] = $drawNode->getYAxisId(); - $resolution = $drawNode->getResolution(); - if (!empty($resolution)) - $result_array['serie-resolution'] = $resolution; + $resolution = $drawNode->getResolution(); + if (!empty($resolution)) + $result_array['serie-resolution'] = $resolution; + + $colorSerieId = $drawNode->getColorSerieId(); + if (!empty($colorSerieId)) + $result_array['serie-colored-param'] = $colorSerieId; - $colorSerieId = $drawNode->getColorSerieId(); - if (!empty($colorSerieId)) - $result_array['serie-colored-param'] = $colorSerieId; - if ($drawNode->isLineDefined()) { - $lineNode = $drawNode->getLine(); - $lineType = $lineNode->getType(); - if($lineType == RequestOutputPlotLineTypeEnum::NO){ - $result_array['serie-lines-activated'] = false; - } - else{ - $result_array['serie-lines-activated'] = true; - $this->unmarshallLineData($drawNode->getLine(), "serie-lines-", $result_array); - } + $lineNode = $drawNode->getLine(); + $lineType = $lineNode->getType(); + if ($lineType == RequestOutputPlotLineTypeEnum::NO) { + $result_array['serie-lines-activated'] = false; + } else { + $result_array['serie-lines-activated'] = true; + $this->unmarshallLineData($drawNode->getLine(), "serie-lines-", $result_array); + } } - + if ($drawNode->isSymbolDefined()) { $result_array['serie-symbols-activated'] = true; $this->unmarshallSymbolData($drawNode->getSymbol(), "serie-symbols-", $result_array); } - + $colorSerieId = $drawNode->getColorSerieId(); if (!empty($colorSerieId)) { //ToDo } - + if ($drawNode->isTimeTicksDefined()) { $result_array['serie-timetick-activated'] = true; - + $result_array['serie-timetick-step'] = $drawNode->getTimeTicks()->getStep(); $result_array['serie-timetick-nbmajor'] = $drawNode->getTimeTicks()->getNumber(); $result_array['serie-timetick-nbminor'] = $drawNode->getTimeTicks()->getMinor(); $result_array['serie-timetick-color'] = $this->toHexColor($drawNode->getTimeTicks()->getColor()); - + if (!empty($result_array['serie-timetick-nbmajor']) && intval($result_array['serie-timetick-nbmajor']) > 0) $result_array['serie-timetick-type'] = 'nb-major'; else if (!empty($result_array['serie-timetick-step']) && intval($result_array['serie-timetick-step']) > 0) $result_array['serie-timetick-type'] = 'time-step'; else $result_array['serie-timetick-type'] = 'auto'; - + if ($drawNode->getTimeTicks()->isSymbolDefined()) { $this->unmarshallSymbolData($drawNode->getTimeTicks()->getSymbol(), "serie-timetick-symbols-", $result_array); } - + if ($drawNode->getTimeTicks()->isFirstSymbolDefined()) { $result_array['serie-timetick-firstsymbols-activated'] = true; $this->unmarshallSymbolData($drawNode->getTimeTicks()->getFirstSymbol(), "serie-timetick-firstsymbols-", $result_array); } - + if ($drawNode->getTimeTicks()->isFontDefined()) { $result_array['serie-timetick-font-activated'] = true; $this->unmarshallFontData($drawNode->getTimeTicks()->getFont(), "serie-timetick-font-", $result_array); } } - + if ($drawNode->isIntervalTicksDefined()) { $result_array['serie-intervaltick-activated'] = true; - + $result_array['serie-intervaltick-mode'] = $drawNode->getIntervalTicks()->getMode(); $result_array['serie-intervaltick-color'] = $this->toHexColor($drawNode->getIntervalTicks()->getColor()); - + if ($drawNode->getIntervalTicks()->isSymbolDefined()) { $this->unmarshallSymbolData($drawNode->getIntervalTicks()->getSymbol(), "serie-intervaltick-", $result_array); } - + if ($drawNode->getIntervalTicks()->isFontDefined()) { $result_array['serie-intervaltick-font-activated'] = true; $this->unmarshallFontData($drawNode->getIntervalTicks()->getFont(), "serie-intervaltick-font-", $result_array); } } } - - private function unmarshallLineData($lineNode, $prefix, &$result_array) { - $lineStyle = $lineNode->getStyle(); - if(!empty($lineStyle)) - $result_array[$prefix.'style'] = $lineStyle; - - $lineWidth = $lineNode->getWidth(); - if(!empty($lineWidth)) - $result_array[$prefix.'width'] = $lineWidth; - - $lineColor = $lineNode->getColor(); - if(!empty($lineColor)) - $result_array[$prefix.'color'] = $this->toHexColor($lineColor); + + private function unmarshallLineData($lineNode, $prefix, &$result_array) + { + $lineStyle = $lineNode->getStyle(); + if (!empty($lineStyle)) + $result_array[$prefix . 'style'] = $lineStyle; + + $lineWidth = $lineNode->getWidth(); + if (!empty($lineWidth)) + $result_array[$prefix . 'width'] = $lineWidth; + + $lineColor = $lineNode->getColor(); + if (!empty($lineColor)) + $result_array[$prefix . 'color'] = $this->toHexColor($lineColor); } - - private function unmarshallSymbolData($symbolNode, $prefix, &$result_array) { - $result_array[$prefix.'type'] = $symbolNode->getType(); - $result_array[$prefix.'size'] = $symbolNode->getSize(); - $result_array[$prefix.'color'] = $this->toHexColor($symbolNode->getColor()); + + private function unmarshallSymbolData($symbolNode, $prefix, &$result_array) + { + $result_array[$prefix . 'type'] = $symbolNode->getType(); + $result_array[$prefix . 'size'] = $symbolNode->getSize(); + $result_array[$prefix . 'color'] = $this->toHexColor($symbolNode->getColor()); } - - private function unmarshallFontData($fontNode, $prefix, &$result_array) { - $result_array[$prefix.'name'] = $fontNode->getFontName(); - $result_array[$prefix.'size'] = $fontNode->getSize(); - $result_array[$prefix.'bold'] = ($fontNode->getWeight() == RequestOutputPlotFontWeight::BOLD); - $result_array[$prefix.'italic'] = ($fontNode->getStyle() == RequestOutputPlotFontStyle::ITALIC); + + private function unmarshallFontData($fontNode, $prefix, &$result_array) + { + $result_array[$prefix . 'name'] = $fontNode->getFontName(); + $result_array[$prefix . 'size'] = $fontNode->getSize(); + $result_array[$prefix . 'bold'] = ($fontNode->getWeight() == RequestOutputPlotFontWeight::BOLD); + $result_array[$prefix . 'italic'] = ($fontNode->getStyle() == RequestOutputPlotFontStyle::ITALIC); } - - private function toHexColor($color) { + + private function toHexColor($color) + { $temp = str_replace(array('[', ']', ' '), '', $color); $arr = explode(',', $temp); - if (count ($arr) != 3) + if (count($arr) != 3) return '#000000'; - return '#'.sprintf('%02x', $arr[0]).sprintf('%02x', $arr[1]).sprintf('%02x', $arr[2]); + return '#' . sprintf('%02x', $arr[0]) . sprintf('%02x', $arr[1]) . sprintf('%02x', $arr[2]); } } - -?> diff --git a/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php b/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php index 19fd822..1415c33 100644 --- a/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php +++ b/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php @@ -1,28 +1,28 @@ {'action'})) - { + + if (isset($input->{'action'})) { $input = $this->unmarshallActionRequest($input); $forceTimeZoomReset = isset($input->{'force-time-zoom-reset'}) ? $input->{'force-time-zoom-reset'} : false; - } - else - { + } else { $resetZoom = true; //save request - $this->saveIHMRequest(PLOT_RESULT_FILE_KEY."_".$input->{'tab-index'}, $input); + $this->saveIHMRequest(PLOT_RESULT_FILE_KEY . "_" . $input->{'tab-index'}, $input); } - + //Request $this->isInteractiveRequest = ($input->{'file-output'} == 'INTERACTIVE'); $this->isFromWS = ($input->{'file-output'} == 'WS'); if ($resetZoom || $forceTimeZoomReset) - $this->resetZoomList(PLOT_RESULT_FILE_KEY."_".$input->{'tab-index'}, $forceTimeZoomReset); - + $this->resetZoomList(PLOT_RESULT_FILE_KEY . "_" . $input->{'tab-index'}, $forceTimeZoomReset); + $requestNode = $this->paramsData->addRequestNode($input->{'tab-index'}); $outputsNode = $requestNode->getOutputsNode(); $paramsNode = $requestNode->getParamsNode(); - + //unmarshall time definition $isIntervalRequest = ($input->timesrc == 'Interval'); $ttFileIndex = -1; $ttIntIndex = -1; - if ($this->isInteractiveRequest && !$isIntervalRequest && !$input->{'page-superpose-mode'}) - { + if ($this->isInteractiveRequest && !$isIntervalRequest && !$input->{'page-superpose-mode'}) { $ttFileIndex = !isset($input->{'ttFileIndex'}) ? 0 : $input->{'ttFileIndex'}; $ttIntIndex = !isset($input->{'intIndex'}) ? 0 : $input->{'intIndex'}; } $this->unmarshallTimeDefinition($input, $input->{'tab-index'}, $ttFileIndex, $ttIntIndex); - + $this->interactiveCrtTTFileIndex = $ttFileIndex; - + $plotOutputNode = $outputsNode->addNewOutput(RequestOutputTypeEnum::PLOT); - + $plotOutputNode->setWriteContextFile($this->isInteractiveRequest ? "true" : "false"); - + $compression = ""; - if (!$this->isInteractiveRequest && !$this->isFromWS) - { - switch ($input->{'file-output'}) - { - case 'TGZ' : + if (!$this->isInteractiveRequest && !$this->isFromWS) { + switch ($input->{'file-output'}) { + case 'TGZ': $plotOutputNode->addPostProcessing(RequestOutputPostProcessingEnumClass::TAR); $plotOutputNode->addPostProcessing(RequestOutputPostProcessingEnumClass::GZIP); $compression = ".tar.gz"; break; - case 'ZIP' : + case 'ZIP': $plotOutputNode->addPostProcessing(RequestOutputPostProcessingEnumClass::ZIP); $compression = ".zip"; break; @@ -89,158 +83,146 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass throw new Exception('Compression not implemented.'); } } - + if ($input->{'one-file-per-interval'}) $plotOutputNode->setStructure(RequestOutputPlotStructureEnum::ONE_FILE_PER_INTERVAL); else $plotOutputNode->setStructure(RequestOutputPlotStructureEnum::ONE_FILE); - + //prefix $filePrefix = "plot_"; if ($input->{'file-prefix'} && ($input->{'file-prefix'} != "")) $filePrefix = $input->{'file-prefix'}; $filePrefix .= $input->{'tab-index'}; - + $plotOutputNode->setFilePrefix($filePrefix); - + //page $pageNode = $plotOutputNode->getPage(); - + $fileFormat = RequestOutputPlotPageFormatEnum::PNG; $extension = ".png"; - switch ($input->{'file-format'}) - { - case 'PNG' : + switch ($input->{'file-format'}) { + case 'PNG': $fileFormat = RequestOutputPlotPageFormatEnum::PNG; $extension = ".png"; break; - case 'PDF' : + case 'PDF': $fileFormat = RequestOutputPlotPageFormatEnum::PDF; $extension = ".pdf"; break; - case 'PS' : + case 'PS': $fileFormat = RequestOutputPlotPageFormatEnum::PS; $extension = ".ps"; break; - case 'SVG' : + case 'SVG': $fileFormat = RequestOutputPlotPageFormatEnum::SVG; $extension = ".svg"; break; default: throw new Exception('File format not implemented.'); } - + $pageNode->setFormat($fileFormat); - + $this->unmarshallTitle($input, 'page-title', $pageNode->getTitle()); - + $isPortrait = false; - switch ($input->{'page-orientation'}) - { - case 'landscape' : + switch ($input->{'page-orientation'}) { + case 'landscape': $pageNode->setOrientation(RequestOutputPlotPageOrientationEnum::LANDSCAPE); break; - case 'portrait' : + case 'portrait': $pageNode->setOrientation(RequestOutputPlotPageOrientationEnum::PORTRAIT); $isPortrait = true; break; } - - switch ($input->{'page-dimension'}) - { - case 'ISO A4' : + + switch ($input->{'page-dimension'}) { + case 'ISO A4': $pageNode->setDimension(RequestOutputPlotPageDimensionEnum::ISO_A4); break; - case 'US letter' : + case 'US letter': $pageNode->setDimension(RequestOutputPlotPageDimensionEnum::US_LETTER); break; default: throw new Exception('Page dimension not implemented.'); } - - switch ($input->{'page-mode'}) - { - - case 'grayscale' : + + switch ($input->{'page-mode'}) { + + case 'grayscale': $pageNode->setMode(RequestOutputPlotPageModeEnum::GRAYSCALE); break; - case 'color' : + case 'color': default: $pageNode->setMode(RequestOutputPlotPageModeEnum::COLOR); break; } - - if ($input->{'page-margins-activated'}) - { + + if ($input->{'page-margins-activated'}) { $pageNode->getMargins()->setHorizontal($input->{'page-margin-x'}); $pageNode->getMargins()->setVertical($input->{'page-margin-y'}); } - + if ($input->{'page-font-activated'}) $this->unmarshallFont($input, 'page-font', $pageNode->getFont()); - + //Superpose mode - $pageNode->setSuperposeMode($input->{'page-superpose-mode'} ? "true": "false"); - + $pageNode->setSuperposeMode($input->{'page-superpose-mode'} ? "true" : "false"); + //Layout $this->unmarshallLayout($input, $pageNode); - + foreach ($input->{'panels'} as $panelData) $this->unmarshallPanel($panelData, $pageNode, $paramsNode); - - if ($this->isInteractiveRequest || $this->isFromWS) - { - $resultFile = $filePrefix."_*".$extension; - $waitingResultFile = $filePrefix.$extension; - } - else - { - $resultFile = $filePrefix."_*".$compression; - $waitingResultFile = $filePrefix.$compression; + + if ($this->isInteractiveRequest || $this->isFromWS) { + $resultFile = $filePrefix . "_*" . $extension; + $waitingResultFile = $filePrefix . $extension; + } else { + $resultFile = $filePrefix . "_*" . $compression; + $waitingResultFile = $filePrefix . $compression; } - - if ($this->isInteractiveRequest) - { - $this->interactiveTimeSelectionState[PLOT_RESULT_FILE_KEY."_".$input->{'tab-index'}] = $isIntervalRequest; - $this->interactivePlotTitle[PLOT_RESULT_FILE_KEY."_".$input->{'tab-index'}] = $input->{'tab-title'}; - $this->interactivePlotIndex[PLOT_RESULT_FILE_KEY."_".$input->{'tab-index'}] = $input->{'tab-index'}; + + if ($this->isInteractiveRequest) { + $this->interactiveTimeSelectionState[PLOT_RESULT_FILE_KEY . "_" . $input->{'tab-index'}] = $isIntervalRequest; + $this->interactivePlotTitle[PLOT_RESULT_FILE_KEY . "_" . $input->{'tab-index'}] = $input->{'tab-title'}; + $this->interactivePlotIndex[PLOT_RESULT_FILE_KEY . "_" . $input->{'tab-index'}] = $input->{'tab-index'}; $this->interactivePreview = isset($input->{'interactive-preview'}) && ($input->{'interactive-preview'}); - $this->paramsData->addWaitingResult(PLOT_RESULT_FILE_KEY."_".$input->{'tab-index'}, $waitingResultFile); - } - else + $this->paramsData->addWaitingResult(PLOT_RESULT_FILE_KEY . "_" . $input->{'tab-index'}, $waitingResultFile); + } else $this->paramsData->addWaitingResult(PLOT_RESULT_FILE_KEY, $waitingResultFile); - + //Remove old result files - foreach (glob($this->paramsData->getWorkingPath().$resultFile) as $oldFile) { + foreach (glob($this->paramsData->getWorkingPath() . $resultFile) as $oldFile) { unlink($oldFile); } - + //Post process command to apply to the result file $postProcessCmd = $this->paramsData->getPostCmd(); if ($postProcessCmd != "") $postProcessCmd .= " | "; - $postProcessCmd .= "mv ".$resultFile." ".$waitingResultFile; - + $postProcessCmd .= "mv " . $resultFile . " " . $waitingResultFile; + if (($this->isInteractiveRequest) && $isPortrait) - $postProcessCmd .= " | convert ".$waitingResultFile." -rotate -90 ".$waitingResultFile; - else if ($this->isFromWS) - { + $postProcessCmd .= " | convert " . $waitingResultFile . " -rotate -90 " . $waitingResultFile; + else if ($this->isFromWS) { if ($isPortrait) - $postProcessCmd .= " | convert ".$waitingResultFile." -rotate -90 ".$input->{"ws-result-file"}; + $postProcessCmd .= " | convert " . $waitingResultFile . " -rotate -90 " . $input->{"ws-result-file"}; else - $postProcessCmd .= " | mv ".$waitingResultFile." ".$input->{"ws-result-file"}; + $postProcessCmd .= " | mv " . $waitingResultFile . " " . $input->{"ws-result-file"}; } - + $this->paramsData->setBatchEnable(!(($fileFormat == RequestOutputPlotPageFormatEnum::PNG) && $this->isInteractiveRequest)); $this->paramsData->setPostCmd($postProcessCmd); return $this->paramsData; } - + protected function unmarshallLayout($request, $pageNode) { - switch ($request->{'page-layout-type'}) - { - case 'vertical' : + switch ($request->{'page-layout-type'}) { + case 'vertical': $pageNode->getLayout()->setType(RequestOutputPlotLayoutTypeEnum::VERTICAL); $pageNode->getLayout()->setPanelHeight($request->{'page-layout-object'}->{'layout-panel-height'}); $pageNode->getLayout()->setPanelSpacing($request->{'page-layout-object'}->{'layout-panel-spacing'}); @@ -255,14 +237,14 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass if ($request->{'page-layout-object'}->{'layout-xyplot-height'} > 0) $pageNode->setDefaultXYPlotHeight($request->{'page-layout-object'}->{'layout-xyplot-height'}); break; - case 'auto' : + case 'auto': $pageNode->getLayout()->setType(RequestOutputPlotLayoutTypeEnum::AUTO); $pageNode->getLayout()->setPanelHeight($request->{'page-layout-object'}->{'layout-panel-height'}); $pageNode->getLayout()->setPanelSpacing($request->{'page-layout-object'}->{'layout-panel-spacing'}); $pageNode->getLayout()->setExpand($request->{'page-layout-object'}->{'layout-expand'} ? "true" : "false"); $pageNode->getLayout()->setOnlyLowerTimeAxesLegend($request->{'page-layout-object'}->{'layout-timeaxes-legend-lowerone'} ? "true" : "false"); break; - case 'manual' : + case 'manual': $pageNode->getLayout()->setType(RequestOutputPlotLayoutTypeEnum::MANUAL); $timePlotLeftMargin = $request->{'page-layout-object'}->{'layout-timeplot-margin-left'} ? $request->{'page-layout-object'}->{'layout-timeplot-margin-left'} : -1; $timePlotRightMargin = $request->{'page-layout-object'}->{'layout-timeplot-margin-right'} ? $request->{'page-layout-object'}->{'layout-timeplot-margin-right'} : -1; @@ -274,17 +256,15 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass default: throw new Exception('Layout type not implemented.'); } - } - + protected function unmarshallPanel($panelData, $pageNode, $paramsNode) { $panelNode = $pageNode->addPanel(); - - - switch ($pageNode->getLayout()->getType()) - { - case RequestOutputPlotLayoutTypeEnum::MANUAL : + + + switch ($pageNode->getLayout()->getType()) { + case RequestOutputPlotLayoutTypeEnum::MANUAL: //Panel bounds $panelNode->getBounds()->setX($panelData->{'panel-bounds-x'}); $panelNode->getBounds()->setY($panelData->{'panel-bounds-y'}); @@ -295,127 +275,120 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass $rightMargin = $panelData->{'panel-margin-right'} ? $panelData->{'panel-margin-right'} : -1; $panelNode->setXMargin($leftMargin, $rightMargin); break; - case RequestOutputPlotLayoutTypeEnum::VERTICAL : + case RequestOutputPlotLayoutTypeEnum::VERTICAL: //Panel prefered dimensions if ($panelData->{'panel-prefered-width'} > 0) $panelNode->setPreferedWidth($panelData->{'panel-prefered-width'}); if ($panelData->{'panel-prefered-height'} > 0) $panelNode->setPreferedHeight($panelData->{'panel-prefered-height'}); break; - default : + default: //Nothing to do } - + //Panel id if (isset($panelData->{'id'})) $panelNode->setId($panelData->{'id'}); - //Panel id - if (isset($panelData->{'panel-index'})) - $panelNode->setIndex($panelData->{'panel-index'}); - - + //Panel id + if (isset($panelData->{'panel-index'})) + $panelNode->setIndex($panelData->{'panel-index'}); + + //Panel background color if (($panelData->{'panel-background-color'} != 'none') && ($panelData->{'panel-background-color'} != '')) $panelNode->setBackgroundColor($this->hexColor2KernelColor($panelData->{'panel-background-color'})); //Panel font $this->unmarshallFont($panelData, 'panel-font', $panelNode->getFont()); - + //Panel title $this->unmarshallTitle($panelData, 'panel-title', $panelNode->getTitle()); - + //Plot type $this->isInstantPlot = false; $plotNode = $this->unmarshallPlotType($panelData, $panelNode); - + $isTimePlot = ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTTIME_NAME); - + //Tick plot $tickPlotNode = NULL; - if ($isTimePlot) - { - if ($this->hasTickBar($panelData->{'params'})) - { - $tickPlotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::TICKPLOT,true); + if ($isTimePlot) { + if ($this->hasTickBar($panelData->{'params'})) { + $tickPlotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::TICKPLOT, true); if ($panelData->{'panel-tick-format'} != '') $tickPlotNode->setFormat($panelData->{'panel-tick-format'}); } } - + //Status plot $statusPlotNode = NULL; - if ($isTimePlot) - { - if ($this->hasStatusBar($panelData->{'params'})) - { - $statusPlotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::STATUSPLOT,true); - switch ($panelData->{'panel-status-position'}) - { - case 'top' : + if ($isTimePlot) { + if ($this->hasStatusBar($panelData->{'params'})) { + $statusPlotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::STATUSPLOT, true); + switch ($panelData->{'panel-status-position'}) { + case 'top': $statusPlotNode->setPosition(RequestOutputPlotElementStatusPosition::TOP); break; - case 'bottom' : + case 'bottom': $statusPlotNode->setPosition(RequestOutputPlotElementStatusPosition::BOTTOM); break; } $statusPlotNode->setColorMap($panelData->{'panel-status-colormap'}); } } - + //Axes foreach ($panelData->{'axes'} as $axisData) $this->unmarshallAxis($axisData, $panelData->{'constants'}, $plotNode); - + //Params $this->unmarshallParams($panelData->{'params'}, $paramsNode, $plotNode, $panelNode, $statusPlotNode, $tickPlotNode); - + //Additional objects if ($plotNode->getAdditionalObjects() != NULL) $this->unmarshallAdditionalObjects($panelData, $plotNode->getAdditionalObjects(), $isTimePlot); - + //Fills if ($plotNode->getFills() != NULL) $this->unmarshallFills($panelData, $plotNode->getFills()); - + return $panelNode; } - + protected function unmarshallPlotType($panelData, $panelNode) { - switch ($panelData->{'panel-plot-type'}) - { - case 'timePlot' : + switch ($panelData->{'panel-plot-type'}) { + case 'timePlot': $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::TIMEPLOT); break; - case 'xyPlot' : + case 'xyPlot': $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::XYPLOT); $plotNode->setIsIsotropic($panelData->{'panel-scatter-isotropic'}); break; - case 'statusPlot' : + case 'statusPlot': $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::STATUSPLOT); - switch ($panelData->{'panel-status-position'}) - { - case 'top' : + switch ($panelData->{'panel-status-position'}) { + case 'top': $plotNode->setPosition(RequestOutputPlotElementStatusPosition::TOP); break; - case 'bottom' : + case 'bottom': $plotNode->setPosition(RequestOutputPlotElementStatusPosition::BOTTOM); break; } $plotNode->setColorMap($panelData->{'panel-status-colormap'}); break; - case 'tickPlot' : + case 'tickPlot': $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::TICKPLOT); if ($panelData->{'panel-tick-format'} != '') $plotNode->setFormat($panelData->{'panel-tick-format'}); break; - case 'epochPlot' : + case 'epochPlot': $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::EPOCHPLOT); if ($panelData->{'panel-epoch-centertimeid'} != '') $plotNode->setCenterTimeId($panelData->{'panel-epoch-centertimeid'}); break; - case 'instantPlot' : + case 'instantPlot': $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::INSTANTPLOT); date_default_timezone_set('UTC'); $timeStamp = strtotime($panelData->{'panel-instant-time'}); @@ -426,48 +399,47 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass default: throw new Exception('Plot type not implemented.'); } - + //Params Legend if (isset($panelData->{'panel-series-legend'}) && $panelData->{'panel-series-legend'}->{'legend-series-activated'}) $this->unmarshallParamsLegend($panelData->{'panel-series-legend'}, $plotNode->getLegends()->getParamsLegend()); - + //Text Legends foreach ($panelData->{'text-legends'} as $textLegendData) $this->unmarshallTextLegend($textLegendData, $plotNode->getLegends()); - + return $plotNode; } - + protected function unmarshallAxis($axisData, $constantsData, $plotNode) { //axis type $constantAxisId = ''; - switch ($axisData->{'axis-type'}) - { - case 'time' : + switch ($axisData->{'axis-type'}) { + case 'time': $axisNode = $plotNode->getTimeAxis(); $axisNode->setFormat($axisData->{'axis-time-format'}); $constantAxisId = 'x'; break; - case 'epoch' : + case 'epoch': $axisNode = $plotNode->getEpochAxis(); $axisNode->setNormalized($axisData->{'axis-epoch-normalized'} ? "true" : "false"); $constantAxisId = 'x'; break; - case 'x' : + case 'x': $axisNode = $plotNode->getXAxis(); $constantAxisId = 'x'; break; - case 'y-left' : + case 'y-left': $axisNode = $plotNode->addYAxis('y-left'); $constantAxisId = 'y-left'; break; - case 'y-right' : + case 'y-right': $axisNode = $plotNode->addYAxis('y-right'); $axisNode->setPosition(RequestOutputPlotAxisElementPosition::RIGHT); $constantAxisId = 'y-right'; break; - case 'color' : + case 'color': $axisNode = $plotNode->getZAxis(); $axisNode->setColorMapIndex($axisData->{'axis-color-map'}); if ($axisData->{'axis-color-minval'} != 'none') @@ -478,118 +450,111 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass default: throw new Exception('Axis type not implemented.'); } - + //reverse axis if (isset($axisData->{'axis-reverse'})) $axisNode->setReverse($axisData->{'axis-reverse'} ? "true" : "false"); - + //axis scale - switch ($axisData->{'axis-scale'}) - { - case 'logarithmic' : + switch ($axisData->{'axis-scale'}) { + case 'logarithmic': $axisNode->setScale(RequestOutputPlotAxisElementScale::LOGARITHMIC); break; default: $axisNode->setScale(RequestOutputPlotAxisElementScale::LINEAR); } - + //axis range if ($axisData->{'axis-range-min'} < $axisData->{'axis-range-max'}) $axisNode->getRange()->setMinMax($axisData->{'axis-range-min'}, $axisData->{'axis-range-max'}); if (isset($axisData->{'axis-range-extend'})) $axisNode->getRange()->setExtend($axisData->{'axis-range-extend'} ? "true" : "false"); - + //axis color if (isset($axisData->{'axis-color'})) $axisNode->setColor($this->hexColor2KernelColor($axisData->{'axis-color'})); - + //axis thickness if (isset($axisData->{'axis-thickness'})) $axisNode->setThickness($axisData->{'axis-thickness'}); - + //axis ticks position - switch ($axisData->{'axis-tick-position'}) - { - case 'inwards' : + switch ($axisData->{'axis-tick-position'}) { + case 'inwards': $axisNode->getTick()->setPosition(RequestOutputPlotAxisElementTickPosition::INWARDS); break; - default : + default: $axisNode->getTick()->setPosition(RequestOutputPlotAxisElementTickPosition::OUTWARDS); } - + //axis minor and major grid if (isset($axisData->{'axis-grid-minor'})) $axisNode->getTick()->setMinorGrid($axisData->{'axis-grid-minor'} ? "true" : "false"); if (isset($axisData->{'axis-grid-major'})) $axisNode->getTick()->setMajorGrid($axisData->{'axis-grid-major'} ? "true" : "false"); - if ( $axisData->{'axis-grid-specify-ticks-number'}){ - - if (isset($axisData->{'axis-grid-minor-number'}) && $axisData->{'axis-grid-minor-number'} != 0) - $axisNode->getTick()->setMinorGridNumber($axisData->{'axis-grid-minor-number'}); - - if (isset($axisData->{'axis-grid-major-number'}) && $axisData->{'axis-grid-major-number'} != 0) - $axisNode->getTick()->setMajorGridNumber($axisData->{'axis-grid-major-number'}); - }elseif($axisData->{'axis-grid-specify-ticks-spacing'}){ - - if (isset($axisData->{'axis-grid-major-space'}) && $axisData->{'axis-grid-major-space'} != 0) - $axisNode->getTick()->setMajorGridSpace($axisData->{'axis-grid-major-space'}); - - if (isset($axisData->{'axis-grid-minor-space'}) && $axisData->{'axis-grid-minor-space'} != 0) - $axisNode->getTick()->setMinorGridSpace($axisData->{'axis-grid-minor-space'}); - } - - - //legend - if (isset($axisData->{'axis-legend-text'}) && $axisData->{'axis-legend-text'} != '') - { + if ($axisData->{'axis-grid-specify-ticks-number'}) { + + if (isset($axisData->{'axis-grid-minor-number'}) && $axisData->{'axis-grid-minor-number'} != 0) + $axisNode->getTick()->setMinorGridNumber($axisData->{'axis-grid-minor-number'}); + + if (isset($axisData->{'axis-grid-major-number'}) && $axisData->{'axis-grid-major-number'} != 0) + $axisNode->getTick()->setMajorGridNumber($axisData->{'axis-grid-major-number'}); + } elseif ($axisData->{'axis-grid-specify-ticks-spacing'}) { + + if (isset($axisData->{'axis-grid-major-space'}) && $axisData->{'axis-grid-major-space'} != 0) + $axisNode->getTick()->setMajorGridSpace($axisData->{'axis-grid-major-space'}); + + if (isset($axisData->{'axis-grid-minor-space'}) && $axisData->{'axis-grid-minor-space'} != 0) + $axisNode->getTick()->setMinorGridSpace($axisData->{'axis-grid-minor-space'}); + } + + + //legend + if (isset($axisData->{'axis-legend-text'}) && $axisData->{'axis-legend-text'} != '') { $axisNode->getLegend()->setText($axisData->{'axis-legend-text'}); $axisNode->getLegend()->setColor($this->hexColor2KernelColor($axisData->{'axis-legend-color'})); $this->unmarshallLabel($axisData, "axis-legend", $axisNode->getLegend()); } - + //Show legend if (isset($axisData->{'axis-legend-activated'})) $axisNode->setShowLegend($axisData->{'axis-legend-activated'} ? "true" : "false"); - + //Show tick marks if (isset($axisData->{'axis-tick-showmarks'})) $axisNode->setShowTickMarks($axisData->{'axis-tick-showmarks'} ? "true" : "false"); - + //Add constants - if ($constantAxisId != '') - { + if ($constantAxisId != '') { foreach ($constantsData as $constantData) if ($constantData->{'constant-axis-id'} == $constantAxisId) - $this->unmarshallConstant($constantData,$axisNode); + $this->unmarshallConstant($constantData, $axisNode); } } - + protected function unmarshallParams($paramsData, $requestParamsNode, $plotNode, $panelNode, $statusPlotNode, $tickPlotNode) { //X parameters $isScatter = ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTXY_NAME); $xIds = array(); - if ($isScatter) - { + if ($isScatter) { $crtXId = 0; - foreach ($paramsData as $paramData) - { + foreach ($paramsData as $paramData) { if ($paramData->{'param-drawing-object'}->{'serie-xaxis-param'} == '') continue; if (array_key_exists($paramData->{'param-drawing-object'}->{'serie-xaxis-param'}, $xIds)) { //x param already exists continue; } - + $paramXInfo = $this->paramManager->addExistingParam($paramData->{'param-drawing-object'}->{'serie-xaxis-param'}, $this->paramsData); if ($paramXInfo['id'] == '') throw new Exception('Cannot retrieve X parameter.'); $requestParamsNode->addParam($paramXInfo['id']); $xParamNode = $plotNode->getParams()->getParamById($paramXInfo['id']); - switch ($paramData->{'param-drawing-type'}) - { - case 'serie' : + switch ($paramData->{'param-drawing-type'}) { + case 'serie': //Unmarshall x serie if (count($paramXInfo['indexes']) == 0) $xParamNode->addXSerie(-1, $crtXId, $paramData->{'param-drawing-object'}->{'serie-xvalue-min'}, $paramData->{'param-drawing-object'}->{'serie-xvalue-max'}); @@ -598,111 +563,105 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass else throw new Exception('X parameter for serie must be a component.'); break; - default : + default: throw new Exception('X parameter not allowed for this drawing type. '); } $xIds[$paramData->{'param-drawing-object'}->{'serie-xaxis-param'}] = $crtXId; ++$crtXId; } } - + //Main drawing element parameter $drawingEltIndex = 0; - foreach ($paramsData as $paramData) - { + foreach ($paramsData as $paramData) { $isTTCat = ($paramData->{'param-type'} == 'ttcat'); //Param if (!$isTTCat) { $paramInfo = $this->paramManager->addExistingParam($paramData->{'paramid'}, $this->paramsData, isset($paramData->{'template_args'}) ? $paramData->{'template_args'} : NULL); - } - else { + } else { $paramInfo = $this->paramManager->addTTCatParam($paramData->{'paramid'}, $this->paramsData); } - + $paramInfo['indexes'] = array(); $this->paramManager->applyRangesAndIndexes($this->paramsData, $paramData, !$this->isInstantPlot, $paramInfo); - - $this->paramManager->applyFilter($this->paramsData, $paramData, $paramInfo); - + + $this->paramManager->applyFilter($this->paramsData, $paramData, $paramInfo); + $requestParamsNode->addParam($paramInfo['id']); - + $colorSerieId = -1; if (!empty($paramData->{'param-drawing-object'}->{'serie-colored-param'})) $colorSerieId = $drawingEltIndex; $xId = ($isScatter && !empty($paramData->{'param-drawing-object'}->{'serie-xaxis-param'})) ? $xIds[$paramData->{'param-drawing-object'}->{'serie-xaxis-param'}] : -1; - - switch ($paramData->{'param-drawing-type'}) - { - case 'serie' : + + switch ($paramData->{'param-drawing-type'}) { + case 'serie': $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); $this->unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, $paramInfo['indexes'], $xId, $colorSerieId, false); break; - case 'orbit-serie' : + case 'orbit-serie': $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); $this->unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, -1, $xId, $colorSerieId, true); break; - case 'spectro' : + case 'spectro': $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); $this->unmarshallSpectro($paramData->{'param-drawing-object'}, $plotNode, $paramNode, $paramInfo['indexes']); break; - case 'status-bar' : + case 'status-bar': if (($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTSTATUS_NAME) && !isset($statusPlotNode)) $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); else $paramNode = $statusPlotNode->getParams()->getParamById($paramInfo['id']); $this->unmarshallStatusBar($paramData->{'param-drawing-object'}, $paramNode, $paramInfo['indexes']); break; - case 'tick-bar' : + case 'tick-bar': if (($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTTICK_NAME) && !isset($tickPlotNode)) $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); else $paramNode = $tickPlotNode->getParams()->getParamById($paramInfo['id']); - + $this->unmarshallTickBar($paramData->{'param-drawing-object'}, $paramNode, $paramInfo['indexes']); break; - case 'iserie' : + case 'iserie': $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); $this->unmarshallInstantSerie($paramData->{'param-drawing-object'}, $plotNode, $paramNode); break; - case 'ispectro' : + case 'ispectro': $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); $this->unmarshallInstantSpectro($paramData->{'param-drawing-object'}, $plotNode, $paramNode, $paramInfo['indexes']); break; - case 'intervals' : + case 'intervals': $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); $this->unmarshallIntervals($paramData->{'param-drawing-object'}, $paramNode); break; - default : + default: throw new Exception('Drawing type not implemented.'); } ++$drawingEltIndex; } - + //Colored parameter $drawingEltIndex = 0; - foreach ($paramsData as $paramData) - { - if (empty($paramData->{'param-drawing-object'}->{'serie-colored-param'})) - { + foreach ($paramsData as $paramData) { + if (empty($paramData->{'param-drawing-object'}->{'serie-colored-param'})) { ++$drawingEltIndex; continue; } - + $paramColoredInfo = $this->paramManager->addExistingParam($paramData->{'param-drawing-object'}->{'serie-colored-param'}, $this->paramsData); if ($paramColoredInfo['id'] == '') throw new Exception('Cannot retrieve colored parameter.'); $requestParamsNode->addParam($paramColoredInfo['id']); $coloredParamNode = $plotNode->getParams()->getParamById($paramColoredInfo['id']); - + $colorSerieId = $drawingEltIndex; - - switch ($paramData->{'param-drawing-type'}) - { - case 'serie' : - case 'orbit-serie' : + + switch ($paramData->{'param-drawing-type'}) { + case 'serie': + case 'orbit-serie': //Unmarshall colored serie if (count($paramColoredInfo['indexes']) == 0) $coloredParamNode->addColorSerie($colorSerieId, -1); @@ -711,29 +670,26 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass else throw new Exception('Colored parameter for serie must be a component.'); break; - default : + default: throw new Exception('Colored parameter not allowed for this drawing type. '); } ++$drawingEltIndex; } } - + protected function unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, $indexes, $xId, $colorSerieId, $isOrbitSerie) { $serieNodes = array(); - - if (!$isOrbitSerie) - { - if (count($indexes) == 0) - { + + if (!$isOrbitSerie) { + if (count($indexes) == 0) { $serieNode = $paramNode->addYSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, -1, $xId, $colorSerieId, $paramData->{'param-drawing-object'}->{'serie-value-min'}, $paramData->{'param-drawing-object'}->{'serie-value-max'}); $serieNode->setId($paramData->{'id'}); if (!empty($paramData->{'param-drawing-object'}->{'serie-resolution'})) $serieNode->setResolution($paramData->{'param-drawing-object'}->{'serie-resolution'}); $serieNodes[] = $serieNode; } - foreach ($indexes as $index) - { + foreach ($indexes as $index) { $serieNode = $paramNode->addYSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, $index, $xId, $colorSerieId, $paramData->{'param-drawing-object'}->{'serie-value-min'}, $paramData->{'param-drawing-object'}->{'serie-value-max'}); if (count($indexes) == 1) $serieNode->setId($paramData->{'id'}); @@ -741,60 +697,51 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass $serieNode->setResolution($paramData->{'param-drawing-object'}->{'serie-resolution'}); $serieNodes[] = $serieNode; } - } - else - { + } else { $orbitSerie = $paramNode->addOrbitSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, $colorSerieId); $orbitSerie->setId($paramData->{'id'}); $serieNodes[] = $orbitSerie; } - - foreach ($serieNodes as $serieNode) - { - if (!$isOrbitSerie) - { + + foreach ($serieNodes as $serieNode) { + if (!$isOrbitSerie) { //Resampling - if ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTXY_NAME) - { - switch ($paramData->{'param-drawing-object'}->{'serie-resampling-mode'}) - { - case 'yparam' : + if ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTXY_NAME) { + switch ($paramData->{'param-drawing-object'}->{'serie-resampling-mode'}) { + case 'yparam': $serieNode->getResampling()->setType(RequestOutputPlotResamplingTypeEnum::YPARAM); break; - case 'xparam' : - default : + case 'xparam': + default: $serieNode->getResampling()->setType(RequestOutputPlotResamplingTypeEnum::XPARAM); } } - } - else - { + } else { //Projection - switch ($paramData->{'param-drawing-object'}->{'serie-projection'}) - { - case 'XY' : + switch ($paramData->{'param-drawing-object'}->{'serie-projection'}) { + case 'XY': $serieNode->setProjection(RequestOutputPlotOrbitSerieProjectionEnum::XY); break; - case 'XZ' : + case 'XZ': $serieNode->setProjection(RequestOutputPlotOrbitSerieProjectionEnum::XZ); break; - case 'YZ' : + case 'YZ': $serieNode->setProjection(RequestOutputPlotOrbitSerieProjectionEnum::YZ); break; - case 'XR' : + case 'XR': $serieNode->setProjection(RequestOutputPlotOrbitSerieProjectionEnum::XR); break; - case 'YR' : + case 'YR': $serieNode->setProjection(RequestOutputPlotOrbitSerieProjectionEnum::YR); break; - case 'ZR' : + case 'ZR': $serieNode->setProjection(RequestOutputPlotOrbitSerieProjectionEnum::ZR); break; - default : + default: throw new Exception('Projection not allowed for the orbit serie'); } } - + //Line $this->unmarshallLine($paramData->{'param-drawing-object'}, 'serie', $serieNode->getLine(), $paramData->{'param-drawing-object'}->{"serie-lines-activated"} ? RequestOutputPlotLineTypeEnum::LINE : RequestOutputPlotLineTypeEnum::NO); //Symbol @@ -808,15 +755,14 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass //Interval tick if ($paramData->{'param-drawing-object'}->{'serie-intervaltick-activated'}) $this->unmarshallIntervalTick($paramData->{'param-drawing-object'}, $serieNode->getIntervalTicks()); - if (!$isOrbitSerie) - { + if (!$isOrbitSerie) { //Error bar if ($paramData->{'param-drawing-object'}->{'serie-errorbar-activated'}) $this->unmarshallErrorBar($paramData->{'param-drawing-object'}, $requestParamsNode, $serieNode->getErrorBar()); } } } - + protected function unmarshallTimeTick($serieData, $timeTickNode) { //Font @@ -828,18 +774,17 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass //Symbol $this->unmarshallSymbol($serieData, 'serie-timetick-symbols', $timeTickNode->getSymbol()); //Set options by type - switch ($serieData->{'serie-timetick-type'}) - { - case 'time-step' : + switch ($serieData->{'serie-timetick-type'}) { + case 'time-step': $timeTickNode->setStep(CommonClass::timeStampToDDTime($serieData->{'serie-timetick-step'})); $timeTickNode->setNumber(0); break; - case 'nb-major' : + case 'nb-major': $timeTickNode->setStep(0); $timeTickNode->setNumber($serieData->{'serie-timetick-nbmajor'}); break; - case 'auto' : - default : + case 'auto': + default: $timeTickNode->setStep('auto'); $timeTickNode->setNumber(0); } @@ -848,12 +793,11 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass //Color $timeTickNode->setColor($this->hexColor2KernelColor($serieData->{'serie-timetick-color'})); } - + protected function unmarshallIntervalTick($serieData, $intervalTickNode) { //Mode - switch ($serieData->{'serie-intervaltick-mode'}) - { + switch ($serieData->{'serie-intervaltick-mode'}) { case 'symbol-only': $intervalTickNode->setMode(RequestOutputPlotSerieIntervalTicksModeEnum::SYMBOLONLY); break; @@ -864,29 +808,28 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass $intervalTickNode->setMode(RequestOutputPlotSerieIntervalTicksModeEnum::STARTSTOPTIME); break; case 'start-time': - default : + default: $intervalTickNode->setMode(RequestOutputPlotSerieIntervalTicksModeEnum::STARTTIME); } - + //Color $intervalTickNode->setColor($this->hexColor2KernelColor($serieData->{'serie-intervaltick-color'})); - + //Symbol $this->unmarshallSymbol($serieData, 'serie-intervaltick-symbols', $intervalTickNode->getSymbol()); - + //Font if ($serieData->{'serie-intervaltick-font-activated'}) $this->unmarshallFont($serieData, 'serie-intervaltick-font', $intervalTickNode->getFont()); } - + protected function unmarshallErrorBar($serieData, $requestParamsNode, $errorBarNode) { //Type - switch ($serieData->{'serie-errorbar-type'}) - { + switch ($serieData->{'serie-errorbar-type'}) { case 'min-max': $errorBarTypeNode = $errorBarNode->getBarByType(RequestOutputPlotYSerieErrorBarTypeEnum::MINMAX); - + $minParamInfo = $this->paramManager->addExistingParam($serieData->{'serie-errorbar-minparam'}, $this->paramsData); if ($minParamInfo['id'] == '') throw new Exception('Cannot retrieve min. error parameter.'); @@ -897,7 +840,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass $errorBarTypeNode->setMinParam($minParamInfo['id'], $minParamInfo['indexes'][0]); else throw new Exception('Min parameter for error bar must be a component.'); - + $maxParamInfo = $this->paramManager->addExistingParam($serieData->{'serie-errorbar-maxparam'}, $this->paramsData); if ($maxParamInfo['id'] == '') throw new Exception('Cannot retrieve max. error parameter.'); @@ -911,7 +854,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass break; case 'delta': $errorBarTypeNode = $errorBarNode->getBarByType(RequestOutputPlotYSerieErrorBarTypeEnum::DELTA); - + $deltaParamInfo = $this->paramManager->addExistingParam($serieData->{'serie-errorbar-deltaparam'}, $this->paramsData); if ($deltaParamInfo['id'] == '') throw new Exception('Cannot retrieve delta error parameter.'); @@ -923,21 +866,21 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass else throw new Exception('Delta parameter for error bar must be a component.'); break; - default : + default: throw new Exception('Unknown error bar type.'); } - + //Line $this->unmarshallLine($serieData, 'serie-errorbar', $errorBarNode->getLine(), RequestOutputPlotLineTypeEnum::LINE); } - + protected function unmarshallInstantSerie($paramDrawingData, $plotNode, $paramNode) { $iserieNode = $paramNode->addInstantSerie('y-left'); - + //Table on X Axis $iserieNode->setTableOnXAxis($paramDrawingData->{'iserie-tableonx'} ? "true" : "false"); - + //Line $this->unmarshallLine($paramDrawingData, 'iserie', $iserieNode->getLine(), $paramDrawingData->{"iserie-lines-activated"} ? RequestOutputPlotLineTypeEnum::LINE : RequestOutputPlotLineTypeEnum::NO); @@ -947,18 +890,29 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass else $this->unmarshallSymbol($paramDrawingData, 'iserie-symbols', $iserieNode->getSymbol()); } - + protected function unmarshallSpectro($paramDrawingData, $plotNode, $paramNode, $indexes) { - $spectroNode = $paramNode->addSpectro($paramDrawingData->{'spectro-yaxis'}, empty($paramDrawingData->{'spectro-resolution'}) ? NULL : $paramDrawingData->{'spectro-resolution'}, count($indexes) > 0 ? $indexes[0] : NULL, $paramDrawingData->{'spectro-value-min'}, $paramDrawingData->{'spectro-value-max'}, isset($paramDrawingData->{'spectro-log0-as-min'}) ? $paramDrawingData->{'spectro-log0-as-min'} : false, empty($paramDrawingData->{'spectro-normalization'}) ? NULL: $paramDrawingData->{'spectro-normalization'}); + $spectroNode = $paramNode->addSpectro( + $paramDrawingData->{'spectro-yaxis'}, + empty($paramDrawingData->{'spectro-resolution'}) ? NULL : $paramDrawingData->{'spectro-resolution'}, + count($indexes) > 0 ? $indexes[0] : NULL, + $paramDrawingData->{'spectro-value-min'}, + $paramDrawingData->{'spectro-value-max'}, + isset($paramDrawingData->{'spectro-log0-as-min'}) ? $paramDrawingData->{'spectro-log0-as-min'} : false, + empty($paramDrawingData->{'spectro-normalization'}) ? NULL : $paramDrawingData->{'spectro-normalization'}, + empty($paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE}) ? NULL : $paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE}, + !isset($paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE}) ? NULL : $paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE}, + !isset($paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_DIM}) ? NULL : $paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_DIM} + ); } - + protected function unmarshallInstantSpectro($paramDrawingData, $plotNode, $paramNode, $indexes) { - //TBD how to process inexes if they are defined ? + //TBD how to process inexes if they are defined ? $spectroNode = $paramNode->addInstantSpectro('y-left', $paramDrawingData->{'ispectro-dimonxaxis'}); } - + protected function unmarshallStatusBar($paramDrawingData, $paramNode, $indexes) { if (count($indexes) == 0) @@ -971,7 +925,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass { $paramNode->addIntervals(); } - + protected function unmarshallTickBar($paramDrawingData, $paramNode, $indexes) { if (count($indexes) == 0) @@ -979,7 +933,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass foreach ($indexes as $index) $paramNode->addTickBar($index); } - + protected function hasStatusBar($paramsData) { foreach ($paramsData as $paramData) @@ -987,7 +941,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass return true; return false; } - + protected function hasTickBar($paramsData) { foreach ($paramsData as $paramData) @@ -995,116 +949,111 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass return true; return false; } - + protected function unmarshallParamsLegend($paramsLegendData, $paramsLegendNode) { //Legend type - switch ($paramsLegendData->{'legend-series-type'}) - { - case 'text-line-symbol' : + switch ($paramsLegendData->{'legend-series-type'}) { + case 'text-line-symbol': $paramsLegendNode->setType(RequestOutputPlotParamsLegendTypeEnum::TEXTLINESYMBOL); break; - case 'text-only' : - default : + 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' : + switch ($paramsLegendData->{'legend-series-intervalinfo-type'}) { + case 'start-stop': $paramsLegendNode->setIntervalInfoType(RequestOutputPlotParamsLegendIntervalInfoTypeEnum::STARTSTOP); break; - case 'index' : - default : + case 'index': + default: $paramsLegendNode->setIntervalInfoType(RequestOutputPlotParamsLegendIntervalInfoTypeEnum::INDEX); } - + //Position - switch ($paramsLegendData->{'legend-series-position'}) - { - case 'inside' : + switch ($paramsLegendData->{'legend-series-position'}) { + case 'inside': $paramsLegendNode->setPosition(RequestOutputPlotParamsLegendPositionEnum::INSIDE); break; - case 'outside' : - default : + 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 unmarshallTextLegend($textLegendData, $legendsNode) { $legendNode = $legendsNode->addTextLegend(); - + //Legend text $legendNode->setText($textLegendData->{'legend-text-value'}); - + //Legend position - switch ($textLegendData->{'legend-text-position'}) - { - case 'top' : + switch ($textLegendData->{'legend-text-position'}) { + case 'top': $legendNode->setPosition(RequestOutputPlotTextLegendPositionEnum::TOP); break; - case 'bottom' : + case 'bottom': $legendNode->setPosition(RequestOutputPlotTextLegendPositionEnum::BOTTOM); break; - case 'left' : + case 'left': $legendNode->setPosition(RequestOutputPlotTextLegendPositionEnum::LEFT); break; - case 'right' : - default : + case 'right': + default: $legendNode->setPosition(RequestOutputPlotTextLegendPositionEnum::RIGHT); } - + //Legend text color $legendNode->setColor($this->hexColor2KernelColor($textLegendData->{'legend-text-color'})); - + //Font if ($textLegendData->{'legend-text-font-activated'}) $this->unmarshallFont($textLegendData, 'legend-text-font', $legendNode->getFont()); } - - protected function unmarshallConstant($constantData,$axisNode) + + protected function unmarshallConstant($constantData, $axisNode) { $constantNode = $axisNode->addConstant(); $constantNode->setId($constantData->{'id'}); - + //Constant value - switch ($axisNode->getName()) - { - case REQUESTOUTPUTPLOTTIMEAXIS_NAME : + switch ($axisNode->getName()) { + case REQUESTOUTPUTPLOTTIMEAXIS_NAME: date_default_timezone_set('UTC'); $timeStamp = strtotime($constantData->{'constant-time-value'}); $time = CommonClass::timeStampToDDTime($timeStamp); $constantNode->setConstantValue($time); break; - default : + default: $constantNode->setConstantValue($constantData->{'constant-float-value'}); } - + //Curve options $this->unmarshallCurve($constantData, "constant-line", $constantNode); } - + protected function unmarshallAdditionalObjects($panelData, $addObjectsNode, $isTimePlot) { foreach ($panelData->{'textObjs'} as $textData) @@ -1112,87 +1061,81 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass foreach ($panelData->{'curves'} as $curveData) $this->unmarshallCurveObject($curveData, $addObjectsNode); } - + protected function unmarshallTextObject($textData, $addObjectsNode, $isTimePlot) { $textNode = $addObjectsNode->addTextObject(); - + $textNode->setText($textData->{'text-value'}); - - switch ($textData->{'text-y-axis'}) - { - case 'y-right' : + + switch ($textData->{'text-y-axis'}) { + case 'y-right': $textNode->setYAxis('y-right'); break; - case 'y-left' : + case 'y-left': $textNode->setYAxis('y-left'); break; } - - if ($isTimePlot && !$textData->{'text-x-relative'}) - { + + if ($isTimePlot && !$textData->{'text-x-relative'}) { date_default_timezone_set('UTC'); $timeStamp = strtotime($textData->{'text-x-timevalue'}); $time = CommonClass::timeStampToDDTime($timeStamp); $textNode->setX($time); - } - else if ($textData->{'text-x-relative'}) - $textNode->setX(($textData->{'text-x-floatvalue'}*100)."%"); + } else if ($textData->{'text-x-relative'}) + $textNode->setX(($textData->{'text-x-floatvalue'} * 100) . "%"); else $textNode->setX($textData->{'text-x-floatvalue'}); - + if ($textData->{'text-y-relative'}) - $textNode->setY(($textData->{'text-y-value'}*100)."%"); + $textNode->setY(($textData->{'text-y-value'} * 100) . "%"); else $textNode->setY($textData->{'text-y-value'}); - + $textNode->setAngle($textData->{'text-angle'}); - + $textNode->setColor($this->hexColor2KernelColor($textData->{'text-color'})); - - switch ($textData->{'text-align'}) - { - case 'center' : + + switch ($textData->{'text-align'}) { + case 'center': $textNode->setAlign(RequestOutputPlotTextAlign::CENTER); break; - case 'right' : + case 'right': $textNode->setAlign(RequestOutputPlotTextAlign::RIGHT); break; - case 'left' : + case 'left': default: $textNode->setAlign(RequestOutputPlotTextAlign::LEFT); } - + //Font if ($textData->{'text-font-activated'}) $this->unmarshallFont($textData, 'text-font', $textNode->getFont()); } - + protected function unmarshallCurveObject($curveData, $addObjectsNode) { if (($curveData->{'curve-name'} == '') || !isset($curveData->{'curve-serie-id'})) return; - + $curveNode = $addObjectsNode->addCurveObject(); - + $curveNode->setSerieId($curveData->{'curve-serie-id'}); - + $curveNode->getFunction()->setFunctionName($curveData->{'curve-name'}); - + foreach ($curveData->{'params'} as $paramData) $curveNode->getFunction()->addAttribute($paramData->{'curve-param-name'}, $paramData->{'curve-param-value'}); - + //Curve options $this->unmarshallCurve($curveData, "curve-line", $curveNode); } - + protected function unmarshallFills($panelData, $fillsNode) { - foreach ($panelData->{'fills'} as $fillData) - { + foreach ($panelData->{'fills'} as $fillData) { //Serie / Constant - if ($fillData->{'fill-type'} == 'serie-constant') - { + if ($fillData->{'fill-type'} == 'serie-constant') { $fillNode = $fillsNode->addFill(RequestOutputPlotFillTypeEnum::SERIECONSTANT); $fillNode->setSerieId($fillData->{'fill-firstserie-id'}); $fillNode->setConstantId($fillData->{'fill-constant-id'}); @@ -1202,12 +1145,10 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass $fillNode->setLessColor($this->hexColor2KernelColor($fillData->{'fill-less-color'})); } } - - foreach ($panelData->{'fills'} as $fillData) - { + + foreach ($panelData->{'fills'} as $fillData) { //Serie / Serie - if ($fillData->{'fill-type'} == 'serie-serie') - { + if ($fillData->{'fill-type'} == 'serie-serie') { $fillNode = $fillsNode->addFill(RequestOutputPlotFillTypeEnum::SERIESERIE); $fillNode->setFirstSerieId($fillData->{'fill-firstserie-id'}); $fillNode->setSecondSerieId($fillData->{'fill-secondserie-id'}); @@ -1216,172 +1157,162 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass if ($fillData->{'fill-less-color'} != 'none') $fillNode->setLessColor($this->hexColor2KernelColor($fillData->{'fill-less-color'})); } - } + } } - + protected function unmarshallTitle($inputData, $keyPrefix, $titleNode) { - if ($inputData->{$keyPrefix.'-text'} != '') - { - $titleNode->setText($inputData->{$keyPrefix.'-text'}); - - switch ($inputData->{$keyPrefix.'-position'}) - { - case 'top' : + if ($inputData->{$keyPrefix . '-text'} != '') { + $titleNode->setText($inputData->{$keyPrefix . '-text'}); + + switch ($inputData->{$keyPrefix . '-position'}) { + case 'top': $titleNode->setPosition(RequestOutputPlotTitlePosition::TOP); break; - case 'bottom' : + case 'bottom': $titleNode->setPosition(RequestOutputPlotTitlePosition::BOTTOM); break; } - - switch ($inputData->{$keyPrefix.'-alignment'}) - { - case 'center' : + + switch ($inputData->{$keyPrefix . '-alignment'}) { + case 'center': $titleNode->setAlign(RequestOutputPlotTitleAlign::CENTER); break; - case 'left' : + case 'left': $titleNode->setAlign(RequestOutputPlotTitleAlign::LEFT); break; - case 'right' : + case 'right': $titleNode->setAlign(RequestOutputPlotTitleAlign::RIGHT); break; } - - if ($inputData->{$keyPrefix.'-color'} != '') - $titleNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix.'-color'})); - + + if ($inputData->{$keyPrefix . '-color'} != '') + $titleNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix . '-color'})); + $this->unmarshallLabel($inputData, $keyPrefix, $titleNode); } } - + protected function unmarshallLabel($inputData, $keyPrefix, $labelNode) { - if ($inputData->{$keyPrefix.'-font-activated'}) - { - $labelNode->setFontName($inputData->{$keyPrefix.'-font-name'}); - $labelNode->setFontSize($inputData->{$keyPrefix.'-font-size'}); - if ($inputData->{$keyPrefix.'-font-bold'}) - { + if ($inputData->{$keyPrefix . '-font-activated'}) { + $labelNode->setFontName($inputData->{$keyPrefix . '-font-name'}); + $labelNode->setFontSize($inputData->{$keyPrefix . '-font-size'}); + if ($inputData->{$keyPrefix . '-font-bold'}) { $labelNode->setFontWeight("bold"); } - if ($inputData->{$keyPrefix.'-font-italic'}) - { - $labelNode->setFontStyle("italic"); + if ($inputData->{$keyPrefix . '-font-italic'}) { + $labelNode->setFontStyle("italic"); } } - } - + protected function unmarshallFont($inputData, $keyPrefix, $fontNode) { - if ($inputData->{$keyPrefix.'-activated'}) - { - $fontNode->setFontName($inputData->{$keyPrefix.'-name'}); - $fontNode->setSize($inputData->{$keyPrefix.'-size'}); - - if ($inputData->{$keyPrefix.'-italic'}) + if ($inputData->{$keyPrefix . '-activated'}) { + $fontNode->setFontName($inputData->{$keyPrefix . '-name'}); + $fontNode->setSize($inputData->{$keyPrefix . '-size'}); + + if ($inputData->{$keyPrefix . '-italic'}) $fontNode->setStyle(RequestOutputPlotFontStyle::ITALIC); else $fontNode->setStyle(RequestOutputPlotFontStyle::UPRIGHT); - - if ($inputData->{$keyPrefix.'-bold'}) + + if ($inputData->{$keyPrefix . '-bold'}) $fontNode->setWeight(RequestOutputPlotFontWeight::BOLD); else $fontNode->setWeight(RequestOutputPlotFontWeight::MEDIUM); } } - + protected function unmarshallCurve($inputData, $keyPrefix, $curveNode) { - switch ($inputData->{$keyPrefix.'-style'}) - { - - case 'dot' : + switch ($inputData->{$keyPrefix . '-style'}) { + + case 'dot': $curveNode->setStyle(RequestOutputPlotCurveStyleEnum::DOT); break; - case 'long-spaced-dot' : + case 'long-spaced-dot': $curveNode->setStyle(RequestOutputPlotCurveStyleEnum::LONGSPACEDDOT); break; - case 'long-short-dot' : + case 'long-short-dot': $curveNode->setStyle(RequestOutputPlotCurveStyleEnum::LONGSHORTDOT); break; - case 'plain' : - default : + case 'plain': + default: $curveNode->setStyle(RequestOutputPlotCurveStyleEnum::PLAIN); break; } - - if (isset($inputData->{$keyPrefix.'-width'})) - $curveNode->setWidth($inputData->{$keyPrefix.'-width'}); - - if (isset($inputData->{$keyPrefix.'-color'}) && ($inputData->{$keyPrefix.'-color'} != 'auto')) - $curveNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix.'-color'})); + + if (isset($inputData->{$keyPrefix . '-width'})) + $curveNode->setWidth($inputData->{$keyPrefix . '-width'}); + + if (isset($inputData->{$keyPrefix . '-color'}) && ($inputData->{$keyPrefix . '-color'} != 'auto')) + $curveNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix . '-color'})); } - + protected function unmarshallLine($inputData, $keyPrefix, $lineNode, $lineType) { $lineNode->setType($lineType); - $this->unmarshallCurve($inputData, $keyPrefix."-lines", $lineNode); + $this->unmarshallCurve($inputData, $keyPrefix . "-lines", $lineNode); } - + protected function unmarshallSymbol($inputData, $keyPrefix, $symbolNode) { - switch ($inputData->{$keyPrefix.'-type'}) - { - case 'dot' : + switch ($inputData->{$keyPrefix . '-type'}) { + case 'dot': $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::DOT); break; - case 'plus' : + case 'plus': $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::PLUS); break; - case 'wildcard' : + case 'wildcard': $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::WILDCARD); break; - case 'circle' : + case 'circle': $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::CIRCLE); break; - case 'crux' : + case 'crux': $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::CRUX); break; - case 'square' : + case 'square': $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::SQUARE); break; - case 'triangle' : + case 'triangle': $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::TRIANGLE); break; - case 'crux-in-circle' : + case 'crux-in-circle': $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::CRUXINCIRCLE); break; - case 'dot-in-circle' : + case 'dot-in-circle': $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::DOTINCIRCLE); break; - case 'diamond' : + case 'diamond': $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::DIAMOND); break; - case 'star' : + case 'star': $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::STAR); break; - case 'david-star' : + case 'david-star': $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::DAVIDSTAR); break; - case 'full-square' : + case 'full-square': $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::FULLSQUARE); break; - case 'full-circle' : + case 'full-circle': $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::FULLCIRCLE); break; - case 'full-star' : + case 'full-star': $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::FULLSTAR); break; - default : + default: throw new Exception('Symbol type not implemented.'); } - - $symbolNode->setSize($inputData->{$keyPrefix.'-size'}); - - if ($inputData->{$keyPrefix.'-color'} != 'auto') - $symbolNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix.'-color'})); + + $symbolNode->setSize($inputData->{$keyPrefix . '-size'}); + + if ($inputData->{$keyPrefix . '-color'} != 'auto') + $symbolNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix . '-color'})); } /* @@ -1389,29 +1320,27 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass */ protected function marshallResult($data) { - if (!$this->isInteractiveRequest) - { + if (!$this->isInteractiveRequest) { //add to job - $commonRes = $this->commonMarshallResult($data,PLOT_RESULT_FILE_KEY); - + $commonRes = $this->commonMarshallResult($data, PLOT_RESULT_FILE_KEY); + return $commonRes; } - + //Interactive request if (!$data->getSuccess()) return array( - 'success' => false, - 'message' => $data->getLastErrorMessage()); - - switch ($data->getStatus()) - { - case ProcessStatusEnumClass::DONE : - + 'success' => false, + 'message' => $data->getLastErrorMessage() + ); + + switch ($data->getStatus()) { + case ProcessStatusEnumClass::DONE: + $result = array(); - foreach ($data->getWaitingResults() as $key => $waitingResult) - { - $contextResult = str_replace(".png","_context.xml",$waitingResult); - + foreach ($data->getWaitingResults() as $key => $waitingResult) { + $contextResult = str_replace(".png", "_context.xml", $waitingResult); + $result[] = array( "id" => $key, "title" => $this->interactivePlotTitle[$key], @@ -1419,64 +1348,67 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass "isInterval" => $this->interactiveTimeSelectionState[$key], "index" => $this->interactivePlotIndex[$key], "ttFileIndex" => $this->interactiveCrtTTFileIndex, - "context" => IHMPlotContextFileClass::parse($this->getWorkingPath().$contextResult), + "context" => IHMPlotContextFileClass::parse($this->getWorkingPath() . $contextResult), "plot" => $waitingResult, "exectime" => $data->getExecTime(), "multiplot" => $this->isMultiPlot, ); } - + return array( 'success' => true, 'id' => $data->getId(), 'folder' => $this->getWorkingDirName(), 'result' => $result ); - case ProcessStatusEnumClass::KILLED : + case ProcessStatusEnumClass::KILLED: return array( - 'success' => true, - 'killed' => true); - default : + 'success' => true, + 'killed' => true + ); + default: $errorMsg = $data->getErrorMsg(); return array( - 'success' => false, - 'message' => 'Request processing error'.(!empty($errorMsg) ? "
(".$errorMsg.")" : "")); + 'success' => false, + 'message' => 'Request processing error' . (!empty($errorMsg) ? "
(" . $errorMsg . ")" : "") + ); } } - - private function hexColor2KernelColor($hex) { + + private function hexColor2KernelColor($hex) + { $hex = str_replace("#", "", $hex); - $r = hexdec(substr($hex,0,2)); - $g = hexdec(substr($hex,2,2)); - $b = hexdec(substr($hex,4,2)); + $r = hexdec(substr($hex, 0, 2)); + $g = hexdec(substr($hex, 2, 2)); + $b = hexdec(substr($hex, 4, 2)); - return "[".$r.",".$g.",".$b."]"; + return "[" . $r . "," . $g . "," . $b . "]"; } - + protected function saveIHMRequest($interactiveId, $input) { - $path = $this->getWorkingPath()."ihm.request.".$interactiveId; + $path = $this->getWorkingPath() . "ihm.request." . $interactiveId; if (!is_dir($this->getWorkingPath())) - mkdir($this->getWorkingPath(),0777); + mkdir($this->getWorkingPath(), 0777); $file = fopen($path, 'w'); fwrite($file, json_encode($input)); fclose($file); } - + protected function loadIHMRequest($interactiveId) { - $path = $this->getWorkingPath()."ihm.request.".$interactiveId; + $path = $this->getWorkingPath() . "ihm.request." . $interactiveId; if (!file_exists($path)) return NULL; return json_decode(file_get_contents($path)); } - + private function loadZoomList($interactiveId) { - $path = $this->getWorkingPath()."zoom.list.".$interactiveId; + $path = $this->getWorkingPath() . "zoom.list." . $interactiveId; if (!file_exists($path)) return NULL; return json_decode(file_get_contents($path)); @@ -1484,182 +1416,164 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass private function saveZoomList($interactiveId, $zoomList) { - $path = $this->getWorkingPath()."zoom.list.".$interactiveId; + $path = $this->getWorkingPath() . "zoom.list." . $interactiveId; if (!is_dir($this->getWorkingPath())) - mkdir($this->getWorkingPath(),0777); + mkdir($this->getWorkingPath(), 0777); $file = fopen($path, 'w'); fwrite($file, json_encode($zoomList)); fclose($file); } - + private function unmarshallActionRequest($input) { $actionInput = $input->{'action'}; - + $plotInput = $this->loadIHMRequest($actionInput->{'interactiveId'}); - + if (!isset($plotInput)) throw new Exception('Cannot retrieve request input for interactive action.'); - - switch ($actionInput->{'action'}) - { - case 'zoom' : + + switch ($actionInput->{'action'}) { + case 'zoom': return $this->unmarshallZoom($actionInput, $plotInput); - case 'forward' : - case 'halfforward' : - case 'backward' : - case 'halfbackward' : - case 'extend' : - case 'shift' : + case 'forward': + case 'halfforward': + case 'backward': + case 'halfbackward': + case 'extend': + case 'shift': return $this->unmarshallNavigation($actionInput, $plotInput); - case 'goto' : + case 'goto': return $this->unmarshallTTGoto($actionInput, $plotInput); - case 'instant' : + case 'instant': return $this->unmarshallInstant($actionInput, $plotInput); - case 'undozoom' : + case 'undozoom': return $this->unmarshallUndoZoom($actionInput, $plotInput); - default : + default: throw new Exception('Interactive action not implemented.'); } } - + private function addZoomInList($input, $isInterval, $minOrFileIndex, $maxOrIntervalIndex) { //if $isInterval == true, $minOrFileIndex is the min and $maxOrInetrvalIndex is the max //if $isInterval == false, $minOrFileIndex is the fileIndex and $maxOrInetrvalIndex is the intervalIndex - + $zoomList = $this->loadZoomList($input->interactiveId); - - if (!isset($zoomList)) - { + + if (!isset($zoomList)) { //Init zoom list - $zoomList = (Object)array( + $zoomList = (object)array( 'times' => array(), - 'panels' => (Object)array() + 'panels' => (object)array() ); } - - if ($input->{'axeId'} == 'timeAxis') - { + + if ($input->{'axeId'} == 'timeAxis') { if ($isInterval) - array_push ($zoomList->times, (Object)array( + array_push($zoomList->times, (object)array( 'isInterval' => true, 'min' => $minOrFileIndex, 'max' => $maxOrIntervalIndex )); else - array_push ($zoomList->times, (Object)array( - 'isInterval' => false, - 'ttFileIndex' => $minOrFileIndex, - 'intIndex' => $maxOrIntervalIndex + array_push($zoomList->times, (object)array( + 'isInterval' => false, + 'ttFileIndex' => $minOrFileIndex, + 'intIndex' => $maxOrIntervalIndex )); - } - else - { - if (!isset($zoomList->panels->{$input->{'panelId'}})) - { - $zoomList->panels->{$input->{'panelId'}} = (Object) array( - 'axes' => (Object)array() + } else { + if (!isset($zoomList->panels->{$input->{'panelId'}})) { + $zoomList->panels->{$input->{'panelId'}} = (object) array( + 'axes' => (object)array() ); } - - if (!isset($zoomList->panels->{$input->{'panelId'}}->axes->{$input->{'axeId'}})) - { + + if (!isset($zoomList->panels->{$input->{'panelId'}}->axes->{$input->{'axeId'}})) { $zoomList->panels->{$input->{'panelId'}}->axes->{$input->{'axeId'}} = array(); } - - array_push ($zoomList->panels->{$input->{'panelId'}}->axes->{$input->{'axeId'}}, (Object)array( - 'min' => $minOrFileIndex, - 'max' => $maxOrIntervalIndex + + array_push($zoomList->panels->{$input->{'panelId'}}->axes->{$input->{'axeId'}}, (object)array( + 'min' => $minOrFileIndex, + 'max' => $maxOrIntervalIndex )); } - + $this->saveZoomList($input->interactiveId, $zoomList); } - + private function resetZoomList($interactiveId, $resetOnlyTimeZoom = false) { if (!$resetOnlyTimeZoom) { - $zoomList = (Object)array( + $zoomList = (object)array( 'times' => array(), - 'panels' => (Object)array() + 'panels' => (object)array() ); - } - else { + } else { $zoomList = $this->loadZoomList($interactiveId); $zoomList->times = array(); } $this->saveZoomList($interactiveId, $zoomList); } - + private function undoZoomInList($input) { $zoomList = $this->loadZoomList($input->interactiveId); - + $result = NULL; - if ($zoomList) - { - if ($input->{'axeId'} == 'timeAxis') - { + if ($zoomList) { + if ($input->{'axeId'} == 'timeAxis') { if (count($zoomList->times) <= 0) return NULL; - $result = array_pop($zoomList->times); - } - else - { + $result = array_pop($zoomList->times); + } else { if (!isset($zoomList->panels->{$input->{'panelId'}})) return NULL; - + if (!isset($zoomList->panels->{$input->{'panelId'}}->axes->{$input->{'axeId'}})) return NULL; - + $result = array_pop($zoomList->panels->{$input->{'panelId'}}->axes->{$input->{'axeId'}}); } - } - else + } else return NULL; - + $this->saveZoomList($input->interactiveId, $zoomList); - + return $result; } - + private function unmarshallZoom($input, $plotInput, $isUndo = false) { - if ($input->{'axeId'} == 'timeAxis') - { + if ($input->{'axeId'} == 'timeAxis') { //Zoom on Time Axis - if ($plotInput->{'timesrc'} != 'Interval') - { + if ($plotInput->{'timesrc'} != 'Interval') { $plotInput->{'timesrc'} = 'Interval'; if (!$isUndo) - $this->addZoomInList($input,false, - isset($plotInput->{'ttFileIndex'}) ? $plotInput->{'ttFileIndex'} : 0, - isset($plotInput->{'intIndex'}) ? $plotInput->{'intIndex'} : 0); - } - else - { + $this->addZoomInList( + $input, + false, + isset($plotInput->{'ttFileIndex'}) ? $plotInput->{'ttFileIndex'} : 0, + isset($plotInput->{'intIndex'}) ? $plotInput->{'intIndex'} : 0 + ); + } else { if (!$isUndo) - $this->addZoomInList($input,true,$plotInput->{'startDate'},$plotInput->{'stopDate'}); + $this->addZoomInList($input, true, $plotInput->{'startDate'}, $plotInput->{'stopDate'}); } $plotInput->{'startDate'} = $input->{'min'}; $plotInput->{'stopDate'} = $input->{'max'}; - + $plotInput->{'force-time-zoom-reset'} = false; $this->saveIHMRequest($input->interactiveId, $plotInput); return $plotInput; } - + //Digital axis zoom - foreach ($plotInput->{'panels'} as $panel) - { - if ($input->{'panelId'} == $panel->{'id'}) - { - foreach ($panel->{'axes'} as $axis) - { - if ($input->{'axeId'} == $axis->{'id'}) - { + foreach ($plotInput->{'panels'} as $panel) { + if ($input->{'panelId'} == $panel->{'id'}) { + foreach ($panel->{'axes'} as $axis) { + if ($input->{'axeId'} == $axis->{'id'}) { $axis->{'axis-range-extend'} = false; $oldMin = $axis->{'axis-range-min'}; $oldMax = $axis->{'axis-range-max'}; @@ -1670,7 +1584,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass $plotInput->{'force-single-replot'} = true; $plotInput->{'force-time-zoom-reset'} = false; if (!$isUndo) - $this->addZoomInList($input,true,$oldMin,$oldMax); + $this->addZoomInList($input, true, $oldMin, $oldMax); return $plotInput; } } @@ -1679,16 +1593,13 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass } throw new Exception('Cannot retrieve plot panel for zoom action.'); } - + private function unmarshallUndoZoom($input, $plotInput) { $result = $this->undoZoomInList($input); - if ($result != NULL) - { - if (isset($result->isInterval)) - { - if (!$result->isInterval) - { + if ($result != NULL) { + if (isset($result->isInterval)) { + if (!$result->isInterval) { $input->ttFileIndex = $result->ttFileIndex; $input->intIndex = $result->intIndex; return $this->unmarshallTTGoto($input, $plotInput); @@ -1700,137 +1611,128 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass } throw new Exception('No undo zoom to apply.'); } - + private function unmarshallNavigation($input, $plotInput) { $startTime = $plotInput->{'startDate'}; $stopTime = $plotInput->{'stopDate'}; - + //Compute new start / stop time date_default_timezone_set('UTC'); $startTimeStamp = strtotime($startTime); $stopTimeStamp = strtotime($stopTime); $duration = $stopTimeStamp - $startTimeStamp; - - switch ($input->{'action'}) - { - case 'forward' : + + switch ($input->{'action'}) { + case 'forward': $startTimeStamp += $duration; $stopTimeStamp += $duration; break; - case 'halfforward' : - $startTimeStamp += ($duration/2); - $stopTimeStamp += ($duration/2); + case 'halfforward': + $startTimeStamp += ($duration / 2); + $stopTimeStamp += ($duration / 2); break; - case 'backward' : + case 'backward': $startTimeStamp -= $duration; $stopTimeStamp -= $duration; break; - case 'halfbackward' : - $startTimeStamp -= ($duration/2); - $stopTimeStamp -= ($duration/2); + case 'halfbackward': + $startTimeStamp -= ($duration / 2); + $stopTimeStamp -= ($duration / 2); break; - case 'extend' : + case 'extend': $startTimeStamp -= $input->{'duration'}; $stopTimeStamp += $input->{'duration'}; break; - case 'shift' : + case 'shift': $startTimeStamp += $input->{'duration'}; $stopTimeStamp += $input->{'duration'}; break; } - + if ($stopTimeStamp - $startTimeStamp <= 0) throw new Exception('New duration is lower than 0.'); - - $startTime = date("Y-m-d\TH:i:s",$startTimeStamp); - $stopTime = date("Y-m-d\TH:i:s",$stopTimeStamp); - + + $startTime = date("Y-m-d\TH:i:s", $startTimeStamp); + $stopTime = date("Y-m-d\TH:i:s", $stopTimeStamp); + //Update request $plotInput->{'startDate'} = $startTime; $plotInput->{'stopDate'} = $stopTime; - + $plotInput->{'force-time-zoom-reset'} = true; $this->saveIHMRequest($input->interactiveId, $plotInput); return $plotInput; } - + private function unmarshallTTGoto($input, $plotInput) { $plotInput->{'timesrc'} = 'TimeTable'; $plotInput->{'ttFileIndex'} = $input->{'ttFileIndex'}; $plotInput->{'intIndex'} = $input->{'intIndex'}; - + $plotInput->{'force-time-zoom-reset'} = true; $this->saveIHMRequest($input->interactiveId, $plotInput); return $plotInput; } - + private function unmarshallInstant($input, $plotInput) { //Find current panel $crtPanel = NULL; - foreach ($plotInput->{'panels'} as $panel) - { - if ($input->{'panelId'} == $panel->{'id'}) - { + foreach ($plotInput->{'panels'} as $panel) { + if ($input->{'panelId'} == $panel->{'id'}) { $crtPanel = $panel; break; } } - + if (!$crtPanel) throw new Exception('Cannot retrieve plot panel for instant plot.'); - + if ($crtPanel->{'panel-plot-type'} != 'timePlot') throw new Exception('Instant plot action only available for Time plot.'); - + //Find spectra parameter $crtParam = NULL; - foreach ($crtPanel->{'params'} as $param) - { - if ($param->{'param-drawing-type'} == 'spectro') - { - $crtParam = $param; + foreach ($crtPanel->{'params'} as $param) { + if ($param->{'param-drawing-type'} == 'spectro') { + $crtParam = $param; break; } } - + if (!$crtParam) throw new Exception('Cannot retrieve plot param for instant plot.'); - + //Find table Y-axis $crtYAxis = NULL; - foreach ($crtPanel->{'axes'} as $axis) - { - if ($crtParam->{'param-drawing-object'}->{'spectro-yaxis'} == $axis->{'id'}) - { + foreach ($crtPanel->{'axes'} as $axis) { + if ($crtParam->{'param-drawing-object'}->{'spectro-yaxis'} == $axis->{'id'}) { $crtYAxis = $axis; break; } } - + if (!$crtYAxis) throw new Exception('Cannot retrieve plot y Axis for instant plot.'); - + //Find color Z-axis $crtColorAxis = NULL; - foreach ($crtPanel->{'axes'} as $axis) - { - if ($axis->{'id'} == 'color') - { + foreach ($crtPanel->{'axes'} as $axis) { + if ($axis->{'id'} == 'color') { $crtColorAxis = $axis; break; } } - + if (!$crtColorAxis) throw new Exception('Cannot retrieve plot color Axis for instant plot.'); - + date_default_timezone_set('UTC'); $timeStamp = strtotime($input->time); - - $instantPlotInput = (Object)array( + + $instantPlotInput = (object)array( "interactive-preview" => true, "file-format" => "PNG", "file-output" => "INTERACTIVE", @@ -1845,75 +1747,74 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass "page-orientation" => $plotInput->{"page-orientation"}, "page-dimension" => $plotInput->{"page-dimension"}, "page-layout-type" => "vertical", - "page-layout-object" => (Object)array( + "page-layout-object" => (object)array( "layout-expand" => true, - "layout-panel-height" => 0.5, + "layout-panel-height" => 0.5, "layout-panel-spacing" => 0.05 ), "panels" => array() ); - - $instantPanel = (Object)array( - "id" => "1", - "panel-plot-type" => "instantPlot", - "panel-instant-time" => $input->time, - "axes" => array(), - "params" => array(), - - ); - - $instantXAxis = (Object)array( - "id" => "xaxis_id", - "axis-type" => "x", - "axis-scale" => $crtYAxis->{"axis-scale"}, - "axis-thickness" => 1 + + $instantPanel = (object)array( + "id" => "1", + "panel-plot-type" => "instantPlot", + "panel-instant-time" => $input->time, + "axes" => array(), + "params" => array(), + ); - - $instantYAxis = (Object)array( - "id" => "y-left", - "axis-type" => "y-left", - "axis-scale" => $crtColorAxis->{"axis-scale"}, - "axis-thickness" => 1 + + $instantXAxis = (object)array( + "id" => "xaxis_id", + "axis-type" => "x", + "axis-scale" => $crtYAxis->{"axis-scale"}, + "axis-thickness" => 1 + ); + + $instantYAxis = (object)array( + "id" => "y-left", + "axis-type" => "y-left", + "axis-scale" => $crtColorAxis->{"axis-scale"}, + "axis-thickness" => 1 ); $instantPanel->{"axes"}[] = $instantXAxis; $instantPanel->{"axes"}[] = $instantYAxis; - - $instantParam = (Object)array( + + $instantParam = (object)array( "id" => 1, "paramid" => $crtParam->{'paramid'}, "template_args" => $crtParam->{'template_args'}, "param-drawing-type" => "iserie", - "param-drawing-object" => (Object)array( - "iserie-tableonx" => true, - "iserie-lines-activated" => true, - "iserie-lines-style" => "plain", - "iserie-lines-width" => 1, - "iserie-lines-color" => "auto" + "param-drawing-object" => (object)array( + "iserie-tableonx" => true, + "iserie-lines-activated" => true, + "iserie-lines-style" => "plain", + "iserie-lines-width" => 1, + "iserie-lines-color" => "auto" ), - "dim1-index" => $crtParam->{'dim1-index'}, - "dim1-sum-type" => $crtParam->{'dim1-sum-type'}, - "dim1-min-value" => $crtParam->{'dim1-min-value'}, - "dim1-max-value" => $crtParam->{'dim1-max-value'}, - "dim1-min-index" => $crtParam->{'dim1-min-index'}, - "dim1-max-index" => $crtParam->{'dim1-max-index'}, - - "dim2-index" => $crtParam->{'dim2-index'}, - "dim2-sum-type" => $crtParam->{'dim2-sum-type'}, - "dim2-min-value" => $crtParam->{'dim2-min-value'}, - "dim2-max-value" => $crtParam->{'dim2-max-value'}, - "dim2-min-index" => $crtParam->{'dim2-min-index'}, - "dim2-max-index" => $crtParam->{'dim2-max-index'}, - - "type" => $crtParam->{'type'} + "dim1-index" => $crtParam->{'dim1-index'}, + "dim1-sum-type" => $crtParam->{'dim1-sum-type'}, + "dim1-min-value" => $crtParam->{'dim1-min-value'}, + "dim1-max-value" => $crtParam->{'dim1-max-value'}, + "dim1-min-index" => $crtParam->{'dim1-min-index'}, + "dim1-max-index" => $crtParam->{'dim1-max-index'}, + + "dim2-index" => $crtParam->{'dim2-index'}, + "dim2-sum-type" => $crtParam->{'dim2-sum-type'}, + "dim2-min-value" => $crtParam->{'dim2-min-value'}, + "dim2-max-value" => $crtParam->{'dim2-max-value'}, + "dim2-min-index" => $crtParam->{'dim2-min-index'}, + "dim2-max-index" => $crtParam->{'dim2-max-index'}, + + "type" => $crtParam->{'type'} ); - $instantPanel->{"params"}[] = $instantParam; + $instantPanel->{"params"}[] = $instantParam; + - $instantPlotInput->{"panels"}[] = $instantPanel; - - + + return $instantPlotInput; } } -?> diff --git a/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotParamsNodeClass.php b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotParamsNodeClass.php index 5d78a6f..7d25878 100644 --- a/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotParamsNodeClass.php +++ b/src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotParamsNodeClass.php @@ -4,48 +4,59 @@ require_once("RequestOutputPlotYSerieNodeClass.php"); require_once "RequestOutputPlotOrbitSerieNodeClass.php"; require_once "RequestOutputPlotInstantSerieNodeClass.php"; -define ("REQUESTOUTPUTPLOTPARAMS_NAME", "params"); +define("REQUESTOUTPUTPLOTPARAMS_NAME", "params"); -define ("REQUESTOUTPUTPLOTPARAM_NAME", "param"); -define ("REQUESTOUTPUTPLOTPARAM_ID", "id"); +define("REQUESTOUTPUTPLOTPARAM_NAME", "param"); +define("REQUESTOUTPUTPLOTPARAM_ID", "id"); -define ("REQUESTOUTPUTPLOTXSERIE_NAME", "xserie"); -define ("REQUESTOUTPUTPLOTXSERIE_XAXIS", "xAxis"); -define ("REQUESTOUTPUTPLOTXSERIE_INDEX", "index"); -define ("REQUESTOUTPUTPLOTXSERIE_ID", "id"); -define ("REQUESTOUTPUTPLOTXSERIE_MIN", "min"); -define ("REQUESTOUTPUTPLOTXSERIE_MAX", "max"); +define("REQUESTOUTPUTPLOTXSERIE_NAME", "xserie"); +define("REQUESTOUTPUTPLOTXSERIE_XAXIS", "xAxis"); +define("REQUESTOUTPUTPLOTXSERIE_INDEX", "index"); +define("REQUESTOUTPUTPLOTXSERIE_ID", "id"); +define("REQUESTOUTPUTPLOTXSERIE_MIN", "min"); +define("REQUESTOUTPUTPLOTXSERIE_MAX", "max"); -define ("REQUESTOUTPUTPLOTCOLORSERIE_NAME", "colorserie"); -define ("REQUESTOUTPUTPLOTCOLORSERIE_ID", "id"); -define ("REQUESTOUTPUTPLOTCOLORSERIE_INDEX", "index"); +define("REQUESTOUTPUTPLOTCOLORSERIE_NAME", "colorserie"); +define("REQUESTOUTPUTPLOTCOLORSERIE_ID", "id"); +define("REQUESTOUTPUTPLOTCOLORSERIE_INDEX", "index"); -define ("REQUESTOUTPUTPLOTSPECTRO_NAME", "spectro"); -define ("REQUESTOUTPUTPLOTSPECTRO_YAXIS", "yAxis"); -define ("REQUESTOUTPUTPLOTSPECTRO_INDEX", "index"); -define ("REQUESTOUTPUTPLOTSPECTRO_MIN", "min"); -define ("REQUESTOUTPUTPLOTSPECTRO_MAX", "max"); -define ("REQUESTOUTPUTPLOTSPECTRO_USELOG0ASMIN", "uselog0asmin"); -define ("REQUESTOUTPUTPLOTSPECTRO_NORMALISATION", "normalization"); -define ("REQUESTOUTPUTPLOTSPECTRO_RESOLUTION", "resolution"); +define("REQUESTOUTPUTPLOTSPECTRO_NAME", "spectro"); +define("REQUESTOUTPUTPLOTSPECTRO_YAXIS", "yAxis"); +define("REQUESTOUTPUTPLOTSPECTRO_INDEX", "index"); +define("REQUESTOUTPUTPLOTSPECTRO_MIN", "min"); +define("REQUESTOUTPUTPLOTSPECTRO_MAX", "max"); +define("REQUESTOUTPUTPLOTSPECTRO_USELOG0ASMIN", "uselog0asmin"); +define("REQUESTOUTPUTPLOTSPECTRO_NORMALISATION", "normalization"); -define ("REQUESTOUTPUTPLOTINSTANTSPECTRO_NAME", "ispectro"); -define ("REQUESTOUTPUTPLOTINSTANTSPECTRO_XAXIS", "xAxis"); -define ("REQUESTOUTPUTPLOTINSTANTSPECTRO_DIMONXAXIS", "dimOnXAxis"); +/** + * Here, we define constants about background substracion + */ +define("REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE", "background_sub_type"); +define("REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE_NONE", "None"); +define("REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE", "background_sub_value"); +define("REQUESTOUTPUTPLOTSPECTRO_BGS_DIM", "background_sub_dim"); +define("REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE_NONE", "None"); + +### +define("REQUESTOUTPUTPLOTSPECTRO_RESOLUTION", "resolution"); -define ("REQUESTOUTPUTPLOTSTATUSBAR_NAME", "serie"); -define ("REQUESTOUTPUTPLOTSTATUSBAR_INDEX", "index"); +define("REQUESTOUTPUTPLOTINSTANTSPECTRO_NAME", "ispectro"); +define("REQUESTOUTPUTPLOTINSTANTSPECTRO_XAXIS", "xAxis"); +define("REQUESTOUTPUTPLOTINSTANTSPECTRO_DIMONXAXIS", "dimOnXAxis"); -define ("REQUESTOUTPUTPLOTTICKBAR_NAME", "serie"); -define ("REQUESTOUTPUTPLOTTICKBAR_INDEX", "index"); +define("REQUESTOUTPUTPLOTSTATUSBAR_NAME", "serie"); +define("REQUESTOUTPUTPLOTSTATUSBAR_INDEX", "index"); -define ("REQUESTOUTPUTPLOTINTERVALS_NAME", "intervals"); +define("REQUESTOUTPUTPLOTTICKBAR_NAME", "serie"); +define("REQUESTOUTPUTPLOTTICKBAR_INDEX", "index"); + +define("REQUESTOUTPUTPLOTINTERVALS_NAME", "intervals"); /** * @class RequestOutputPlotParamNodeClass * @brief Definition of a param for a plot of a plot request * @details -*/ + */ class RequestOutputPlotParamNodeClass extends NodeClass { public function __construct($id) @@ -58,21 +69,19 @@ class RequestOutputPlotParamNodeClass extends NodeClass { return $this->getAttribute(REQUESTOUTPUTPLOTPARAM_ID); } - + public function setId($id) { - $this->setAttribute(REQUESTOUTPUTPLOTPARAM_ID,$id); + $this->setAttribute(REQUESTOUTPUTPLOTPARAM_ID, $id); } public function addYSerie($yAxis, $index, $xId = -1, $colorSerieId = -1, $min = NULL, $max = NULL) { - if ($xId != -1) - { + if ($xId != -1) { $ySerieNode = new RequestOutputPlotYSerieNodeClass(REQUESTOUTPUTPLOTYSERIE_XYPLOT_NAME); $ySerieNode->setXId($xId); $ySerieNode->setXAxisId(REQUESTOUTPUTPLOTELEMENTXY_XAXISID); - } - else + } else $ySerieNode = new RequestOutputPlotYSerieNodeClass(REQUESTOUTPUTPLOTYSERIE_TIMEPLOT_NAME); $ySerieNode->setYAxisId($yAxis); if (isset($min)) @@ -86,7 +95,7 @@ class RequestOutputPlotParamNodeClass extends NodeClass $this->addChild($ySerieNode); return $ySerieNode; } - + public function addOrbitSerie($yAxis, $colorSerieId = -1) { $orbitSerieNode = new RequestOutputPlotOrbitSerieNodeClass(); @@ -97,7 +106,7 @@ class RequestOutputPlotParamNodeClass extends NodeClass $this->addChild($orbitSerieNode); return $orbitSerieNode; } - + public function addInstantSerie($yAxis) { $iserieNode = new RequestOutputPlotInstantSerieNodeClass(); @@ -106,9 +115,19 @@ class RequestOutputPlotParamNodeClass extends NodeClass $this->addChild($iserieNode); return $iserieNode; } - - public function addSpectro($yAxis = "", $resolution="", $index = NULL, $min = NULL, $max = NULL, $uselog0asmin = FALSE, $normalization = NULL) - { + + public function addSpectro( + $yAxis = "", + $resolution = "", + $index = NULL, + $min = NULL, + $max = NULL, + $uselog0asmin = FALSE, + $normalization = NULL, + $bgs_type = NULL, + $bgs_value = NULL, + $bgs_dim = NULL + ) { $spectroNode = new NodeClass(REQUESTOUTPUTPLOTSPECTRO_NAME); $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_YAXIS, $yAxis); $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_USELOG0ASMIN, $uselog0asmin ? "true" : "false"); @@ -116,6 +135,12 @@ class RequestOutputPlotParamNodeClass extends NodeClass $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_RESOLUTION, $resolution); if (isset($normalization)) $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_NORMALISATION, $normalization); + if (isset($bgs_type)) + $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE, $bgs_type); + if (isset($bgs_value)) + $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE, $bgs_value); + if (isset($bgs_dim)) + $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_BGS_DIM, $bgs_dim); if (isset($index)) $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_INDEX, $index); if (isset($min)) @@ -125,14 +150,14 @@ class RequestOutputPlotParamNodeClass extends NodeClass $this->addChild($spectroNode); return $spectroNode; } - + public function addInstantSpectro($yAxis, $dimOnXAxis, $index = NULL, $min = NULL, $max = NULL) { $ispectroNode = new NodeClass(REQUESTOUTPUTPLOTINSTANTSPECTRO_NAME); $ispectroNode->setAttribute(REQUESTOUTPUTPLOTINSTANTSPECTRO_XAXIS, REQUESTOUTPUTPLOTELEMENTXY_XAXISID); $ispectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_YAXIS, $yAxis); $ispectroNode->setAttribute(REQUESTOUTPUTPLOTINSTANTSPECTRO_DIMONXAXIS, $dimOnXAxis); - + if (isset($min)) $ispectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_MIN, $min); if (isset($max)) @@ -154,7 +179,7 @@ class RequestOutputPlotParamNodeClass extends NodeClass $this->addChild($xSerieNode); return $xSerieNode; } - + public function addColorSerie($id = "", $index = -1) { $colorSerieNode = new NodeClass(REQUESTOUTPUTPLOTCOLORSERIE_NAME); @@ -164,7 +189,7 @@ class RequestOutputPlotParamNodeClass extends NodeClass $this->addChild($colorSerieNode); return $colorSerieNode; } - + public function addStatusBar($index) { $statusBarNode = new NodeClass(REQUESTOUTPUTPLOTSTATUSBAR_NAME); @@ -173,7 +198,7 @@ class RequestOutputPlotParamNodeClass extends NodeClass $this->addChild($statusBarNode); return $statusBarNode; } - + public function addTickBar($index) { $tickBarNode = new NodeClass(REQUESTOUTPUTPLOTTICKBAR_NAME); @@ -189,27 +214,27 @@ class RequestOutputPlotParamNodeClass extends NodeClass $this->addChild($intervalsNode); return $intervalsNode; } - + public function loadFromNode($xmlNode) { $this->setId($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTPARAM_ID)); - + foreach ($this->getXmlNodeChildren($xmlNode) as $plottypeXmlNode) { $node = NULL; switch ($this->getXmlNodeName($plottypeXmlNode)) { - case REQUESTOUTPUTPLOTYSERIE_XYPLOT_NAME : + case REQUESTOUTPUTPLOTYSERIE_XYPLOT_NAME: $node = new RequestOutputPlotYSerieNodeClass(REQUESTOUTPUTPLOTYSERIE_XYPLOT_NAME); break; - case REQUESTOUTPUTPLOTYSERIE_TIMEPLOT_NAME : + case REQUESTOUTPUTPLOTYSERIE_TIMEPLOT_NAME: $node = new RequestOutputPlotYSerieNodeClass(REQUESTOUTPUTPLOTYSERIE_TIMEPLOT_NAME); break; - case REQUESTOUTPUTPLOTORBITSERIE_NAME : + case REQUESTOUTPUTPLOTORBITSERIE_NAME: $node = new RequestOutputPlotOrbitSerieNodeClass(); break; - case REQUESTOUTPUTPLOTINSTANTSERIE_NAME : + case REQUESTOUTPUTPLOTINSTANTSERIE_NAME: $node = new RequestOutputPlotInstantSerieNodeClass(); break; - case REQUESTOUTPUTPLOTSPECTRO_NAME : + case REQUESTOUTPUTPLOTSPECTRO_NAME: $yAxis = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_YAXIS); $index = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_INDEX); $min = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_MIN); @@ -218,7 +243,7 @@ class RequestOutputPlotParamNodeClass extends NodeClass $uselog0asmin = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_USELOG0ASMIN) == "true"; $node = $this->addSpectro($yAxis, $resolution, $index, $min, $max, $uselog0asmin); break; - case REQUESTOUTPUTPLOTXSERIE_NAME : + case REQUESTOUTPUTPLOTXSERIE_NAME: $xAxis = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTXSERIE_XAXIS); $index = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTXSERIE_INDEX); if (empty($index)) @@ -230,29 +255,28 @@ class RequestOutputPlotParamNodeClass extends NodeClass $max = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTXSERIE_MAX); $node = $this->addXSerie($index, $xId, $min, $max); break; - case REQUESTOUTPUTPLOTCOLORSERIE_NAME : + case REQUESTOUTPUTPLOTCOLORSERIE_NAME: $id = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTCOLORSERIE_ID); $index = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTCOLORSERIE_INDEX); if (empty($index)) $index = -1; $node = $this->addColorSerie($id, $index); break; - case REQUESTOUTPUTPLOTSTATUSBAR_NAME : + case REQUESTOUTPUTPLOTSTATUSBAR_NAME: $index = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSTATUSBAR_INDEX); if (empty($index)) $index = -1; $node = $this->addStatusBar($index); break; - case REQUESTOUTPUTPLOTTICKBAR_NAME : + case REQUESTOUTPUTPLOTTICKBAR_NAME: $index = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTTICKBAR_INDEX); if (empty($index)) $index = -1; $node = $this->addTickBar($index); break; default: - } - + if (isset($node)) { $node->loadFromNode($plottypeXmlNode); $this->addChild($node); @@ -277,14 +301,14 @@ class RequestOutputPlotParamsNodeClass extends NodeClass { $paramNodes = $this->getChildrenByName(REQUESTOUTPUTPLOTPARAM_NAME); foreach ($paramNodes as $paramNode) - if ($paramNode->getId() == $id) - return $paramNode; + if ($paramNode->getId() == $id) + return $paramNode; //create new param $paramNode = new RequestOutputPlotParamNodeClass($id); $this->addChild($paramNode); return $paramNode; } - + public function loadFromNode($xmlNode) { foreach ($this->getXmlNodeChildrenByTagName($xmlNode, REQUESTOUTPUTPLOTPARAM_NAME) as $paramXmlNode) { @@ -292,5 +316,3 @@ class RequestOutputPlotParamsNodeClass extends NodeClass } } } - -?> -- libgit2 0.21.2