Commit 95ab3cf6b101abfdf7d3ca9ec4543af7aff1ebbf
1 parent
4dd48d61
Exists in
master
and in
41 other branches
Prise en compte des paramètres de BS coté AMDA intégration
Showing
4 changed files
with
930 additions
and
992 deletions
Show diff stats
... | ... | @@ -0,0 +1,2 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<plugins xml:id="plugins"><requestProcess type="paramGet" name="CONSTANT"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libConstantInterface.so</plugin></requestProcess><requestProcess type="paramGet" name="DDBASE"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libDDServerInterface.so</plugin></requestProcess><requestProcess type="paramGet" name="LOCALFILE"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libLocalFileInterface.so</plugin></requestProcess><requestProcess type="paramOutputs" name="dataMining"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libParamOutputDataMiningImpl.so</plugin></requestProcess><requestProcess type="paramOutputs" name="download"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libParamOutputImpl.so</plugin></requestProcess><requestProcess type="paramOutputs" name="intervalTrue"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libParamOutputIntervalTrueImpl.so</plugin></requestProcess><requestProcess type="paramOutputs" name="plot"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot.so</plugin></requestProcess><requestProcess type="paramOutputs" name="statistic"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libParamOutputStatisticImpl.so</plugin></requestProcess><requestProcess type="process" name="GSE2GSM"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libFramesTransformation.so</plugin></requestProcess><requestProcess type="process" name="GSM2GSE"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libFramesTransformation.so</plugin></requestProcess><requestProcess type="process" name="attitude_gse"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libtsyganenko96.so</plugin></requestProcess><requestProcess type="process" name="attitude_gsm"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libtsyganenko96.so</plugin></requestProcess><requestProcess type="process" name="bcain"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libCain_2003Process.so</plugin></requestProcess><requestProcess type="process" name="bowshock"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="bowshock_farris"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="boxcar"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libBoxcar.so</plugin></requestProcess><requestProcess type="process" name="circle"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="covariance"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="deriv"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libDeriv.so</plugin></requestProcess><requestProcess type="process" name="energy_bounds"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libEnergy_Bounds.so</plugin></requestProcess><requestProcess type="process" name="filter"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libdataFiltring.so</plugin></requestProcess><requestProcess type="process" name="framesTransformation"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libFramesTransformation.so</plugin></requestProcess><requestProcess type="process" name="getClbInfo"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libGetClbInfo.so</plugin></requestProcess><requestProcess type="process" name="getClbInfoByIndex"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libGetClbInfoByIndex.so</plugin></requestProcess><requestProcess type="process" name="getJunoJediUpperEnergy"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libGetJunoJediEnergy.so</plugin></requestProcess><requestProcess type="process" name="getMavenStaticEnergy"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libGetMavenStaticEnergy.so</plugin></requestProcess><requestProcess type="process" name="jupiter_JRM09_CAN81_bcart"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libJupeter_JRM09_CAN_81Process.so</plugin></requestProcess><requestProcess type="process" name="jupiter_JRM09_CAN81_bmag"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libJupeter_JRM09_CAN_81Process.so</plugin></requestProcess><requestProcess type="process" name="jupiter_JRM09_CAN81_bsphr"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libJupeter_JRM09_CAN_81Process.so</plugin></requestProcess><requestProcess type="process" name="jupiter_bowshock_high"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="jupiter_bowshock_low"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="jupiter_magnetopause_high"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="jupiter_magnetopause_low"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="kendall"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="maglib_invlat"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libmaglibProcess.so</plugin></requestProcess><requestProcess type="process" name="maglib_lparam"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libmaglibProcess.so</plugin></requestProcess><requestProcess type="process" name="maglib_mlt"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libmaglibProcess.so</plugin></requestProcess><requestProcess type="process" name="magnetopause_shue"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="mars_bowshock"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="mars_bowshock_hall"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="mars_magnetopause"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="max"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="max_sm"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="median"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="mercury_bowshock"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="mercury_magnetopause"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="merge"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libMerge.so</plugin></requestProcess><requestProcess type="process" name="mex_els_decode"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libmexvex_els_decode.so</plugin></requestProcess><requestProcess type="process" name="min"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="min_sm"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="morschhauser_bfield"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libMorschhauserProcess.so</plugin></requestProcess><requestProcess type="process" name="morschhauser_bmag"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libMorschhauserProcess.so</plugin></requestProcess><requestProcess type="process" name="pearson"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="rms"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="rms_sm"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="sampling_classic"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libInternLib.so</plugin></requestProcess><requestProcess type="process" name="sampling_under_refparam"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libInternLib.so</plugin></requestProcess><requestProcess type="process" name="saturn_bowshock_went"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="saturn_magnetopause"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="shue"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libshue.so</plugin></requestProcess><requestProcess type="process" name="skew"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="skew_sm"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="sliding_average"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libSlidingAverage.so</plugin></requestProcess><requestProcess type="process" name="spearman"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="standard"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libInternLib.so</plugin></requestProcess><requestProcess type="process" name="sum_into_table_indexes"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libsum_into_table_indexes.so</plugin></requestProcess><requestProcess type="process" name="sum_into_table_range"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libsum_into_table_range.so</plugin></requestProcess><requestProcess type="process" name="tilt_angle"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libtsyganenko96.so</plugin></requestProcess><requestProcess type="process" name="timeShift"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libTime_Shifted.so</plugin></requestProcess><requestProcess type="process" name="tsyganenko_96"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libtsyganenko96.so</plugin></requestProcess><requestProcess type="process" name="tsyganenko_96_gse"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libtsyganenko96.so</plugin></requestProcess><requestProcess type="process" name="ttcat_to_param"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libTTCatToParam.so</plugin></requestProcess><requestProcess type="process" name="var"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="var_sm"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="venus_bowshock"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="venus_magnetopause"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="vex_els_decode"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libmexvex_els_decode.so</plugin></requestProcess><requestProcess type="statisticProcess" name="RMS"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="count"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="countNotNan"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="countTrue"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="firstValue"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="kurtosis"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="lastValue"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="max"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="mean"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="median"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="middleIntervalValue"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="min"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="minvar"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="skewness"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="variance"><plugin>/home/hacene/amda/AMDA_Kernel/build/Release/plugin//libStatisticProcesses.so</plugin></requestProcess></plugins> | ... | ... |
src/InputOutput/IHMImpl/ParamInfo/IHMInputOutputParamInfoClass.php
... | ... | @@ -12,28 +12,28 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface |
12 | 12 | private $paramImpexMgr = null; |
13 | 13 | private $userParamMgr = null; |
14 | 14 | private $paramTemplateMgr = null; |
15 | - | |
15 | + | |
16 | 16 | /* |
17 | 17 | * @brief Constructor |
18 | 18 | */ |
19 | 19 | function __construct() |
20 | 20 | { |
21 | 21 | $this->paramMgr = new IHMParamManagerClass(); |
22 | - $this->paramTemplateMgr = new IHMParamTemplateClass(); | |
22 | + $this->paramTemplateMgr = new IHMParamTemplateClass(); | |
23 | 23 | } |
24 | 24 | |
25 | 25 | /* |
26 | 26 | * @brief translate input data from IHM client to AMDA_Integration module for a get param info request |
27 | 27 | */ |
28 | - public function getInputData($input,$function,$requestId="") | |
28 | + public function getInputData($input, $function, $requestId = "") | |
29 | 29 | { |
30 | 30 | $this->paramInfoData = new ParamInfoRequestDataClass(); |
31 | - | |
31 | + | |
32 | 32 | switch ($input->type) { |
33 | - case 'plot_init' : | |
34 | - | |
33 | + case 'plot_init': | |
34 | + | |
35 | 35 | $this->paramInfoData->setType(ParamInfoTypeEnumClass::PLOTINIT); |
36 | - | |
36 | + | |
37 | 37 | if (!isset($input->paramId) || empty($input->paramId)) |
38 | 38 | throw new Exception("Param info request need a param id as argument"); |
39 | 39 | |
... | ... | @@ -56,98 +56,94 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface |
56 | 56 | ); |
57 | 57 | $this->paramInfoData->setInternalPlotInit($plot_init); |
58 | 58 | } |
59 | - } | |
60 | - else if ($this->paramMgr->getTemplateParamsManager()->isTemplatedParam($input->paramId)) { | |
59 | + } else if ($this->paramMgr->getTemplateParamsManager()->isTemplatedParam($input->paramId)) { | |
61 | 60 | //Use param template file |
62 | 61 | $paramFilePath = $this->paramMgr->getTemplateParamsManager()->getTemplatePath($input->paramId); |
63 | 62 | if (!file_exists($paramFilePath)) |
64 | 63 | throw new Exception("Cannot find parameter definition file"); |
65 | 64 | |
66 | 65 | $this->paramInfoData->setFilePath($paramFilePath); |
67 | - } | |
68 | - else { | |
66 | + } else { | |
69 | 67 | //Direct access to the parameter file |
70 | - $paramFilePath = IHMConfigClass::getLocalParamDBPath().$input->paramId.".xml"; | |
68 | + $paramFilePath = IHMConfigClass::getLocalParamDBPath() . $input->paramId . ".xml"; | |
71 | 69 | if (!file_exists($paramFilePath)) |
72 | 70 | throw new Exception("Cannot find parameter definition file"); |
73 | - | |
71 | + | |
74 | 72 | $this->paramInfoData->setFilePath($paramFilePath); |
75 | 73 | } |
76 | 74 | break; |
77 | - | |
78 | - case 'impex_plot_init' : | |
79 | - | |
75 | + | |
76 | + case 'impex_plot_init': | |
77 | + | |
80 | 78 | $this->paramInfoData->setType(ParamInfoTypeEnumClass::IMPEXPLOTINIT); |
81 | - | |
79 | + | |
82 | 80 | if (!isset($input->paramId) || empty($input->paramId)) |
83 | - throw new Exception("Param info request need a param id as argument"); | |
84 | - | |
85 | - if (!$this->paramImpexMgr) | |
86 | - { | |
87 | - $this->paramImpexMgr = new IHMImpexParamClass(); | |
81 | + throw new Exception("Param info request need a param id as argument"); | |
82 | + | |
83 | + if (!$this->paramImpexMgr) { | |
84 | + $this->paramImpexMgr = new IHMImpexParamClass(); | |
88 | 85 | } |
89 | - | |
86 | + | |
90 | 87 | $paramFilePath = $this->paramImpexMgr->getParamInfoPlotPath($input->paramId); |
91 | - | |
88 | + | |
92 | 89 | if (!$paramFilePath || !file_exists($paramFilePath)) |
93 | 90 | throw new Exception("Cannot find parameter definition file"); |
94 | - | |
91 | + | |
95 | 92 | $this->paramInfoData->setFilePath($paramFilePath); |
96 | 93 | break; |
97 | - | |
98 | - case 'param_info' : | |
99 | - | |
94 | + | |
95 | + case 'param_info': | |
96 | + | |
100 | 97 | $this->paramInfoData->setType(ParamInfoTypeEnumClass::PARAMINFO); |
101 | - | |
98 | + | |
102 | 99 | if (!isset($input->paramId) || empty($input->paramId)) |
103 | 100 | throw new Exception("Param info request need a param id as argument"); |
104 | - | |
101 | + | |
105 | 102 | $templatedParams = $this->paramMgr->getTemplateParamsManager()->getParamTemplates(); |
106 | - | |
103 | + | |
107 | 104 | if (array_key_exists($input->paramId, $templatedParams)) |
108 | 105 | $this->paramInfoData->setTemplateInfo($templatedParams[$input->paramId]); |
109 | - | |
110 | - $paramInfoFilePath = IHMConfigClass::getLocalParamInfoPath().'info_'.$input->paramId.".xml"; | |
111 | - | |
106 | + | |
107 | + $paramInfoFilePath = IHMConfigClass::getLocalParamInfoPath() . 'info_' . $input->paramId . ".xml"; | |
108 | + | |
112 | 109 | if (!file_exists($paramInfoFilePath)) |
113 | 110 | throw new Exception("Cannot find parameter info file"); |
114 | - | |
111 | + | |
115 | 112 | $this->paramInfoData->setFilePath($paramInfoFilePath); |
116 | 113 | break; |
117 | - | |
118 | - case 'impex_param_info' : | |
119 | - | |
120 | - $this->paramInfoData->setType(ParamInfoTypeEnumClass::IMPEXINFO); | |
114 | + | |
115 | + case 'impex_param_info': | |
116 | + | |
117 | + $this->paramInfoData->setType(ParamInfoTypeEnumClass::IMPEXINFO); | |
121 | 118 | if (!isset($input->paramId) || empty($input->paramId)) |
122 | 119 | throw new Exception("Param info request need a param id as argument"); |
123 | - | |
124 | - if (!$this->paramImpexMgr) | |
125 | - { | |
126 | - $this->paramImpexMgr = new IHMImpexParamClass(); | |
120 | + | |
121 | + if (!$this->paramImpexMgr) { | |
122 | + $this->paramImpexMgr = new IHMImpexParamClass(); | |
127 | 123 | } |
128 | 124 | $this->paramImpexMgr->setParamTemplateListFilePath($input->paramId); |
129 | 125 | $templatedParams = $this->paramImpexMgr->getParamTemplates(); |
130 | 126 | |
131 | 127 | $simRegion = $this->paramImpexMgr->getSimulationRegion($input->paramId); |
132 | - | |
128 | + | |
133 | 129 | // No SimulationRuns (LESIA) |
134 | - if ($simRegion == "UNKNOWN") | |
130 | + if ($simRegion == "UNKNOWN") | |
135 | 131 | $simRegion = $this->paramImpexMgr->getResourceID($input->paramId); |
136 | - | |
132 | + | |
137 | 133 | $this->paramInfoData->setTemplateInfo($templatedParams[$simRegion]); |
138 | 134 | |
139 | 135 | break; |
140 | 136 | case 'param_parse_template': |
141 | 137 | |
142 | 138 | $this->paramInfoData->setType(ParamInfoTypeEnumClass::PARSETEMPLATEDPARAM); |
143 | - | |
139 | + | |
144 | 140 | break; |
145 | - default : | |
146 | - throw new Exception("Param info request type '".$input->type."' not yet implemented"); | |
141 | + default: | |
142 | + throw new Exception("Param info request type '" . $input->type . "' not yet implemented"); | |
147 | 143 | } |
148 | - | |
144 | + | |
149 | 145 | $this->paramInfoData->setParamId($input->paramId); |
150 | - | |
146 | + | |
151 | 147 | return $this->paramInfoData; |
152 | 148 | } |
153 | 149 | |
... | ... | @@ -157,37 +153,38 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface |
157 | 153 | public function getOutput($data) |
158 | 154 | { |
159 | 155 | switch ($data->getType()) { |
160 | - case ParamInfoTypeEnumClass::PLOTINIT : | |
156 | + case ParamInfoTypeEnumClass::PLOTINIT: | |
161 | 157 | $result = array("success" => false, "message" => "Cannot get plot init"); |
162 | 158 | $this->getOutputPlotInit($data, $result); |
163 | 159 | break; |
164 | - case ParamInfoTypeEnumClass::IMPEXPLOTINIT : | |
160 | + case ParamInfoTypeEnumClass::IMPEXPLOTINIT: | |
165 | 161 | $result = array("success" => false, "message" => "Cannot get impex plot init"); |
166 | 162 | $this->getOutputPlotInit($data, $result); |
167 | 163 | break; |
168 | - case ParamInfoTypeEnumClass::PARAMINFO : | |
164 | + case ParamInfoTypeEnumClass::PARAMINFO: | |
169 | 165 | $result = array("success" => false, "message" => "Cannot get param info"); |
170 | 166 | $this->getOutputParamInfo($data, $result); |
171 | 167 | break; |
172 | - case ParamInfoTypeEnumClass::IMPEXINFO : | |
168 | + case ParamInfoTypeEnumClass::IMPEXINFO: | |
173 | 169 | $result = array("success" => false, "message" => "Cannot get impex param info"); |
174 | 170 | $this->getOutputParamInfo($data, $result); |
175 | 171 | break; |
176 | - case ParamInfoTypeEnumClass::PARSETEMPLATEDPARAM : | |
172 | + case ParamInfoTypeEnumClass::PARSETEMPLATEDPARAM: | |
177 | 173 | $result = array("success" => false, "message" => "Cannot parse templated param"); |
178 | 174 | $this->getOutputParseTemplatedParam($data, $result); |
179 | 175 | default: |
180 | 176 | //Nothing ToDo |
181 | 177 | } |
182 | - | |
178 | + | |
183 | 179 | return $result; |
184 | 180 | } |
185 | 181 | |
186 | - private function getOutputParamInfo($data, &$result) { | |
182 | + private function getOutputParamInfo($data, &$result) | |
183 | + { | |
187 | 184 | if (($data->getResult() != NULL)) { |
188 | 185 | $result = array( |
189 | - "success" => true, | |
190 | - "data" => $data->getResult() | |
186 | + "success" => true, | |
187 | + "data" => $data->getResult() | |
191 | 188 | ); |
192 | 189 | if ($data->getTemplateInfo() != NULL) { |
193 | 190 | $result["template"] = $data->getTemplateInfo(); |
... | ... | @@ -195,7 +192,8 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface |
195 | 192 | } |
196 | 193 | } |
197 | 194 | |
198 | - private function getOutputParseTemplatedParam($data, &$result) { | |
195 | + private function getOutputParseTemplatedParam($data, &$result) | |
196 | + { | |
199 | 197 | if ($info = $this->paramTemplateMgr->parseTemplatedParam($data->getParamId())) { |
200 | 198 | $result = array( |
201 | 199 | "success" => true, |
... | ... | @@ -203,21 +201,21 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface |
203 | 201 | ); |
204 | 202 | } |
205 | 203 | } |
206 | - | |
207 | - private function getOutputPlotInit($data, &$result) { | |
204 | + | |
205 | + private function getOutputPlotInit($data, &$result) | |
206 | + { | |
208 | 207 | $internal_info = $data->getInternalPlotInit(); |
209 | 208 | if (isset($internal_info)) { |
210 | 209 | $result = array( |
211 | 210 | "success" => true, |
212 | 211 | "data" => $internal_info |
213 | 212 | ); |
214 | - } | |
215 | - else if (($data->getResult() != NULL) && ($data->getResult()->getName() == "plot") && (count($data->getResult()->getChildren()) >= 1)) { | |
213 | + } else if (($data->getResult() != NULL) && ($data->getResult()->getName() == "plot") && (count($data->getResult()->getChildren()) >= 1)) { | |
216 | 214 | $result_data = array(); |
217 | - | |
215 | + | |
218 | 216 | $panelNodes = $data->getResult()->getChildren(); |
219 | 217 | $panelNode = $panelNodes[0]; |
220 | - | |
218 | + | |
221 | 219 | $plotNode = NULL; |
222 | 220 | if (count($panelNode->getChildren()) >= 1) { |
223 | 221 | foreach ($panelNode->getChildren() as $crtNode) { |
... | ... | @@ -226,47 +224,47 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface |
226 | 224 | $plotNode = $crtNode; |
227 | 225 | break; |
228 | 226 | } |
229 | - | |
230 | - if (isset($plotNode)) { | |
227 | + | |
228 | + if (isset($plotNode)) { | |
231 | 229 | $result_data['panel'] = array(); |
232 | 230 | switch ($plotNode->getName()) { |
233 | - case 'timePlot' : | |
231 | + case 'timePlot': | |
234 | 232 | $result_data['panel']['plotType'] = 'timePlot'; |
235 | - | |
233 | + | |
236 | 234 | break; |
237 | - case 'epochPlot' : | |
235 | + case 'epochPlot': | |
238 | 236 | $result_data['panel']['plotType'] = 'epochPlot'; |
239 | - | |
237 | + | |
240 | 238 | break; |
241 | - case 'xyPlot' : | |
239 | + case 'xyPlot': | |
242 | 240 | $result_data['panel']['plotType'] = 'xyPlot'; |
243 | 241 | $result_data['panel']['isotropic'] = ($plotNode->getIsIsotropic() == "true"); |
244 | 242 | $result_data['additionalObjects'] = $this->unmarshallAdditionalObjectsData($plotNode); |
245 | 243 | break; |
246 | - case 'instantPlot' : | |
244 | + case 'instantPlot': | |
247 | 245 | $result_data['panel']['plotType'] = 'instantPlot'; |
248 | - | |
246 | + | |
249 | 247 | break; |
250 | - case 'statusPlot' : | |
248 | + case 'statusPlot': | |
251 | 249 | $result_data['panel']['plotType'] = 'statusPlot'; |
252 | - | |
250 | + | |
253 | 251 | break; |
254 | - case 'tickPlot' : | |
252 | + case 'tickPlot': | |
255 | 253 | $result_data['panel']['plotType'] = 'tickPlot'; |
256 | - | |
254 | + | |
257 | 255 | break; |
258 | 256 | } |
259 | - | |
257 | + | |
260 | 258 | $result_data['draw'] = $this->unmarshallDrawData($plotNode, $data->getParamId()); |
261 | 259 | } |
262 | - | |
260 | + | |
263 | 261 | $result = array( |
264 | - "success" => true, | |
265 | - "data" => $result_data | |
262 | + "success" => true, | |
263 | + "data" => $result_data | |
266 | 264 | ); |
267 | 265 | //var_dump($result); |
268 | 266 | } |
269 | - | |
267 | + | |
270 | 268 | /*if (count($paramsNode->getChildren()) >= 1) { |
271 | 269 | $paramNode = $paramsNode->getChildren()[0]; |
272 | 270 | if (count($paramNode->getChildren()) >= 1) { |
... | ... | @@ -290,16 +288,17 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface |
290 | 288 | }*/ |
291 | 289 | } |
292 | 290 | } |
293 | - | |
294 | - private function unmarshallDrawData($plotNode, $paramId) { | |
295 | - | |
291 | + | |
292 | + private function unmarshallDrawData($plotNode, $paramId) | |
293 | + { | |
294 | + | |
296 | 295 | $result_data = array(); |
297 | - | |
296 | + | |
298 | 297 | if (!isset($plotNode)) |
299 | 298 | return $result_data; |
300 | - | |
299 | + | |
301 | 300 | $paramsNode = $plotNode->getParams(); |
302 | - | |
301 | + | |
303 | 302 | if (!isset($paramsNode)) |
304 | 303 | return $result_data; |
305 | 304 | if ($this->paramMgr->getTemplateParamsManager()->isTemplatedParam($paramId)) |
... | ... | @@ -307,13 +306,13 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface |
307 | 306 | $realParamId = $this->paramMgr->getTemplateParamsManager()->getTemplateFileName($paramId); |
308 | 307 | else |
309 | 308 | $realParamId = $paramId; |
310 | - | |
309 | + | |
311 | 310 | $paramNode = $paramsNode->getParamById($realParamId); |
312 | - | |
313 | - | |
311 | + | |
312 | + | |
314 | 313 | if (!isset($paramNode) || (count($paramNode->getChildren()) < 1)) |
315 | 314 | return $result_data; |
316 | - | |
315 | + | |
317 | 316 | $mainDrawNode = NULL; |
318 | 317 | $otherDrawNodes = array(); |
319 | 318 | foreach ($paramNode->getChildren() as $crtDrawNode) { |
... | ... | @@ -322,26 +321,25 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface |
322 | 321 | else |
323 | 322 | $otherDrawNodes[$mainDrawNode->getName()] = $crtDrawNode; |
324 | 323 | } |
325 | - | |
324 | + | |
326 | 325 | if (!isset($mainDrawNode)) |
327 | 326 | return $result_data; |
328 | 327 | switch ($mainDrawNode->getName()) { |
329 | - case 'serie' : | |
328 | + case 'serie': | |
330 | 329 | if ($plotNode->getName() == 'statusPlot') { |
331 | 330 | $result_data['type'] = 'status-bar'; |
332 | - } | |
333 | - else { | |
331 | + } else { | |
334 | 332 | $result_data['type'] = 'serie'; |
335 | 333 | $this->unmarshallBaseSerieData($mainDrawNode, $result_data); |
336 | 334 | } |
337 | 335 | //if (array_key_exists('colorserie', $otherDrawNodes)) |
338 | 336 | // $this->unmarshallColorSerieData($mainDrawNode, $result_data); |
339 | 337 | break; |
340 | - case 'spectro' : | |
338 | + case 'spectro': | |
341 | 339 | $result_data['type'] = 'spectro'; |
342 | 340 | $this->unmarshallSpectroData($mainDrawNode, $result_data); |
343 | 341 | break; |
344 | - case 'yserie' : | |
342 | + case 'yserie': | |
345 | 343 | if (!array_key_exists('xserie', $otherDrawNodes)) |
346 | 344 | return $result_data; |
347 | 345 | $this->unmarshallBaseSerieData($mainDrawNode, $result_data); |
... | ... | @@ -349,60 +347,61 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface |
349 | 347 | //if (array_key_exists('colorserie', $otherDrawNodes)) |
350 | 348 | // $this->unmarshallColorSerieData($mainDrawNode, $result_data); |
351 | 349 | break; |
352 | - case 'orbitserie' : | |
350 | + case 'orbitserie': | |
353 | 351 | $result_data['type'] = 'orbit-serie'; |
354 | 352 | $result_data['serie-projection'] = $mainDrawNode->getProjection(); |
355 | 353 | $this->unmarshallBaseSerieData($mainDrawNode, $result_data); |
356 | 354 | //if (array_key_exists('colorserie', $otherDrawNodes)) |
357 | 355 | // $this->unmarshallColorSerieData($mainDrawNode, $result_data); |
358 | 356 | break; |
359 | - default : | |
357 | + default: | |
360 | 358 | return $result_data; |
361 | 359 | } |
362 | - | |
360 | + | |
363 | 361 | $axesNode = $plotNode->getAxes(); |
364 | 362 | if (isset($axesNode)) { |
365 | 363 | $result_data['axes'] = array(); |
366 | - | |
364 | + | |
367 | 365 | $colorAxis = $axesNode->getColorAxis(); |
368 | 366 | if (isset($colorAxis)) { |
369 | 367 | $result_data['axes']['color'] = array(); |
370 | 368 | $this->unmarshallAxisData($colorAxis, $result_data['axes']['color']); |
371 | 369 | } |
372 | - | |
370 | + | |
373 | 371 | $xAxis = $axesNode->getDigitalAxis(RequestOutputPlotAxisTypeEnum::XAXIS, 'xaxis_id'); |
374 | 372 | if (isset($xAxis)) { |
375 | 373 | $result_data['axes']['xaxis_id'] = array(); |
376 | 374 | $this->unmarshallAxisData($xAxis, $result_data['axes']['xaxis_id']); |
377 | 375 | } |
378 | - | |
376 | + | |
379 | 377 | $yLeftAxis = $axesNode->getDigitalAxis(RequestOutputPlotAxisTypeEnum::YAXIS, 'y-left'); |
380 | 378 | if (isset($yLeftAxis)) { |
381 | 379 | $result_data['axes']['y-left'] = array(); |
382 | 380 | $this->unmarshallAxisData($yLeftAxis, $result_data['axes']['y-left']); |
383 | 381 | } |
384 | - | |
382 | + | |
385 | 383 | $yRightAxis = $axesNode->getDigitalAxis(RequestOutputPlotAxisTypeEnum::YAXIS, 'y-right'); |
386 | 384 | if (isset($yRightAxis)) { |
387 | 385 | $result_data['axes']['y-right'] = array(); |
388 | 386 | $this->unmarshallAxisData($yRightAxis, $result_data['axes']['y-right']); |
389 | 387 | } |
390 | 388 | } |
391 | - | |
389 | + | |
392 | 390 | return $result_data; |
393 | 391 | } |
394 | - | |
395 | - private function unmarshallAxisData($axisNode, &$result_array) { | |
392 | + | |
393 | + private function unmarshallAxisData($axisNode, &$result_array) | |
394 | + { | |
396 | 395 | if (!isset($axisNode)) |
397 | 396 | return; |
398 | - | |
397 | + | |
399 | 398 | $scale = $axisNode->getScale(); |
400 | 399 | if (isset($scale)) |
401 | 400 | $result_array['axis-scale'] = $scale; |
402 | 401 | |
403 | - $showLegend = $axisNode->getShowLegend(); | |
404 | - if (!empty($showLegend)) | |
405 | - $result_array['axis-legend-activated'] = ($showLegend == "true"); | |
402 | + $showLegend = $axisNode->getShowLegend(); | |
403 | + if (!empty($showLegend)) | |
404 | + $result_array['axis-legend-activated'] = ($showLegend == "true"); | |
406 | 405 | |
407 | 406 | $rangeNode = $axisNode->getRange(); |
408 | 407 | if (isset($rangeNode)) { |
... | ... | @@ -413,25 +412,25 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface |
413 | 412 | $rangeMax = $rangeNode->getMax(); |
414 | 413 | if (!empty($rangeMax)) |
415 | 414 | $result_array['axis-range-max'] = $rangeMax; |
416 | - $extend = $rangeNode->getExtend(); | |
417 | - if (!empty($extend)) | |
418 | - $result_array['axis-range-extend'] = ($extend == "true"); | |
419 | - | |
415 | + $extend = $rangeNode->getExtend(); | |
416 | + if (!empty($extend)) | |
417 | + $result_array['axis-range-extend'] = ($extend == "true"); | |
420 | 418 | } |
421 | 419 | } |
422 | - | |
423 | - private function unmarshallSpectroData($drawNode, &$result_array) { | |
420 | + | |
421 | + private function unmarshallSpectroData($drawNode, &$result_array) | |
422 | + { | |
424 | 423 | if (!isset($drawNode)) |
425 | 424 | return; |
426 | - | |
425 | + | |
427 | 426 | $yAxis = $drawNode->getAttribute(REQUESTOUTPUTPLOTSPECTRO_YAXIS); |
428 | 427 | if (!empty($yAxis)) |
429 | 428 | $result_array['spectro-yaxis'] = $yAxis; |
430 | - | |
429 | + | |
431 | 430 | $min = $drawNode->getAttribute(REQUESTOUTPUTPLOTSPECTRO_MIN); |
432 | 431 | if (!empty($min)) |
433 | 432 | $result_array['spectro-value-min'] = $min; |
434 | - | |
433 | + | |
435 | 434 | $max = $drawNode->getAttribute(REQUESTOUTPUTPLOTSPECTRO_MAX); |
436 | 435 | if (!empty($max)) |
437 | 436 | $result_array['spectro-value-max'] = $max; |
... | ... | @@ -448,16 +447,29 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface |
448 | 447 | $normalization = $drawNode->getAttribute(REQUESTOUTPUTPLOTSPECTRO_NORMALISATION); |
449 | 448 | if (!empty($normalization)) |
450 | 449 | $result_array['spectro-normalization'] = $normalization; |
450 | + | |
451 | + $bgs_type = $drawNode->getAttribute(REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE); | |
452 | + if (!empty($bgs_type)) | |
453 | + $result_array[REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE] = $bgs_type; | |
454 | + | |
455 | + $bgs_value = $drawNode->getAttribute(REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE); | |
456 | + if (!empty($bgs_value)) | |
457 | + $result_array[REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE] = $bgs_value; | |
458 | + | |
459 | + $bgs_dim = $drawNode->getAttribute(REQUESTOUTPUTPLOTSPECTRO_BGS_DIM); | |
460 | + if (!empty($bgs_dim)) | |
461 | + $result_array[REQUESTOUTPUTPLOTSPECTRO_BGS_DIM] = $bgs_dim; | |
451 | 462 | } |
452 | - | |
453 | - private function unmarshallAdditionalObjectsData($plotNode) { | |
463 | + | |
464 | + private function unmarshallAdditionalObjectsData($plotNode) | |
465 | + { | |
454 | 466 | $result_data = array(); |
455 | - | |
467 | + | |
456 | 468 | if (!isset($plotNode)) |
457 | 469 | return $result_data; |
458 | - | |
470 | + | |
459 | 471 | $additionalObjectsNode = $plotNode->getAdditionalObjects(); |
460 | - | |
472 | + | |
461 | 473 | //curvePlot |
462 | 474 | $result_data['curves'] = array(); |
463 | 475 | $curveObjectsNode = $additionalObjectsNode->getCurveObjects(); |
... | ... | @@ -465,147 +477,148 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface |
465 | 477 | $crt_curve_data = array(); |
466 | 478 | $crt_curve_data['curve-serie-id'] = $curveNode->getSerieId(); |
467 | 479 | $this->unmarshallLineData($curveNode, "curve-line-", $crt_curve_data); |
468 | - | |
480 | + | |
469 | 481 | if ($curveNode->isFunctionDefined()) { |
470 | 482 | $crt_curve_data['curve-name'] = $curveNode->getFunction()->getFunctionName(); |
471 | 483 | $crt_curve_data['curve-attributes'] = array(); |
472 | - | |
484 | + | |
473 | 485 | foreach ($curveNode->getFunction()->getAttributes()->getChildren() as $attributeNode) { |
474 | 486 | $crt_attribute_data = array(); |
475 | - | |
487 | + | |
476 | 488 | $crt_attribute_data['curve-param-name'] = $attributeNode->getAttribute(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTENAME); |
477 | 489 | $crt_attribute_data['curve-param-value'] = $attributeNode->getAttribute(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTEVALUE); |
478 | - | |
490 | + | |
479 | 491 | $crt_curve_data['curve-attributes'][] = $crt_attribute_data; |
480 | 492 | } |
481 | - | |
482 | 493 | } |
483 | - | |
494 | + | |
484 | 495 | $result_data['curves'][] = $crt_curve_data; |
485 | 496 | } |
486 | - | |
497 | + | |
487 | 498 | return $result_data; |
488 | 499 | } |
489 | - | |
490 | - private function unmarshallBaseSerieData($drawNode, &$result_array) { | |
500 | + | |
501 | + private function unmarshallBaseSerieData($drawNode, &$result_array) | |
502 | + { | |
491 | 503 | if (!isset($drawNode)) |
492 | 504 | return; |
493 | - | |
505 | + | |
494 | 506 | $result_array['serie-id'] = $drawNode->getId(); |
495 | - | |
507 | + | |
496 | 508 | $result_array['serie-yaxis'] = $drawNode->getYAxisId(); |
497 | 509 | |
498 | - $resolution = $drawNode->getResolution(); | |
499 | - if (!empty($resolution)) | |
500 | - $result_array['serie-resolution'] = $resolution; | |
510 | + $resolution = $drawNode->getResolution(); | |
511 | + if (!empty($resolution)) | |
512 | + $result_array['serie-resolution'] = $resolution; | |
513 | + | |
514 | + $colorSerieId = $drawNode->getColorSerieId(); | |
515 | + if (!empty($colorSerieId)) | |
516 | + $result_array['serie-colored-param'] = $colorSerieId; | |
501 | 517 | |
502 | - $colorSerieId = $drawNode->getColorSerieId(); | |
503 | - if (!empty($colorSerieId)) | |
504 | - $result_array['serie-colored-param'] = $colorSerieId; | |
505 | - | |
506 | 518 | if ($drawNode->isLineDefined()) { |
507 | - $lineNode = $drawNode->getLine(); | |
508 | - $lineType = $lineNode->getType(); | |
509 | - if($lineType == RequestOutputPlotLineTypeEnum::NO){ | |
510 | - $result_array['serie-lines-activated'] = false; | |
511 | - } | |
512 | - else{ | |
513 | - $result_array['serie-lines-activated'] = true; | |
514 | - $this->unmarshallLineData($drawNode->getLine(), "serie-lines-", $result_array); | |
515 | - } | |
519 | + $lineNode = $drawNode->getLine(); | |
520 | + $lineType = $lineNode->getType(); | |
521 | + if ($lineType == RequestOutputPlotLineTypeEnum::NO) { | |
522 | + $result_array['serie-lines-activated'] = false; | |
523 | + } else { | |
524 | + $result_array['serie-lines-activated'] = true; | |
525 | + $this->unmarshallLineData($drawNode->getLine(), "serie-lines-", $result_array); | |
526 | + } | |
516 | 527 | } |
517 | - | |
528 | + | |
518 | 529 | if ($drawNode->isSymbolDefined()) { |
519 | 530 | $result_array['serie-symbols-activated'] = true; |
520 | 531 | $this->unmarshallSymbolData($drawNode->getSymbol(), "serie-symbols-", $result_array); |
521 | 532 | } |
522 | - | |
533 | + | |
523 | 534 | $colorSerieId = $drawNode->getColorSerieId(); |
524 | 535 | if (!empty($colorSerieId)) { |
525 | 536 | //ToDo |
526 | 537 | } |
527 | - | |
538 | + | |
528 | 539 | if ($drawNode->isTimeTicksDefined()) { |
529 | 540 | $result_array['serie-timetick-activated'] = true; |
530 | - | |
541 | + | |
531 | 542 | $result_array['serie-timetick-step'] = $drawNode->getTimeTicks()->getStep(); |
532 | 543 | $result_array['serie-timetick-nbmajor'] = $drawNode->getTimeTicks()->getNumber(); |
533 | 544 | $result_array['serie-timetick-nbminor'] = $drawNode->getTimeTicks()->getMinor(); |
534 | 545 | $result_array['serie-timetick-color'] = $this->toHexColor($drawNode->getTimeTicks()->getColor()); |
535 | - | |
546 | + | |
536 | 547 | if (!empty($result_array['serie-timetick-nbmajor']) && intval($result_array['serie-timetick-nbmajor']) > 0) |
537 | 548 | $result_array['serie-timetick-type'] = 'nb-major'; |
538 | 549 | else if (!empty($result_array['serie-timetick-step']) && intval($result_array['serie-timetick-step']) > 0) |
539 | 550 | $result_array['serie-timetick-type'] = 'time-step'; |
540 | 551 | else |
541 | 552 | $result_array['serie-timetick-type'] = 'auto'; |
542 | - | |
553 | + | |
543 | 554 | if ($drawNode->getTimeTicks()->isSymbolDefined()) { |
544 | 555 | $this->unmarshallSymbolData($drawNode->getTimeTicks()->getSymbol(), "serie-timetick-symbols-", $result_array); |
545 | 556 | } |
546 | - | |
557 | + | |
547 | 558 | if ($drawNode->getTimeTicks()->isFirstSymbolDefined()) { |
548 | 559 | $result_array['serie-timetick-firstsymbols-activated'] = true; |
549 | 560 | $this->unmarshallSymbolData($drawNode->getTimeTicks()->getFirstSymbol(), "serie-timetick-firstsymbols-", $result_array); |
550 | 561 | } |
551 | - | |
562 | + | |
552 | 563 | if ($drawNode->getTimeTicks()->isFontDefined()) { |
553 | 564 | $result_array['serie-timetick-font-activated'] = true; |
554 | 565 | $this->unmarshallFontData($drawNode->getTimeTicks()->getFont(), "serie-timetick-font-", $result_array); |
555 | 566 | } |
556 | 567 | } |
557 | - | |
568 | + | |
558 | 569 | if ($drawNode->isIntervalTicksDefined()) { |
559 | 570 | $result_array['serie-intervaltick-activated'] = true; |
560 | - | |
571 | + | |
561 | 572 | $result_array['serie-intervaltick-mode'] = $drawNode->getIntervalTicks()->getMode(); |
562 | 573 | $result_array['serie-intervaltick-color'] = $this->toHexColor($drawNode->getIntervalTicks()->getColor()); |
563 | - | |
574 | + | |
564 | 575 | if ($drawNode->getIntervalTicks()->isSymbolDefined()) { |
565 | 576 | $this->unmarshallSymbolData($drawNode->getIntervalTicks()->getSymbol(), "serie-intervaltick-", $result_array); |
566 | 577 | } |
567 | - | |
578 | + | |
568 | 579 | if ($drawNode->getIntervalTicks()->isFontDefined()) { |
569 | 580 | $result_array['serie-intervaltick-font-activated'] = true; |
570 | 581 | $this->unmarshallFontData($drawNode->getIntervalTicks()->getFont(), "serie-intervaltick-font-", $result_array); |
571 | 582 | } |
572 | 583 | } |
573 | 584 | } |
574 | - | |
575 | - private function unmarshallLineData($lineNode, $prefix, &$result_array) { | |
576 | - $lineStyle = $lineNode->getStyle(); | |
577 | - if(!empty($lineStyle)) | |
578 | - $result_array[$prefix.'style'] = $lineStyle; | |
579 | - | |
580 | - $lineWidth = $lineNode->getWidth(); | |
581 | - if(!empty($lineWidth)) | |
582 | - $result_array[$prefix.'width'] = $lineWidth; | |
583 | - | |
584 | - $lineColor = $lineNode->getColor(); | |
585 | - if(!empty($lineColor)) | |
586 | - $result_array[$prefix.'color'] = $this->toHexColor($lineColor); | |
585 | + | |
586 | + private function unmarshallLineData($lineNode, $prefix, &$result_array) | |
587 | + { | |
588 | + $lineStyle = $lineNode->getStyle(); | |
589 | + if (!empty($lineStyle)) | |
590 | + $result_array[$prefix . 'style'] = $lineStyle; | |
591 | + | |
592 | + $lineWidth = $lineNode->getWidth(); | |
593 | + if (!empty($lineWidth)) | |
594 | + $result_array[$prefix . 'width'] = $lineWidth; | |
595 | + | |
596 | + $lineColor = $lineNode->getColor(); | |
597 | + if (!empty($lineColor)) | |
598 | + $result_array[$prefix . 'color'] = $this->toHexColor($lineColor); | |
587 | 599 | } |
588 | - | |
589 | - private function unmarshallSymbolData($symbolNode, $prefix, &$result_array) { | |
590 | - $result_array[$prefix.'type'] = $symbolNode->getType(); | |
591 | - $result_array[$prefix.'size'] = $symbolNode->getSize(); | |
592 | - $result_array[$prefix.'color'] = $this->toHexColor($symbolNode->getColor()); | |
600 | + | |
601 | + private function unmarshallSymbolData($symbolNode, $prefix, &$result_array) | |
602 | + { | |
603 | + $result_array[$prefix . 'type'] = $symbolNode->getType(); | |
604 | + $result_array[$prefix . 'size'] = $symbolNode->getSize(); | |
605 | + $result_array[$prefix . 'color'] = $this->toHexColor($symbolNode->getColor()); | |
593 | 606 | } |
594 | - | |
595 | - private function unmarshallFontData($fontNode, $prefix, &$result_array) { | |
596 | - $result_array[$prefix.'name'] = $fontNode->getFontName(); | |
597 | - $result_array[$prefix.'size'] = $fontNode->getSize(); | |
598 | - $result_array[$prefix.'bold'] = ($fontNode->getWeight() == RequestOutputPlotFontWeight::BOLD); | |
599 | - $result_array[$prefix.'italic'] = ($fontNode->getStyle() == RequestOutputPlotFontStyle::ITALIC); | |
607 | + | |
608 | + private function unmarshallFontData($fontNode, $prefix, &$result_array) | |
609 | + { | |
610 | + $result_array[$prefix . 'name'] = $fontNode->getFontName(); | |
611 | + $result_array[$prefix . 'size'] = $fontNode->getSize(); | |
612 | + $result_array[$prefix . 'bold'] = ($fontNode->getWeight() == RequestOutputPlotFontWeight::BOLD); | |
613 | + $result_array[$prefix . 'italic'] = ($fontNode->getStyle() == RequestOutputPlotFontStyle::ITALIC); | |
600 | 614 | } |
601 | - | |
602 | - private function toHexColor($color) { | |
615 | + | |
616 | + private function toHexColor($color) | |
617 | + { | |
603 | 618 | $temp = str_replace(array('[', ']', ' '), '', $color); |
604 | 619 | $arr = explode(',', $temp); |
605 | - if (count ($arr) != 3) | |
620 | + if (count($arr) != 3) | |
606 | 621 | return '#000000'; |
607 | - return '#'.sprintf('%02x', $arr[0]).sprintf('%02x', $arr[1]).sprintf('%02x', $arr[2]); | |
622 | + return '#' . sprintf('%02x', $arr[0]) . sprintf('%02x', $arr[1]) . sprintf('%02x', $arr[2]); | |
608 | 623 | } |
609 | 624 | } |
610 | - | |
611 | -?> | ... | ... |
src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
1 | 1 | <?php |
2 | 2 | |
3 | -define ("PLOT_RESULT_FILE_KEY","plot"); | |
3 | +define("PLOT_RESULT_FILE_KEY", "plot"); | |
4 | 4 | |
5 | 5 | /** |
6 | 6 | * @class IHMInputOutputParamsPlotClass |
7 | 7 | * @brief Implementation of IHMInputOutputParamsAbstractClass to treat plot request |
8 | 8 | * @details |
9 | -*/ | |
9 | + */ | |
10 | 10 | class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
11 | 11 | { |
12 | 12 | private $isInteractiveRequest = false; |
13 | - | |
13 | + | |
14 | 14 | private $isFromWS = false; |
15 | - | |
15 | + | |
16 | 16 | private $isInstantPlot = false; |
17 | - | |
17 | + | |
18 | 18 | private $interactiveTimeSelectionState = array(); |
19 | - private $interactivePlotTitle = array(); | |
20 | - private $interactivePlotIndex = array(); | |
19 | + private $interactivePlotTitle = array(); | |
20 | + private $interactivePlotIndex = array(); | |
21 | 21 | private $interactiveCrtTTFileIndex = -1; |
22 | 22 | private $interactivePreview = false; |
23 | 23 | |
24 | 24 | protected $isMultiPlot = FALSE; |
25 | - | |
25 | + | |
26 | 26 | /* |
27 | 27 | * @brief method to unmarshall a plot request |
28 | 28 | */ |
... | ... | @@ -30,58 +30,52 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
30 | 30 | { |
31 | 31 | $forceTimeZoomReset = false; |
32 | 32 | $resetZoom = false; |
33 | - | |
34 | - if (isset($input->{'action'})) | |
35 | - { | |
33 | + | |
34 | + if (isset($input->{'action'})) { | |
36 | 35 | $input = $this->unmarshallActionRequest($input); |
37 | 36 | $forceTimeZoomReset = isset($input->{'force-time-zoom-reset'}) ? $input->{'force-time-zoom-reset'} : false; |
38 | - } | |
39 | - else | |
40 | - { | |
37 | + } else { | |
41 | 38 | $resetZoom = true; |
42 | 39 | //save request |
43 | - $this->saveIHMRequest(PLOT_RESULT_FILE_KEY."_".$input->{'tab-index'}, $input); | |
40 | + $this->saveIHMRequest(PLOT_RESULT_FILE_KEY . "_" . $input->{'tab-index'}, $input); | |
44 | 41 | } |
45 | - | |
42 | + | |
46 | 43 | //Request |
47 | 44 | $this->isInteractiveRequest = ($input->{'file-output'} == 'INTERACTIVE'); |
48 | 45 | $this->isFromWS = ($input->{'file-output'} == 'WS'); |
49 | 46 | |
50 | 47 | if ($resetZoom || $forceTimeZoomReset) |
51 | - $this->resetZoomList(PLOT_RESULT_FILE_KEY."_".$input->{'tab-index'}, $forceTimeZoomReset); | |
52 | - | |
48 | + $this->resetZoomList(PLOT_RESULT_FILE_KEY . "_" . $input->{'tab-index'}, $forceTimeZoomReset); | |
49 | + | |
53 | 50 | $requestNode = $this->paramsData->addRequestNode($input->{'tab-index'}); |
54 | 51 | $outputsNode = $requestNode->getOutputsNode(); |
55 | 52 | $paramsNode = $requestNode->getParamsNode(); |
56 | - | |
53 | + | |
57 | 54 | //unmarshall time definition |
58 | 55 | $isIntervalRequest = ($input->timesrc == 'Interval'); |
59 | 56 | $ttFileIndex = -1; |
60 | 57 | $ttIntIndex = -1; |
61 | - if ($this->isInteractiveRequest && !$isIntervalRequest && !$input->{'page-superpose-mode'}) | |
62 | - { | |
58 | + if ($this->isInteractiveRequest && !$isIntervalRequest && !$input->{'page-superpose-mode'}) { | |
63 | 59 | $ttFileIndex = !isset($input->{'ttFileIndex'}) ? 0 : $input->{'ttFileIndex'}; |
64 | 60 | $ttIntIndex = !isset($input->{'intIndex'}) ? 0 : $input->{'intIndex'}; |
65 | 61 | } |
66 | 62 | $this->unmarshallTimeDefinition($input, $input->{'tab-index'}, $ttFileIndex, $ttIntIndex); |
67 | - | |
63 | + | |
68 | 64 | $this->interactiveCrtTTFileIndex = $ttFileIndex; |
69 | - | |
65 | + | |
70 | 66 | $plotOutputNode = $outputsNode->addNewOutput(RequestOutputTypeEnum::PLOT); |
71 | - | |
67 | + | |
72 | 68 | $plotOutputNode->setWriteContextFile($this->isInteractiveRequest ? "true" : "false"); |
73 | - | |
69 | + | |
74 | 70 | $compression = ""; |
75 | - if (!$this->isInteractiveRequest && !$this->isFromWS) | |
76 | - { | |
77 | - switch ($input->{'file-output'}) | |
78 | - { | |
79 | - case 'TGZ' : | |
71 | + if (!$this->isInteractiveRequest && !$this->isFromWS) { | |
72 | + switch ($input->{'file-output'}) { | |
73 | + case 'TGZ': | |
80 | 74 | $plotOutputNode->addPostProcessing(RequestOutputPostProcessingEnumClass::TAR); |
81 | 75 | $plotOutputNode->addPostProcessing(RequestOutputPostProcessingEnumClass::GZIP); |
82 | 76 | $compression = ".tar.gz"; |
83 | 77 | break; |
84 | - case 'ZIP' : | |
78 | + case 'ZIP': | |
85 | 79 | $plotOutputNode->addPostProcessing(RequestOutputPostProcessingEnumClass::ZIP); |
86 | 80 | $compression = ".zip"; |
87 | 81 | break; |
... | ... | @@ -89,158 +83,146 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
89 | 83 | throw new Exception('Compression not implemented.'); |
90 | 84 | } |
91 | 85 | } |
92 | - | |
86 | + | |
93 | 87 | if ($input->{'one-file-per-interval'}) |
94 | 88 | $plotOutputNode->setStructure(RequestOutputPlotStructureEnum::ONE_FILE_PER_INTERVAL); |
95 | 89 | else |
96 | 90 | $plotOutputNode->setStructure(RequestOutputPlotStructureEnum::ONE_FILE); |
97 | - | |
91 | + | |
98 | 92 | //prefix |
99 | 93 | $filePrefix = "plot_"; |
100 | 94 | if ($input->{'file-prefix'} && ($input->{'file-prefix'} != "")) |
101 | 95 | $filePrefix = $input->{'file-prefix'}; |
102 | 96 | $filePrefix .= $input->{'tab-index'}; |
103 | - | |
97 | + | |
104 | 98 | $plotOutputNode->setFilePrefix($filePrefix); |
105 | - | |
99 | + | |
106 | 100 | //page |
107 | 101 | $pageNode = $plotOutputNode->getPage(); |
108 | - | |
102 | + | |
109 | 103 | $fileFormat = RequestOutputPlotPageFormatEnum::PNG; |
110 | 104 | $extension = ".png"; |
111 | - switch ($input->{'file-format'}) | |
112 | - { | |
113 | - case 'PNG' : | |
105 | + switch ($input->{'file-format'}) { | |
106 | + case 'PNG': | |
114 | 107 | $fileFormat = RequestOutputPlotPageFormatEnum::PNG; |
115 | 108 | $extension = ".png"; |
116 | 109 | break; |
117 | - case 'PDF' : | |
110 | + case 'PDF': | |
118 | 111 | $fileFormat = RequestOutputPlotPageFormatEnum::PDF; |
119 | 112 | $extension = ".pdf"; |
120 | 113 | break; |
121 | - case 'PS' : | |
114 | + case 'PS': | |
122 | 115 | $fileFormat = RequestOutputPlotPageFormatEnum::PS; |
123 | 116 | $extension = ".ps"; |
124 | 117 | break; |
125 | - case 'SVG' : | |
118 | + case 'SVG': | |
126 | 119 | $fileFormat = RequestOutputPlotPageFormatEnum::SVG; |
127 | 120 | $extension = ".svg"; |
128 | 121 | break; |
129 | 122 | default: |
130 | 123 | throw new Exception('File format not implemented.'); |
131 | 124 | } |
132 | - | |
125 | + | |
133 | 126 | $pageNode->setFormat($fileFormat); |
134 | - | |
127 | + | |
135 | 128 | $this->unmarshallTitle($input, 'page-title', $pageNode->getTitle()); |
136 | - | |
129 | + | |
137 | 130 | $isPortrait = false; |
138 | - switch ($input->{'page-orientation'}) | |
139 | - { | |
140 | - case 'landscape' : | |
131 | + switch ($input->{'page-orientation'}) { | |
132 | + case 'landscape': | |
141 | 133 | $pageNode->setOrientation(RequestOutputPlotPageOrientationEnum::LANDSCAPE); |
142 | 134 | break; |
143 | - case 'portrait' : | |
135 | + case 'portrait': | |
144 | 136 | $pageNode->setOrientation(RequestOutputPlotPageOrientationEnum::PORTRAIT); |
145 | 137 | $isPortrait = true; |
146 | 138 | break; |
147 | 139 | } |
148 | - | |
149 | - switch ($input->{'page-dimension'}) | |
150 | - { | |
151 | - case 'ISO A4' : | |
140 | + | |
141 | + switch ($input->{'page-dimension'}) { | |
142 | + case 'ISO A4': | |
152 | 143 | $pageNode->setDimension(RequestOutputPlotPageDimensionEnum::ISO_A4); |
153 | 144 | break; |
154 | - case 'US letter' : | |
145 | + case 'US letter': | |
155 | 146 | $pageNode->setDimension(RequestOutputPlotPageDimensionEnum::US_LETTER); |
156 | 147 | break; |
157 | 148 | default: |
158 | 149 | throw new Exception('Page dimension not implemented.'); |
159 | 150 | } |
160 | - | |
161 | - switch ($input->{'page-mode'}) | |
162 | - { | |
163 | - | |
164 | - case 'grayscale' : | |
151 | + | |
152 | + switch ($input->{'page-mode'}) { | |
153 | + | |
154 | + case 'grayscale': | |
165 | 155 | $pageNode->setMode(RequestOutputPlotPageModeEnum::GRAYSCALE); |
166 | 156 | break; |
167 | - case 'color' : | |
157 | + case 'color': | |
168 | 158 | default: |
169 | 159 | $pageNode->setMode(RequestOutputPlotPageModeEnum::COLOR); |
170 | 160 | break; |
171 | 161 | } |
172 | - | |
173 | - if ($input->{'page-margins-activated'}) | |
174 | - { | |
162 | + | |
163 | + if ($input->{'page-margins-activated'}) { | |
175 | 164 | $pageNode->getMargins()->setHorizontal($input->{'page-margin-x'}); |
176 | 165 | $pageNode->getMargins()->setVertical($input->{'page-margin-y'}); |
177 | 166 | } |
178 | - | |
167 | + | |
179 | 168 | if ($input->{'page-font-activated'}) |
180 | 169 | $this->unmarshallFont($input, 'page-font', $pageNode->getFont()); |
181 | - | |
170 | + | |
182 | 171 | //Superpose mode |
183 | - $pageNode->setSuperposeMode($input->{'page-superpose-mode'} ? "true": "false"); | |
184 | - | |
172 | + $pageNode->setSuperposeMode($input->{'page-superpose-mode'} ? "true" : "false"); | |
173 | + | |
185 | 174 | //Layout |
186 | 175 | $this->unmarshallLayout($input, $pageNode); |
187 | - | |
176 | + | |
188 | 177 | foreach ($input->{'panels'} as $panelData) |
189 | 178 | $this->unmarshallPanel($panelData, $pageNode, $paramsNode); |
190 | - | |
191 | - if ($this->isInteractiveRequest || $this->isFromWS) | |
192 | - { | |
193 | - $resultFile = $filePrefix."_*".$extension; | |
194 | - $waitingResultFile = $filePrefix.$extension; | |
195 | - } | |
196 | - else | |
197 | - { | |
198 | - $resultFile = $filePrefix."_*".$compression; | |
199 | - $waitingResultFile = $filePrefix.$compression; | |
179 | + | |
180 | + if ($this->isInteractiveRequest || $this->isFromWS) { | |
181 | + $resultFile = $filePrefix . "_*" . $extension; | |
182 | + $waitingResultFile = $filePrefix . $extension; | |
183 | + } else { | |
184 | + $resultFile = $filePrefix . "_*" . $compression; | |
185 | + $waitingResultFile = $filePrefix . $compression; | |
200 | 186 | } |
201 | - | |
202 | - if ($this->isInteractiveRequest) | |
203 | - { | |
204 | - $this->interactiveTimeSelectionState[PLOT_RESULT_FILE_KEY."_".$input->{'tab-index'}] = $isIntervalRequest; | |
205 | - $this->interactivePlotTitle[PLOT_RESULT_FILE_KEY."_".$input->{'tab-index'}] = $input->{'tab-title'}; | |
206 | - $this->interactivePlotIndex[PLOT_RESULT_FILE_KEY."_".$input->{'tab-index'}] = $input->{'tab-index'}; | |
187 | + | |
188 | + if ($this->isInteractiveRequest) { | |
189 | + $this->interactiveTimeSelectionState[PLOT_RESULT_FILE_KEY . "_" . $input->{'tab-index'}] = $isIntervalRequest; | |
190 | + $this->interactivePlotTitle[PLOT_RESULT_FILE_KEY . "_" . $input->{'tab-index'}] = $input->{'tab-title'}; | |
191 | + $this->interactivePlotIndex[PLOT_RESULT_FILE_KEY . "_" . $input->{'tab-index'}] = $input->{'tab-index'}; | |
207 | 192 | $this->interactivePreview = isset($input->{'interactive-preview'}) && ($input->{'interactive-preview'}); |
208 | - $this->paramsData->addWaitingResult(PLOT_RESULT_FILE_KEY."_".$input->{'tab-index'}, $waitingResultFile); | |
209 | - } | |
210 | - else | |
193 | + $this->paramsData->addWaitingResult(PLOT_RESULT_FILE_KEY . "_" . $input->{'tab-index'}, $waitingResultFile); | |
194 | + } else | |
211 | 195 | $this->paramsData->addWaitingResult(PLOT_RESULT_FILE_KEY, $waitingResultFile); |
212 | - | |
196 | + | |
213 | 197 | //Remove old result files |
214 | - foreach (glob($this->paramsData->getWorkingPath().$resultFile) as $oldFile) { | |
198 | + foreach (glob($this->paramsData->getWorkingPath() . $resultFile) as $oldFile) { | |
215 | 199 | unlink($oldFile); |
216 | 200 | } |
217 | - | |
201 | + | |
218 | 202 | //Post process command to apply to the result file |
219 | 203 | $postProcessCmd = $this->paramsData->getPostCmd(); |
220 | 204 | if ($postProcessCmd != "") |
221 | 205 | $postProcessCmd .= " | "; |
222 | - $postProcessCmd .= "mv ".$resultFile." ".$waitingResultFile; | |
223 | - | |
206 | + $postProcessCmd .= "mv " . $resultFile . " " . $waitingResultFile; | |
207 | + | |
224 | 208 | if (($this->isInteractiveRequest) && $isPortrait) |
225 | - $postProcessCmd .= " | convert ".$waitingResultFile." -rotate -90 ".$waitingResultFile; | |
226 | - else if ($this->isFromWS) | |
227 | - { | |
209 | + $postProcessCmd .= " | convert " . $waitingResultFile . " -rotate -90 " . $waitingResultFile; | |
210 | + else if ($this->isFromWS) { | |
228 | 211 | if ($isPortrait) |
229 | - $postProcessCmd .= " | convert ".$waitingResultFile." -rotate -90 ".$input->{"ws-result-file"}; | |
212 | + $postProcessCmd .= " | convert " . $waitingResultFile . " -rotate -90 " . $input->{"ws-result-file"}; | |
230 | 213 | else |
231 | - $postProcessCmd .= " | mv ".$waitingResultFile." ".$input->{"ws-result-file"}; | |
214 | + $postProcessCmd .= " | mv " . $waitingResultFile . " " . $input->{"ws-result-file"}; | |
232 | 215 | } |
233 | - | |
216 | + | |
234 | 217 | $this->paramsData->setBatchEnable(!(($fileFormat == RequestOutputPlotPageFormatEnum::PNG) && $this->isInteractiveRequest)); |
235 | 218 | $this->paramsData->setPostCmd($postProcessCmd); |
236 | 219 | return $this->paramsData; |
237 | 220 | } |
238 | - | |
221 | + | |
239 | 222 | protected function unmarshallLayout($request, $pageNode) |
240 | 223 | { |
241 | - switch ($request->{'page-layout-type'}) | |
242 | - { | |
243 | - case 'vertical' : | |
224 | + switch ($request->{'page-layout-type'}) { | |
225 | + case 'vertical': | |
244 | 226 | $pageNode->getLayout()->setType(RequestOutputPlotLayoutTypeEnum::VERTICAL); |
245 | 227 | $pageNode->getLayout()->setPanelHeight($request->{'page-layout-object'}->{'layout-panel-height'}); |
246 | 228 | $pageNode->getLayout()->setPanelSpacing($request->{'page-layout-object'}->{'layout-panel-spacing'}); |
... | ... | @@ -255,14 +237,14 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
255 | 237 | if ($request->{'page-layout-object'}->{'layout-xyplot-height'} > 0) |
256 | 238 | $pageNode->setDefaultXYPlotHeight($request->{'page-layout-object'}->{'layout-xyplot-height'}); |
257 | 239 | break; |
258 | - case 'auto' : | |
240 | + case 'auto': | |
259 | 241 | $pageNode->getLayout()->setType(RequestOutputPlotLayoutTypeEnum::AUTO); |
260 | 242 | $pageNode->getLayout()->setPanelHeight($request->{'page-layout-object'}->{'layout-panel-height'}); |
261 | 243 | $pageNode->getLayout()->setPanelSpacing($request->{'page-layout-object'}->{'layout-panel-spacing'}); |
262 | 244 | $pageNode->getLayout()->setExpand($request->{'page-layout-object'}->{'layout-expand'} ? "true" : "false"); |
263 | 245 | $pageNode->getLayout()->setOnlyLowerTimeAxesLegend($request->{'page-layout-object'}->{'layout-timeaxes-legend-lowerone'} ? "true" : "false"); |
264 | 246 | break; |
265 | - case 'manual' : | |
247 | + case 'manual': | |
266 | 248 | $pageNode->getLayout()->setType(RequestOutputPlotLayoutTypeEnum::MANUAL); |
267 | 249 | $timePlotLeftMargin = $request->{'page-layout-object'}->{'layout-timeplot-margin-left'} ? $request->{'page-layout-object'}->{'layout-timeplot-margin-left'} : -1; |
268 | 250 | $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 |
274 | 256 | default: |
275 | 257 | throw new Exception('Layout type not implemented.'); |
276 | 258 | } |
277 | - | |
278 | 259 | } |
279 | - | |
260 | + | |
280 | 261 | protected function unmarshallPanel($panelData, $pageNode, $paramsNode) |
281 | 262 | { |
282 | 263 | $panelNode = $pageNode->addPanel(); |
283 | - | |
284 | - | |
285 | - switch ($pageNode->getLayout()->getType()) | |
286 | - { | |
287 | - case RequestOutputPlotLayoutTypeEnum::MANUAL : | |
264 | + | |
265 | + | |
266 | + switch ($pageNode->getLayout()->getType()) { | |
267 | + case RequestOutputPlotLayoutTypeEnum::MANUAL: | |
288 | 268 | //Panel bounds |
289 | 269 | $panelNode->getBounds()->setX($panelData->{'panel-bounds-x'}); |
290 | 270 | $panelNode->getBounds()->setY($panelData->{'panel-bounds-y'}); |
... | ... | @@ -295,127 +275,120 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
295 | 275 | $rightMargin = $panelData->{'panel-margin-right'} ? $panelData->{'panel-margin-right'} : -1; |
296 | 276 | $panelNode->setXMargin($leftMargin, $rightMargin); |
297 | 277 | break; |
298 | - case RequestOutputPlotLayoutTypeEnum::VERTICAL : | |
278 | + case RequestOutputPlotLayoutTypeEnum::VERTICAL: | |
299 | 279 | //Panel prefered dimensions |
300 | 280 | if ($panelData->{'panel-prefered-width'} > 0) |
301 | 281 | $panelNode->setPreferedWidth($panelData->{'panel-prefered-width'}); |
302 | 282 | if ($panelData->{'panel-prefered-height'} > 0) |
303 | 283 | $panelNode->setPreferedHeight($panelData->{'panel-prefered-height'}); |
304 | 284 | break; |
305 | - default : | |
285 | + default: | |
306 | 286 | //Nothing to do |
307 | 287 | } |
308 | - | |
288 | + | |
309 | 289 | //Panel id |
310 | 290 | if (isset($panelData->{'id'})) |
311 | 291 | $panelNode->setId($panelData->{'id'}); |
312 | 292 | |
313 | - //Panel id | |
314 | - if (isset($panelData->{'panel-index'})) | |
315 | - $panelNode->setIndex($panelData->{'panel-index'}); | |
316 | - | |
317 | - | |
293 | + //Panel id | |
294 | + if (isset($panelData->{'panel-index'})) | |
295 | + $panelNode->setIndex($panelData->{'panel-index'}); | |
296 | + | |
297 | + | |
318 | 298 | //Panel background color |
319 | 299 | if (($panelData->{'panel-background-color'} != 'none') && ($panelData->{'panel-background-color'} != '')) |
320 | 300 | $panelNode->setBackgroundColor($this->hexColor2KernelColor($panelData->{'panel-background-color'})); |
321 | 301 | |
322 | 302 | //Panel font |
323 | 303 | $this->unmarshallFont($panelData, 'panel-font', $panelNode->getFont()); |
324 | - | |
304 | + | |
325 | 305 | //Panel title |
326 | 306 | $this->unmarshallTitle($panelData, 'panel-title', $panelNode->getTitle()); |
327 | - | |
307 | + | |
328 | 308 | //Plot type |
329 | 309 | $this->isInstantPlot = false; |
330 | 310 | $plotNode = $this->unmarshallPlotType($panelData, $panelNode); |
331 | - | |
311 | + | |
332 | 312 | $isTimePlot = ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTTIME_NAME); |
333 | - | |
313 | + | |
334 | 314 | //Tick plot |
335 | 315 | $tickPlotNode = NULL; |
336 | - if ($isTimePlot) | |
337 | - { | |
338 | - if ($this->hasTickBar($panelData->{'params'})) | |
339 | - { | |
340 | - $tickPlotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::TICKPLOT,true); | |
316 | + if ($isTimePlot) { | |
317 | + if ($this->hasTickBar($panelData->{'params'})) { | |
318 | + $tickPlotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::TICKPLOT, true); | |
341 | 319 | if ($panelData->{'panel-tick-format'} != '') |
342 | 320 | $tickPlotNode->setFormat($panelData->{'panel-tick-format'}); |
343 | 321 | } |
344 | 322 | } |
345 | - | |
323 | + | |
346 | 324 | //Status plot |
347 | 325 | $statusPlotNode = NULL; |
348 | - if ($isTimePlot) | |
349 | - { | |
350 | - if ($this->hasStatusBar($panelData->{'params'})) | |
351 | - { | |
352 | - $statusPlotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::STATUSPLOT,true); | |
353 | - switch ($panelData->{'panel-status-position'}) | |
354 | - { | |
355 | - case 'top' : | |
326 | + if ($isTimePlot) { | |
327 | + if ($this->hasStatusBar($panelData->{'params'})) { | |
328 | + $statusPlotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::STATUSPLOT, true); | |
329 | + switch ($panelData->{'panel-status-position'}) { | |
330 | + case 'top': | |
356 | 331 | $statusPlotNode->setPosition(RequestOutputPlotElementStatusPosition::TOP); |
357 | 332 | break; |
358 | - case 'bottom' : | |
333 | + case 'bottom': | |
359 | 334 | $statusPlotNode->setPosition(RequestOutputPlotElementStatusPosition::BOTTOM); |
360 | 335 | break; |
361 | 336 | } |
362 | 337 | $statusPlotNode->setColorMap($panelData->{'panel-status-colormap'}); |
363 | 338 | } |
364 | 339 | } |
365 | - | |
340 | + | |
366 | 341 | //Axes |
367 | 342 | foreach ($panelData->{'axes'} as $axisData) |
368 | 343 | $this->unmarshallAxis($axisData, $panelData->{'constants'}, $plotNode); |
369 | - | |
344 | + | |
370 | 345 | //Params |
371 | 346 | $this->unmarshallParams($panelData->{'params'}, $paramsNode, $plotNode, $panelNode, $statusPlotNode, $tickPlotNode); |
372 | - | |
347 | + | |
373 | 348 | //Additional objects |
374 | 349 | if ($plotNode->getAdditionalObjects() != NULL) |
375 | 350 | $this->unmarshallAdditionalObjects($panelData, $plotNode->getAdditionalObjects(), $isTimePlot); |
376 | - | |
351 | + | |
377 | 352 | //Fills |
378 | 353 | if ($plotNode->getFills() != NULL) |
379 | 354 | $this->unmarshallFills($panelData, $plotNode->getFills()); |
380 | - | |
355 | + | |
381 | 356 | return $panelNode; |
382 | 357 | } |
383 | - | |
358 | + | |
384 | 359 | protected function unmarshallPlotType($panelData, $panelNode) |
385 | 360 | { |
386 | - switch ($panelData->{'panel-plot-type'}) | |
387 | - { | |
388 | - case 'timePlot' : | |
361 | + switch ($panelData->{'panel-plot-type'}) { | |
362 | + case 'timePlot': | |
389 | 363 | $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::TIMEPLOT); |
390 | 364 | break; |
391 | - case 'xyPlot' : | |
365 | + case 'xyPlot': | |
392 | 366 | $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::XYPLOT); |
393 | 367 | $plotNode->setIsIsotropic($panelData->{'panel-scatter-isotropic'}); |
394 | 368 | break; |
395 | - case 'statusPlot' : | |
369 | + case 'statusPlot': | |
396 | 370 | $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::STATUSPLOT); |
397 | - switch ($panelData->{'panel-status-position'}) | |
398 | - { | |
399 | - case 'top' : | |
371 | + switch ($panelData->{'panel-status-position'}) { | |
372 | + case 'top': | |
400 | 373 | $plotNode->setPosition(RequestOutputPlotElementStatusPosition::TOP); |
401 | 374 | break; |
402 | - case 'bottom' : | |
375 | + case 'bottom': | |
403 | 376 | $plotNode->setPosition(RequestOutputPlotElementStatusPosition::BOTTOM); |
404 | 377 | break; |
405 | 378 | } |
406 | 379 | $plotNode->setColorMap($panelData->{'panel-status-colormap'}); |
407 | 380 | break; |
408 | - case 'tickPlot' : | |
381 | + case 'tickPlot': | |
409 | 382 | $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::TICKPLOT); |
410 | 383 | if ($panelData->{'panel-tick-format'} != '') |
411 | 384 | $plotNode->setFormat($panelData->{'panel-tick-format'}); |
412 | 385 | break; |
413 | - case 'epochPlot' : | |
386 | + case 'epochPlot': | |
414 | 387 | $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::EPOCHPLOT); |
415 | 388 | if ($panelData->{'panel-epoch-centertimeid'} != '') |
416 | 389 | $plotNode->setCenterTimeId($panelData->{'panel-epoch-centertimeid'}); |
417 | 390 | break; |
418 | - case 'instantPlot' : | |
391 | + case 'instantPlot': | |
419 | 392 | $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::INSTANTPLOT); |
420 | 393 | date_default_timezone_set('UTC'); |
421 | 394 | $timeStamp = strtotime($panelData->{'panel-instant-time'}); |
... | ... | @@ -426,48 +399,47 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
426 | 399 | default: |
427 | 400 | throw new Exception('Plot type not implemented.'); |
428 | 401 | } |
429 | - | |
402 | + | |
430 | 403 | //Params Legend |
431 | 404 | if (isset($panelData->{'panel-series-legend'}) && $panelData->{'panel-series-legend'}->{'legend-series-activated'}) |
432 | 405 | $this->unmarshallParamsLegend($panelData->{'panel-series-legend'}, $plotNode->getLegends()->getParamsLegend()); |
433 | - | |
406 | + | |
434 | 407 | //Text Legends |
435 | 408 | foreach ($panelData->{'text-legends'} as $textLegendData) |
436 | 409 | $this->unmarshallTextLegend($textLegendData, $plotNode->getLegends()); |
437 | - | |
410 | + | |
438 | 411 | return $plotNode; |
439 | 412 | } |
440 | - | |
413 | + | |
441 | 414 | protected function unmarshallAxis($axisData, $constantsData, $plotNode) |
442 | 415 | { |
443 | 416 | //axis type |
444 | 417 | $constantAxisId = ''; |
445 | - switch ($axisData->{'axis-type'}) | |
446 | - { | |
447 | - case 'time' : | |
418 | + switch ($axisData->{'axis-type'}) { | |
419 | + case 'time': | |
448 | 420 | $axisNode = $plotNode->getTimeAxis(); |
449 | 421 | $axisNode->setFormat($axisData->{'axis-time-format'}); |
450 | 422 | $constantAxisId = 'x'; |
451 | 423 | break; |
452 | - case 'epoch' : | |
424 | + case 'epoch': | |
453 | 425 | $axisNode = $plotNode->getEpochAxis(); |
454 | 426 | $axisNode->setNormalized($axisData->{'axis-epoch-normalized'} ? "true" : "false"); |
455 | 427 | $constantAxisId = 'x'; |
456 | 428 | break; |
457 | - case 'x' : | |
429 | + case 'x': | |
458 | 430 | $axisNode = $plotNode->getXAxis(); |
459 | 431 | $constantAxisId = 'x'; |
460 | 432 | break; |
461 | - case 'y-left' : | |
433 | + case 'y-left': | |
462 | 434 | $axisNode = $plotNode->addYAxis('y-left'); |
463 | 435 | $constantAxisId = 'y-left'; |
464 | 436 | break; |
465 | - case 'y-right' : | |
437 | + case 'y-right': | |
466 | 438 | $axisNode = $plotNode->addYAxis('y-right'); |
467 | 439 | $axisNode->setPosition(RequestOutputPlotAxisElementPosition::RIGHT); |
468 | 440 | $constantAxisId = 'y-right'; |
469 | 441 | break; |
470 | - case 'color' : | |
442 | + case 'color': | |
471 | 443 | $axisNode = $plotNode->getZAxis(); |
472 | 444 | $axisNode->setColorMapIndex($axisData->{'axis-color-map'}); |
473 | 445 | if ($axisData->{'axis-color-minval'} != 'none') |
... | ... | @@ -478,118 +450,111 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
478 | 450 | default: |
479 | 451 | throw new Exception('Axis type not implemented.'); |
480 | 452 | } |
481 | - | |
453 | + | |
482 | 454 | //reverse axis |
483 | 455 | if (isset($axisData->{'axis-reverse'})) |
484 | 456 | $axisNode->setReverse($axisData->{'axis-reverse'} ? "true" : "false"); |
485 | - | |
457 | + | |
486 | 458 | //axis scale |
487 | - switch ($axisData->{'axis-scale'}) | |
488 | - { | |
489 | - case 'logarithmic' : | |
459 | + switch ($axisData->{'axis-scale'}) { | |
460 | + case 'logarithmic': | |
490 | 461 | $axisNode->setScale(RequestOutputPlotAxisElementScale::LOGARITHMIC); |
491 | 462 | break; |
492 | 463 | default: |
493 | 464 | $axisNode->setScale(RequestOutputPlotAxisElementScale::LINEAR); |
494 | 465 | } |
495 | - | |
466 | + | |
496 | 467 | //axis range |
497 | 468 | if ($axisData->{'axis-range-min'} < $axisData->{'axis-range-max'}) |
498 | 469 | $axisNode->getRange()->setMinMax($axisData->{'axis-range-min'}, $axisData->{'axis-range-max'}); |
499 | 470 | if (isset($axisData->{'axis-range-extend'})) |
500 | 471 | $axisNode->getRange()->setExtend($axisData->{'axis-range-extend'} ? "true" : "false"); |
501 | - | |
472 | + | |
502 | 473 | //axis color |
503 | 474 | if (isset($axisData->{'axis-color'})) |
504 | 475 | $axisNode->setColor($this->hexColor2KernelColor($axisData->{'axis-color'})); |
505 | - | |
476 | + | |
506 | 477 | //axis thickness |
507 | 478 | if (isset($axisData->{'axis-thickness'})) |
508 | 479 | $axisNode->setThickness($axisData->{'axis-thickness'}); |
509 | - | |
480 | + | |
510 | 481 | //axis ticks position |
511 | - switch ($axisData->{'axis-tick-position'}) | |
512 | - { | |
513 | - case 'inwards' : | |
482 | + switch ($axisData->{'axis-tick-position'}) { | |
483 | + case 'inwards': | |
514 | 484 | $axisNode->getTick()->setPosition(RequestOutputPlotAxisElementTickPosition::INWARDS); |
515 | 485 | break; |
516 | - default : | |
486 | + default: | |
517 | 487 | $axisNode->getTick()->setPosition(RequestOutputPlotAxisElementTickPosition::OUTWARDS); |
518 | 488 | } |
519 | - | |
489 | + | |
520 | 490 | //axis minor and major grid |
521 | 491 | if (isset($axisData->{'axis-grid-minor'})) |
522 | 492 | $axisNode->getTick()->setMinorGrid($axisData->{'axis-grid-minor'} ? "true" : "false"); |
523 | 493 | |
524 | 494 | if (isset($axisData->{'axis-grid-major'})) |
525 | 495 | $axisNode->getTick()->setMajorGrid($axisData->{'axis-grid-major'} ? "true" : "false"); |
526 | - if ( $axisData->{'axis-grid-specify-ticks-number'}){ | |
527 | - | |
528 | - if (isset($axisData->{'axis-grid-minor-number'}) && $axisData->{'axis-grid-minor-number'} != 0) | |
529 | - $axisNode->getTick()->setMinorGridNumber($axisData->{'axis-grid-minor-number'}); | |
530 | - | |
531 | - if (isset($axisData->{'axis-grid-major-number'}) && $axisData->{'axis-grid-major-number'} != 0) | |
532 | - $axisNode->getTick()->setMajorGridNumber($axisData->{'axis-grid-major-number'}); | |
533 | - }elseif($axisData->{'axis-grid-specify-ticks-spacing'}){ | |
534 | - | |
535 | - if (isset($axisData->{'axis-grid-major-space'}) && $axisData->{'axis-grid-major-space'} != 0) | |
536 | - $axisNode->getTick()->setMajorGridSpace($axisData->{'axis-grid-major-space'}); | |
537 | - | |
538 | - if (isset($axisData->{'axis-grid-minor-space'}) && $axisData->{'axis-grid-minor-space'} != 0) | |
539 | - $axisNode->getTick()->setMinorGridSpace($axisData->{'axis-grid-minor-space'}); | |
540 | - } | |
541 | - | |
542 | - | |
543 | - //legend | |
544 | - if (isset($axisData->{'axis-legend-text'}) && $axisData->{'axis-legend-text'} != '') | |
545 | - { | |
496 | + if ($axisData->{'axis-grid-specify-ticks-number'}) { | |
497 | + | |
498 | + if (isset($axisData->{'axis-grid-minor-number'}) && $axisData->{'axis-grid-minor-number'} != 0) | |
499 | + $axisNode->getTick()->setMinorGridNumber($axisData->{'axis-grid-minor-number'}); | |
500 | + | |
501 | + if (isset($axisData->{'axis-grid-major-number'}) && $axisData->{'axis-grid-major-number'} != 0) | |
502 | + $axisNode->getTick()->setMajorGridNumber($axisData->{'axis-grid-major-number'}); | |
503 | + } elseif ($axisData->{'axis-grid-specify-ticks-spacing'}) { | |
504 | + | |
505 | + if (isset($axisData->{'axis-grid-major-space'}) && $axisData->{'axis-grid-major-space'} != 0) | |
506 | + $axisNode->getTick()->setMajorGridSpace($axisData->{'axis-grid-major-space'}); | |
507 | + | |
508 | + if (isset($axisData->{'axis-grid-minor-space'}) && $axisData->{'axis-grid-minor-space'} != 0) | |
509 | + $axisNode->getTick()->setMinorGridSpace($axisData->{'axis-grid-minor-space'}); | |
510 | + } | |
511 | + | |
512 | + | |
513 | + //legend | |
514 | + if (isset($axisData->{'axis-legend-text'}) && $axisData->{'axis-legend-text'} != '') { | |
546 | 515 | $axisNode->getLegend()->setText($axisData->{'axis-legend-text'}); |
547 | 516 | $axisNode->getLegend()->setColor($this->hexColor2KernelColor($axisData->{'axis-legend-color'})); |
548 | 517 | $this->unmarshallLabel($axisData, "axis-legend", $axisNode->getLegend()); |
549 | 518 | } |
550 | - | |
519 | + | |
551 | 520 | //Show legend |
552 | 521 | if (isset($axisData->{'axis-legend-activated'})) |
553 | 522 | $axisNode->setShowLegend($axisData->{'axis-legend-activated'} ? "true" : "false"); |
554 | - | |
523 | + | |
555 | 524 | //Show tick marks |
556 | 525 | if (isset($axisData->{'axis-tick-showmarks'})) |
557 | 526 | $axisNode->setShowTickMarks($axisData->{'axis-tick-showmarks'} ? "true" : "false"); |
558 | - | |
527 | + | |
559 | 528 | //Add constants |
560 | - if ($constantAxisId != '') | |
561 | - { | |
529 | + if ($constantAxisId != '') { | |
562 | 530 | foreach ($constantsData as $constantData) |
563 | 531 | if ($constantData->{'constant-axis-id'} == $constantAxisId) |
564 | - $this->unmarshallConstant($constantData,$axisNode); | |
532 | + $this->unmarshallConstant($constantData, $axisNode); | |
565 | 533 | } |
566 | 534 | } |
567 | - | |
535 | + | |
568 | 536 | protected function unmarshallParams($paramsData, $requestParamsNode, $plotNode, $panelNode, $statusPlotNode, $tickPlotNode) |
569 | 537 | { |
570 | 538 | //X parameters |
571 | 539 | $isScatter = ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTXY_NAME); |
572 | 540 | $xIds = array(); |
573 | - if ($isScatter) | |
574 | - { | |
541 | + if ($isScatter) { | |
575 | 542 | $crtXId = 0; |
576 | - foreach ($paramsData as $paramData) | |
577 | - { | |
543 | + foreach ($paramsData as $paramData) { | |
578 | 544 | if ($paramData->{'param-drawing-object'}->{'serie-xaxis-param'} == '') |
579 | 545 | continue; |
580 | 546 | if (array_key_exists($paramData->{'param-drawing-object'}->{'serie-xaxis-param'}, $xIds)) { |
581 | 547 | //x param already exists |
582 | 548 | continue; |
583 | 549 | } |
584 | - | |
550 | + | |
585 | 551 | $paramXInfo = $this->paramManager->addExistingParam($paramData->{'param-drawing-object'}->{'serie-xaxis-param'}, $this->paramsData); |
586 | 552 | if ($paramXInfo['id'] == '') |
587 | 553 | throw new Exception('Cannot retrieve X parameter.'); |
588 | 554 | $requestParamsNode->addParam($paramXInfo['id']); |
589 | 555 | $xParamNode = $plotNode->getParams()->getParamById($paramXInfo['id']); |
590 | - switch ($paramData->{'param-drawing-type'}) | |
591 | - { | |
592 | - case 'serie' : | |
556 | + switch ($paramData->{'param-drawing-type'}) { | |
557 | + case 'serie': | |
593 | 558 | //Unmarshall x serie |
594 | 559 | if (count($paramXInfo['indexes']) == 0) |
595 | 560 | $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 |
598 | 563 | else |
599 | 564 | throw new Exception('X parameter for serie must be a component.'); |
600 | 565 | break; |
601 | - default : | |
566 | + default: | |
602 | 567 | throw new Exception('X parameter not allowed for this drawing type. '); |
603 | 568 | } |
604 | 569 | $xIds[$paramData->{'param-drawing-object'}->{'serie-xaxis-param'}] = $crtXId; |
605 | 570 | ++$crtXId; |
606 | 571 | } |
607 | 572 | } |
608 | - | |
573 | + | |
609 | 574 | //Main drawing element parameter |
610 | 575 | $drawingEltIndex = 0; |
611 | - foreach ($paramsData as $paramData) | |
612 | - { | |
576 | + foreach ($paramsData as $paramData) { | |
613 | 577 | $isTTCat = ($paramData->{'param-type'} == 'ttcat'); |
614 | 578 | |
615 | 579 | //Param |
616 | 580 | if (!$isTTCat) { |
617 | 581 | $paramInfo = $this->paramManager->addExistingParam($paramData->{'paramid'}, $this->paramsData, isset($paramData->{'template_args'}) ? $paramData->{'template_args'} : NULL); |
618 | - } | |
619 | - else { | |
582 | + } else { | |
620 | 583 | $paramInfo = $this->paramManager->addTTCatParam($paramData->{'paramid'}, $this->paramsData); |
621 | 584 | } |
622 | - | |
585 | + | |
623 | 586 | $paramInfo['indexes'] = array(); |
624 | 587 | |
625 | 588 | $this->paramManager->applyRangesAndIndexes($this->paramsData, $paramData, !$this->isInstantPlot, $paramInfo); |
626 | - | |
627 | - $this->paramManager->applyFilter($this->paramsData, $paramData, $paramInfo); | |
628 | - | |
589 | + | |
590 | + $this->paramManager->applyFilter($this->paramsData, $paramData, $paramInfo); | |
591 | + | |
629 | 592 | $requestParamsNode->addParam($paramInfo['id']); |
630 | - | |
593 | + | |
631 | 594 | $colorSerieId = -1; |
632 | 595 | if (!empty($paramData->{'param-drawing-object'}->{'serie-colored-param'})) |
633 | 596 | $colorSerieId = $drawingEltIndex; |
634 | 597 | |
635 | 598 | $xId = ($isScatter && !empty($paramData->{'param-drawing-object'}->{'serie-xaxis-param'})) ? $xIds[$paramData->{'param-drawing-object'}->{'serie-xaxis-param'}] : -1; |
636 | - | |
637 | - switch ($paramData->{'param-drawing-type'}) | |
638 | - { | |
639 | - case 'serie' : | |
599 | + | |
600 | + switch ($paramData->{'param-drawing-type'}) { | |
601 | + case 'serie': | |
640 | 602 | $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); |
641 | 603 | $this->unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, $paramInfo['indexes'], $xId, $colorSerieId, false); |
642 | 604 | break; |
643 | - case 'orbit-serie' : | |
605 | + case 'orbit-serie': | |
644 | 606 | $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); |
645 | 607 | $this->unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, -1, $xId, $colorSerieId, true); |
646 | 608 | break; |
647 | - case 'spectro' : | |
609 | + case 'spectro': | |
648 | 610 | $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); |
649 | 611 | $this->unmarshallSpectro($paramData->{'param-drawing-object'}, $plotNode, $paramNode, $paramInfo['indexes']); |
650 | 612 | break; |
651 | - case 'status-bar' : | |
613 | + case 'status-bar': | |
652 | 614 | if (($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTSTATUS_NAME) && !isset($statusPlotNode)) |
653 | 615 | $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); |
654 | 616 | else |
655 | 617 | $paramNode = $statusPlotNode->getParams()->getParamById($paramInfo['id']); |
656 | 618 | $this->unmarshallStatusBar($paramData->{'param-drawing-object'}, $paramNode, $paramInfo['indexes']); |
657 | 619 | break; |
658 | - case 'tick-bar' : | |
620 | + case 'tick-bar': | |
659 | 621 | if (($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTTICK_NAME) && !isset($tickPlotNode)) |
660 | 622 | $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); |
661 | 623 | else |
662 | 624 | $paramNode = $tickPlotNode->getParams()->getParamById($paramInfo['id']); |
663 | - | |
625 | + | |
664 | 626 | $this->unmarshallTickBar($paramData->{'param-drawing-object'}, $paramNode, $paramInfo['indexes']); |
665 | 627 | break; |
666 | - case 'iserie' : | |
628 | + case 'iserie': | |
667 | 629 | $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); |
668 | 630 | $this->unmarshallInstantSerie($paramData->{'param-drawing-object'}, $plotNode, $paramNode); |
669 | 631 | break; |
670 | - case 'ispectro' : | |
632 | + case 'ispectro': | |
671 | 633 | $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); |
672 | 634 | $this->unmarshallInstantSpectro($paramData->{'param-drawing-object'}, $plotNode, $paramNode, $paramInfo['indexes']); |
673 | 635 | break; |
674 | - case 'intervals' : | |
636 | + case 'intervals': | |
675 | 637 | $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); |
676 | 638 | $this->unmarshallIntervals($paramData->{'param-drawing-object'}, $paramNode); |
677 | 639 | break; |
678 | - default : | |
640 | + default: | |
679 | 641 | throw new Exception('Drawing type not implemented.'); |
680 | 642 | } |
681 | 643 | ++$drawingEltIndex; |
682 | 644 | } |
683 | - | |
645 | + | |
684 | 646 | //Colored parameter |
685 | 647 | $drawingEltIndex = 0; |
686 | - foreach ($paramsData as $paramData) | |
687 | - { | |
688 | - if (empty($paramData->{'param-drawing-object'}->{'serie-colored-param'})) | |
689 | - { | |
648 | + foreach ($paramsData as $paramData) { | |
649 | + if (empty($paramData->{'param-drawing-object'}->{'serie-colored-param'})) { | |
690 | 650 | ++$drawingEltIndex; |
691 | 651 | continue; |
692 | 652 | } |
693 | - | |
653 | + | |
694 | 654 | $paramColoredInfo = $this->paramManager->addExistingParam($paramData->{'param-drawing-object'}->{'serie-colored-param'}, $this->paramsData); |
695 | 655 | if ($paramColoredInfo['id'] == '') |
696 | 656 | throw new Exception('Cannot retrieve colored parameter.'); |
697 | 657 | $requestParamsNode->addParam($paramColoredInfo['id']); |
698 | 658 | $coloredParamNode = $plotNode->getParams()->getParamById($paramColoredInfo['id']); |
699 | - | |
659 | + | |
700 | 660 | $colorSerieId = $drawingEltIndex; |
701 | - | |
702 | - switch ($paramData->{'param-drawing-type'}) | |
703 | - { | |
704 | - case 'serie' : | |
705 | - case 'orbit-serie' : | |
661 | + | |
662 | + switch ($paramData->{'param-drawing-type'}) { | |
663 | + case 'serie': | |
664 | + case 'orbit-serie': | |
706 | 665 | //Unmarshall colored serie |
707 | 666 | if (count($paramColoredInfo['indexes']) == 0) |
708 | 667 | $coloredParamNode->addColorSerie($colorSerieId, -1); |
... | ... | @@ -711,29 +670,26 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
711 | 670 | else |
712 | 671 | throw new Exception('Colored parameter for serie must be a component.'); |
713 | 672 | break; |
714 | - default : | |
673 | + default: | |
715 | 674 | throw new Exception('Colored parameter not allowed for this drawing type. '); |
716 | 675 | } |
717 | 676 | ++$drawingEltIndex; |
718 | 677 | } |
719 | 678 | } |
720 | - | |
679 | + | |
721 | 680 | protected function unmarshallSerie($paramData, $requestParamsNode, $plotNode, $paramNode, $indexes, $xId, $colorSerieId, $isOrbitSerie) |
722 | 681 | { |
723 | 682 | $serieNodes = array(); |
724 | - | |
725 | - if (!$isOrbitSerie) | |
726 | - { | |
727 | - if (count($indexes) == 0) | |
728 | - { | |
683 | + | |
684 | + if (!$isOrbitSerie) { | |
685 | + if (count($indexes) == 0) { | |
729 | 686 | $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'}); |
730 | 687 | $serieNode->setId($paramData->{'id'}); |
731 | 688 | if (!empty($paramData->{'param-drawing-object'}->{'serie-resolution'})) |
732 | 689 | $serieNode->setResolution($paramData->{'param-drawing-object'}->{'serie-resolution'}); |
733 | 690 | $serieNodes[] = $serieNode; |
734 | 691 | } |
735 | - foreach ($indexes as $index) | |
736 | - { | |
692 | + foreach ($indexes as $index) { | |
737 | 693 | $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'}); |
738 | 694 | if (count($indexes) == 1) |
739 | 695 | $serieNode->setId($paramData->{'id'}); |
... | ... | @@ -741,60 +697,51 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
741 | 697 | $serieNode->setResolution($paramData->{'param-drawing-object'}->{'serie-resolution'}); |
742 | 698 | $serieNodes[] = $serieNode; |
743 | 699 | } |
744 | - } | |
745 | - else | |
746 | - { | |
700 | + } else { | |
747 | 701 | $orbitSerie = $paramNode->addOrbitSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, $colorSerieId); |
748 | 702 | $orbitSerie->setId($paramData->{'id'}); |
749 | 703 | $serieNodes[] = $orbitSerie; |
750 | 704 | } |
751 | - | |
752 | - foreach ($serieNodes as $serieNode) | |
753 | - { | |
754 | - if (!$isOrbitSerie) | |
755 | - { | |
705 | + | |
706 | + foreach ($serieNodes as $serieNode) { | |
707 | + if (!$isOrbitSerie) { | |
756 | 708 | //Resampling |
757 | - if ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTXY_NAME) | |
758 | - { | |
759 | - switch ($paramData->{'param-drawing-object'}->{'serie-resampling-mode'}) | |
760 | - { | |
761 | - case 'yparam' : | |
709 | + if ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTXY_NAME) { | |
710 | + switch ($paramData->{'param-drawing-object'}->{'serie-resampling-mode'}) { | |
711 | + case 'yparam': | |
762 | 712 | $serieNode->getResampling()->setType(RequestOutputPlotResamplingTypeEnum::YPARAM); |
763 | 713 | break; |
764 | - case 'xparam' : | |
765 | - default : | |
714 | + case 'xparam': | |
715 | + default: | |
766 | 716 | $serieNode->getResampling()->setType(RequestOutputPlotResamplingTypeEnum::XPARAM); |
767 | 717 | } |
768 | 718 | } |
769 | - } | |
770 | - else | |
771 | - { | |
719 | + } else { | |
772 | 720 | //Projection |
773 | - switch ($paramData->{'param-drawing-object'}->{'serie-projection'}) | |
774 | - { | |
775 | - case 'XY' : | |
721 | + switch ($paramData->{'param-drawing-object'}->{'serie-projection'}) { | |
722 | + case 'XY': | |
776 | 723 | $serieNode->setProjection(RequestOutputPlotOrbitSerieProjectionEnum::XY); |
777 | 724 | break; |
778 | - case 'XZ' : | |
725 | + case 'XZ': | |
779 | 726 | $serieNode->setProjection(RequestOutputPlotOrbitSerieProjectionEnum::XZ); |
780 | 727 | break; |
781 | - case 'YZ' : | |
728 | + case 'YZ': | |
782 | 729 | $serieNode->setProjection(RequestOutputPlotOrbitSerieProjectionEnum::YZ); |
783 | 730 | break; |
784 | - case 'XR' : | |
731 | + case 'XR': | |
785 | 732 | $serieNode->setProjection(RequestOutputPlotOrbitSerieProjectionEnum::XR); |
786 | 733 | break; |
787 | - case 'YR' : | |
734 | + case 'YR': | |
788 | 735 | $serieNode->setProjection(RequestOutputPlotOrbitSerieProjectionEnum::YR); |
789 | 736 | break; |
790 | - case 'ZR' : | |
737 | + case 'ZR': | |
791 | 738 | $serieNode->setProjection(RequestOutputPlotOrbitSerieProjectionEnum::ZR); |
792 | 739 | break; |
793 | - default : | |
740 | + default: | |
794 | 741 | throw new Exception('Projection not allowed for the orbit serie'); |
795 | 742 | } |
796 | 743 | } |
797 | - | |
744 | + | |
798 | 745 | //Line |
799 | 746 | $this->unmarshallLine($paramData->{'param-drawing-object'}, 'serie', $serieNode->getLine(), $paramData->{'param-drawing-object'}->{"serie-lines-activated"} ? RequestOutputPlotLineTypeEnum::LINE : RequestOutputPlotLineTypeEnum::NO); |
800 | 747 | //Symbol |
... | ... | @@ -808,15 +755,14 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
808 | 755 | //Interval tick |
809 | 756 | if ($paramData->{'param-drawing-object'}->{'serie-intervaltick-activated'}) |
810 | 757 | $this->unmarshallIntervalTick($paramData->{'param-drawing-object'}, $serieNode->getIntervalTicks()); |
811 | - if (!$isOrbitSerie) | |
812 | - { | |
758 | + if (!$isOrbitSerie) { | |
813 | 759 | //Error bar |
814 | 760 | if ($paramData->{'param-drawing-object'}->{'serie-errorbar-activated'}) |
815 | 761 | $this->unmarshallErrorBar($paramData->{'param-drawing-object'}, $requestParamsNode, $serieNode->getErrorBar()); |
816 | 762 | } |
817 | 763 | } |
818 | 764 | } |
819 | - | |
765 | + | |
820 | 766 | protected function unmarshallTimeTick($serieData, $timeTickNode) |
821 | 767 | { |
822 | 768 | //Font |
... | ... | @@ -828,18 +774,17 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
828 | 774 | //Symbol |
829 | 775 | $this->unmarshallSymbol($serieData, 'serie-timetick-symbols', $timeTickNode->getSymbol()); |
830 | 776 | //Set options by type |
831 | - switch ($serieData->{'serie-timetick-type'}) | |
832 | - { | |
833 | - case 'time-step' : | |
777 | + switch ($serieData->{'serie-timetick-type'}) { | |
778 | + case 'time-step': | |
834 | 779 | $timeTickNode->setStep(CommonClass::timeStampToDDTime($serieData->{'serie-timetick-step'})); |
835 | 780 | $timeTickNode->setNumber(0); |
836 | 781 | break; |
837 | - case 'nb-major' : | |
782 | + case 'nb-major': | |
838 | 783 | $timeTickNode->setStep(0); |
839 | 784 | $timeTickNode->setNumber($serieData->{'serie-timetick-nbmajor'}); |
840 | 785 | break; |
841 | - case 'auto' : | |
842 | - default : | |
786 | + case 'auto': | |
787 | + default: | |
843 | 788 | $timeTickNode->setStep('auto'); |
844 | 789 | $timeTickNode->setNumber(0); |
845 | 790 | } |
... | ... | @@ -848,12 +793,11 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
848 | 793 | //Color |
849 | 794 | $timeTickNode->setColor($this->hexColor2KernelColor($serieData->{'serie-timetick-color'})); |
850 | 795 | } |
851 | - | |
796 | + | |
852 | 797 | protected function unmarshallIntervalTick($serieData, $intervalTickNode) |
853 | 798 | { |
854 | 799 | //Mode |
855 | - switch ($serieData->{'serie-intervaltick-mode'}) | |
856 | - { | |
800 | + switch ($serieData->{'serie-intervaltick-mode'}) { | |
857 | 801 | case 'symbol-only': |
858 | 802 | $intervalTickNode->setMode(RequestOutputPlotSerieIntervalTicksModeEnum::SYMBOLONLY); |
859 | 803 | break; |
... | ... | @@ -864,29 +808,28 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
864 | 808 | $intervalTickNode->setMode(RequestOutputPlotSerieIntervalTicksModeEnum::STARTSTOPTIME); |
865 | 809 | break; |
866 | 810 | case 'start-time': |
867 | - default : | |
811 | + default: | |
868 | 812 | $intervalTickNode->setMode(RequestOutputPlotSerieIntervalTicksModeEnum::STARTTIME); |
869 | 813 | } |
870 | - | |
814 | + | |
871 | 815 | //Color |
872 | 816 | $intervalTickNode->setColor($this->hexColor2KernelColor($serieData->{'serie-intervaltick-color'})); |
873 | - | |
817 | + | |
874 | 818 | //Symbol |
875 | 819 | $this->unmarshallSymbol($serieData, 'serie-intervaltick-symbols', $intervalTickNode->getSymbol()); |
876 | - | |
820 | + | |
877 | 821 | //Font |
878 | 822 | if ($serieData->{'serie-intervaltick-font-activated'}) |
879 | 823 | $this->unmarshallFont($serieData, 'serie-intervaltick-font', $intervalTickNode->getFont()); |
880 | 824 | } |
881 | - | |
825 | + | |
882 | 826 | protected function unmarshallErrorBar($serieData, $requestParamsNode, $errorBarNode) |
883 | 827 | { |
884 | 828 | //Type |
885 | - switch ($serieData->{'serie-errorbar-type'}) | |
886 | - { | |
829 | + switch ($serieData->{'serie-errorbar-type'}) { | |
887 | 830 | case 'min-max': |
888 | 831 | $errorBarTypeNode = $errorBarNode->getBarByType(RequestOutputPlotYSerieErrorBarTypeEnum::MINMAX); |
889 | - | |
832 | + | |
890 | 833 | $minParamInfo = $this->paramManager->addExistingParam($serieData->{'serie-errorbar-minparam'}, $this->paramsData); |
891 | 834 | if ($minParamInfo['id'] == '') |
892 | 835 | throw new Exception('Cannot retrieve min. error parameter.'); |
... | ... | @@ -897,7 +840,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
897 | 840 | $errorBarTypeNode->setMinParam($minParamInfo['id'], $minParamInfo['indexes'][0]); |
898 | 841 | else |
899 | 842 | throw new Exception('Min parameter for error bar must be a component.'); |
900 | - | |
843 | + | |
901 | 844 | $maxParamInfo = $this->paramManager->addExistingParam($serieData->{'serie-errorbar-maxparam'}, $this->paramsData); |
902 | 845 | if ($maxParamInfo['id'] == '') |
903 | 846 | throw new Exception('Cannot retrieve max. error parameter.'); |
... | ... | @@ -911,7 +854,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
911 | 854 | break; |
912 | 855 | case 'delta': |
913 | 856 | $errorBarTypeNode = $errorBarNode->getBarByType(RequestOutputPlotYSerieErrorBarTypeEnum::DELTA); |
914 | - | |
857 | + | |
915 | 858 | $deltaParamInfo = $this->paramManager->addExistingParam($serieData->{'serie-errorbar-deltaparam'}, $this->paramsData); |
916 | 859 | if ($deltaParamInfo['id'] == '') |
917 | 860 | throw new Exception('Cannot retrieve delta error parameter.'); |
... | ... | @@ -923,21 +866,21 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
923 | 866 | else |
924 | 867 | throw new Exception('Delta parameter for error bar must be a component.'); |
925 | 868 | break; |
926 | - default : | |
869 | + default: | |
927 | 870 | throw new Exception('Unknown error bar type.'); |
928 | 871 | } |
929 | - | |
872 | + | |
930 | 873 | //Line |
931 | 874 | $this->unmarshallLine($serieData, 'serie-errorbar', $errorBarNode->getLine(), RequestOutputPlotLineTypeEnum::LINE); |
932 | 875 | } |
933 | - | |
876 | + | |
934 | 877 | protected function unmarshallInstantSerie($paramDrawingData, $plotNode, $paramNode) |
935 | 878 | { |
936 | 879 | $iserieNode = $paramNode->addInstantSerie('y-left'); |
937 | - | |
880 | + | |
938 | 881 | //Table on X Axis |
939 | 882 | $iserieNode->setTableOnXAxis($paramDrawingData->{'iserie-tableonx'} ? "true" : "false"); |
940 | - | |
883 | + | |
941 | 884 | //Line |
942 | 885 | $this->unmarshallLine($paramDrawingData, 'iserie', $iserieNode->getLine(), $paramDrawingData->{"iserie-lines-activated"} ? RequestOutputPlotLineTypeEnum::LINE : RequestOutputPlotLineTypeEnum::NO); |
943 | 886 | |
... | ... | @@ -947,18 +890,29 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
947 | 890 | else |
948 | 891 | $this->unmarshallSymbol($paramDrawingData, 'iserie-symbols', $iserieNode->getSymbol()); |
949 | 892 | } |
950 | - | |
893 | + | |
951 | 894 | protected function unmarshallSpectro($paramDrawingData, $plotNode, $paramNode, $indexes) |
952 | 895 | { |
953 | - $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'}); | |
896 | + $spectroNode = $paramNode->addSpectro( | |
897 | + $paramDrawingData->{'spectro-yaxis'}, | |
898 | + empty($paramDrawingData->{'spectro-resolution'}) ? NULL : $paramDrawingData->{'spectro-resolution'}, | |
899 | + count($indexes) > 0 ? $indexes[0] : NULL, | |
900 | + $paramDrawingData->{'spectro-value-min'}, | |
901 | + $paramDrawingData->{'spectro-value-max'}, | |
902 | + isset($paramDrawingData->{'spectro-log0-as-min'}) ? $paramDrawingData->{'spectro-log0-as-min'} : false, | |
903 | + empty($paramDrawingData->{'spectro-normalization'}) ? NULL : $paramDrawingData->{'spectro-normalization'}, | |
904 | + empty($paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE}) ? NULL : $paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE}, | |
905 | + !isset($paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE}) ? NULL : $paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE}, | |
906 | + !isset($paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_DIM}) ? NULL : $paramDrawingData->{REQUESTOUTPUTPLOTSPECTRO_BGS_DIM} | |
907 | + ); | |
954 | 908 | } |
955 | - | |
909 | + | |
956 | 910 | protected function unmarshallInstantSpectro($paramDrawingData, $plotNode, $paramNode, $indexes) |
957 | 911 | { |
958 | - //TBD how to process inexes if they are defined ? | |
912 | + //TBD how to process inexes if they are defined ? | |
959 | 913 | $spectroNode = $paramNode->addInstantSpectro('y-left', $paramDrawingData->{'ispectro-dimonxaxis'}); |
960 | 914 | } |
961 | - | |
915 | + | |
962 | 916 | protected function unmarshallStatusBar($paramDrawingData, $paramNode, $indexes) |
963 | 917 | { |
964 | 918 | if (count($indexes) == 0) |
... | ... | @@ -971,7 +925,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
971 | 925 | { |
972 | 926 | $paramNode->addIntervals(); |
973 | 927 | } |
974 | - | |
928 | + | |
975 | 929 | protected function unmarshallTickBar($paramDrawingData, $paramNode, $indexes) |
976 | 930 | { |
977 | 931 | if (count($indexes) == 0) |
... | ... | @@ -979,7 +933,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
979 | 933 | foreach ($indexes as $index) |
980 | 934 | $paramNode->addTickBar($index); |
981 | 935 | } |
982 | - | |
936 | + | |
983 | 937 | protected function hasStatusBar($paramsData) |
984 | 938 | { |
985 | 939 | foreach ($paramsData as $paramData) |
... | ... | @@ -987,7 +941,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
987 | 941 | return true; |
988 | 942 | return false; |
989 | 943 | } |
990 | - | |
944 | + | |
991 | 945 | protected function hasTickBar($paramsData) |
992 | 946 | { |
993 | 947 | foreach ($paramsData as $paramData) |
... | ... | @@ -995,116 +949,111 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
995 | 949 | return true; |
996 | 950 | return false; |
997 | 951 | } |
998 | - | |
952 | + | |
999 | 953 | protected function unmarshallParamsLegend($paramsLegendData, $paramsLegendNode) |
1000 | 954 | { |
1001 | 955 | //Legend type |
1002 | - switch ($paramsLegendData->{'legend-series-type'}) | |
1003 | - { | |
1004 | - case 'text-line-symbol' : | |
956 | + switch ($paramsLegendData->{'legend-series-type'}) { | |
957 | + case 'text-line-symbol': | |
1005 | 958 | $paramsLegendNode->setType(RequestOutputPlotParamsLegendTypeEnum::TEXTLINESYMBOL); |
1006 | 959 | break; |
1007 | - case 'text-only' : | |
1008 | - default : | |
960 | + case 'text-only': | |
961 | + default: | |
1009 | 962 | $paramsLegendNode->setType(RequestOutputPlotParamsLegendTypeEnum::TEXTONLY); |
1010 | 963 | } |
1011 | - | |
964 | + | |
1012 | 965 | //Show param legend |
1013 | 966 | $paramsLegendNode->setShowParamInfo($paramsLegendData->{'legend-series-showparaminfo'} ? "true" : "false"); |
1014 | - | |
967 | + | |
1015 | 968 | //Show interval legend |
1016 | 969 | $paramsLegendNode->setShowIntervalInfo($paramsLegendData->{'legend-series-intervalinfo-activated'} ? "true" : "false"); |
1017 | - | |
970 | + | |
1018 | 971 | //Interval info type |
1019 | - switch ($paramsLegendData->{'legend-series-intervalinfo-type'}) | |
1020 | - { | |
1021 | - case 'start-stop' : | |
972 | + switch ($paramsLegendData->{'legend-series-intervalinfo-type'}) { | |
973 | + case 'start-stop': | |
1022 | 974 | $paramsLegendNode->setIntervalInfoType(RequestOutputPlotParamsLegendIntervalInfoTypeEnum::STARTSTOP); |
1023 | 975 | break; |
1024 | - case 'index' : | |
1025 | - default : | |
976 | + case 'index': | |
977 | + default: | |
1026 | 978 | $paramsLegendNode->setIntervalInfoType(RequestOutputPlotParamsLegendIntervalInfoTypeEnum::INDEX); |
1027 | 979 | } |
1028 | - | |
980 | + | |
1029 | 981 | //Position |
1030 | - switch ($paramsLegendData->{'legend-series-position'}) | |
1031 | - { | |
1032 | - case 'inside' : | |
982 | + switch ($paramsLegendData->{'legend-series-position'}) { | |
983 | + case 'inside': | |
1033 | 984 | $paramsLegendNode->setPosition(RequestOutputPlotParamsLegendPositionEnum::INSIDE); |
1034 | 985 | break; |
1035 | - case 'outside' : | |
1036 | - default : | |
986 | + case 'outside': | |
987 | + default: | |
1037 | 988 | $paramsLegendNode->setPosition(RequestOutputPlotParamsLegendPositionEnum::OUTSIDE); |
1038 | 989 | } |
1039 | - | |
990 | + | |
1040 | 991 | //Default text color |
1041 | 992 | $paramsLegendNode->setDefaultTextColor($this->hexColor2KernelColor($paramsLegendData->{'legend-series-defaulttextcolor'})); |
1042 | - | |
993 | + | |
1043 | 994 | //Border visible |
1044 | 995 | $paramsLegendNode->setBorderVisible($paramsLegendData->{'legend-series-border-activated'} ? "true" : "false"); |
1045 | - | |
996 | + | |
1046 | 997 | //Border color |
1047 | 998 | $paramsLegendNode->setBorderColor($this->hexColor2KernelColor($paramsLegendData->{'legend-series-border-color'})); |
1048 | - | |
999 | + | |
1049 | 1000 | //Font |
1050 | 1001 | if ($paramsLegendData->{'legend-series-font-activated'}) |
1051 | 1002 | $this->unmarshallFont($paramsLegendData, 'legend-series-font', $paramsLegendNode->getFont()); |
1052 | 1003 | } |
1053 | - | |
1004 | + | |
1054 | 1005 | protected function unmarshallTextLegend($textLegendData, $legendsNode) |
1055 | 1006 | { |
1056 | 1007 | $legendNode = $legendsNode->addTextLegend(); |
1057 | - | |
1008 | + | |
1058 | 1009 | //Legend text |
1059 | 1010 | $legendNode->setText($textLegendData->{'legend-text-value'}); |
1060 | - | |
1011 | + | |
1061 | 1012 | //Legend position |
1062 | - switch ($textLegendData->{'legend-text-position'}) | |
1063 | - { | |
1064 | - case 'top' : | |
1013 | + switch ($textLegendData->{'legend-text-position'}) { | |
1014 | + case 'top': | |
1065 | 1015 | $legendNode->setPosition(RequestOutputPlotTextLegendPositionEnum::TOP); |
1066 | 1016 | break; |
1067 | - case 'bottom' : | |
1017 | + case 'bottom': | |
1068 | 1018 | $legendNode->setPosition(RequestOutputPlotTextLegendPositionEnum::BOTTOM); |
1069 | 1019 | break; |
1070 | - case 'left' : | |
1020 | + case 'left': | |
1071 | 1021 | $legendNode->setPosition(RequestOutputPlotTextLegendPositionEnum::LEFT); |
1072 | 1022 | break; |
1073 | - case 'right' : | |
1074 | - default : | |
1023 | + case 'right': | |
1024 | + default: | |
1075 | 1025 | $legendNode->setPosition(RequestOutputPlotTextLegendPositionEnum::RIGHT); |
1076 | 1026 | } |
1077 | - | |
1027 | + | |
1078 | 1028 | //Legend text color |
1079 | 1029 | $legendNode->setColor($this->hexColor2KernelColor($textLegendData->{'legend-text-color'})); |
1080 | - | |
1030 | + | |
1081 | 1031 | //Font |
1082 | 1032 | if ($textLegendData->{'legend-text-font-activated'}) |
1083 | 1033 | $this->unmarshallFont($textLegendData, 'legend-text-font', $legendNode->getFont()); |
1084 | 1034 | } |
1085 | - | |
1086 | - protected function unmarshallConstant($constantData,$axisNode) | |
1035 | + | |
1036 | + protected function unmarshallConstant($constantData, $axisNode) | |
1087 | 1037 | { |
1088 | 1038 | $constantNode = $axisNode->addConstant(); |
1089 | 1039 | $constantNode->setId($constantData->{'id'}); |
1090 | - | |
1040 | + | |
1091 | 1041 | //Constant value |
1092 | - switch ($axisNode->getName()) | |
1093 | - { | |
1094 | - case REQUESTOUTPUTPLOTTIMEAXIS_NAME : | |
1042 | + switch ($axisNode->getName()) { | |
1043 | + case REQUESTOUTPUTPLOTTIMEAXIS_NAME: | |
1095 | 1044 | date_default_timezone_set('UTC'); |
1096 | 1045 | $timeStamp = strtotime($constantData->{'constant-time-value'}); |
1097 | 1046 | $time = CommonClass::timeStampToDDTime($timeStamp); |
1098 | 1047 | $constantNode->setConstantValue($time); |
1099 | 1048 | break; |
1100 | - default : | |
1049 | + default: | |
1101 | 1050 | $constantNode->setConstantValue($constantData->{'constant-float-value'}); |
1102 | 1051 | } |
1103 | - | |
1052 | + | |
1104 | 1053 | //Curve options |
1105 | 1054 | $this->unmarshallCurve($constantData, "constant-line", $constantNode); |
1106 | 1055 | } |
1107 | - | |
1056 | + | |
1108 | 1057 | protected function unmarshallAdditionalObjects($panelData, $addObjectsNode, $isTimePlot) |
1109 | 1058 | { |
1110 | 1059 | foreach ($panelData->{'textObjs'} as $textData) |
... | ... | @@ -1112,87 +1061,81 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
1112 | 1061 | foreach ($panelData->{'curves'} as $curveData) |
1113 | 1062 | $this->unmarshallCurveObject($curveData, $addObjectsNode); |
1114 | 1063 | } |
1115 | - | |
1064 | + | |
1116 | 1065 | protected function unmarshallTextObject($textData, $addObjectsNode, $isTimePlot) |
1117 | 1066 | { |
1118 | 1067 | $textNode = $addObjectsNode->addTextObject(); |
1119 | - | |
1068 | + | |
1120 | 1069 | $textNode->setText($textData->{'text-value'}); |
1121 | - | |
1122 | - switch ($textData->{'text-y-axis'}) | |
1123 | - { | |
1124 | - case 'y-right' : | |
1070 | + | |
1071 | + switch ($textData->{'text-y-axis'}) { | |
1072 | + case 'y-right': | |
1125 | 1073 | $textNode->setYAxis('y-right'); |
1126 | 1074 | break; |
1127 | - case 'y-left' : | |
1075 | + case 'y-left': | |
1128 | 1076 | $textNode->setYAxis('y-left'); |
1129 | 1077 | break; |
1130 | 1078 | } |
1131 | - | |
1132 | - if ($isTimePlot && !$textData->{'text-x-relative'}) | |
1133 | - { | |
1079 | + | |
1080 | + if ($isTimePlot && !$textData->{'text-x-relative'}) { | |
1134 | 1081 | date_default_timezone_set('UTC'); |
1135 | 1082 | $timeStamp = strtotime($textData->{'text-x-timevalue'}); |
1136 | 1083 | $time = CommonClass::timeStampToDDTime($timeStamp); |
1137 | 1084 | $textNode->setX($time); |
1138 | - } | |
1139 | - else if ($textData->{'text-x-relative'}) | |
1140 | - $textNode->setX(($textData->{'text-x-floatvalue'}*100)."%"); | |
1085 | + } else if ($textData->{'text-x-relative'}) | |
1086 | + $textNode->setX(($textData->{'text-x-floatvalue'} * 100) . "%"); | |
1141 | 1087 | else |
1142 | 1088 | $textNode->setX($textData->{'text-x-floatvalue'}); |
1143 | - | |
1089 | + | |
1144 | 1090 | if ($textData->{'text-y-relative'}) |
1145 | - $textNode->setY(($textData->{'text-y-value'}*100)."%"); | |
1091 | + $textNode->setY(($textData->{'text-y-value'} * 100) . "%"); | |
1146 | 1092 | else |
1147 | 1093 | $textNode->setY($textData->{'text-y-value'}); |
1148 | - | |
1094 | + | |
1149 | 1095 | $textNode->setAngle($textData->{'text-angle'}); |
1150 | - | |
1096 | + | |
1151 | 1097 | $textNode->setColor($this->hexColor2KernelColor($textData->{'text-color'})); |
1152 | - | |
1153 | - switch ($textData->{'text-align'}) | |
1154 | - { | |
1155 | - case 'center' : | |
1098 | + | |
1099 | + switch ($textData->{'text-align'}) { | |
1100 | + case 'center': | |
1156 | 1101 | $textNode->setAlign(RequestOutputPlotTextAlign::CENTER); |
1157 | 1102 | break; |
1158 | - case 'right' : | |
1103 | + case 'right': | |
1159 | 1104 | $textNode->setAlign(RequestOutputPlotTextAlign::RIGHT); |
1160 | 1105 | break; |
1161 | - case 'left' : | |
1106 | + case 'left': | |
1162 | 1107 | default: |
1163 | 1108 | $textNode->setAlign(RequestOutputPlotTextAlign::LEFT); |
1164 | 1109 | } |
1165 | - | |
1110 | + | |
1166 | 1111 | //Font |
1167 | 1112 | if ($textData->{'text-font-activated'}) |
1168 | 1113 | $this->unmarshallFont($textData, 'text-font', $textNode->getFont()); |
1169 | 1114 | } |
1170 | - | |
1115 | + | |
1171 | 1116 | protected function unmarshallCurveObject($curveData, $addObjectsNode) |
1172 | 1117 | { |
1173 | 1118 | if (($curveData->{'curve-name'} == '') || !isset($curveData->{'curve-serie-id'})) |
1174 | 1119 | return; |
1175 | - | |
1120 | + | |
1176 | 1121 | $curveNode = $addObjectsNode->addCurveObject(); |
1177 | - | |
1122 | + | |
1178 | 1123 | $curveNode->setSerieId($curveData->{'curve-serie-id'}); |
1179 | - | |
1124 | + | |
1180 | 1125 | $curveNode->getFunction()->setFunctionName($curveData->{'curve-name'}); |
1181 | - | |
1126 | + | |
1182 | 1127 | foreach ($curveData->{'params'} as $paramData) |
1183 | 1128 | $curveNode->getFunction()->addAttribute($paramData->{'curve-param-name'}, $paramData->{'curve-param-value'}); |
1184 | - | |
1129 | + | |
1185 | 1130 | //Curve options |
1186 | 1131 | $this->unmarshallCurve($curveData, "curve-line", $curveNode); |
1187 | 1132 | } |
1188 | - | |
1133 | + | |
1189 | 1134 | protected function unmarshallFills($panelData, $fillsNode) |
1190 | 1135 | { |
1191 | - foreach ($panelData->{'fills'} as $fillData) | |
1192 | - { | |
1136 | + foreach ($panelData->{'fills'} as $fillData) { | |
1193 | 1137 | //Serie / Constant |
1194 | - if ($fillData->{'fill-type'} == 'serie-constant') | |
1195 | - { | |
1138 | + if ($fillData->{'fill-type'} == 'serie-constant') { | |
1196 | 1139 | $fillNode = $fillsNode->addFill(RequestOutputPlotFillTypeEnum::SERIECONSTANT); |
1197 | 1140 | $fillNode->setSerieId($fillData->{'fill-firstserie-id'}); |
1198 | 1141 | $fillNode->setConstantId($fillData->{'fill-constant-id'}); |
... | ... | @@ -1202,12 +1145,10 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
1202 | 1145 | $fillNode->setLessColor($this->hexColor2KernelColor($fillData->{'fill-less-color'})); |
1203 | 1146 | } |
1204 | 1147 | } |
1205 | - | |
1206 | - foreach ($panelData->{'fills'} as $fillData) | |
1207 | - { | |
1148 | + | |
1149 | + foreach ($panelData->{'fills'} as $fillData) { | |
1208 | 1150 | //Serie / Serie |
1209 | - if ($fillData->{'fill-type'} == 'serie-serie') | |
1210 | - { | |
1151 | + if ($fillData->{'fill-type'} == 'serie-serie') { | |
1211 | 1152 | $fillNode = $fillsNode->addFill(RequestOutputPlotFillTypeEnum::SERIESERIE); |
1212 | 1153 | $fillNode->setFirstSerieId($fillData->{'fill-firstserie-id'}); |
1213 | 1154 | $fillNode->setSecondSerieId($fillData->{'fill-secondserie-id'}); |
... | ... | @@ -1216,172 +1157,162 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
1216 | 1157 | if ($fillData->{'fill-less-color'} != 'none') |
1217 | 1158 | $fillNode->setLessColor($this->hexColor2KernelColor($fillData->{'fill-less-color'})); |
1218 | 1159 | } |
1219 | - } | |
1160 | + } | |
1220 | 1161 | } |
1221 | - | |
1162 | + | |
1222 | 1163 | protected function unmarshallTitle($inputData, $keyPrefix, $titleNode) |
1223 | 1164 | { |
1224 | - if ($inputData->{$keyPrefix.'-text'} != '') | |
1225 | - { | |
1226 | - $titleNode->setText($inputData->{$keyPrefix.'-text'}); | |
1227 | - | |
1228 | - switch ($inputData->{$keyPrefix.'-position'}) | |
1229 | - { | |
1230 | - case 'top' : | |
1165 | + if ($inputData->{$keyPrefix . '-text'} != '') { | |
1166 | + $titleNode->setText($inputData->{$keyPrefix . '-text'}); | |
1167 | + | |
1168 | + switch ($inputData->{$keyPrefix . '-position'}) { | |
1169 | + case 'top': | |
1231 | 1170 | $titleNode->setPosition(RequestOutputPlotTitlePosition::TOP); |
1232 | 1171 | break; |
1233 | - case 'bottom' : | |
1172 | + case 'bottom': | |
1234 | 1173 | $titleNode->setPosition(RequestOutputPlotTitlePosition::BOTTOM); |
1235 | 1174 | break; |
1236 | 1175 | } |
1237 | - | |
1238 | - switch ($inputData->{$keyPrefix.'-alignment'}) | |
1239 | - { | |
1240 | - case 'center' : | |
1176 | + | |
1177 | + switch ($inputData->{$keyPrefix . '-alignment'}) { | |
1178 | + case 'center': | |
1241 | 1179 | $titleNode->setAlign(RequestOutputPlotTitleAlign::CENTER); |
1242 | 1180 | break; |
1243 | - case 'left' : | |
1181 | + case 'left': | |
1244 | 1182 | $titleNode->setAlign(RequestOutputPlotTitleAlign::LEFT); |
1245 | 1183 | break; |
1246 | - case 'right' : | |
1184 | + case 'right': | |
1247 | 1185 | $titleNode->setAlign(RequestOutputPlotTitleAlign::RIGHT); |
1248 | 1186 | break; |
1249 | 1187 | } |
1250 | - | |
1251 | - if ($inputData->{$keyPrefix.'-color'} != '') | |
1252 | - $titleNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix.'-color'})); | |
1253 | - | |
1188 | + | |
1189 | + if ($inputData->{$keyPrefix . '-color'} != '') | |
1190 | + $titleNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix . '-color'})); | |
1191 | + | |
1254 | 1192 | $this->unmarshallLabel($inputData, $keyPrefix, $titleNode); |
1255 | 1193 | } |
1256 | 1194 | } |
1257 | - | |
1195 | + | |
1258 | 1196 | protected function unmarshallLabel($inputData, $keyPrefix, $labelNode) |
1259 | 1197 | { |
1260 | - if ($inputData->{$keyPrefix.'-font-activated'}) | |
1261 | - { | |
1262 | - $labelNode->setFontName($inputData->{$keyPrefix.'-font-name'}); | |
1263 | - $labelNode->setFontSize($inputData->{$keyPrefix.'-font-size'}); | |
1264 | - if ($inputData->{$keyPrefix.'-font-bold'}) | |
1265 | - { | |
1198 | + if ($inputData->{$keyPrefix . '-font-activated'}) { | |
1199 | + $labelNode->setFontName($inputData->{$keyPrefix . '-font-name'}); | |
1200 | + $labelNode->setFontSize($inputData->{$keyPrefix . '-font-size'}); | |
1201 | + if ($inputData->{$keyPrefix . '-font-bold'}) { | |
1266 | 1202 | $labelNode->setFontWeight("bold"); |
1267 | 1203 | } |
1268 | - if ($inputData->{$keyPrefix.'-font-italic'}) | |
1269 | - { | |
1270 | - $labelNode->setFontStyle("italic"); | |
1204 | + if ($inputData->{$keyPrefix . '-font-italic'}) { | |
1205 | + $labelNode->setFontStyle("italic"); | |
1271 | 1206 | } |
1272 | 1207 | } |
1273 | - | |
1274 | 1208 | } |
1275 | - | |
1209 | + | |
1276 | 1210 | protected function unmarshallFont($inputData, $keyPrefix, $fontNode) |
1277 | 1211 | { |
1278 | - if ($inputData->{$keyPrefix.'-activated'}) | |
1279 | - { | |
1280 | - $fontNode->setFontName($inputData->{$keyPrefix.'-name'}); | |
1281 | - $fontNode->setSize($inputData->{$keyPrefix.'-size'}); | |
1282 | - | |
1283 | - if ($inputData->{$keyPrefix.'-italic'}) | |
1212 | + if ($inputData->{$keyPrefix . '-activated'}) { | |
1213 | + $fontNode->setFontName($inputData->{$keyPrefix . '-name'}); | |
1214 | + $fontNode->setSize($inputData->{$keyPrefix . '-size'}); | |
1215 | + | |
1216 | + if ($inputData->{$keyPrefix . '-italic'}) | |
1284 | 1217 | $fontNode->setStyle(RequestOutputPlotFontStyle::ITALIC); |
1285 | 1218 | else |
1286 | 1219 | $fontNode->setStyle(RequestOutputPlotFontStyle::UPRIGHT); |
1287 | - | |
1288 | - if ($inputData->{$keyPrefix.'-bold'}) | |
1220 | + | |
1221 | + if ($inputData->{$keyPrefix . '-bold'}) | |
1289 | 1222 | $fontNode->setWeight(RequestOutputPlotFontWeight::BOLD); |
1290 | 1223 | else |
1291 | 1224 | $fontNode->setWeight(RequestOutputPlotFontWeight::MEDIUM); |
1292 | 1225 | } |
1293 | 1226 | } |
1294 | - | |
1227 | + | |
1295 | 1228 | protected function unmarshallCurve($inputData, $keyPrefix, $curveNode) |
1296 | 1229 | { |
1297 | - switch ($inputData->{$keyPrefix.'-style'}) | |
1298 | - { | |
1299 | - | |
1300 | - case 'dot' : | |
1230 | + switch ($inputData->{$keyPrefix . '-style'}) { | |
1231 | + | |
1232 | + case 'dot': | |
1301 | 1233 | $curveNode->setStyle(RequestOutputPlotCurveStyleEnum::DOT); |
1302 | 1234 | break; |
1303 | - case 'long-spaced-dot' : | |
1235 | + case 'long-spaced-dot': | |
1304 | 1236 | $curveNode->setStyle(RequestOutputPlotCurveStyleEnum::LONGSPACEDDOT); |
1305 | 1237 | break; |
1306 | - case 'long-short-dot' : | |
1238 | + case 'long-short-dot': | |
1307 | 1239 | $curveNode->setStyle(RequestOutputPlotCurveStyleEnum::LONGSHORTDOT); |
1308 | 1240 | break; |
1309 | - case 'plain' : | |
1310 | - default : | |
1241 | + case 'plain': | |
1242 | + default: | |
1311 | 1243 | $curveNode->setStyle(RequestOutputPlotCurveStyleEnum::PLAIN); |
1312 | 1244 | break; |
1313 | 1245 | } |
1314 | - | |
1315 | - if (isset($inputData->{$keyPrefix.'-width'})) | |
1316 | - $curveNode->setWidth($inputData->{$keyPrefix.'-width'}); | |
1317 | - | |
1318 | - if (isset($inputData->{$keyPrefix.'-color'}) && ($inputData->{$keyPrefix.'-color'} != 'auto')) | |
1319 | - $curveNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix.'-color'})); | |
1246 | + | |
1247 | + if (isset($inputData->{$keyPrefix . '-width'})) | |
1248 | + $curveNode->setWidth($inputData->{$keyPrefix . '-width'}); | |
1249 | + | |
1250 | + if (isset($inputData->{$keyPrefix . '-color'}) && ($inputData->{$keyPrefix . '-color'} != 'auto')) | |
1251 | + $curveNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix . '-color'})); | |
1320 | 1252 | } |
1321 | - | |
1253 | + | |
1322 | 1254 | protected function unmarshallLine($inputData, $keyPrefix, $lineNode, $lineType) |
1323 | 1255 | { |
1324 | 1256 | $lineNode->setType($lineType); |
1325 | - $this->unmarshallCurve($inputData, $keyPrefix."-lines", $lineNode); | |
1257 | + $this->unmarshallCurve($inputData, $keyPrefix . "-lines", $lineNode); | |
1326 | 1258 | } |
1327 | - | |
1259 | + | |
1328 | 1260 | protected function unmarshallSymbol($inputData, $keyPrefix, $symbolNode) |
1329 | 1261 | { |
1330 | - switch ($inputData->{$keyPrefix.'-type'}) | |
1331 | - { | |
1332 | - case 'dot' : | |
1262 | + switch ($inputData->{$keyPrefix . '-type'}) { | |
1263 | + case 'dot': | |
1333 | 1264 | $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::DOT); |
1334 | 1265 | break; |
1335 | - case 'plus' : | |
1266 | + case 'plus': | |
1336 | 1267 | $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::PLUS); |
1337 | 1268 | break; |
1338 | - case 'wildcard' : | |
1269 | + case 'wildcard': | |
1339 | 1270 | $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::WILDCARD); |
1340 | 1271 | break; |
1341 | - case 'circle' : | |
1272 | + case 'circle': | |
1342 | 1273 | $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::CIRCLE); |
1343 | 1274 | break; |
1344 | - case 'crux' : | |
1275 | + case 'crux': | |
1345 | 1276 | $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::CRUX); |
1346 | 1277 | break; |
1347 | - case 'square' : | |
1278 | + case 'square': | |
1348 | 1279 | $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::SQUARE); |
1349 | 1280 | break; |
1350 | - case 'triangle' : | |
1281 | + case 'triangle': | |
1351 | 1282 | $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::TRIANGLE); |
1352 | 1283 | break; |
1353 | - case 'crux-in-circle' : | |
1284 | + case 'crux-in-circle': | |
1354 | 1285 | $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::CRUXINCIRCLE); |
1355 | 1286 | break; |
1356 | - case 'dot-in-circle' : | |
1287 | + case 'dot-in-circle': | |
1357 | 1288 | $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::DOTINCIRCLE); |
1358 | 1289 | break; |
1359 | - case 'diamond' : | |
1290 | + case 'diamond': | |
1360 | 1291 | $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::DIAMOND); |
1361 | 1292 | break; |
1362 | - case 'star' : | |
1293 | + case 'star': | |
1363 | 1294 | $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::STAR); |
1364 | 1295 | break; |
1365 | - case 'david-star' : | |
1296 | + case 'david-star': | |
1366 | 1297 | $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::DAVIDSTAR); |
1367 | 1298 | break; |
1368 | - case 'full-square' : | |
1299 | + case 'full-square': | |
1369 | 1300 | $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::FULLSQUARE); |
1370 | 1301 | break; |
1371 | - case 'full-circle' : | |
1302 | + case 'full-circle': | |
1372 | 1303 | $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::FULLCIRCLE); |
1373 | 1304 | break; |
1374 | - case 'full-star' : | |
1305 | + case 'full-star': | |
1375 | 1306 | $symbolNode->setType(RequestOutputPlotSymbolTypeEnum::FULLSTAR); |
1376 | 1307 | break; |
1377 | - default : | |
1308 | + default: | |
1378 | 1309 | throw new Exception('Symbol type not implemented.'); |
1379 | 1310 | } |
1380 | - | |
1381 | - $symbolNode->setSize($inputData->{$keyPrefix.'-size'}); | |
1382 | - | |
1383 | - if ($inputData->{$keyPrefix.'-color'} != 'auto') | |
1384 | - $symbolNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix.'-color'})); | |
1311 | + | |
1312 | + $symbolNode->setSize($inputData->{$keyPrefix . '-size'}); | |
1313 | + | |
1314 | + if ($inputData->{$keyPrefix . '-color'} != 'auto') | |
1315 | + $symbolNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix . '-color'})); | |
1385 | 1316 | } |
1386 | 1317 | |
1387 | 1318 | /* |
... | ... | @@ -1389,29 +1320,27 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
1389 | 1320 | */ |
1390 | 1321 | protected function marshallResult($data) |
1391 | 1322 | { |
1392 | - if (!$this->isInteractiveRequest) | |
1393 | - { | |
1323 | + if (!$this->isInteractiveRequest) { | |
1394 | 1324 | //add to job |
1395 | - $commonRes = $this->commonMarshallResult($data,PLOT_RESULT_FILE_KEY); | |
1396 | - | |
1325 | + $commonRes = $this->commonMarshallResult($data, PLOT_RESULT_FILE_KEY); | |
1326 | + | |
1397 | 1327 | return $commonRes; |
1398 | 1328 | } |
1399 | - | |
1329 | + | |
1400 | 1330 | //Interactive request |
1401 | 1331 | if (!$data->getSuccess()) |
1402 | 1332 | return array( |
1403 | - 'success' => false, | |
1404 | - 'message' => $data->getLastErrorMessage()); | |
1405 | - | |
1406 | - switch ($data->getStatus()) | |
1407 | - { | |
1408 | - case ProcessStatusEnumClass::DONE : | |
1409 | - | |
1333 | + 'success' => false, | |
1334 | + 'message' => $data->getLastErrorMessage() | |
1335 | + ); | |
1336 | + | |
1337 | + switch ($data->getStatus()) { | |
1338 | + case ProcessStatusEnumClass::DONE: | |
1339 | + | |
1410 | 1340 | $result = array(); |
1411 | - foreach ($data->getWaitingResults() as $key => $waitingResult) | |
1412 | - { | |
1413 | - $contextResult = str_replace(".png","_context.xml",$waitingResult); | |
1414 | - | |
1341 | + foreach ($data->getWaitingResults() as $key => $waitingResult) { | |
1342 | + $contextResult = str_replace(".png", "_context.xml", $waitingResult); | |
1343 | + | |
1415 | 1344 | $result[] = array( |
1416 | 1345 | "id" => $key, |
1417 | 1346 | "title" => $this->interactivePlotTitle[$key], |
... | ... | @@ -1419,64 +1348,67 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
1419 | 1348 | "isInterval" => $this->interactiveTimeSelectionState[$key], |
1420 | 1349 | "index" => $this->interactivePlotIndex[$key], |
1421 | 1350 | "ttFileIndex" => $this->interactiveCrtTTFileIndex, |
1422 | - "context" => IHMPlotContextFileClass::parse($this->getWorkingPath().$contextResult), | |
1351 | + "context" => IHMPlotContextFileClass::parse($this->getWorkingPath() . $contextResult), | |
1423 | 1352 | "plot" => $waitingResult, |
1424 | 1353 | "exectime" => $data->getExecTime(), |
1425 | 1354 | "multiplot" => $this->isMultiPlot, |
1426 | 1355 | ); |
1427 | 1356 | } |
1428 | - | |
1357 | + | |
1429 | 1358 | return array( |
1430 | 1359 | 'success' => true, |
1431 | 1360 | 'id' => $data->getId(), |
1432 | 1361 | 'folder' => $this->getWorkingDirName(), |
1433 | 1362 | 'result' => $result |
1434 | 1363 | ); |
1435 | - case ProcessStatusEnumClass::KILLED : | |
1364 | + case ProcessStatusEnumClass::KILLED: | |
1436 | 1365 | return array( |
1437 | - 'success' => true, | |
1438 | - 'killed' => true); | |
1439 | - default : | |
1366 | + 'success' => true, | |
1367 | + 'killed' => true | |
1368 | + ); | |
1369 | + default: | |
1440 | 1370 | $errorMsg = $data->getErrorMsg(); |
1441 | 1371 | return array( |
1442 | - 'success' => false, | |
1443 | - 'message' => 'Request processing error'.(!empty($errorMsg) ? "<br>(".$errorMsg.")" : "")); | |
1372 | + 'success' => false, | |
1373 | + 'message' => 'Request processing error' . (!empty($errorMsg) ? "<br>(" . $errorMsg . ")" : "") | |
1374 | + ); | |
1444 | 1375 | } |
1445 | 1376 | } |
1446 | - | |
1447 | - private function hexColor2KernelColor($hex) { | |
1377 | + | |
1378 | + private function hexColor2KernelColor($hex) | |
1379 | + { | |
1448 | 1380 | $hex = str_replace("#", "", $hex); |
1449 | 1381 | |
1450 | - $r = hexdec(substr($hex,0,2)); | |
1451 | - $g = hexdec(substr($hex,2,2)); | |
1452 | - $b = hexdec(substr($hex,4,2)); | |
1382 | + $r = hexdec(substr($hex, 0, 2)); | |
1383 | + $g = hexdec(substr($hex, 2, 2)); | |
1384 | + $b = hexdec(substr($hex, 4, 2)); | |
1453 | 1385 | |
1454 | - return "[".$r.",".$g.",".$b."]"; | |
1386 | + return "[" . $r . "," . $g . "," . $b . "]"; | |
1455 | 1387 | } |
1456 | - | |
1388 | + | |
1457 | 1389 | protected function saveIHMRequest($interactiveId, $input) |
1458 | 1390 | { |
1459 | - $path = $this->getWorkingPath()."ihm.request.".$interactiveId; | |
1391 | + $path = $this->getWorkingPath() . "ihm.request." . $interactiveId; | |
1460 | 1392 | if (!is_dir($this->getWorkingPath())) |
1461 | - mkdir($this->getWorkingPath(),0777); | |
1393 | + mkdir($this->getWorkingPath(), 0777); | |
1462 | 1394 | $file = fopen($path, 'w'); |
1463 | 1395 | fwrite($file, json_encode($input)); |
1464 | 1396 | fclose($file); |
1465 | 1397 | } |
1466 | - | |
1398 | + | |
1467 | 1399 | protected function loadIHMRequest($interactiveId) |
1468 | 1400 | { |
1469 | - $path = $this->getWorkingPath()."ihm.request.".$interactiveId; | |
1401 | + $path = $this->getWorkingPath() . "ihm.request." . $interactiveId; | |
1470 | 1402 | if (!file_exists($path)) |
1471 | 1403 | return NULL; |
1472 | 1404 | return json_decode(file_get_contents($path)); |
1473 | 1405 | } |
1474 | 1406 | |
1475 | - | |
1407 | + | |
1476 | 1408 | |
1477 | 1409 | private function loadZoomList($interactiveId) |
1478 | 1410 | { |
1479 | - $path = $this->getWorkingPath()."zoom.list.".$interactiveId; | |
1411 | + $path = $this->getWorkingPath() . "zoom.list." . $interactiveId; | |
1480 | 1412 | if (!file_exists($path)) |
1481 | 1413 | return NULL; |
1482 | 1414 | return json_decode(file_get_contents($path)); |
... | ... | @@ -1484,182 +1416,164 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
1484 | 1416 | |
1485 | 1417 | private function saveZoomList($interactiveId, $zoomList) |
1486 | 1418 | { |
1487 | - $path = $this->getWorkingPath()."zoom.list.".$interactiveId; | |
1419 | + $path = $this->getWorkingPath() . "zoom.list." . $interactiveId; | |
1488 | 1420 | if (!is_dir($this->getWorkingPath())) |
1489 | - mkdir($this->getWorkingPath(),0777); | |
1421 | + mkdir($this->getWorkingPath(), 0777); | |
1490 | 1422 | $file = fopen($path, 'w'); |
1491 | 1423 | fwrite($file, json_encode($zoomList)); |
1492 | 1424 | fclose($file); |
1493 | 1425 | } |
1494 | - | |
1426 | + | |
1495 | 1427 | private function unmarshallActionRequest($input) |
1496 | 1428 | { |
1497 | 1429 | $actionInput = $input->{'action'}; |
1498 | - | |
1430 | + | |
1499 | 1431 | $plotInput = $this->loadIHMRequest($actionInput->{'interactiveId'}); |
1500 | - | |
1432 | + | |
1501 | 1433 | if (!isset($plotInput)) |
1502 | 1434 | throw new Exception('Cannot retrieve request input for interactive action.'); |
1503 | - | |
1504 | - switch ($actionInput->{'action'}) | |
1505 | - { | |
1506 | - case 'zoom' : | |
1435 | + | |
1436 | + switch ($actionInput->{'action'}) { | |
1437 | + case 'zoom': | |
1507 | 1438 | return $this->unmarshallZoom($actionInput, $plotInput); |
1508 | - case 'forward' : | |
1509 | - case 'halfforward' : | |
1510 | - case 'backward' : | |
1511 | - case 'halfbackward' : | |
1512 | - case 'extend' : | |
1513 | - case 'shift' : | |
1439 | + case 'forward': | |
1440 | + case 'halfforward': | |
1441 | + case 'backward': | |
1442 | + case 'halfbackward': | |
1443 | + case 'extend': | |
1444 | + case 'shift': | |
1514 | 1445 | return $this->unmarshallNavigation($actionInput, $plotInput); |
1515 | - case 'goto' : | |
1446 | + case 'goto': | |
1516 | 1447 | return $this->unmarshallTTGoto($actionInput, $plotInput); |
1517 | - case 'instant' : | |
1448 | + case 'instant': | |
1518 | 1449 | return $this->unmarshallInstant($actionInput, $plotInput); |
1519 | - case 'undozoom' : | |
1450 | + case 'undozoom': | |
1520 | 1451 | return $this->unmarshallUndoZoom($actionInput, $plotInput); |
1521 | - default : | |
1452 | + default: | |
1522 | 1453 | throw new Exception('Interactive action not implemented.'); |
1523 | 1454 | } |
1524 | 1455 | } |
1525 | - | |
1456 | + | |
1526 | 1457 | private function addZoomInList($input, $isInterval, $minOrFileIndex, $maxOrIntervalIndex) |
1527 | 1458 | { |
1528 | 1459 | //if $isInterval == true, $minOrFileIndex is the min and $maxOrInetrvalIndex is the max |
1529 | 1460 | //if $isInterval == false, $minOrFileIndex is the fileIndex and $maxOrInetrvalIndex is the intervalIndex |
1530 | - | |
1461 | + | |
1531 | 1462 | $zoomList = $this->loadZoomList($input->interactiveId); |
1532 | - | |
1533 | - if (!isset($zoomList)) | |
1534 | - { | |
1463 | + | |
1464 | + if (!isset($zoomList)) { | |
1535 | 1465 | //Init zoom list |
1536 | - $zoomList = (Object)array( | |
1466 | + $zoomList = (object)array( | |
1537 | 1467 | 'times' => array(), |
1538 | - 'panels' => (Object)array() | |
1468 | + 'panels' => (object)array() | |
1539 | 1469 | ); |
1540 | 1470 | } |
1541 | - | |
1542 | - if ($input->{'axeId'} == 'timeAxis') | |
1543 | - { | |
1471 | + | |
1472 | + if ($input->{'axeId'} == 'timeAxis') { | |
1544 | 1473 | if ($isInterval) |
1545 | - array_push ($zoomList->times, (Object)array( | |
1474 | + array_push($zoomList->times, (object)array( | |
1546 | 1475 | 'isInterval' => true, |
1547 | 1476 | 'min' => $minOrFileIndex, |
1548 | 1477 | 'max' => $maxOrIntervalIndex |
1549 | 1478 | )); |
1550 | 1479 | else |
1551 | - array_push ($zoomList->times, (Object)array( | |
1552 | - 'isInterval' => false, | |
1553 | - 'ttFileIndex' => $minOrFileIndex, | |
1554 | - 'intIndex' => $maxOrIntervalIndex | |
1480 | + array_push($zoomList->times, (object)array( | |
1481 | + 'isInterval' => false, | |
1482 | + 'ttFileIndex' => $minOrFileIndex, | |
1483 | + 'intIndex' => $maxOrIntervalIndex | |
1555 | 1484 | )); |
1556 | - } | |
1557 | - else | |
1558 | - { | |
1559 | - if (!isset($zoomList->panels->{$input->{'panelId'}})) | |
1560 | - { | |
1561 | - $zoomList->panels->{$input->{'panelId'}} = (Object) array( | |
1562 | - 'axes' => (Object)array() | |
1485 | + } else { | |
1486 | + if (!isset($zoomList->panels->{$input->{'panelId'}})) { | |
1487 | + $zoomList->panels->{$input->{'panelId'}} = (object) array( | |
1488 | + 'axes' => (object)array() | |
1563 | 1489 | ); |
1564 | 1490 | } |
1565 | - | |
1566 | - if (!isset($zoomList->panels->{$input->{'panelId'}}->axes->{$input->{'axeId'}})) | |
1567 | - { | |
1491 | + | |
1492 | + if (!isset($zoomList->panels->{$input->{'panelId'}}->axes->{$input->{'axeId'}})) { | |
1568 | 1493 | $zoomList->panels->{$input->{'panelId'}}->axes->{$input->{'axeId'}} = array(); |
1569 | 1494 | } |
1570 | - | |
1571 | - array_push ($zoomList->panels->{$input->{'panelId'}}->axes->{$input->{'axeId'}}, (Object)array( | |
1572 | - 'min' => $minOrFileIndex, | |
1573 | - 'max' => $maxOrIntervalIndex | |
1495 | + | |
1496 | + array_push($zoomList->panels->{$input->{'panelId'}}->axes->{$input->{'axeId'}}, (object)array( | |
1497 | + 'min' => $minOrFileIndex, | |
1498 | + 'max' => $maxOrIntervalIndex | |
1574 | 1499 | )); |
1575 | 1500 | } |
1576 | - | |
1501 | + | |
1577 | 1502 | $this->saveZoomList($input->interactiveId, $zoomList); |
1578 | 1503 | } |
1579 | - | |
1504 | + | |
1580 | 1505 | private function resetZoomList($interactiveId, $resetOnlyTimeZoom = false) |
1581 | 1506 | { |
1582 | 1507 | if (!$resetOnlyTimeZoom) { |
1583 | - $zoomList = (Object)array( | |
1508 | + $zoomList = (object)array( | |
1584 | 1509 | 'times' => array(), |
1585 | - 'panels' => (Object)array() | |
1510 | + 'panels' => (object)array() | |
1586 | 1511 | ); |
1587 | - } | |
1588 | - else { | |
1512 | + } else { | |
1589 | 1513 | $zoomList = $this->loadZoomList($interactiveId); |
1590 | 1514 | $zoomList->times = array(); |
1591 | 1515 | } |
1592 | 1516 | |
1593 | 1517 | $this->saveZoomList($interactiveId, $zoomList); |
1594 | 1518 | } |
1595 | - | |
1519 | + | |
1596 | 1520 | private function undoZoomInList($input) |
1597 | 1521 | { |
1598 | 1522 | $zoomList = $this->loadZoomList($input->interactiveId); |
1599 | - | |
1523 | + | |
1600 | 1524 | $result = NULL; |
1601 | - if ($zoomList) | |
1602 | - { | |
1603 | - if ($input->{'axeId'} == 'timeAxis') | |
1604 | - { | |
1525 | + if ($zoomList) { | |
1526 | + if ($input->{'axeId'} == 'timeAxis') { | |
1605 | 1527 | if (count($zoomList->times) <= 0) |
1606 | 1528 | return NULL; |
1607 | - $result = array_pop($zoomList->times); | |
1608 | - } | |
1609 | - else | |
1610 | - { | |
1529 | + $result = array_pop($zoomList->times); | |
1530 | + } else { | |
1611 | 1531 | if (!isset($zoomList->panels->{$input->{'panelId'}})) |
1612 | 1532 | return NULL; |
1613 | - | |
1533 | + | |
1614 | 1534 | if (!isset($zoomList->panels->{$input->{'panelId'}}->axes->{$input->{'axeId'}})) |
1615 | 1535 | return NULL; |
1616 | - | |
1536 | + | |
1617 | 1537 | $result = array_pop($zoomList->panels->{$input->{'panelId'}}->axes->{$input->{'axeId'}}); |
1618 | 1538 | } |
1619 | - } | |
1620 | - else | |
1539 | + } else | |
1621 | 1540 | return NULL; |
1622 | - | |
1541 | + | |
1623 | 1542 | $this->saveZoomList($input->interactiveId, $zoomList); |
1624 | - | |
1543 | + | |
1625 | 1544 | return $result; |
1626 | 1545 | } |
1627 | - | |
1546 | + | |
1628 | 1547 | private function unmarshallZoom($input, $plotInput, $isUndo = false) |
1629 | 1548 | { |
1630 | - if ($input->{'axeId'} == 'timeAxis') | |
1631 | - { | |
1549 | + if ($input->{'axeId'} == 'timeAxis') { | |
1632 | 1550 | //Zoom on Time Axis |
1633 | - if ($plotInput->{'timesrc'} != 'Interval') | |
1634 | - { | |
1551 | + if ($plotInput->{'timesrc'} != 'Interval') { | |
1635 | 1552 | $plotInput->{'timesrc'} = 'Interval'; |
1636 | 1553 | if (!$isUndo) |
1637 | - $this->addZoomInList($input,false, | |
1638 | - isset($plotInput->{'ttFileIndex'}) ? $plotInput->{'ttFileIndex'} : 0, | |
1639 | - isset($plotInput->{'intIndex'}) ? $plotInput->{'intIndex'} : 0); | |
1640 | - } | |
1641 | - else | |
1642 | - { | |
1554 | + $this->addZoomInList( | |
1555 | + $input, | |
1556 | + false, | |
1557 | + isset($plotInput->{'ttFileIndex'}) ? $plotInput->{'ttFileIndex'} : 0, | |
1558 | + isset($plotInput->{'intIndex'}) ? $plotInput->{'intIndex'} : 0 | |
1559 | + ); | |
1560 | + } else { | |
1643 | 1561 | if (!$isUndo) |
1644 | - $this->addZoomInList($input,true,$plotInput->{'startDate'},$plotInput->{'stopDate'}); | |
1562 | + $this->addZoomInList($input, true, $plotInput->{'startDate'}, $plotInput->{'stopDate'}); | |
1645 | 1563 | } |
1646 | 1564 | $plotInput->{'startDate'} = $input->{'min'}; |
1647 | 1565 | $plotInput->{'stopDate'} = $input->{'max'}; |
1648 | - | |
1566 | + | |
1649 | 1567 | $plotInput->{'force-time-zoom-reset'} = false; |
1650 | 1568 | $this->saveIHMRequest($input->interactiveId, $plotInput); |
1651 | 1569 | return $plotInput; |
1652 | 1570 | } |
1653 | - | |
1571 | + | |
1654 | 1572 | //Digital axis zoom |
1655 | - foreach ($plotInput->{'panels'} as $panel) | |
1656 | - { | |
1657 | - if ($input->{'panelId'} == $panel->{'id'}) | |
1658 | - { | |
1659 | - foreach ($panel->{'axes'} as $axis) | |
1660 | - { | |
1661 | - if ($input->{'axeId'} == $axis->{'id'}) | |
1662 | - { | |
1573 | + foreach ($plotInput->{'panels'} as $panel) { | |
1574 | + if ($input->{'panelId'} == $panel->{'id'}) { | |
1575 | + foreach ($panel->{'axes'} as $axis) { | |
1576 | + if ($input->{'axeId'} == $axis->{'id'}) { | |
1663 | 1577 | $axis->{'axis-range-extend'} = false; |
1664 | 1578 | $oldMin = $axis->{'axis-range-min'}; |
1665 | 1579 | $oldMax = $axis->{'axis-range-max'}; |
... | ... | @@ -1670,7 +1584,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
1670 | 1584 | $plotInput->{'force-single-replot'} = true; |
1671 | 1585 | $plotInput->{'force-time-zoom-reset'} = false; |
1672 | 1586 | if (!$isUndo) |
1673 | - $this->addZoomInList($input,true,$oldMin,$oldMax); | |
1587 | + $this->addZoomInList($input, true, $oldMin, $oldMax); | |
1674 | 1588 | return $plotInput; |
1675 | 1589 | } |
1676 | 1590 | } |
... | ... | @@ -1679,16 +1593,13 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
1679 | 1593 | } |
1680 | 1594 | throw new Exception('Cannot retrieve plot panel for zoom action.'); |
1681 | 1595 | } |
1682 | - | |
1596 | + | |
1683 | 1597 | private function unmarshallUndoZoom($input, $plotInput) |
1684 | 1598 | { |
1685 | 1599 | $result = $this->undoZoomInList($input); |
1686 | - if ($result != NULL) | |
1687 | - { | |
1688 | - if (isset($result->isInterval)) | |
1689 | - { | |
1690 | - if (!$result->isInterval) | |
1691 | - { | |
1600 | + if ($result != NULL) { | |
1601 | + if (isset($result->isInterval)) { | |
1602 | + if (!$result->isInterval) { | |
1692 | 1603 | $input->ttFileIndex = $result->ttFileIndex; |
1693 | 1604 | $input->intIndex = $result->intIndex; |
1694 | 1605 | return $this->unmarshallTTGoto($input, $plotInput); |
... | ... | @@ -1700,137 +1611,128 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
1700 | 1611 | } |
1701 | 1612 | throw new Exception('No undo zoom to apply.'); |
1702 | 1613 | } |
1703 | - | |
1614 | + | |
1704 | 1615 | private function unmarshallNavigation($input, $plotInput) |
1705 | 1616 | { |
1706 | 1617 | $startTime = $plotInput->{'startDate'}; |
1707 | 1618 | $stopTime = $plotInput->{'stopDate'}; |
1708 | - | |
1619 | + | |
1709 | 1620 | //Compute new start / stop time |
1710 | 1621 | date_default_timezone_set('UTC'); |
1711 | 1622 | $startTimeStamp = strtotime($startTime); |
1712 | 1623 | $stopTimeStamp = strtotime($stopTime); |
1713 | 1624 | $duration = $stopTimeStamp - $startTimeStamp; |
1714 | - | |
1715 | - switch ($input->{'action'}) | |
1716 | - { | |
1717 | - case 'forward' : | |
1625 | + | |
1626 | + switch ($input->{'action'}) { | |
1627 | + case 'forward': | |
1718 | 1628 | $startTimeStamp += $duration; |
1719 | 1629 | $stopTimeStamp += $duration; |
1720 | 1630 | break; |
1721 | - case 'halfforward' : | |
1722 | - $startTimeStamp += ($duration/2); | |
1723 | - $stopTimeStamp += ($duration/2); | |
1631 | + case 'halfforward': | |
1632 | + $startTimeStamp += ($duration / 2); | |
1633 | + $stopTimeStamp += ($duration / 2); | |
1724 | 1634 | break; |
1725 | - case 'backward' : | |
1635 | + case 'backward': | |
1726 | 1636 | $startTimeStamp -= $duration; |
1727 | 1637 | $stopTimeStamp -= $duration; |
1728 | 1638 | break; |
1729 | - case 'halfbackward' : | |
1730 | - $startTimeStamp -= ($duration/2); | |
1731 | - $stopTimeStamp -= ($duration/2); | |
1639 | + case 'halfbackward': | |
1640 | + $startTimeStamp -= ($duration / 2); | |
1641 | + $stopTimeStamp -= ($duration / 2); | |
1732 | 1642 | break; |
1733 | - case 'extend' : | |
1643 | + case 'extend': | |
1734 | 1644 | $startTimeStamp -= $input->{'duration'}; |
1735 | 1645 | $stopTimeStamp += $input->{'duration'}; |
1736 | 1646 | break; |
1737 | - case 'shift' : | |
1647 | + case 'shift': | |
1738 | 1648 | $startTimeStamp += $input->{'duration'}; |
1739 | 1649 | $stopTimeStamp += $input->{'duration'}; |
1740 | 1650 | break; |
1741 | 1651 | } |
1742 | - | |
1652 | + | |
1743 | 1653 | if ($stopTimeStamp - $startTimeStamp <= 0) |
1744 | 1654 | throw new Exception('New duration is lower than 0.'); |
1745 | - | |
1746 | - $startTime = date("Y-m-d\TH:i:s",$startTimeStamp); | |
1747 | - $stopTime = date("Y-m-d\TH:i:s",$stopTimeStamp); | |
1748 | - | |
1655 | + | |
1656 | + $startTime = date("Y-m-d\TH:i:s", $startTimeStamp); | |
1657 | + $stopTime = date("Y-m-d\TH:i:s", $stopTimeStamp); | |
1658 | + | |
1749 | 1659 | //Update request |
1750 | 1660 | $plotInput->{'startDate'} = $startTime; |
1751 | 1661 | $plotInput->{'stopDate'} = $stopTime; |
1752 | - | |
1662 | + | |
1753 | 1663 | $plotInput->{'force-time-zoom-reset'} = true; |
1754 | 1664 | $this->saveIHMRequest($input->interactiveId, $plotInput); |
1755 | 1665 | return $plotInput; |
1756 | 1666 | } |
1757 | - | |
1667 | + | |
1758 | 1668 | private function unmarshallTTGoto($input, $plotInput) |
1759 | 1669 | { |
1760 | 1670 | $plotInput->{'timesrc'} = 'TimeTable'; |
1761 | 1671 | $plotInput->{'ttFileIndex'} = $input->{'ttFileIndex'}; |
1762 | 1672 | $plotInput->{'intIndex'} = $input->{'intIndex'}; |
1763 | - | |
1673 | + | |
1764 | 1674 | $plotInput->{'force-time-zoom-reset'} = true; |
1765 | 1675 | $this->saveIHMRequest($input->interactiveId, $plotInput); |
1766 | 1676 | return $plotInput; |
1767 | 1677 | } |
1768 | - | |
1678 | + | |
1769 | 1679 | private function unmarshallInstant($input, $plotInput) |
1770 | 1680 | { |
1771 | 1681 | //Find current panel |
1772 | 1682 | $crtPanel = NULL; |
1773 | - foreach ($plotInput->{'panels'} as $panel) | |
1774 | - { | |
1775 | - if ($input->{'panelId'} == $panel->{'id'}) | |
1776 | - { | |
1683 | + foreach ($plotInput->{'panels'} as $panel) { | |
1684 | + if ($input->{'panelId'} == $panel->{'id'}) { | |
1777 | 1685 | $crtPanel = $panel; |
1778 | 1686 | break; |
1779 | 1687 | } |
1780 | 1688 | } |
1781 | - | |
1689 | + | |
1782 | 1690 | if (!$crtPanel) |
1783 | 1691 | throw new Exception('Cannot retrieve plot panel for instant plot.'); |
1784 | - | |
1692 | + | |
1785 | 1693 | if ($crtPanel->{'panel-plot-type'} != 'timePlot') |
1786 | 1694 | throw new Exception('Instant plot action only available for Time plot.'); |
1787 | - | |
1695 | + | |
1788 | 1696 | //Find spectra parameter |
1789 | 1697 | $crtParam = NULL; |
1790 | - foreach ($crtPanel->{'params'} as $param) | |
1791 | - { | |
1792 | - if ($param->{'param-drawing-type'} == 'spectro') | |
1793 | - { | |
1794 | - $crtParam = $param; | |
1698 | + foreach ($crtPanel->{'params'} as $param) { | |
1699 | + if ($param->{'param-drawing-type'} == 'spectro') { | |
1700 | + $crtParam = $param; | |
1795 | 1701 | break; |
1796 | 1702 | } |
1797 | 1703 | } |
1798 | - | |
1704 | + | |
1799 | 1705 | if (!$crtParam) |
1800 | 1706 | throw new Exception('Cannot retrieve plot param for instant plot.'); |
1801 | - | |
1707 | + | |
1802 | 1708 | //Find table Y-axis |
1803 | 1709 | $crtYAxis = NULL; |
1804 | - foreach ($crtPanel->{'axes'} as $axis) | |
1805 | - { | |
1806 | - if ($crtParam->{'param-drawing-object'}->{'spectro-yaxis'} == $axis->{'id'}) | |
1807 | - { | |
1710 | + foreach ($crtPanel->{'axes'} as $axis) { | |
1711 | + if ($crtParam->{'param-drawing-object'}->{'spectro-yaxis'} == $axis->{'id'}) { | |
1808 | 1712 | $crtYAxis = $axis; |
1809 | 1713 | break; |
1810 | 1714 | } |
1811 | 1715 | } |
1812 | - | |
1716 | + | |
1813 | 1717 | if (!$crtYAxis) |
1814 | 1718 | throw new Exception('Cannot retrieve plot y Axis for instant plot.'); |
1815 | - | |
1719 | + | |
1816 | 1720 | //Find color Z-axis |
1817 | 1721 | $crtColorAxis = NULL; |
1818 | - foreach ($crtPanel->{'axes'} as $axis) | |
1819 | - { | |
1820 | - if ($axis->{'id'} == 'color') | |
1821 | - { | |
1722 | + foreach ($crtPanel->{'axes'} as $axis) { | |
1723 | + if ($axis->{'id'} == 'color') { | |
1822 | 1724 | $crtColorAxis = $axis; |
1823 | 1725 | break; |
1824 | 1726 | } |
1825 | 1727 | } |
1826 | - | |
1728 | + | |
1827 | 1729 | if (!$crtColorAxis) |
1828 | 1730 | throw new Exception('Cannot retrieve plot color Axis for instant plot.'); |
1829 | - | |
1731 | + | |
1830 | 1732 | date_default_timezone_set('UTC'); |
1831 | 1733 | $timeStamp = strtotime($input->time); |
1832 | - | |
1833 | - $instantPlotInput = (Object)array( | |
1734 | + | |
1735 | + $instantPlotInput = (object)array( | |
1834 | 1736 | "interactive-preview" => true, |
1835 | 1737 | "file-format" => "PNG", |
1836 | 1738 | "file-output" => "INTERACTIVE", |
... | ... | @@ -1845,75 +1747,74 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
1845 | 1747 | "page-orientation" => $plotInput->{"page-orientation"}, |
1846 | 1748 | "page-dimension" => $plotInput->{"page-dimension"}, |
1847 | 1749 | "page-layout-type" => "vertical", |
1848 | - "page-layout-object" => (Object)array( | |
1750 | + "page-layout-object" => (object)array( | |
1849 | 1751 | "layout-expand" => true, |
1850 | - "layout-panel-height" => 0.5, | |
1752 | + "layout-panel-height" => 0.5, | |
1851 | 1753 | "layout-panel-spacing" => 0.05 |
1852 | 1754 | ), |
1853 | 1755 | "panels" => array() |
1854 | 1756 | ); |
1855 | - | |
1856 | - $instantPanel = (Object)array( | |
1857 | - "id" => "1", | |
1858 | - "panel-plot-type" => "instantPlot", | |
1859 | - "panel-instant-time" => $input->time, | |
1860 | - "axes" => array(), | |
1861 | - "params" => array(), | |
1862 | - | |
1863 | - ); | |
1864 | - | |
1865 | - $instantXAxis = (Object)array( | |
1866 | - "id" => "xaxis_id", | |
1867 | - "axis-type" => "x", | |
1868 | - "axis-scale" => $crtYAxis->{"axis-scale"}, | |
1869 | - "axis-thickness" => 1 | |
1757 | + | |
1758 | + $instantPanel = (object)array( | |
1759 | + "id" => "1", | |
1760 | + "panel-plot-type" => "instantPlot", | |
1761 | + "panel-instant-time" => $input->time, | |
1762 | + "axes" => array(), | |
1763 | + "params" => array(), | |
1764 | + | |
1870 | 1765 | ); |
1871 | - | |
1872 | - $instantYAxis = (Object)array( | |
1873 | - "id" => "y-left", | |
1874 | - "axis-type" => "y-left", | |
1875 | - "axis-scale" => $crtColorAxis->{"axis-scale"}, | |
1876 | - "axis-thickness" => 1 | |
1766 | + | |
1767 | + $instantXAxis = (object)array( | |
1768 | + "id" => "xaxis_id", | |
1769 | + "axis-type" => "x", | |
1770 | + "axis-scale" => $crtYAxis->{"axis-scale"}, | |
1771 | + "axis-thickness" => 1 | |
1772 | + ); | |
1773 | + | |
1774 | + $instantYAxis = (object)array( | |
1775 | + "id" => "y-left", | |
1776 | + "axis-type" => "y-left", | |
1777 | + "axis-scale" => $crtColorAxis->{"axis-scale"}, | |
1778 | + "axis-thickness" => 1 | |
1877 | 1779 | ); |
1878 | 1780 | $instantPanel->{"axes"}[] = $instantXAxis; |
1879 | 1781 | $instantPanel->{"axes"}[] = $instantYAxis; |
1880 | - | |
1881 | - $instantParam = (Object)array( | |
1782 | + | |
1783 | + $instantParam = (object)array( | |
1882 | 1784 | "id" => 1, |
1883 | 1785 | "paramid" => $crtParam->{'paramid'}, |
1884 | 1786 | "template_args" => $crtParam->{'template_args'}, |
1885 | 1787 | "param-drawing-type" => "iserie", |
1886 | - "param-drawing-object" => (Object)array( | |
1887 | - "iserie-tableonx" => true, | |
1888 | - "iserie-lines-activated" => true, | |
1889 | - "iserie-lines-style" => "plain", | |
1890 | - "iserie-lines-width" => 1, | |
1891 | - "iserie-lines-color" => "auto" | |
1788 | + "param-drawing-object" => (object)array( | |
1789 | + "iserie-tableonx" => true, | |
1790 | + "iserie-lines-activated" => true, | |
1791 | + "iserie-lines-style" => "plain", | |
1792 | + "iserie-lines-width" => 1, | |
1793 | + "iserie-lines-color" => "auto" | |
1892 | 1794 | ), |
1893 | - "dim1-index" => $crtParam->{'dim1-index'}, | |
1894 | - "dim1-sum-type" => $crtParam->{'dim1-sum-type'}, | |
1895 | - "dim1-min-value" => $crtParam->{'dim1-min-value'}, | |
1896 | - "dim1-max-value" => $crtParam->{'dim1-max-value'}, | |
1897 | - "dim1-min-index" => $crtParam->{'dim1-min-index'}, | |
1898 | - "dim1-max-index" => $crtParam->{'dim1-max-index'}, | |
1899 | - | |
1900 | - "dim2-index" => $crtParam->{'dim2-index'}, | |
1901 | - "dim2-sum-type" => $crtParam->{'dim2-sum-type'}, | |
1902 | - "dim2-min-value" => $crtParam->{'dim2-min-value'}, | |
1903 | - "dim2-max-value" => $crtParam->{'dim2-max-value'}, | |
1904 | - "dim2-min-index" => $crtParam->{'dim2-min-index'}, | |
1905 | - "dim2-max-index" => $crtParam->{'dim2-max-index'}, | |
1906 | - | |
1907 | - "type" => $crtParam->{'type'} | |
1795 | + "dim1-index" => $crtParam->{'dim1-index'}, | |
1796 | + "dim1-sum-type" => $crtParam->{'dim1-sum-type'}, | |
1797 | + "dim1-min-value" => $crtParam->{'dim1-min-value'}, | |
1798 | + "dim1-max-value" => $crtParam->{'dim1-max-value'}, | |
1799 | + "dim1-min-index" => $crtParam->{'dim1-min-index'}, | |
1800 | + "dim1-max-index" => $crtParam->{'dim1-max-index'}, | |
1801 | + | |
1802 | + "dim2-index" => $crtParam->{'dim2-index'}, | |
1803 | + "dim2-sum-type" => $crtParam->{'dim2-sum-type'}, | |
1804 | + "dim2-min-value" => $crtParam->{'dim2-min-value'}, | |
1805 | + "dim2-max-value" => $crtParam->{'dim2-max-value'}, | |
1806 | + "dim2-min-index" => $crtParam->{'dim2-min-index'}, | |
1807 | + "dim2-max-index" => $crtParam->{'dim2-max-index'}, | |
1808 | + | |
1809 | + "type" => $crtParam->{'type'} | |
1908 | 1810 | |
1909 | 1811 | ); |
1910 | - $instantPanel->{"params"}[] = $instantParam; | |
1812 | + $instantPanel->{"params"}[] = $instantParam; | |
1813 | + | |
1911 | 1814 | |
1912 | - | |
1913 | 1815 | $instantPlotInput->{"panels"}[] = $instantPanel; |
1914 | - | |
1915 | - | |
1816 | + | |
1817 | + | |
1916 | 1818 | return $instantPlotInput; |
1917 | 1819 | } |
1918 | 1820 | } |
1919 | -?> | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotParamsNodeClass.php
... | ... | @@ -4,48 +4,59 @@ require_once("RequestOutputPlotYSerieNodeClass.php"); |
4 | 4 | require_once "RequestOutputPlotOrbitSerieNodeClass.php"; |
5 | 5 | require_once "RequestOutputPlotInstantSerieNodeClass.php"; |
6 | 6 | |
7 | -define ("REQUESTOUTPUTPLOTPARAMS_NAME", "params"); | |
7 | +define("REQUESTOUTPUTPLOTPARAMS_NAME", "params"); | |
8 | 8 | |
9 | -define ("REQUESTOUTPUTPLOTPARAM_NAME", "param"); | |
10 | -define ("REQUESTOUTPUTPLOTPARAM_ID", "id"); | |
9 | +define("REQUESTOUTPUTPLOTPARAM_NAME", "param"); | |
10 | +define("REQUESTOUTPUTPLOTPARAM_ID", "id"); | |
11 | 11 | |
12 | -define ("REQUESTOUTPUTPLOTXSERIE_NAME", "xserie"); | |
13 | -define ("REQUESTOUTPUTPLOTXSERIE_XAXIS", "xAxis"); | |
14 | -define ("REQUESTOUTPUTPLOTXSERIE_INDEX", "index"); | |
15 | -define ("REQUESTOUTPUTPLOTXSERIE_ID", "id"); | |
16 | -define ("REQUESTOUTPUTPLOTXSERIE_MIN", "min"); | |
17 | -define ("REQUESTOUTPUTPLOTXSERIE_MAX", "max"); | |
12 | +define("REQUESTOUTPUTPLOTXSERIE_NAME", "xserie"); | |
13 | +define("REQUESTOUTPUTPLOTXSERIE_XAXIS", "xAxis"); | |
14 | +define("REQUESTOUTPUTPLOTXSERIE_INDEX", "index"); | |
15 | +define("REQUESTOUTPUTPLOTXSERIE_ID", "id"); | |
16 | +define("REQUESTOUTPUTPLOTXSERIE_MIN", "min"); | |
17 | +define("REQUESTOUTPUTPLOTXSERIE_MAX", "max"); | |
18 | 18 | |
19 | -define ("REQUESTOUTPUTPLOTCOLORSERIE_NAME", "colorserie"); | |
20 | -define ("REQUESTOUTPUTPLOTCOLORSERIE_ID", "id"); | |
21 | -define ("REQUESTOUTPUTPLOTCOLORSERIE_INDEX", "index"); | |
19 | +define("REQUESTOUTPUTPLOTCOLORSERIE_NAME", "colorserie"); | |
20 | +define("REQUESTOUTPUTPLOTCOLORSERIE_ID", "id"); | |
21 | +define("REQUESTOUTPUTPLOTCOLORSERIE_INDEX", "index"); | |
22 | 22 | |
23 | -define ("REQUESTOUTPUTPLOTSPECTRO_NAME", "spectro"); | |
24 | -define ("REQUESTOUTPUTPLOTSPECTRO_YAXIS", "yAxis"); | |
25 | -define ("REQUESTOUTPUTPLOTSPECTRO_INDEX", "index"); | |
26 | -define ("REQUESTOUTPUTPLOTSPECTRO_MIN", "min"); | |
27 | -define ("REQUESTOUTPUTPLOTSPECTRO_MAX", "max"); | |
28 | -define ("REQUESTOUTPUTPLOTSPECTRO_USELOG0ASMIN", "uselog0asmin"); | |
29 | -define ("REQUESTOUTPUTPLOTSPECTRO_NORMALISATION", "normalization"); | |
30 | -define ("REQUESTOUTPUTPLOTSPECTRO_RESOLUTION", "resolution"); | |
23 | +define("REQUESTOUTPUTPLOTSPECTRO_NAME", "spectro"); | |
24 | +define("REQUESTOUTPUTPLOTSPECTRO_YAXIS", "yAxis"); | |
25 | +define("REQUESTOUTPUTPLOTSPECTRO_INDEX", "index"); | |
26 | +define("REQUESTOUTPUTPLOTSPECTRO_MIN", "min"); | |
27 | +define("REQUESTOUTPUTPLOTSPECTRO_MAX", "max"); | |
28 | +define("REQUESTOUTPUTPLOTSPECTRO_USELOG0ASMIN", "uselog0asmin"); | |
29 | +define("REQUESTOUTPUTPLOTSPECTRO_NORMALISATION", "normalization"); | |
31 | 30 | |
32 | -define ("REQUESTOUTPUTPLOTINSTANTSPECTRO_NAME", "ispectro"); | |
33 | -define ("REQUESTOUTPUTPLOTINSTANTSPECTRO_XAXIS", "xAxis"); | |
34 | -define ("REQUESTOUTPUTPLOTINSTANTSPECTRO_DIMONXAXIS", "dimOnXAxis"); | |
31 | +/** | |
32 | + * Here, we define constants about background substracion | |
33 | + */ | |
34 | +define("REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE", "background_sub_type"); | |
35 | +define("REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE_NONE", "None"); | |
36 | +define("REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE", "background_sub_value"); | |
37 | +define("REQUESTOUTPUTPLOTSPECTRO_BGS_DIM", "background_sub_dim"); | |
38 | +define("REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE_NONE", "None"); | |
39 | + | |
40 | +### | |
41 | +define("REQUESTOUTPUTPLOTSPECTRO_RESOLUTION", "resolution"); | |
35 | 42 | |
36 | -define ("REQUESTOUTPUTPLOTSTATUSBAR_NAME", "serie"); | |
37 | -define ("REQUESTOUTPUTPLOTSTATUSBAR_INDEX", "index"); | |
43 | +define("REQUESTOUTPUTPLOTINSTANTSPECTRO_NAME", "ispectro"); | |
44 | +define("REQUESTOUTPUTPLOTINSTANTSPECTRO_XAXIS", "xAxis"); | |
45 | +define("REQUESTOUTPUTPLOTINSTANTSPECTRO_DIMONXAXIS", "dimOnXAxis"); | |
38 | 46 | |
39 | -define ("REQUESTOUTPUTPLOTTICKBAR_NAME", "serie"); | |
40 | -define ("REQUESTOUTPUTPLOTTICKBAR_INDEX", "index"); | |
47 | +define("REQUESTOUTPUTPLOTSTATUSBAR_NAME", "serie"); | |
48 | +define("REQUESTOUTPUTPLOTSTATUSBAR_INDEX", "index"); | |
41 | 49 | |
42 | -define ("REQUESTOUTPUTPLOTINTERVALS_NAME", "intervals"); | |
50 | +define("REQUESTOUTPUTPLOTTICKBAR_NAME", "serie"); | |
51 | +define("REQUESTOUTPUTPLOTTICKBAR_INDEX", "index"); | |
52 | + | |
53 | +define("REQUESTOUTPUTPLOTINTERVALS_NAME", "intervals"); | |
43 | 54 | |
44 | 55 | /** |
45 | 56 | * @class RequestOutputPlotParamNodeClass |
46 | 57 | * @brief Definition of a param for a plot of a plot request |
47 | 58 | * @details |
48 | -*/ | |
59 | + */ | |
49 | 60 | class RequestOutputPlotParamNodeClass extends NodeClass |
50 | 61 | { |
51 | 62 | public function __construct($id) |
... | ... | @@ -58,21 +69,19 @@ class RequestOutputPlotParamNodeClass extends NodeClass |
58 | 69 | { |
59 | 70 | return $this->getAttribute(REQUESTOUTPUTPLOTPARAM_ID); |
60 | 71 | } |
61 | - | |
72 | + | |
62 | 73 | public function setId($id) |
63 | 74 | { |
64 | - $this->setAttribute(REQUESTOUTPUTPLOTPARAM_ID,$id); | |
75 | + $this->setAttribute(REQUESTOUTPUTPLOTPARAM_ID, $id); | |
65 | 76 | } |
66 | 77 | |
67 | 78 | public function addYSerie($yAxis, $index, $xId = -1, $colorSerieId = -1, $min = NULL, $max = NULL) |
68 | 79 | { |
69 | - if ($xId != -1) | |
70 | - { | |
80 | + if ($xId != -1) { | |
71 | 81 | $ySerieNode = new RequestOutputPlotYSerieNodeClass(REQUESTOUTPUTPLOTYSERIE_XYPLOT_NAME); |
72 | 82 | $ySerieNode->setXId($xId); |
73 | 83 | $ySerieNode->setXAxisId(REQUESTOUTPUTPLOTELEMENTXY_XAXISID); |
74 | - } | |
75 | - else | |
84 | + } else | |
76 | 85 | $ySerieNode = new RequestOutputPlotYSerieNodeClass(REQUESTOUTPUTPLOTYSERIE_TIMEPLOT_NAME); |
77 | 86 | $ySerieNode->setYAxisId($yAxis); |
78 | 87 | if (isset($min)) |
... | ... | @@ -86,7 +95,7 @@ class RequestOutputPlotParamNodeClass extends NodeClass |
86 | 95 | $this->addChild($ySerieNode); |
87 | 96 | return $ySerieNode; |
88 | 97 | } |
89 | - | |
98 | + | |
90 | 99 | public function addOrbitSerie($yAxis, $colorSerieId = -1) |
91 | 100 | { |
92 | 101 | $orbitSerieNode = new RequestOutputPlotOrbitSerieNodeClass(); |
... | ... | @@ -97,7 +106,7 @@ class RequestOutputPlotParamNodeClass extends NodeClass |
97 | 106 | $this->addChild($orbitSerieNode); |
98 | 107 | return $orbitSerieNode; |
99 | 108 | } |
100 | - | |
109 | + | |
101 | 110 | public function addInstantSerie($yAxis) |
102 | 111 | { |
103 | 112 | $iserieNode = new RequestOutputPlotInstantSerieNodeClass(); |
... | ... | @@ -106,9 +115,19 @@ class RequestOutputPlotParamNodeClass extends NodeClass |
106 | 115 | $this->addChild($iserieNode); |
107 | 116 | return $iserieNode; |
108 | 117 | } |
109 | - | |
110 | - public function addSpectro($yAxis = "", $resolution="", $index = NULL, $min = NULL, $max = NULL, $uselog0asmin = FALSE, $normalization = NULL) | |
111 | - { | |
118 | + | |
119 | + public function addSpectro( | |
120 | + $yAxis = "", | |
121 | + $resolution = "", | |
122 | + $index = NULL, | |
123 | + $min = NULL, | |
124 | + $max = NULL, | |
125 | + $uselog0asmin = FALSE, | |
126 | + $normalization = NULL, | |
127 | + $bgs_type = NULL, | |
128 | + $bgs_value = NULL, | |
129 | + $bgs_dim = NULL | |
130 | + ) { | |
112 | 131 | $spectroNode = new NodeClass(REQUESTOUTPUTPLOTSPECTRO_NAME); |
113 | 132 | $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_YAXIS, $yAxis); |
114 | 133 | $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_USELOG0ASMIN, $uselog0asmin ? "true" : "false"); |
... | ... | @@ -116,6 +135,12 @@ class RequestOutputPlotParamNodeClass extends NodeClass |
116 | 135 | $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_RESOLUTION, $resolution); |
117 | 136 | if (isset($normalization)) |
118 | 137 | $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_NORMALISATION, $normalization); |
138 | + if (isset($bgs_type)) | |
139 | + $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_BGS_TYPE, $bgs_type); | |
140 | + if (isset($bgs_value)) | |
141 | + $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_BGS_VALUE, $bgs_value); | |
142 | + if (isset($bgs_dim)) | |
143 | + $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_BGS_DIM, $bgs_dim); | |
119 | 144 | if (isset($index)) |
120 | 145 | $spectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_INDEX, $index); |
121 | 146 | if (isset($min)) |
... | ... | @@ -125,14 +150,14 @@ class RequestOutputPlotParamNodeClass extends NodeClass |
125 | 150 | $this->addChild($spectroNode); |
126 | 151 | return $spectroNode; |
127 | 152 | } |
128 | - | |
153 | + | |
129 | 154 | public function addInstantSpectro($yAxis, $dimOnXAxis, $index = NULL, $min = NULL, $max = NULL) |
130 | 155 | { |
131 | 156 | $ispectroNode = new NodeClass(REQUESTOUTPUTPLOTINSTANTSPECTRO_NAME); |
132 | 157 | $ispectroNode->setAttribute(REQUESTOUTPUTPLOTINSTANTSPECTRO_XAXIS, REQUESTOUTPUTPLOTELEMENTXY_XAXISID); |
133 | 158 | $ispectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_YAXIS, $yAxis); |
134 | 159 | $ispectroNode->setAttribute(REQUESTOUTPUTPLOTINSTANTSPECTRO_DIMONXAXIS, $dimOnXAxis); |
135 | - | |
160 | + | |
136 | 161 | if (isset($min)) |
137 | 162 | $ispectroNode->setAttribute(REQUESTOUTPUTPLOTSPECTRO_MIN, $min); |
138 | 163 | if (isset($max)) |
... | ... | @@ -154,7 +179,7 @@ class RequestOutputPlotParamNodeClass extends NodeClass |
154 | 179 | $this->addChild($xSerieNode); |
155 | 180 | return $xSerieNode; |
156 | 181 | } |
157 | - | |
182 | + | |
158 | 183 | public function addColorSerie($id = "", $index = -1) |
159 | 184 | { |
160 | 185 | $colorSerieNode = new NodeClass(REQUESTOUTPUTPLOTCOLORSERIE_NAME); |
... | ... | @@ -164,7 +189,7 @@ class RequestOutputPlotParamNodeClass extends NodeClass |
164 | 189 | $this->addChild($colorSerieNode); |
165 | 190 | return $colorSerieNode; |
166 | 191 | } |
167 | - | |
192 | + | |
168 | 193 | public function addStatusBar($index) |
169 | 194 | { |
170 | 195 | $statusBarNode = new NodeClass(REQUESTOUTPUTPLOTSTATUSBAR_NAME); |
... | ... | @@ -173,7 +198,7 @@ class RequestOutputPlotParamNodeClass extends NodeClass |
173 | 198 | $this->addChild($statusBarNode); |
174 | 199 | return $statusBarNode; |
175 | 200 | } |
176 | - | |
201 | + | |
177 | 202 | public function addTickBar($index) |
178 | 203 | { |
179 | 204 | $tickBarNode = new NodeClass(REQUESTOUTPUTPLOTTICKBAR_NAME); |
... | ... | @@ -189,27 +214,27 @@ class RequestOutputPlotParamNodeClass extends NodeClass |
189 | 214 | $this->addChild($intervalsNode); |
190 | 215 | return $intervalsNode; |
191 | 216 | } |
192 | - | |
217 | + | |
193 | 218 | public function loadFromNode($xmlNode) |
194 | 219 | { |
195 | 220 | $this->setId($this->getXmlNodeAttribute($xmlNode, REQUESTOUTPUTPLOTPARAM_ID)); |
196 | - | |
221 | + | |
197 | 222 | foreach ($this->getXmlNodeChildren($xmlNode) as $plottypeXmlNode) { |
198 | 223 | $node = NULL; |
199 | 224 | switch ($this->getXmlNodeName($plottypeXmlNode)) { |
200 | - case REQUESTOUTPUTPLOTYSERIE_XYPLOT_NAME : | |
225 | + case REQUESTOUTPUTPLOTYSERIE_XYPLOT_NAME: | |
201 | 226 | $node = new RequestOutputPlotYSerieNodeClass(REQUESTOUTPUTPLOTYSERIE_XYPLOT_NAME); |
202 | 227 | break; |
203 | - case REQUESTOUTPUTPLOTYSERIE_TIMEPLOT_NAME : | |
228 | + case REQUESTOUTPUTPLOTYSERIE_TIMEPLOT_NAME: | |
204 | 229 | $node = new RequestOutputPlotYSerieNodeClass(REQUESTOUTPUTPLOTYSERIE_TIMEPLOT_NAME); |
205 | 230 | break; |
206 | - case REQUESTOUTPUTPLOTORBITSERIE_NAME : | |
231 | + case REQUESTOUTPUTPLOTORBITSERIE_NAME: | |
207 | 232 | $node = new RequestOutputPlotOrbitSerieNodeClass(); |
208 | 233 | break; |
209 | - case REQUESTOUTPUTPLOTINSTANTSERIE_NAME : | |
234 | + case REQUESTOUTPUTPLOTINSTANTSERIE_NAME: | |
210 | 235 | $node = new RequestOutputPlotInstantSerieNodeClass(); |
211 | 236 | break; |
212 | - case REQUESTOUTPUTPLOTSPECTRO_NAME : | |
237 | + case REQUESTOUTPUTPLOTSPECTRO_NAME: | |
213 | 238 | $yAxis = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_YAXIS); |
214 | 239 | $index = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_INDEX); |
215 | 240 | $min = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_MIN); |
... | ... | @@ -218,7 +243,7 @@ class RequestOutputPlotParamNodeClass extends NodeClass |
218 | 243 | $uselog0asmin = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSPECTRO_USELOG0ASMIN) == "true"; |
219 | 244 | $node = $this->addSpectro($yAxis, $resolution, $index, $min, $max, $uselog0asmin); |
220 | 245 | break; |
221 | - case REQUESTOUTPUTPLOTXSERIE_NAME : | |
246 | + case REQUESTOUTPUTPLOTXSERIE_NAME: | |
222 | 247 | $xAxis = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTXSERIE_XAXIS); |
223 | 248 | $index = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTXSERIE_INDEX); |
224 | 249 | if (empty($index)) |
... | ... | @@ -230,29 +255,28 @@ class RequestOutputPlotParamNodeClass extends NodeClass |
230 | 255 | $max = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTXSERIE_MAX); |
231 | 256 | $node = $this->addXSerie($index, $xId, $min, $max); |
232 | 257 | break; |
233 | - case REQUESTOUTPUTPLOTCOLORSERIE_NAME : | |
258 | + case REQUESTOUTPUTPLOTCOLORSERIE_NAME: | |
234 | 259 | $id = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTCOLORSERIE_ID); |
235 | 260 | $index = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTCOLORSERIE_INDEX); |
236 | 261 | if (empty($index)) |
237 | 262 | $index = -1; |
238 | 263 | $node = $this->addColorSerie($id, $index); |
239 | 264 | break; |
240 | - case REQUESTOUTPUTPLOTSTATUSBAR_NAME : | |
265 | + case REQUESTOUTPUTPLOTSTATUSBAR_NAME: | |
241 | 266 | $index = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTSTATUSBAR_INDEX); |
242 | 267 | if (empty($index)) |
243 | 268 | $index = -1; |
244 | 269 | $node = $this->addStatusBar($index); |
245 | 270 | break; |
246 | - case REQUESTOUTPUTPLOTTICKBAR_NAME : | |
271 | + case REQUESTOUTPUTPLOTTICKBAR_NAME: | |
247 | 272 | $index = $this->getXmlNodeAttribute($plottypeXmlNode, REQUESTOUTPUTPLOTTICKBAR_INDEX); |
248 | 273 | if (empty($index)) |
249 | 274 | $index = -1; |
250 | 275 | $node = $this->addTickBar($index); |
251 | 276 | break; |
252 | 277 | default: |
253 | - | |
254 | 278 | } |
255 | - | |
279 | + | |
256 | 280 | if (isset($node)) { |
257 | 281 | $node->loadFromNode($plottypeXmlNode); |
258 | 282 | $this->addChild($node); |
... | ... | @@ -277,14 +301,14 @@ class RequestOutputPlotParamsNodeClass extends NodeClass |
277 | 301 | { |
278 | 302 | $paramNodes = $this->getChildrenByName(REQUESTOUTPUTPLOTPARAM_NAME); |
279 | 303 | foreach ($paramNodes as $paramNode) |
280 | - if ($paramNode->getId() == $id) | |
281 | - return $paramNode; | |
304 | + if ($paramNode->getId() == $id) | |
305 | + return $paramNode; | |
282 | 306 | //create new param |
283 | 307 | $paramNode = new RequestOutputPlotParamNodeClass($id); |
284 | 308 | $this->addChild($paramNode); |
285 | 309 | return $paramNode; |
286 | 310 | } |
287 | - | |
311 | + | |
288 | 312 | public function loadFromNode($xmlNode) |
289 | 313 | { |
290 | 314 | foreach ($this->getXmlNodeChildrenByTagName($xmlNode, REQUESTOUTPUTPLOTPARAM_NAME) as $paramXmlNode) { |
... | ... | @@ -292,5 +316,3 @@ class RequestOutputPlotParamsNodeClass extends NodeClass |
292 | 316 | } |
293 | 317 | } |
294 | 318 | } |
295 | - | |
296 | -?> | ... | ... |