Commit c0535e834f9229275e4b7a0d3f02bfc7d35fd9b8
1 parent
97a69b20
Exists in
master
and in
65 other branches
Use units and yTitle definition for a derived parameter (#5672)
Showing
4 changed files
with
35 additions
and
8 deletions
Show diff stats
src/InputOutput/IHMImpl/Params/DataMiningImpl/IHMInputOutputParamsDataMiningClass.php
... | ... | @@ -38,7 +38,7 @@ class IHMInputOutputParamsDataMiningClass extends IHMInputOutputParamsAbstractCl |
38 | 38 | //create a derived param for the expression |
39 | 39 | $this->paramManager->addProcessParam($paramId, $expressionInfo["expression"], $input->expression, |
40 | 40 | $expressionInfo['params'], $input->sampling, |
41 | - $input->gap,time(),$this->paramsData); | |
41 | + $input->gap,time(),"","",$this->paramsData); | |
42 | 42 | |
43 | 43 | //add derived param to output |
44 | 44 | $paramsNode->addParam($paramId); | ... | ... |
src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php
... | ... | @@ -39,9 +39,9 @@ class IHMParamManagerClass |
39 | 39 | /* |
40 | 40 | * @brief Add a process parameter |
41 | 41 | */ |
42 | - public function addProcessParam($paramId,$expression,$expression_info,$params,$sampling,$gap,$dateModif,$paramsData) | |
43 | - { | |
44 | - $paramsData->addProcessParamToCreate($paramId, $expression, $expression_info, $params, $sampling, $gap,$dateModif); | |
42 | + public function addProcessParam($paramId,$expression,$expression_info,$params,$sampling,$gap,$dateModif,$units,$ytitle,$paramsData) | |
43 | + { | |
44 | + $paramsData->addProcessParamToCreate($paramId, $expression, $expression_info, $params, $sampling, $gap,$dateModif, $units, $ytitle); | |
45 | 45 | |
46 | 46 | foreach ($params as $param) { |
47 | 47 | $template_args = NULL; |
... | ... | @@ -202,7 +202,8 @@ class IHMParamManagerClass |
202 | 202 | //create a process param for the derived parameter |
203 | 203 | $this->addProcessParam($paramId, $expressionInfo["expression"], $res["param"]["expression"], |
204 | 204 | $expressionInfo['params'], $res["param"]["timestep"], |
205 | - 0,$res["param"]["dateModif"],$paramsData); | |
205 | + 0,$res["param"]["dateModif"],!empty($res["param"]["info"]["units"]) ? $res["param"]["info"]["units"] : "", | |
206 | + !empty($res["param"]["info"]["yTitle"]) ? $res["param"]["info"]["yTitle"] : "", $paramsData); | |
206 | 207 | |
207 | 208 | return array("id" => $paramId, "indexes" => array(), "calib_infos" => array()); |
208 | 209 | } | ... | ... |
src/InputOutput/IHMImpl/Tools/IHMUserParamLoaderClass.php
... | ... | @@ -19,7 +19,10 @@ class IHMUserParamLoaderClass |
19 | 19 | |
20 | 20 | //additional info for derived parameter |
21 | 21 | private static $infoDerivedUnitsNode = 'units'; |
22 | + private static $infoDerivedYTitleNode = 'ytitle'; | |
22 | 23 | private static $infoDerivedDescriptionNode = 'description'; |
24 | + | |
25 | + private static $infoDerivedUndefined = 'undefined'; | |
23 | 26 | |
24 | 27 | //uploaded parameters in manager file |
25 | 28 | private static $mgrUploadedNode = 'mydataList'; |
... | ... | @@ -255,6 +258,7 @@ class IHMUserParamLoaderClass |
255 | 258 | |
256 | 259 | $result = array( |
257 | 260 | "units" => "", |
261 | + "yTitle" => "", | |
258 | 262 | "description" => "" |
259 | 263 | ); |
260 | 264 | |
... | ... | @@ -268,8 +272,21 @@ class IHMUserParamLoaderClass |
268 | 272 | |
269 | 273 | //get parameter units |
270 | 274 | $unitsNodes = $dom->getElementsByTagName(self::$infoDerivedUnitsNode); |
271 | - if (count($unitsNodes) > 0) | |
275 | + if (count($unitsNodes) > 0) { | |
272 | 276 | $result["units"] = $unitsNodes->item(0)->nodeValue; |
277 | + if ($result["units"] == self::$infoDerivedUndefined) { | |
278 | + $result["units"] = ""; | |
279 | + } | |
280 | + } | |
281 | + | |
282 | + //get parameter y title | |
283 | + $yTitleNodes = $dom->getElementsByTagName(self::$infoDerivedYTitleNode); | |
284 | + if (count($yTitleNodes) > 0) { | |
285 | + $result["yTitle"] = $yTitleNodes->item(0)->nodeValue; | |
286 | + if ($result["yTitle"] == self::$infoDerivedUndefined) { | |
287 | + $result["yTitle"] = ""; | |
288 | + } | |
289 | + } | |
273 | 290 | |
274 | 291 | //get parameter description |
275 | 292 | $descNodes = $dom->getElementsByTagName(self::$infoDerivedDescriptionNode); |
... | ... | @@ -361,4 +378,4 @@ class IHMUserParamLoaderClass |
361 | 378 | |
362 | 379 | return $result; |
363 | 380 | } |
364 | -} | |
365 | 381 | \ No newline at end of file |
382 | +} | ... | ... |
src/Request/ParamsRequestImpl/ParamsRequestDataClass.php
... | ... | @@ -117,10 +117,19 @@ class ParamsRequestDataClass extends ProcessRequestDataClass |
117 | 117 | return $this->processParamsToCreate; |
118 | 118 | } |
119 | 119 | |
120 | - public function addProcessParamToCreate($paramId, $expression, $expression_info, $getParams, $sampling, $gap, $dateModif) | |
120 | + public function addProcessParamToCreate($paramId, $expression, $expression_info, $getParams, $sampling, $gap, $dateModif, $units, $ytitle) | |
121 | 121 | { |
122 | 122 | $newParam = new ParamNodeClass(); |
123 | 123 | $newParam->setId($paramId); |
124 | + if (!empty($units)) { | |
125 | + $newParam->getInfo()->setUnits($units); | |
126 | + } | |
127 | + if (!empty($ytitle)) { | |
128 | + $newParam->getInfo()->setShortName($ytitle); | |
129 | + } | |
130 | + else { | |
131 | + $newParam->getInfo()->setShortName($paramId); | |
132 | + } | |
124 | 133 | $newParam->setSampling($sampling); |
125 | 134 | if (isset($gap) && ($gap > 0)) |
126 | 135 | $newParam->setGap($gap); | ... | ... |