Commit 8c57155bd2b0c3410120217f6b66d2319cce5cfc
1 parent
1815c314
Exists in
master
and in
66 other branches
Integration for the first implementation of the new plot IHM
Add options for page (font, title, margins)
Showing
17 changed files
with
564 additions
and
319 deletions
Show diff stats
src/InputOutput/IHMImpl/IHMInputOutputClass.php
... | ... | @@ -43,10 +43,12 @@ class IHMInputOutputClass implements InputOutputInterface |
43 | 43 | break; |
44 | 44 | case 'request' : |
45 | 45 | //plot |
46 | + if (($input->{"file-format"} == "PNG") && ($input->{"file-output"} == "INTERACTIVE")) | |
47 | + { | |
48 | + //set working dir for interactive plot | |
49 | + $requestId = "Plot"; | |
50 | + } | |
46 | 51 | $this->inputOutput = new IHMInputOutputParamsPlotClass(); |
47 | - //set working dir for interactive plot | |
48 | - if (($input->format == "PNG") && ($input->tabId != "")) | |
49 | - $requestId = "Plot".$input->tabId; | |
50 | 52 | break; |
51 | 53 | default : |
52 | 54 | throw new Exception('Params request type '.$input_request->nodeType.' not implemented for this client.'); | ... | ... |
src/InputOutput/IHMImpl/Params/DataMiningImpl/IHMInputOutputParamsDataMiningClass.php
... | ... | @@ -17,13 +17,14 @@ class IHMInputOutputParamsDataMiningClass extends IHMInputOutputParamsAbstractCl |
17 | 17 | /* '{"id":"cond_2","name":"us44_test1","sampling":600,"gap":5,"description":"","expression":"dst>0","timesrc":"Interval","startDate":"2008-01-31T00:00:00","stopDate":"2008-02-01T00:00:00","durationDay":"0001","durationHour":"00","durationMin":"00","durationSec":"00","leaf":true,"nodeType":"condition"}' |
18 | 18 | */ |
19 | 19 | |
20 | - $paramsNode = $this->paramsData->getRequestNode()->getParamsNode(); | |
20 | + $requestNode = $this->paramsData->addRequestNode(); | |
21 | + $paramsNode = $requestNode->getParamsNode(); | |
21 | 22 | |
22 | 23 | //unmarshall time definition |
23 | - $this->unmarshallTimeDefinition($input); | |
24 | + $this->unmarshallTimeDefinition($input, 0); | |
24 | 25 | |
25 | 26 | //unmarshall data mining output definition |
26 | - $outputsNode = $this->paramsData->getRequestNode()->getOutputsNode(); | |
27 | + $outputsNode = $requestNode->getOutputsNode(); | |
27 | 28 | $dataMiningNode = $outputsNode->addNewOutput(RequestOutputTypeEnum::DATAMINING); |
28 | 29 | |
29 | 30 | $dataMiningNode->setTimeFormat(RequestOutputDataMiningTimeFormatEnum::ISO); | ... | ... |
src/InputOutput/IHMImpl/Params/DownloadImpl/IHMInputOutputParamsDownloadClass.php
... | ... | @@ -18,13 +18,15 @@ class IHMInputOutputParamsDownloadClass extends IHMInputOutputParamsAbstractClas |
18 | 18 | // "header":"0","timesrc":"TimeTable","timeTables":[{"timeTableName":"rzerzer","id":"tt_1"},{"timeTableName":"sqsdq","id":"tt_0"}], |
19 | 19 | //"list":["dst"],"milli":false,"fileformat":"ASCII","timeformat":"YYYY-MM-DDThh:mm:ss","compression":"tar+gzip","leaf":true} |
20 | 20 | |
21 | - $paramsNode = $this->paramsData->getRequestNode()->getParamsNode(); | |
21 | + $requestNode = $this->paramsData->addRequestNode(); | |
22 | + | |
23 | + $paramsNode = $requestNode->getParamsNode(); | |
22 | 24 | |
23 | 25 | //unmarshall time definition |
24 | - $this->unmarshallTimeDefinition($input); | |
26 | + $this->unmarshallTimeDefinition($input, 0); | |
25 | 27 | |
26 | 28 | //unmarshall download output definition |
27 | - $outputsNode = $this->paramsData->getRequestNode()->getOutputsNode(); | |
29 | + $outputsNode = $requestNode->getOutputsNode(); | |
28 | 30 | $downloadNode = $outputsNode->addNewOutput(RequestOutputTypeEnum::DOWNLOAD); |
29 | 31 | |
30 | 32 | //timeformatData : [['Y-m-dTH:i:s', 'YYYY-MM-DDThh:mm:ss'], ['DD Time', 'DD Time'], ['Timestamp', 'Timestamp']], | ... | ... |
src/InputOutput/IHMImpl/Params/IHMInputOutputParamsAbstractClass.php
... | ... | @@ -52,9 +52,9 @@ abstract class IHMInputOutputParamsAbstractClass implements InputOutputInterface |
52 | 52 | /* |
53 | 53 | * @brief Unmarshall the time definition from the IHM request |
54 | 54 | */ |
55 | - protected function unmarshallTimeDefinition($input) | |
55 | + protected function unmarshallTimeDefinition($input, $requestIndex) | |
56 | 56 | { |
57 | - $timesNode = $this->paramsData->getRequestNode()->getTimesNode(); | |
57 | + $timesNode = $this->paramsData->getRequestNodes()[$requestIndex]->getTimesNode(); | |
58 | 58 | |
59 | 59 | switch ($input->timesrc) |
60 | 60 | { | ... | ... |
src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
... | ... | @@ -9,298 +9,210 @@ define ("PLOT_RESULT_FILE_KEY","plot"); |
9 | 9 | */ |
10 | 10 | class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
11 | 11 | { |
12 | - private $currentTabId; | |
13 | - private $isInterractive; | |
14 | - private $startTime; | |
15 | - private $stopTime; | |
16 | - | |
17 | 12 | /* |
18 | 13 | * @brief method to unmarshall a plot request |
19 | 14 | */ |
20 | 15 | protected function unmarshallRequest($input) |
21 | 16 | { |
22 | - if (isset($input->action)) | |
17 | + //save request | |
18 | + $this->saveIHMRequest($input); | |
19 | + | |
20 | + //Request | |
21 | + $requestIndex = 0; | |
22 | + foreach ($input->tabs as $tab) | |
23 | 23 | { |
24 | - //interactive action | |
25 | - $realInput = $input; | |
26 | - $input = $this->loadIHMRequest(); | |
24 | + $requestNode = $this->paramsData->addRequestNode(); | |
25 | + $outputsNode = $requestNode->getOutputsNode(); | |
27 | 26 | |
28 | - if (!isset($input)) | |
29 | - throw new Exception('Cannot get original request data for interactive action.'); | |
27 | + //unmarshall time definition | |
28 | + $this->unmarshallTimeDefinition($input, $requestIndex); | |
30 | 29 | |
31 | - //modify request | |
32 | - date_default_timezone_set('UTC'); | |
33 | - $intervalMove = 0.; | |
34 | - switch ($realInput->action->name) | |
30 | + $plotOutputNode = $outputsNode->addNewOutput(RequestOutputTypeEnum::PLOT); | |
31 | + | |
32 | + switch ($input->{'file-output'}) | |
35 | 33 | { |
36 | - case 'next' : | |
37 | - $intervalMove = strtotime($input->stopDate) - strtotime($input->startDate); | |
34 | + case 'TGZ' : | |
35 | + $plotOutputNode->addPostProcessing(RequestOutputPostProcessingEnumClass::TAR); | |
36 | + $plotOutputNode->addPostProcessing(RequestOutputPostProcessingEnumClass::GZIP); | |
37 | + break; | |
38 | + case 'ZIP' : | |
39 | + $plotOutputNode->addPostProcessing(RequestOutputPostProcessingEnumClass::ZIP); | |
38 | 40 | break; |
39 | - case 'halfnext' : | |
40 | - $intervalMove = (strtotime($input->stopDate) - strtotime($input->startDate))/2; | |
41 | + } | |
42 | + | |
43 | + if ($input->{'one-file-per-interval'}) | |
44 | + $plotOutputNode->setStructure(RequestOutputPlotStructureEnum::ONE_FILE_PER_INTERVAL); | |
45 | + else | |
46 | + $plotOutputNode->setStructure(RequestOutputPlotStructureEnum::ONE_FILE); | |
47 | + | |
48 | + //prefix | |
49 | + $filePrefix = ""; | |
50 | + if ($input->{'file-prefix'} == "") | |
51 | + $filePrefix = "plot"; | |
52 | + else | |
53 | + $filePrefix = $input->{'file-prefix'}; | |
54 | + $filePrefix .= $requestIndex; | |
55 | + | |
56 | + $plotOutputNode->setFilePrefix($filePrefix); | |
57 | + | |
58 | + //page | |
59 | + $pageNode = $plotOutputNode->getPage(); | |
60 | + | |
61 | + $fileFormat = RequestOutputPlotPageFormatEnum::PNG; | |
62 | + switch ($input->{'file-format'}) | |
63 | + { | |
64 | + case 'PNG' : | |
65 | + $fileFormat = RequestOutputPlotPageFormatEnum::PNG; | |
41 | 66 | break; |
42 | - case 'back' : | |
43 | - $intervalMove = strtotime($input->startDate) - strtotime($input->stopDate); | |
67 | + case 'PDF' : | |
68 | + $fileFormat = RequestOutputPlotPageFormatEnum::PDF; | |
44 | 69 | break; |
45 | - case 'halfback' : | |
46 | - $intervalMove = (strtotime($input->startDate) - strtotime($input->stopDate))/2; | |
70 | + case 'PS' : | |
71 | + $fileFormat = RequestOutputPlotPageFormatEnum::PS; | |
47 | 72 | break; |
73 | + case 'SVG' : | |
74 | + $fileFormat = RequestOutputPlotPageFormatEnum::SVG; | |
75 | + break; | |
76 | + default: | |
77 | + throw new Exception('File format not implemented.'); | |
48 | 78 | } |
49 | - //apply move | |
50 | - $input->startDate = date("Y-m-d\TH:i:s",strtotime($input->startDate)+$intervalMove); | |
51 | - $input->stopDate = date("Y-m-d\TH:i:s",strtotime($input->stopDate)+$intervalMove); | |
52 | - } | |
53 | - | |
54 | - //remove old result files | |
55 | - foreach (glob($this->getWorkingPath()."plot_*.png") as $oldfile) | |
56 | - { | |
57 | - unlink($oldfile); | |
58 | - } | |
59 | - | |
60 | - //Full plot request | |
61 | - $this->startTime = $input->startDate; | |
62 | - $this->stopTime = $input->stopDate; | |
63 | - | |
64 | - //save request | |
65 | - $this->saveIHMRequest($input); | |
66 | - | |
67 | - //TimePlot | |
68 | - //{"id":"","name":"","tabId":"1","outputName":"","orientation":"LANDSCAPE","format":"PNG","title":"", | |
69 | - //"description":"","charSize":1.3,"thickness":1,"ppp":3000,"forcedLayout":false,"forcedMulti":false, | |
70 | - //"children":[{"name":"Panel 1","leaf":false,"text":"","width":1,"height":0.4,"xTitle":"", | |
71 | - //"xRangeMin":0,"xRangeMax":0,"y1Title":"","y1RangeMin":0,"y1RangeMax":0,"y2Title":"", | |
72 | - //"y2RangeMin":0,"y2RangeMax":0,"plotType":"TIME", | |
73 | - //"children":[{"name":"imf","leaf":true,"text":"imf","paramArgs":"select...","isScatter":false, | |
74 | - //"needsArgs":false,"plotOnly":false,"yaxe":false}]}], | |
75 | - //"timesrc":"Interval","startDate":"2008-03-17T14:07:43","stopDate":"2008-03-17T15:26:18" | |
76 | - //"durationDay":"0000","durationHour":"01","durationMin":"18","durationSec":"35","leaf":true,"nodeType":"request"} | |
77 | - | |
78 | - | |
79 | - //XYPlot | |
80 | - //{"id":"","name":"","tabId":"1","outputName":"","orientation":"LANDSCAPE","format":"PNG","title":"", | |
81 | - //"description":"","charSize":1.3,"thickness":1,"ppp":3000,"forcedLayout":false,"forcedMulti":false, | |
82 | - //"children":[{"name":"Panel 1","leaf":false,"text":"","width":0.4,"height":0.4,"xTitle":"", | |
83 | - //"xRangeMin":0,"xRangeMax":0,"y1Title":"","y1RangeMin":0,"y1RangeMax":0,"y2Title":"", | |
84 | - //"y2RangeMin":0,"y2RangeMax":0,"plotType":"SCATTER", | |
85 | - //"scatterParam":{"phantom":true,"internalId":"ext-record-71","raw":{"name":"imf(1)"}, | |
86 | - //"data":{"id":"","name":"imf(1)"},"modified":{},"hasListeners":{},"events":{},"stores":[], | |
87 | - //"dirty":false,"id":"amdaModel.AmdaObject-ext-record-71"}, | |
88 | - //"children":[{"name":"#xmfi","leaf":true,"text":"#xmfi","paramArgs":"select...","isScatter":true, | |
89 | - //"needsArgs":false,"plotOnly":false,"yaxe":false}]}], | |
90 | - //"timesrc":"Interval","startDate":"2008-03-17T14:07:43","stopDate":"2008-03-17T15:26:18", | |
91 | - //"durationDay":"0000","durationHour":"01","durationMin":"18","durationSec":"35","leaf":true,"nodeType":"request"} | |
92 | - | |
93 | - $this->currentTabId = $input->tabId; | |
94 | - | |
95 | - $paramsNode = $this->paramsData->getRequestNode()->getParamsNode(); | |
96 | - | |
97 | - //unmarshall time definition | |
98 | - $this->unmarshallTimeDefinition($input); | |
99 | - | |
100 | - //unmarshall plot output definition | |
101 | - $outputsNode = $this->paramsData->getRequestNode()->getOutputsNode(); | |
102 | - $plotOutputNode = $outputsNode->addNewOutput(RequestOutputTypeEnum::PLOT); | |
103 | - | |
104 | - $pageNode = $plotOutputNode->getPage(); | |
105 | - | |
106 | - //title | |
107 | - $pageNode->setTitle($input->description); | |
108 | - | |
109 | - //orientation = [['landscape','LANDSCAPE'], ['portrait', 'PORTRAIT']]; | |
110 | - $forceRotation = false; | |
111 | - switch (strtolower($input->orientation)) | |
112 | - { | |
113 | - case 'landscape' : | |
114 | - $pageNode->setOrientation(RequestOutputPlotPageOrientationEnum::LANDSCAPE); | |
115 | - break; | |
116 | - case 'portrait' : | |
117 | - $pageNode->setOrientation(RequestOutputPlotPageOrientationEnum::PORTRAIT); | |
118 | - $forceRotation = true; | |
119 | - break; | |
120 | - default : | |
121 | - $pageNode->setOrientation(RequestOutputPlotPageOrientationEnum::LANDSCAPE); | |
122 | - break; | |
123 | - } | |
124 | - | |
125 | - //format = [['PNG','PNG'], ['PDF', 'PDF'], ['PS', 'PostScript']]; | |
126 | - switch ($input->format) | |
127 | - { | |
128 | - case 'PNG' : | |
129 | - $pageNode->setFormat(RequestOutputPlotPageFormatEnum::PNG); | |
130 | - //interactive plot => disable batch mode | |
131 | - $this->paramsData->setBatchEnable(false); | |
132 | - $this->isInterractive = true; | |
133 | - break; | |
134 | - case 'PDF' : | |
135 | - $pageNode->setFormat(RequestOutputPlotPageFormatEnum::PDF); | |
136 | - $this->isInterractive = false; | |
137 | - break; | |
138 | - case 'PS' : | |
139 | - case 'PostScript' : | |
140 | - $pageNode->setFormat(RequestOutputPlotPageFormatEnum::PS); | |
141 | - $this->isInterractive = false; | |
142 | - break; | |
143 | - } | |
144 | - | |
145 | - //auto layout | |
146 | - if (count($input->children) > 1) | |
147 | - { | |
148 | - if ($input->forcedLayout) | |
149 | - $pageNode->getLayout()->setType(RequestOutputPlotLayoutTypeEnum::AUTO); | |
150 | - else | |
151 | - $pageNode->getLayout()->setType(RequestOutputPlotLayoutTypeEnum::VERTICAL); | |
152 | - } | |
153 | 79 | |
154 | - $pageNode->getLayout()->setExpand("true"); | |
155 | - | |
156 | - //panels | |
157 | - | |
158 | - foreach ($input->children as $panel) | |
159 | - { | |
160 | - $panelNode = $pageNode->addPanel(); | |
161 | - $panelNode->setTitle($panel->name); | |
162 | - | |
163 | - //add plot element | |
164 | - switch ($panel->plotType) | |
80 | + $pageNode->setFormat($fileFormat); | |
81 | + | |
82 | + $this->unmarshallTitle($tab, 'page-title', $pageNode->getTitle()); | |
83 | + | |
84 | + switch ($tab->{'page-orientation'}) | |
165 | 85 | { |
166 | - case "TIME" : | |
167 | - //time plot definition | |
168 | - $plotElementNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::TIMEPLOT); | |
169 | - //time axis definition | |
170 | - $timeAxisNode = $plotElementNode->getTimeAxis(); | |
171 | - $isXYPlot = false; | |
86 | + case 'landscape' : | |
87 | + $pageNode->setOrientation(RequestOutputPlotPageOrientationEnum::LANDSCAPE); | |
172 | 88 | break; |
173 | - case "SCATTER" : | |
174 | - //XY plot definition | |
175 | - $plotElementNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::XYPLOT); | |
176 | - //x axis definition | |
177 | - $xAxisNode = $plotElementNode->getXAxis(); | |
178 | - $xAxisNode->getLegend()->setText($panel->xTitle); | |
179 | - if ((($panel->xRangeMin != 0) || ($panel->xRangeMax != 0)) && ($panel->xRangeMin < $panel->xRangeMax)) | |
180 | - $xAxisNode->getRange()->setMinMax($panel->xRangeMin, $panel->xRangeMax); | |
181 | - $isXYPlot = true; | |
89 | + case 'portrait' : | |
90 | + $pageNode->setOrientation(RequestOutputPlotPageOrientationEnum::PORTRAIT); | |
182 | 91 | break; |
183 | 92 | } |
184 | - | |
185 | - if (!isset($plotElementNode)) | |
186 | - //unknown plot type | |
187 | - continue; | |
188 | - | |
189 | - //y1 axis definition | |
190 | - $y1AxisNode = $plotElementNode->addYAxis("y1"); | |
191 | - $y1AxisNode->getLegend()->setText($panel->y1Title); | |
192 | - if ((($panel->y1RangeMin != 0) || ($panel->y1RangeMax != 0)) && ($panel->y1RangeMin < $panel->y1RangeMax)) | |
193 | - $y1AxisNode->getRange()->setMinMax($panel->y1RangeMin, $panel->y1RangeMax); | |
194 | - | |
195 | - //y2 axis definition - it will drawn only if at least one param is associated to this axis | |
196 | - $y2AxisNode = $plotElementNode->addYAxis("y2"); | |
197 | - $y2AxisNode->getLegend()->setText($panel->y2Title); | |
198 | - if ((($panel->y2RangeMin != 0) || ($panel->y2RangeMax != 0)) && ($panel->y2RangeMin < $panel->y2RangeMax)) | |
199 | - $y2AxisNode->getRange()->setMinMax($panel->y2RangeMin, $panel->y2RangeMax); | |
200 | - | |
201 | - //add xserie if XYPlot | |
202 | - if ($panel->plotType == "SCATTER") | |
203 | - { | |
204 | - //"scatterParam":{"phantom":true,"internalId":"ext-record-71","raw":{"name":"imf(1)"}, | |
205 | - //"data":{"id":"","name":"imf(1)"},"modified":{},"hasListeners":{},"events":{},"stores":[], | |
206 | - //"dirty":false,"id":"amdaModel.AmdaObject-ext-record-71"} | |
207 | - $paramInfo = $this->paramManager->addExistingParam($panel->scatterParam->data->name,$this->paramsData); | |
208 | - $paramsNode->addParam($paramInfo['id']); | |
209 | - | |
210 | - $paramNode = $plotElementNode->getParams()->getParamById($paramInfo['id']); | |
211 | - if (count($paramInfo['indexes']) == 0) | |
212 | - $paramNode->addXSerie($xAxisNode->getId(), -1); | |
213 | - else | |
214 | - { | |
215 | - $paramNode->addXSerie($xAxisNode->getId(), $paramInfo['indexes'][0]); | |
216 | - } | |
93 | + | |
94 | + switch ($tab->{'page-dimension'}) | |
95 | + { | |
96 | + case 'ISO A4' : | |
97 | + $pageNode->setDimension(RequestOutputPlotPageDimensionEnum::ISO_A4); | |
98 | + break; | |
99 | + case 'US letter' : | |
100 | + $pageNode->setDimension(RequestOutputPlotPageDimensionEnum::US_LETTER); | |
101 | + break; | |
102 | + default: | |
103 | + throw new Exception('Page dimension not implemented.'); | |
217 | 104 | } |
218 | 105 | |
219 | - //add yseries | |
220 | - foreach ($panel->children as $yserie) | |
106 | + switch ($tab->{'page-mode'}) | |
221 | 107 | { |
222 | - //{"name":"imf","leaf":true,"text":"imf","paramArgs":"select...","isScatter":false, | |
223 | - //"needsArgs":false,"plotOnly":false,"yaxe":false} | |
224 | - | |
225 | - //{"name":"#xmfi","leaf":true,"text":"#xmfi","paramArgs":"select...","isScatter":true, | |
226 | - //"needsArgs":false,"plotOnly":false,"yaxe":false} | |
227 | - | |
228 | - $xAxis = ""; | |
229 | - if ($isXYPlot) | |
230 | - $xAxis = $xAxisNode->getId(); | |
231 | - | |
232 | - $yAxis = $y1AxisNode->getId(); | |
233 | - if ($yserie->yaxe) | |
234 | - $yAxis = $y2AxisNode->getId(); | |
235 | - | |
236 | - $paramInfo = $this->paramManager->addExistingParam($yserie->name,$this->paramsData); | |
237 | - $paramsNode->addParam($paramInfo['id']); | |
238 | - | |
239 | - $paramNode = $plotElementNode->getParams()->getParamById($paramInfo['id']); | |
240 | - if (count($paramInfo['indexes']) == 0) | |
241 | - { | |
242 | - $isSpectro = ($paramInfo['plotType'] == 'Spectra'); | |
243 | - if ($isSpectro && $panel->plotType == "TIME") | |
244 | - $paramNode->addSpectro($yAxis); | |
245 | - else | |
246 | - $paramNode->addYSerie($yAxis, -1,$xAxis); | |
247 | - } | |
248 | - else | |
249 | - { | |
250 | - foreach ($paramInfo['indexes'] as $index) | |
251 | - $paramNode->addYSerie($yAxis, $index,$xAxis); | |
252 | - } | |
108 | + case 'color' : | |
109 | + $pageNode->setMode(RequestOutputPlotPageModeEnum::COLOR); | |
110 | + break; | |
111 | + case 'grayscale' : | |
112 | + $pageNode->setMode(RequestOutputPlotPageModeEnum::GRAYSCALE); | |
113 | + break; | |
114 | + default: | |
115 | + throw new Exception('Page mode not implemented.'); | |
253 | 116 | } |
117 | + | |
118 | + if ($tab->{'page-margins-activated'}) | |
119 | + { | |
120 | + $pageNode->getMargins()->setHorizontal($tab->{'page-margin-x'}); | |
121 | + $pageNode->getMargins()->setVertical($tab->{'page-margin-y'}); | |
122 | + } | |
123 | + | |
124 | + if ($tab->{'page-font-activated'}) | |
125 | + $this->unmarshallFont($tab, 'page', $pageNode->getFont()); | |
126 | + | |
127 | + $pageNode->getLayout()->setType(RequestOutputPlotLayoutTypeEnum::VERTICAL); | |
128 | + | |
129 | + ++$requestIndex; | |
254 | 130 | } |
255 | - | |
131 | + | |
132 | + $this->paramsData->setBatchEnable(!(($fileFormat == RequestOutputPlotPageFormatEnum::PNG) && ($input->{'file-output'} == 'INTERACTIVE'))); | |
133 | + | |
256 | 134 | //determine extension and add post processing if needed |
257 | - $extension = ""; | |
258 | - switch (strtolower($pageNode->getFormat())) | |
259 | - { | |
260 | - case RequestOutputPlotPageFormatEnum::PNG : | |
261 | - $extension = ".png"; | |
262 | - break; | |
263 | - case RequestOutputPlotPageFormatEnum::PS : | |
264 | - $extension = ".ps"; | |
265 | - break; | |
266 | - case RequestOutputPlotPageFormatEnum::PDF : | |
267 | - $extension = ".pdf"; | |
268 | - break; | |
269 | - } | |
270 | - | |
271 | - $compression = ""; | |
272 | - if ($pageNode->getFormat() != RequestOutputPlotPageFormatEnum::PNG) | |
135 | + return $this->paramsData; | |
136 | + } | |
137 | + | |
138 | + protected function unmarshallTitle($inputData, $keyPrefix, $titleNode) | |
139 | + { | |
140 | + if ($inputData->{$keyPrefix.'-text'} != '') | |
273 | 141 | { |
274 | - //one file per interval | |
275 | - $plotOutputNode->setStructure(RequestOutputPlotStructureEnum::ONE_FILE_PER_INTERVAL); | |
276 | - //auto compression if not PNG format | |
277 | - $compression = ".tar.gz"; | |
278 | - $plotOutputNode->addPostProcessing(RequestOutputPostProcessingEnumClass::TAR); | |
279 | - $plotOutputNode->addPostProcessing(RequestOutputPostProcessingEnumClass::GZIP); | |
142 | + $titleNode->setText($inputData->{$keyPrefix.'-text'}); | |
143 | + | |
144 | + switch ($inputData->{$keyPrefix.'-position'}) | |
145 | + { | |
146 | + case 'top' : | |
147 | + $titleNode->setPosition(RequestOutputPlotTitlePosition::TOP); | |
148 | + break; | |
149 | + case 'bottom' : | |
150 | + $titleNode->setPosition(RequestOutputPlotTitlePosition::BOTTOM); | |
151 | + break; | |
152 | + } | |
153 | + | |
154 | + switch ($inputData->{$keyPrefix.'-alignment'}) | |
155 | + { | |
156 | + case 'center' : | |
157 | + $titleNode->setAlign(RequestOutputPlotTitleAlign::CENTER); | |
158 | + break; | |
159 | + case 'left' : | |
160 | + $titleNode->setAlign(RequestOutputPlotTitleAlign::LEFT); | |
161 | + break; | |
162 | + case 'right' : | |
163 | + $titleNode->setAlign(RequestOutputPlotTitleAlign::RIGHT); | |
164 | + break; | |
165 | + } | |
166 | + | |
167 | + if ($inputData->{$keyPrefix.'-color'} != '') | |
168 | + $titleNode->setColor($this->hexColor2KernelColor($inputData->{$keyPrefix.'-color'})); | |
169 | + | |
170 | + $this->unmarshallLabel($inputData, $keyPrefix, $titleNode); | |
280 | 171 | } |
281 | - | |
282 | - //Set post command to retrieve request result file | |
283 | - //Use a cache killer (ie - random string in file name) | |
284 | - $resultFile = "plot_".CommonClass::generateRandomString(6); | |
285 | - $this->paramsData->addWaitingResult(PLOT_RESULT_FILE_KEY, $resultFile); | |
286 | - | |
287 | - if ($pageNode->getFormat() != RequestOutputPlotPageFormatEnum::PNG) | |
172 | + } | |
173 | + | |
174 | + protected function unmarshallLabel($inputData, $keyPrefix, $labelNode) | |
175 | + { | |
176 | + if ($inputData->{$keyPrefix.'-font-activated'}) | |
288 | 177 | { |
289 | - $postProcessCmd = "mv plot_*".$compression; | |
290 | - $postProcessCmd .= " ".$resultFile.$extension.$compression; | |
178 | + $labelNode->setFontName($inputData->{$keyPrefix.'-font-name'}); | |
179 | + $labelNode->setFontSize($inputData->{$keyPrefix.'-font-size'}); | |
180 | + $style = ""; | |
181 | + if ($inputData->{$keyPrefix.'-font-bold'}) | |
182 | + { | |
183 | + if ($style != "") | |
184 | + $style .= ","; | |
185 | + $style .= "bold"; | |
186 | + } | |
187 | + if ($inputData->{$keyPrefix.'-font-italic'}) | |
188 | + { | |
189 | + if ($style != "") | |
190 | + $style .= ","; | |
191 | + $style .= "italic"; | |
192 | + } | |
193 | + if ($style != "") | |
194 | + $labelNode->setFontStyle($style); | |
291 | 195 | } |
292 | - else | |
196 | + | |
197 | + } | |
198 | + | |
199 | + protected function unmarshallFont($inputData, $keyPrefix, $fontNode) | |
200 | + { | |
201 | + if ($inputData->{$keyPrefix.'-font-activated'}) | |
293 | 202 | { |
294 | - $postProcessCmd = "mv plot_*"; | |
295 | - $postProcessCmd .= $extension; | |
296 | - $postProcessCmd .= " ".$resultFile.$extension; | |
297 | - if ($forceRotation) | |
298 | - $postProcessCmd .= " | convert ".$resultFile.$extension." -rotate -90 ".$resultFile.$extension; | |
203 | + $fontNode->setFontName($inputData->{$keyPrefix.'-font-name'}); | |
204 | + $fontNode->setSize($inputData->{$keyPrefix.'-font-size'}); | |
205 | + | |
206 | + if ($inputData->{$keyPrefix.'-font-italic'}) | |
207 | + $fontNode->setStyle(RequestOutputPlotFontStyle::ITALIC); | |
208 | + else | |
209 | + $fontNode->setStyle(RequestOutputPlotFontStyle::UPRIGHT); | |
210 | + | |
211 | + if ($inputData->{$keyPrefix.'-font-bold'}) | |
212 | + $fontNode->setWeight(RequestOutputPlotFontWeight::BOLD); | |
213 | + else | |
214 | + $fontNode->setWeight(RequestOutputPlotFontWeight::MEDIUM); | |
299 | 215 | } |
300 | - | |
301 | - $this->paramsData->setPostCmd($postProcessCmd); | |
302 | - | |
303 | - return $this->paramsData; | |
304 | 216 | } |
305 | 217 | |
306 | 218 | /* |
... | ... | @@ -351,6 +263,16 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
351 | 263 | } |
352 | 264 | } |
353 | 265 | |
266 | + private function hexColor2KernelColor($hex) { | |
267 | + $hex = str_replace("#", "", $hex); | |
268 | + | |
269 | + $r = hexdec(substr($hex,0,2)); | |
270 | + $g = hexdec(substr($hex,2,2)); | |
271 | + $b = hexdec(substr($hex,4,2)); | |
272 | + | |
273 | + return "[".$r.",".$g.",".$b."]"; | |
274 | + } | |
275 | + | |
354 | 276 | private function saveIHMRequest($input) |
355 | 277 | { |
356 | 278 | $path = $this->getWorkingPath()."ihm.request"; | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputDownloadNodeClass.php
... | ... | @@ -146,7 +146,7 @@ class RequestOutputDownloadNodeClass extends NodeClass |
146 | 146 | |
147 | 147 | public function getFileName() |
148 | 148 | { |
149 | - $node = $this->getChildInstanceByName(REQUESTOUTPUTDOWNLOAD_FILEFORMAT); | |
149 | + $node = $this->getChildInstanceByName(REQUESTOUTPUTDOWNLOAD_FILENAME); | |
150 | 150 | return (($node == NULL) ? "" : $node->getValue()); |
151 | 151 | } |
152 | 152 | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotFontNameEnumClass.php
0 → 100644
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotFontNodeClass.php
0 → 100644
... | ... | @@ -0,0 +1,77 @@ |
1 | +<?php | |
2 | + | |
3 | +require_once("RequestOutputPlotFontNodeClass.php"); | |
4 | + | |
5 | +abstract class RequestOutputPlotFontStyle | |
6 | +{ | |
7 | + const UPRIGHT = "upright"; | |
8 | + const ITALIC = "italic"; | |
9 | + const OBLIQUE = "oblique"; | |
10 | +} | |
11 | + | |
12 | +abstract class RequestOutputPlotFontWeight | |
13 | +{ | |
14 | + const MEDIUM = "medium"; | |
15 | + const BOLD = "bold"; | |
16 | +} | |
17 | + | |
18 | +define ("REQUESTOUTPUTPLOTFONT_NODENAME", "font"); | |
19 | +define ("REQUESTOUTPUTPLOTFONT_NAME", "name"); | |
20 | +define ("REQUESTOUTPUTPLOTFONT_SIZE", "size"); | |
21 | +define ("REQUESTOUTPUTPLOTFONT_STYLE", "style"); | |
22 | +define ("REQUESTOUTPUTPLOTFONT_WEIGHT", "weight"); | |
23 | + | |
24 | +/** | |
25 | + * @class RequestOutputPlotFontNodeClass | |
26 | + * @brief Definition of a font for an element of a plot request | |
27 | + * @details | |
28 | +*/ | |
29 | +class RequestOutputPlotFontNodeClass extends NodeClass | |
30 | +{ | |
31 | + public function __construct() | |
32 | + { | |
33 | + parent::__construct(REQUESTOUTPUTPLOTFONT_NODENAME); | |
34 | + } | |
35 | + | |
36 | + public function setFontName($fontName) | |
37 | + { | |
38 | + $this->setAttribute(REQUESTOUTPUTPLOTFONT_NAME, $fontName); | |
39 | + } | |
40 | + | |
41 | + public function getFontName() | |
42 | + { | |
43 | + return $this->getAttribute(REQUESTOUTPUTPLOTFONT_NAME); | |
44 | + } | |
45 | + | |
46 | + public function setSize($size) | |
47 | + { | |
48 | + $this->setAttribute(REQUESTOUTPUTPLOTFONT_SIZE, $size); | |
49 | + } | |
50 | + | |
51 | + public function getSize() | |
52 | + { | |
53 | + return $this->getAttribute(REQUESTOUTPUTPLOTFONT_SIZE); | |
54 | + } | |
55 | + | |
56 | + public function setStyle($style) | |
57 | + { | |
58 | + $this->setAttribute(REQUESTOUTPUTPLOTFONT_STYLE, $style); | |
59 | + } | |
60 | + | |
61 | + public function getStyle() | |
62 | + { | |
63 | + return $this->getAttribute(REQUESTOUTPUTPLOTFONT_STYLE); | |
64 | + } | |
65 | + | |
66 | + public function setWeight($weight) | |
67 | + { | |
68 | + $this->setAttribute(REQUESTOUTPUTPLOTFONT_WEIGHT, $weight); | |
69 | + } | |
70 | + | |
71 | + public function getWeight() | |
72 | + { | |
73 | + return $this->getAttribute(REQUESTOUTPUTPLOTFONT_WEIGHT); | |
74 | + } | |
75 | +} | |
76 | + | |
77 | +?> | |
0 | 78 | \ No newline at end of file | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotMarginsNodeClass.php
0 → 100644
... | ... | @@ -0,0 +1,42 @@ |
1 | + | |
2 | + | |
3 | +<?php | |
4 | + | |
5 | +define ("REQUESTOUTPUTPLOTMARGINS_NAME", "margin"); | |
6 | +define ("REQUESTOUTPUTPLOTMARGINS_HORIZONTAL", "x"); | |
7 | +define ("REQUESTOUTPUTPLOTMARGINS_VERTIVAL", "y"); | |
8 | + | |
9 | +/** | |
10 | + * @class RequestOutputPlotMarginsNodeClass | |
11 | + * @brief Definition of margins for a page of a plot request | |
12 | + * @details | |
13 | + */ | |
14 | +class RequestOutputPlotMarginsNodeClass extends NodeClass | |
15 | +{ | |
16 | + public function __construct() | |
17 | + { | |
18 | + parent::__construct(REQUESTOUTPUTPLOTMARGINS_NAME); | |
19 | + } | |
20 | + | |
21 | + public function setHorizontal($horizontal) | |
22 | + { | |
23 | + $this->setAttribute(REQUESTOUTPUTPLOTMARGINS_HORIZONTAL, $horizontal); | |
24 | + } | |
25 | + | |
26 | + public function getHorizontal() | |
27 | + { | |
28 | + return $this->getAttribute(REQUESTOUTPUTPLOTMARGINS_HORIZONTAL); | |
29 | + } | |
30 | + | |
31 | + public function setVertical($vertical) | |
32 | + { | |
33 | + $this->setAttribute(REQUESTOUTPUTPLOTMARGINS_VERTIVAL, $vertical); | |
34 | + } | |
35 | + | |
36 | + public function getVertical() | |
37 | + { | |
38 | + return $this->getAttribute(REQUESTOUTPUTPLOTMARGINS_VERTIVAL); | |
39 | + } | |
40 | +} | |
41 | + | |
42 | +?> | |
0 | 43 | \ No newline at end of file | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotNodeClass.php
... | ... | @@ -5,6 +5,7 @@ require_once("RequestOutputPostProcessingNodeClass.php"); |
5 | 5 | |
6 | 6 | define ("REQUESTOUTPUTPLOT_NAME", "plot"); |
7 | 7 | define ("REQUESTOUTPUTPLOT_STRUCTURE", "outputStructure"); |
8 | +define ("REQUESTOUTPUTPLOT_FILEPREFIX", "filePrefix"); | |
8 | 9 | |
9 | 10 | abstract class RequestOutputPlotStructureEnum |
10 | 11 | { |
... | ... | @@ -24,6 +25,8 @@ class RequestOutputPlotNodeClass extends NodeClass |
24 | 25 | parent::__construct(REQUESTOUTPUTPLOT_NAME); |
25 | 26 | //default properties |
26 | 27 | $this->setStructure(RequestOutputPlotStructureEnum::ONE_FILE); |
28 | + //default prefix | |
29 | + $this->setFilePrefix("plot"); | |
27 | 30 | //force page construction |
28 | 31 | $this->getPage(); |
29 | 32 | } |
... | ... | @@ -40,6 +43,18 @@ class RequestOutputPlotNodeClass extends NodeClass |
40 | 43 | return (($node == NULL) ? RequestOutputPlotStructureEnum::ONE_FILE : $node->getValue()); |
41 | 44 | } |
42 | 45 | |
46 | + public function setFilePrefix($prefix) | |
47 | + { | |
48 | + $node = $this->getChildInstanceByName(REQUESTOUTPUTPLOT_FILEPREFIX, true); | |
49 | + $node->setValue($prefix); | |
50 | + } | |
51 | + | |
52 | + public function getFilePrefix() | |
53 | + { | |
54 | + $node = $this->getChildInstanceByName(REQUESTOUTPUTPLOT_FILEPREFIX); | |
55 | + return (($node == NULL) ? "" : $node->getValue()); | |
56 | + } | |
57 | + | |
43 | 58 | public function getPage() |
44 | 59 | { |
45 | 60 | $node = $this->getChildInstanceByName(REQUESTOUTPUTPLOTPAGE_NAME); | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotPageNodeClass.php
... | ... | @@ -53,21 +53,44 @@ class RequestOutputPlotPageNodeClass extends NodeClass |
53 | 53 | $this->setMode(RequestOutputPlotPageModeEnum::COLOR); |
54 | 54 | } |
55 | 55 | |
56 | - public function setTitle($title) | |
56 | + public function getTitle() | |
57 | 57 | { |
58 | - $node = $this->getChildInstanceByName(REQUESTOUTPUTPLOTPAGE_TITLE, true); | |
59 | - $node->setValue($title); | |
58 | + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTPAGE_TITLE); | |
59 | + | |
60 | + if (!isset($node)) | |
61 | + { | |
62 | + $node = new RequestOutputPlotTitleNodeClass(); | |
63 | + $this->addChild($node); | |
64 | + } | |
65 | + | |
66 | + return $node; | |
60 | 67 | } |
61 | 68 | |
62 | - public function getTitle() | |
69 | + public function getMargins() | |
63 | 70 | { |
64 | - $node = $this->getChildInstanceByName(REQUESTOUTPUTPLOTPAGE_TITLE); | |
65 | - return (($node == NULL) ? "" : $node->getValue()); | |
71 | + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTMARGINS_NAME); | |
72 | + | |
73 | + if (!isset($node)) | |
74 | + { | |
75 | + $node = new RequestOutputPlotMarginsNodeClass(); | |
76 | + $this->addChild($node); | |
77 | + } | |
78 | + | |
79 | + return $node; | |
80 | + } | |
81 | + | |
82 | + public function getFont() | |
83 | + { | |
84 | + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTFONT_NODENAME); | |
85 | + | |
86 | + if (!isset($node)) | |
87 | + { | |
88 | + $node = new RequestOutputPlotFontNodeClass(); | |
89 | + $this->addChild($node); | |
90 | + } | |
91 | + | |
92 | + return $node; | |
66 | 93 | } |
67 | - | |
68 | - /* ToDo margin */ | |
69 | - | |
70 | - /* ToDo font */ | |
71 | 94 | |
72 | 95 | public function getLayout() |
73 | 96 | { |
... | ... | @@ -82,8 +105,6 @@ class RequestOutputPlotPageNodeClass extends NodeClass |
82 | 105 | return $node; |
83 | 106 | } |
84 | 107 | |
85 | - /* ToDo panelDefaults */ | |
86 | - | |
87 | 108 | public function addPanel() |
88 | 109 | { |
89 | 110 | $node = new RequestOutputPlotPanelNodeClass(); |
... | ... | @@ -135,8 +156,6 @@ class RequestOutputPlotPageNodeClass extends NodeClass |
135 | 156 | { |
136 | 157 | return $this->getAttribute(REQUESTOUTPUTPLOTPAGE_MODE); |
137 | 158 | } |
138 | - | |
139 | - /* ToDo plot size and margins */ | |
140 | 159 | } |
141 | 160 | |
142 | 161 | ?> |
143 | 162 | \ No newline at end of file | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotTitleNodeClass.php
0 → 100644
... | ... | @@ -0,0 +1,120 @@ |
1 | +<?php | |
2 | + | |
3 | +require_once("RequestOutputPlotTitleNodeClass.php"); | |
4 | + | |
5 | +abstract class RequestOutputPlotTitlePosition | |
6 | +{ | |
7 | + const TOP = "top"; | |
8 | + const BOTTOM = "bottom"; | |
9 | +} | |
10 | + | |
11 | +abstract class RequestOutputPlotTitleAlign | |
12 | +{ | |
13 | + const CENTER = "center"; | |
14 | + const LEFT = "left"; | |
15 | + const RIGHT = "right"; | |
16 | +} | |
17 | + | |
18 | +define ("REQUESTOUTPUTPLOTTITLE_NAME", "title"); | |
19 | +define ("REQUESTOUTPUTPLOTTITLE_POSITION", "position"); | |
20 | +define ("REQUESTOUTPUTPLOTTITLE_ALIGN", "align"); | |
21 | +define ("REQUESTOUTPUTPLOTTITLE_FONTNAME", "fontName"); | |
22 | +define ("REQUESTOUTPUTPLOTTITLE_FONTSIZE", "fontSize"); | |
23 | +define ("REQUESTOUTPUTPLOTTITLE_STYLE", "style"); | |
24 | +define ("REQUESTOUTPUTPLOTTITLE_COLOR", "color"); | |
25 | +define ("REQUESTOUTPUTPLOTTITLE_COLORMAPINDEX", "colorMapIndex"); | |
26 | + | |
27 | +/** | |
28 | + * @class RequestOutputPlotTitleNodeClass | |
29 | + * @brief Definition of a title for a plot request | |
30 | + * @details | |
31 | +*/ | |
32 | +class RequestOutputPlotTitleNodeClass extends NodeClass | |
33 | +{ | |
34 | + public function __construct() | |
35 | + { | |
36 | + parent::__construct(REQUESTOUTPUTPLOTTITLE_NAME); | |
37 | + } | |
38 | + | |
39 | + public function setText($text) | |
40 | + { | |
41 | + $this->setValue($text); | |
42 | + } | |
43 | + | |
44 | + public function getText() | |
45 | + { | |
46 | + return $this->getValue(); | |
47 | + } | |
48 | + | |
49 | + public function setPosition($position) | |
50 | + { | |
51 | + $this->setAttribute(REQUESTOUTPUTPLOTTITLE_POSITION, $position); | |
52 | + } | |
53 | + | |
54 | + public function getPosition() | |
55 | + { | |
56 | + return $this->getAttribute(REQUESTOUTPUTPLOTTITLE_POSITION); | |
57 | + } | |
58 | + | |
59 | + public function setAlign($align) | |
60 | + { | |
61 | + $this->setAttribute(REQUESTOUTPUTPLOTTITLE_ALIGN, $align); | |
62 | + } | |
63 | + | |
64 | + public function getAlign() | |
65 | + { | |
66 | + return $this->getAttribute(REQUESTOUTPUTPLOTTITLE_ALIGN); | |
67 | + } | |
68 | + | |
69 | + public function setFontName($fontName) | |
70 | + { | |
71 | + $this->setAttribute(REQUESTOUTPUTPLOTTITLE_FONTNAME, $fontName); | |
72 | + } | |
73 | + | |
74 | + public function getFontName() | |
75 | + { | |
76 | + return $this->getAttribute(REQUESTOUTPUTPLOTTITLE_FONTNAME); | |
77 | + } | |
78 | + | |
79 | + public function setFontSize($fontSize) | |
80 | + { | |
81 | + $this->setAttribute(REQUESTOUTPUTPLOTTITLE_FONTSIZE, $fontSize); | |
82 | + } | |
83 | + | |
84 | + public function getFontSize() | |
85 | + { | |
86 | + return $this->getAttribute(REQUESTOUTPUTPLOTTITLE_FONTSIZE); | |
87 | + } | |
88 | + | |
89 | + public function setFontStyle($style) | |
90 | + { | |
91 | + $this->setAttribute(REQUESTOUTPUTPLOTTITLE_STYLE, $style); | |
92 | + } | |
93 | + | |
94 | + public function getFontStyle() | |
95 | + { | |
96 | + return $this->getAttribute(REQUESTOUTPUTPLOTTITLE_STYLE); | |
97 | + } | |
98 | + | |
99 | + public function setColor($color) | |
100 | + { | |
101 | + $this->setAttribute(REQUESTOUTPUTPLOTTITLE_COLOR, $color); | |
102 | + } | |
103 | + | |
104 | + public function getColor() | |
105 | + { | |
106 | + return $this->getAttribute(REQUESTOUTPUTPLOTTITLE_COLOR); | |
107 | + } | |
108 | + | |
109 | + public function setColorMapIndex($colorMapIndex) | |
110 | + { | |
111 | + $this->setAttribute(REQUESTOUTPUTPLOTTITLE_COLORMAPINDEX, $colorMapIndex); | |
112 | + } | |
113 | + | |
114 | + public function getColorMapIndex() | |
115 | + { | |
116 | + return $this->getAttribute(REQUESTOUTPUTPLOTTITLE_COLORMAPINDEX); | |
117 | + } | |
118 | +} | |
119 | + | |
120 | +?> | |
0 | 121 | \ No newline at end of file | ... | ... |
src/Request/ParamsRequestImpl/ParamsRequestClass.php
... | ... | @@ -19,7 +19,16 @@ class ParamsRequestClass extends ProcessRequestClass |
19 | 19 | switch ($this->requestData->getRequestType()) |
20 | 20 | { |
21 | 21 | case ParamsRequestTypeEnumClass::XMLREQUEST : |
22 | - $this->requestData->setCmd(KernelConfigClass::getKernelBinPath()."amdaXMLRequestorTool ".$this->getRequestFilePath()); | |
22 | + $cmd = ""; | |
23 | + $requestIndex = 0; | |
24 | + foreach ($this->requestData->getRequestNodes() as $requestNode) | |
25 | + { | |
26 | + if ($cmd != "") | |
27 | + $cmd .= " && "; | |
28 | + $cmd .= KernelConfigClass::getKernelBinPath()."amdaXMLRequestorTool ".$this->getRequestFilePath($requestIndex); | |
29 | + ++$requestIndex; | |
30 | + } | |
31 | + $this->requestData->setCmd($cmd); | |
23 | 32 | break; |
24 | 33 | case ParamsRequestTypeEnumClass::PARAMGEN : |
25 | 34 | $this->requestData->setCmd(KernelConfigClass::getKernelBinPath()."amdaParameterGenerator -p ".$this->requestData->getParamId()); |
... | ... | @@ -50,29 +59,35 @@ class ParamsRequestClass extends ProcessRequestClass |
50 | 59 | |
51 | 60 | if ($this->requestData->getRequestType() == ParamsRequestTypeEnumClass::XMLREQUEST) |
52 | 61 | { |
53 | - //create XML request file | |
54 | - $doc = new DOMDocument("1.0", "UTF-8"); | |
55 | - $doc->preserveWhiteSpace = false; | |
56 | - $doc->formatOutput = true; | |
57 | - | |
58 | - if (!$xmlNode = $this->requestData->getRequestNode()->toXMLNode($doc)) | |
62 | + $requestIndex = 0; | |
63 | + foreach ($this->requestData->getRequestNodes() as $requestNode) | |
59 | 64 | { |
60 | - $this->requestData->setLastErrorMessage('Cannot create params request XML file'); | |
61 | - return false; | |
62 | - } | |
65 | + //create XML request file | |
66 | + $doc = new DOMDocument("1.0", "UTF-8"); | |
67 | + $doc->preserveWhiteSpace = false; | |
68 | + $doc->formatOutput = true; | |
69 | + | |
70 | + if (!$xmlNode = $requestNode->toXMLNode($doc)) | |
71 | + { | |
72 | + $this->requestData->setLastErrorMessage('Cannot create params request XML file for request '.$requestIndex); | |
73 | + return false; | |
74 | + } | |
63 | 75 | |
64 | - $doc->appendChild($xmlNode); | |
65 | - | |
66 | - if (!$doc->schemaValidate(KernelConfigClass::getXSDRequestFilePath())) | |
67 | - { | |
68 | - $this->requestData->setLastErrorMessage('Params request XML file not valid'); | |
69 | - return false; | |
70 | - } | |
71 | - | |
72 | - if (!$doc->save($this->getRequestFilePath())) | |
73 | - { | |
74 | - $this->requestData->setLastErrorMessage('Cannot save params request XML file'); | |
75 | - return false; | |
76 | + $doc->appendChild($xmlNode); | |
77 | + | |
78 | + if (!$doc->schemaValidate(KernelConfigClass::getXSDRequestFilePath())) | |
79 | + { | |
80 | + $this->requestData->setLastErrorMessage('Params request XML file not valid for request '.$requestIndex); | |
81 | + return false; | |
82 | + } | |
83 | + | |
84 | + if (!$doc->save($this->getRequestFilePath($requestIndex))) | |
85 | + { | |
86 | + $this->requestData->setLastErrorMessage('Cannot save params request XML file for request '.$requestIndex); | |
87 | + return false; | |
88 | + } | |
89 | + | |
90 | + ++$requestIndex; | |
76 | 91 | } |
77 | 92 | } |
78 | 93 | |
... | ... | @@ -168,9 +183,9 @@ class ParamsRequestClass extends ProcessRequestClass |
168 | 183 | /* |
169 | 184 | * @brief Get the request file path for AMDA_Kernel |
170 | 185 | */ |
171 | - private function getRequestFilePath() | |
186 | + private function getRequestFilePath($requestIndex) | |
172 | 187 | { |
173 | - return $this->requestData->getWorkingPath()."request.xml"; | |
188 | + return $this->requestData->getWorkingPath()."request_".$requestIndex.".xml"; | |
174 | 189 | } |
175 | 190 | } |
176 | 191 | ?> | ... | ... |
src/Request/ParamsRequestImpl/ParamsRequestDataClass.php
... | ... | @@ -20,7 +20,7 @@ abstract class ParamsRequestTypeEnumClass |
20 | 20 | class ParamsRequestDataClass extends ProcessRequestDataClass |
21 | 21 | { |
22 | 22 | private $requestType = ParamsRequestTypeEnumClass::XMLREQUEST; |
23 | - private $requestNode = null; | |
23 | + private $requestNodes = array(); | |
24 | 24 | private $compilationPath = ""; |
25 | 25 | private $localBasePath = ""; |
26 | 26 | private $waitingResults = array(); |
... | ... | @@ -32,7 +32,6 @@ class ParamsRequestDataClass extends ProcessRequestDataClass |
32 | 32 | function __construct() |
33 | 33 | { |
34 | 34 | parent::__construct(); |
35 | - $this->requestNode = new RequestNodeClass(); | |
36 | 35 | } |
37 | 36 | |
38 | 37 | public function getCompilationPath() |
... | ... | @@ -65,9 +64,16 @@ class ParamsRequestDataClass extends ProcessRequestDataClass |
65 | 64 | $this->requestType = $requestType; |
66 | 65 | } |
67 | 66 | |
68 | - public function getRequestNode() | |
67 | + public function addRequestNode() | |
69 | 68 | { |
70 | - return $this->requestNode; | |
69 | + $newRequestNode = new RequestNodeClass(); | |
70 | + $this->requestNodes[] = $newRequestNode; | |
71 | + return $newRequestNode; | |
72 | + } | |
73 | + | |
74 | + public function getRequestNodes() | |
75 | + { | |
76 | + return $this->requestNodes; | |
71 | 77 | } |
72 | 78 | |
73 | 79 | public function getWaitingResult($key) | ... | ... |
src/Request/ProcessRequestImpl/Process/ProcessManagerClass.php
... | ... | @@ -0,0 +1,9 @@ |
1 | +<?php | |
2 | + | |
3 | +$debug_1 = '{"nodeType":"request","id":"","file-format":"PNG","file-output":"INTERACTIVE","file-prefix":"","one-file-per-interval":false,"request-name":"","timesrc":"Interval","startDate":"2015-08-10T00:00:00","stopDate":"2015-08-11T00:00:00","durationDay":"0001","durationHour":"00","durationMin":"00","durationSec":"00","tabs":[{"page-title-text":"","page-title-color":"#000000","page-title-position":"top","page-title-alignment":" center","page-title-font-activated":false,"page-title-font-name":"sans-serif","page-title-font-size":12,"page-title-font-bold":false,"page-title-font-italic":false,"page-margins-activated":false,"page-margin-x":15,"page-margin-y":20,"page-mode":"color","page-orientation":"landscape","page-dimension":"ISO A4","page-superpose-mode":false,"page-font-activated":false,"page-font-name":"sans-serif","page-font-size":12,"page-font-bold":false,"page-font-italic":false},{"page-title-text":"coucou","page-title-color":"#0000FF","page-title-position":"top","page-title-alignment":" center","page-title-font-activated":false,"page-title-font-name":"sans-serif","page-title-font-size":12,"page-title-font-bold":false,"page-title-font-italic":false,"page-margins-activated":false,"page-margin-x":15,"page-margin-y":20,"page-mode":"color","page-orientation":"landscape","page-dimension":"ISO A4","page-superpose-mode":false,"page-font-activated":false,"page-font-name":"sans-serif","page-font-size":12,"page-font-bold":false,"page-font-italic":false}]}'; | |
4 | + | |
5 | +$debug = array("Debug - Test 1" => $debug_1); | |
6 | + | |
7 | +?> | |
8 | + | |
9 | + | ... | ... |
test/test.php
... | ... | @@ -10,14 +10,18 @@ require(__DIR__.'/../config/AMDAIntegrationConfig.php'); |
10 | 10 | define("NEWKERNEL_DEBUG",true); |
11 | 11 | define("NEWKERNEL_DEBUG_USER","test-integration"); |
12 | 12 | |
13 | +define('BASE_PATH', IHM_SRC_DIR); | |
14 | +define('DATAPATH', BASE_PATH.'generic_data/'); | |
15 | + | |
13 | 16 | //define test suite |
14 | -require_once(__DIR__."/US42/test_us42.php"); | |
17 | +/*require_once(__DIR__."/US42/test_us42.php"); | |
15 | 18 | require_once(__DIR__."/US44/test_us44.php"); |
16 | 19 | require_once(__DIR__."/US43/test_us43.php"); |
17 | 20 | require_once(__DIR__."/US78/test_us78.php"); |
18 | -require_once(__DIR__."/LocalParam/test_localparam.php"); | |
21 | +require_once(__DIR__."/LocalParam/test_localparam.php");*/ | |
22 | +require_once(__DIR__."/debug_request.php"); | |
19 | 23 | |
20 | -$testSuite = array($us42,$us44,$us43,$us78,$localparam); | |
24 | +$testSuite = array($debug)/*$us42,$us44,$us43,$us78,$localparam)*/; | |
21 | 25 | |
22 | 26 | //include required IHM source |
23 | 27 | require_once(IHM_SRC_DIR."php/classes/AmdaAction.php"); | ... | ... |