Commit 78a73e9a1b1bfe15eb5bbdae1a407ce51e0b4a35
1 parent
9b4c17eb
Exists in
master
and in
66 other branches
Integration for panels and axes definition
Showing
8 changed files
with
386 additions
and
75 deletions
Show diff stats
src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
... | ... | @@ -145,6 +145,9 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
145 | 145 | |
146 | 146 | $pageNode->getLayout()->setType(RequestOutputPlotLayoutTypeEnum::VERTICAL); |
147 | 147 | |
148 | + foreach ($tab->{'panels'} as $panelData) | |
149 | + $this->unmarshallPanel($panelData, $pageNode); | |
150 | + | |
148 | 151 | if ($this->isInteractiveRequest) |
149 | 152 | { |
150 | 153 | $resultFile = $filePrefix."_*".$extension; |
... | ... | @@ -177,10 +180,125 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
177 | 180 | $this->paramsData->setBatchEnable(!(($fileFormat == RequestOutputPlotPageFormatEnum::PNG) && $this->isInteractiveRequest)); |
178 | 181 | $this->paramsData->setPostCmd($postProcessCmd); |
179 | 182 | |
180 | - //determine extension and add post processing if needed | |
181 | 183 | return $this->paramsData; |
182 | 184 | } |
183 | 185 | |
186 | + protected function unmarshallPanel($panelData, $pageNode) | |
187 | + { | |
188 | + $panelNode = $pageNode->addPanel(); | |
189 | + | |
190 | + //Panel background color | |
191 | + if (($panelData->{'panel-background-color'} != 'none') && ($panelData->{'panel-background-color'} != '')) | |
192 | + $panelNode->setBackgroundColor($this->hexColor2KernelColor($panelData->{'panel-background-color'})); | |
193 | + | |
194 | + //Panel font | |
195 | + $this->unmarshallFont($panelData, 'panel', $panelNode->getFont()); | |
196 | + | |
197 | + //Panel title | |
198 | + $this->unmarshallTitle($panelData, 'panel-title', $panelNode->getTitle()); | |
199 | + | |
200 | + //Plot type | |
201 | + $this->unmarshallPlotType($panelData, $panelNode); | |
202 | + | |
203 | + return $panelNode; | |
204 | + } | |
205 | + | |
206 | + protected function unmarshallPlotType($panelData, $panelNode) | |
207 | + { | |
208 | + switch ($panelData->{'panel-plot-type'}) | |
209 | + { | |
210 | + case 'timePlot' : | |
211 | + $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::TIMEPLOT); | |
212 | + break; | |
213 | + case 'xyPlot' : | |
214 | + $plotNode = $panelNode->addPlotElement(RequestOutputPlotElementTypeEnum::XYPLOT); | |
215 | + break; | |
216 | + default: | |
217 | + throw new Exception('Plot type not implemented.'); | |
218 | + } | |
219 | + | |
220 | + //Axes | |
221 | + foreach ($panelData->{'axes'} as $axisData) | |
222 | + $this->unmarshallAxis($axisData, $plotNode); | |
223 | + } | |
224 | + | |
225 | + protected function unmarshallAxis($axisData, $plotNode) | |
226 | + { | |
227 | + //axis type | |
228 | + switch ($axisData->{'axis-type'}) | |
229 | + { | |
230 | + case 'time' : | |
231 | + $axisNode = $plotNode->getTimeAxis(); | |
232 | + $axisNode->setFormat($axisData->{'axis-time-format'}); | |
233 | + break; | |
234 | + case 'epoch' : | |
235 | + $axisNode = $plotNode->getEpochAxis(); | |
236 | + $axisNode->setNormalized($axisData->{'axis-epoch-normalized'} ? "true" : "false"); | |
237 | + break; | |
238 | + case 'x' : | |
239 | + $axisNode = $plotNode->getXAxis(); | |
240 | + break; | |
241 | + case 'y-left' : | |
242 | + $axisNode = $plotNode->addYAxis('y1'); | |
243 | + break; | |
244 | + case 'y-right' : | |
245 | + $axisNode = $plotNode->addYAxis('y2'); | |
246 | + break; | |
247 | + case 'color' : | |
248 | + $axisNode = $plotNode->getZAxis(); | |
249 | + $axisNode->setColorMapIndex($axisData->{'axis-color-map'}); | |
250 | + if ($axisData->{'axis-color-minval'} != 'none') | |
251 | + $axisNode->setMinValColor($this->hexColor2KernelColor($axisData->{'axis-color-minval'})); | |
252 | + if ($axisData->{'axis-color-maxval'} != 'none') | |
253 | + $axisNode->setMaxValColor($this->hexColor2KernelColor($axisData->{'axis-color-maxval'})); | |
254 | + break; | |
255 | + default: | |
256 | + throw new Exception('Axis type not implemented.'); | |
257 | + } | |
258 | + | |
259 | + //reverse axis | |
260 | + $axisNode->setReverse($axisData->{'axis-reverse'} ? "true" : "false"); | |
261 | + | |
262 | + //axis scale | |
263 | + switch ($axisData->{'axis-scale'}) | |
264 | + { | |
265 | + case 'logarithmic' : | |
266 | + $axisNode->setScale(RequestOutputPlotAxisElementScale::LOGARITHMIC); | |
267 | + break; | |
268 | + default: | |
269 | + $axisNode->setScale(RequestOutputPlotAxisElementScale::LINEAR); | |
270 | + } | |
271 | + | |
272 | + //axis range | |
273 | + if ($axisData->{'axis-range-min'} < $axisData->{'axis-range-max'}) | |
274 | + $axisNode->getRange()->setMinMax($axisData->{'axis-range-min'}, $axisData->{'axis-range-max'}); | |
275 | + $axisNode->getRange()->setExtend($axisData->{'axis-range-extend'} ? "true" : "false"); | |
276 | + | |
277 | + //axis color | |
278 | + $axisNode->setColor($this->hexColor2KernelColor($axisData->{'axis-color'})); | |
279 | + | |
280 | + //axis thickness | |
281 | + $axisNode->setThickness($axisData->{'axis-thickness'}); | |
282 | + | |
283 | + //axis ticks position | |
284 | + switch ($axisData->{'axis-tick-position'}) | |
285 | + { | |
286 | + case 'inwards' : | |
287 | + $axisNode->getTick()->setPosition(RequestOutputPlotAxisElementTickPosition::INWARDS); | |
288 | + break; | |
289 | + default : | |
290 | + $axisNode->getTick()->setPosition(RequestOutputPlotAxisElementTickPosition::OUTWARDS); | |
291 | + } | |
292 | + | |
293 | + //axis minor and major grid | |
294 | + $axisNode->getTick()->setMinorGrid($axisData->{'axis-grid-minor'} ? "true" : "false"); | |
295 | + $axisNode->getTick()->setMajorGrid($axisData->{'axis-grid-major'} ? "true" : "false"); | |
296 | + | |
297 | + //legend | |
298 | + $axisNode->getLegend()->setText($axisData->{'-text'}); | |
299 | + $this->unmarshallLabel($axisData, "axis-legend", $axisNode->getLegend()); | |
300 | + } | |
301 | + | |
184 | 302 | protected function unmarshallTitle($inputData, $keyPrefix, $titleNode) |
185 | 303 | { |
186 | 304 | if ($inputData->{$keyPrefix.'-text'} != '') | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotAxisElementNodeClass.php
1 | 1 | <?php |
2 | 2 | |
3 | 3 | define ("REQUESTOUTPUTPLOTAXISELEMENT_POSITION", "position"); |
4 | +define ("REQUESTOUTPUTPLOTAXISELEMENT_REVERSE", "reverse"); | |
5 | +define ("REQUESTOUTPUTPLOTAXISELEMENT_SCALE", "scale"); | |
6 | +define ("REQUESTOUTPUTPLOTAXISELEMENT_COLOR", "color"); | |
7 | +define ("REQUESTOUTPUTPLOTAXISELEMENT_THICKNESS", "thickness"); | |
4 | 8 | |
5 | 9 | define ("REQUESTOUTPUTPLOTAXISELEMENTRANGE_NAME", "range"); |
6 | 10 | define ("REQUESTOUTPUTPLOTAXISELEMENTRANGE_MIN", "min"); |
7 | 11 | define ("REQUESTOUTPUTPLOTAXISELEMENTRANGE_MAX", "max"); |
8 | 12 | define ("REQUESTOUTPUTPLOTAXISELEMENTRANGE_EXTEND", "extend"); |
9 | 13 | |
14 | +define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_NAME", "tick"); | |
15 | +define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_POSITION", "position"); | |
16 | +define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_MINORGRID", "minorGrid"); | |
17 | +define ("REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRID", "majorGrid"); | |
18 | + | |
10 | 19 | define ("REQUESTOUTPUTPLOTAXISELEMENTLEGEND_NAME", "legend"); |
11 | 20 | define ("REQUESTOUTPUTPLOTAXISELEMENTLEGEND_TEXT", "text"); |
12 | 21 | |
22 | +abstract class RequestOutputPlotAxisElementScale | |
23 | +{ | |
24 | + const LINEAR = "linear"; | |
25 | + const LOGARITHMIC = "logarithmic"; | |
26 | +} | |
27 | + | |
28 | +abstract class RequestOutputPlotAxisElementTickPosition | |
29 | +{ | |
30 | + const INWARDS = "inwards"; | |
31 | + const OUTWARDS = "outwards"; | |
32 | +} | |
33 | + | |
13 | 34 | /** |
14 | 35 | * @class RequestOutputPlotAxisElementRangeNodeClass |
15 | 36 | * @brief Definition of range for an axis |
... | ... | @@ -50,11 +71,54 @@ class RequestOutputPlotAxisElementRangeNodeClass extends NodeClass |
50 | 71 | } |
51 | 72 | |
52 | 73 | /** |
74 | + * @class RequestOutputPlotAxisElementTickClass | |
75 | + * @brief Definition of ticks for an axis | |
76 | + * @details | |
77 | + */ | |
78 | +class RequestOutputPlotAxisElementTickClass extends NodeClass | |
79 | +{ | |
80 | + public function __construct() | |
81 | + { | |
82 | + parent::__construct(REQUESTOUTPUTPLOTAXISELEMENTTICK_NAME); | |
83 | + } | |
84 | + | |
85 | + public function setPosition($position) | |
86 | + { | |
87 | + $this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_POSITION, $position); | |
88 | + } | |
89 | + | |
90 | + public function getPosition() | |
91 | + { | |
92 | + return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_POSITION); | |
93 | + } | |
94 | + | |
95 | + public function setMinorGrid($minorGrid) | |
96 | + { | |
97 | + $this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MINORGRID, $minorGrid); | |
98 | + } | |
99 | + | |
100 | + public function getMinorGrid() | |
101 | + { | |
102 | + return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MINORGRID); | |
103 | + } | |
104 | + | |
105 | + public function setMajorGrid($majorGrid) | |
106 | + { | |
107 | + $this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRID, $majorGrid); | |
108 | + } | |
109 | + | |
110 | + public function getMajorGrid() | |
111 | + { | |
112 | + return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENTTICK_MAJORGRID); | |
113 | + } | |
114 | +} | |
115 | + | |
116 | +/** | |
53 | 117 | * @class RequestOutputPlotAxisElementLegendNodeClass |
54 | 118 | * @brief Definition of legend for an axis |
55 | 119 | * @details |
56 | 120 | */ |
57 | -class RequestOutputPlotAxisElementLegendNodeClass extends NodeClass | |
121 | +class RequestOutputPlotAxisElementLegendNodeClass extends RequestOutputPlotLabelNodeClass | |
58 | 122 | { |
59 | 123 | public function __construct() |
60 | 124 | { |
... | ... | @@ -89,6 +153,10 @@ class RequestOutputPlotAxisElementNodeClass extends NodeClass |
89 | 153 | $node = new RequestOutputPlotAxisElementRangeNodeClass(); |
90 | 154 | $this->addChild($node); |
91 | 155 | |
156 | + //tick | |
157 | + $node = new RequestOutputPlotAxisElementTickClass(); | |
158 | + $this->addChild($node); | |
159 | + | |
92 | 160 | //legend |
93 | 161 | $node = new RequestOutputPlotAxisElementLegendNodeClass(); |
94 | 162 | $this->addChild($node); |
... | ... | @@ -99,7 +167,10 @@ class RequestOutputPlotAxisElementNodeClass extends NodeClass |
99 | 167 | return $this->getFirstChildByName(REQUESTOUTPUTPLOTAXISELEMENTRANGE_NAME); |
100 | 168 | } |
101 | 169 | |
102 | - /* ToDo tick */ | |
170 | + public function getTick() | |
171 | + { | |
172 | + return $this->getFirstChildByName(REQUESTOUTPUTPLOTAXISELEMENTTICK_NAME); | |
173 | + } | |
103 | 174 | |
104 | 175 | public function getLegend() |
105 | 176 | { |
... | ... | @@ -120,15 +191,47 @@ class RequestOutputPlotAxisElementNodeClass extends NodeClass |
120 | 191 | return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_POSITION); |
121 | 192 | } |
122 | 193 | |
123 | - /* ToDo thickness */ | |
194 | + public function setThickness($thickness) | |
195 | + { | |
196 | + $this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_THICKNESS, $thickness); | |
197 | + } | |
124 | 198 | |
125 | - /* ToDo ColorGroup */ | |
199 | + public function getThickness() | |
200 | + { | |
201 | + return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_THICKNESS); | |
202 | + } | |
203 | + | |
204 | + public function setColor($color) | |
205 | + { | |
206 | + $this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_COLOR, $color); | |
207 | + } | |
208 | + | |
209 | + public function getColor() | |
210 | + { | |
211 | + return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_COLOR); | |
212 | + } | |
213 | + | |
214 | + public function setReverse($reverse) | |
215 | + { | |
216 | + $this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_REVERSE, $reverse); | |
217 | + } | |
126 | 218 | |
127 | - /* ToDo reverse */ | |
219 | + public function getReverse() | |
220 | + { | |
221 | + return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_REVERSE); | |
222 | + } | |
128 | 223 | |
129 | 224 | /* ToDo visible */ |
130 | 225 | |
131 | - /* ToDo scale */ | |
226 | + public function setScale($scale) | |
227 | + { | |
228 | + $this->setAttribute(REQUESTOUTPUTPLOTAXISELEMENT_SCALE, $scale); | |
229 | + } | |
230 | + | |
231 | + public function getScale() | |
232 | + { | |
233 | + return $this->getAttribute(REQUESTOUTPUTPLOTAXISELEMENT_SCALE); | |
234 | + } | |
132 | 235 | |
133 | 236 | /* ToDo showLegend */ |
134 | 237 | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotColorAxisNodeClass.php
... | ... | @@ -5,6 +5,9 @@ require_once("RequestOutputPlotAxisElementNodeClass.php"); |
5 | 5 | define ("REQUESTOUTPUTPLOTCOLORAXIS_NAME", "colorAxis"); |
6 | 6 | define ("REQUESTOUTPUTPLOTCOLORAXIS_ID", "id"); |
7 | 7 | define ("REQUESTOUTPUTPLOTCOLORAXIS_MAPINDEX", "colorMapIndex"); |
8 | +define ("REQUESTOUTPUTPLOTCOLORAXIS_MINVALCOLOR", "minValColor"); | |
9 | +define ("REQUESTOUTPUTPLOTCOLORAXIS_MAXVALCOLOR", "maxValColor"); | |
10 | + | |
8 | 11 | |
9 | 12 | /** |
10 | 13 | * @class RequestOutputPlotColorAxisNodeClass |
... | ... | @@ -23,7 +26,26 @@ class RequestOutputPlotColorAxisNodeClass extends RequestOutputPlotAxisElementNo |
23 | 26 | { |
24 | 27 | $this->setAttribute(REQUESTOUTPUTPLOTCOLORAXIS_MAPINDEX, $mapIndex); |
25 | 28 | } |
26 | - /* ToDo min max valcolor */ | |
29 | + | |
30 | + public function setMinValColor($minValColor) | |
31 | + { | |
32 | + $this->setAttribute(REQUESTOUTPUTPLOTCOLORAXIS_MINVALCOLOR, $minValColor); | |
33 | + } | |
34 | + | |
35 | + public function getMinValColor() | |
36 | + { | |
37 | + return $this->getAttribute(REQUESTOUTPUTPLOTCOLORAXIS_MINVALCOLOR); | |
38 | + } | |
39 | + | |
40 | + public function setMaxValColor($maxValColor) | |
41 | + { | |
42 | + $this->setAttribute(REQUESTOUTPUTPLOTCOLORAXIS_MAXVALCOLOR, $maxValColor); | |
43 | + } | |
44 | + | |
45 | + public function getMaxValColor() | |
46 | + { | |
47 | + return $this->getAttribute(REQUESTOUTPUTPLOTCOLORAXIS_MAXVALCOLOR); | |
48 | + } | |
27 | 49 | } |
28 | 50 | |
29 | 51 | ?> |
30 | 52 | \ No newline at end of file | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotEpochAxisNodeClass.php
0 โ 100644
... | ... | @@ -0,0 +1,31 @@ |
1 | +<?php | |
2 | + | |
3 | +require_once("RequestOutputPlotAxisElementNodeClass.php"); | |
4 | + | |
5 | +define ("REQUESTOUTPUTPLOTEPOCHAXIS_NAME", "epochAxis"); | |
6 | +define ("REQUESTOUTPUTPLOTEPOCHAXIS_NORMALIZED", "normalized"); | |
7 | + | |
8 | +/** | |
9 | + * @class RequestOutputPlotEpochAxisNodeClass | |
10 | + * @brief Definition of an epoch axis element for a plot element of a plot request | |
11 | + * @details | |
12 | +*/ | |
13 | +class RequestOutputPlotEpochAxisNodeClass extends RequestOutputPlotAxisElementNodeClass | |
14 | +{ | |
15 | + public function __construct() | |
16 | + { | |
17 | + parent::__construct(REQUESTOUTPUTPLOTEPOCHAXIS_NAME); | |
18 | + } | |
19 | + | |
20 | + public function setNormalized($normalized) | |
21 | + { | |
22 | + $this->setAttribute(REQUESTOUTPUTPLOTEPOCHAXIS_NORMALIZED, $normalized); | |
23 | + } | |
24 | + | |
25 | + public function getNormalized() | |
26 | + { | |
27 | + return $this->getAttribute(REQUESTOUTPUTPLOTEPOCHAXIS_NORMALIZED); | |
28 | + } | |
29 | +} | |
30 | + | |
31 | +?> | |
0 | 32 | \ No newline at end of file | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotLabelNodeClass.php
0 โ 100644
... | ... | @@ -0,0 +1,72 @@ |
1 | +<?php | |
2 | + | |
3 | +define ("REQUESTOUTPUTPLOTLABEL_FONTNAME", "fontName"); | |
4 | +define ("REQUESTOUTPUTPLOTLABEL_FONTSIZE", "fontSize"); | |
5 | +define ("REQUESTOUTPUTPLOTLABEL_STYLE", "style"); | |
6 | +define ("REQUESTOUTPUTPLOTLABEL_COLOR", "color"); | |
7 | +define ("REQUESTOUTPUTPLOTLABEL_COLORMAPINDEX", "colorMapIndex"); | |
8 | + | |
9 | +/** | |
10 | + * @class RequestOutputPlotTitleNodeClass | |
11 | + * @brief Definition of a title for a plot request | |
12 | + * @details | |
13 | +*/ | |
14 | +class RequestOutputPlotLabelNodeClass extends NodeClass | |
15 | +{ | |
16 | + public function __construct($nodeName) | |
17 | + { | |
18 | + parent::__construct($nodeName); | |
19 | + } | |
20 | + | |
21 | + public function setFontName($fontName) | |
22 | + { | |
23 | + $this->setAttribute(REQUESTOUTPUTPLOTLABEL_FONTNAME, $fontName); | |
24 | + } | |
25 | + | |
26 | + public function getFontName() | |
27 | + { | |
28 | + return $this->getAttribute(REQUESTOUTPUTPLOTLABEL_FONTNAME); | |
29 | + } | |
30 | + | |
31 | + public function setFontSize($fontSize) | |
32 | + { | |
33 | + $this->setAttribute(REQUESTOUTPUTPLOTLABEL_FONTSIZE, $fontSize); | |
34 | + } | |
35 | + | |
36 | + public function getFontSize() | |
37 | + { | |
38 | + return $this->getAttribute(REQUESTOUTPUTPLOTLABEL_FONTSIZE); | |
39 | + } | |
40 | + | |
41 | + public function setFontStyle($style) | |
42 | + { | |
43 | + $this->setAttribute(REQUESTOUTPUTPLOTLABEL_STYLE, $style); | |
44 | + } | |
45 | + | |
46 | + public function getFontStyle() | |
47 | + { | |
48 | + return $this->getAttribute(REQUESTOUTPUTPLOTLABEL_STYLE); | |
49 | + } | |
50 | + | |
51 | + public function setColor($color) | |
52 | + { | |
53 | + $this->setAttribute(REQUESTOUTPUTPLOTLABEL_COLOR, $color); | |
54 | + } | |
55 | + | |
56 | + public function getColor() | |
57 | + { | |
58 | + return $this->getAttribute(REQUESTOUTPUTPLOTLABEL_COLOR); | |
59 | + } | |
60 | + | |
61 | + public function setColorMapIndex($colorMapIndex) | |
62 | + { | |
63 | + $this->setAttribute(REQUESTOUTPUTPLOTLABEL_COLORMAPINDEX, $colorMapIndex); | |
64 | + } | |
65 | + | |
66 | + public function getColorMapIndex() | |
67 | + { | |
68 | + return $this->getAttribute(REQUESTOUTPUTPLOTLABEL_COLORMAPINDEX); | |
69 | + } | |
70 | +} | |
71 | + | |
72 | +?> | |
0 | 73 | \ No newline at end of file | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotPanelNodeClass.php
... | ... | @@ -5,6 +5,7 @@ require_once("RequestOutputPlotElementXYNodeClass.php"); |
5 | 5 | |
6 | 6 | define ("REQUESTOUTPUTPLOTPANEL_NAME", "panel"); |
7 | 7 | define ("REQUESTOUTPUTPLOTPANEL_TITLE", "title"); |
8 | +define ("REQUESTOUTPUTPLOTPANEL_BACKGROUNDCOLOR", "backgroundColor"); | |
8 | 9 | |
9 | 10 | abstract class RequestOutputPlotElementTypeEnum |
10 | 11 | { |
... | ... | @@ -22,24 +23,44 @@ class RequestOutputPlotPanelNodeClass extends NodeClass |
22 | 23 | public function __construct() |
23 | 24 | { |
24 | 25 | parent::__construct(REQUESTOUTPUTPLOTPANEL_NAME); |
25 | - //default attributes | |
26 | - $this->setTitle(""); | |
27 | 26 | } |
28 | 27 | |
28 | + public function setBackgroundColor($color) | |
29 | + { | |
30 | + $this->setAttribute(REQUESTOUTPUTPLOTPANEL_BACKGROUNDCOLOR, $color); | |
31 | + } | |
32 | + | |
33 | + public function getBackgroundColor() | |
34 | + { | |
35 | + return $this->getAttribute(REQUESTOUTPUTPLOTPANEL_BACKGROUNDCOLOR); | |
36 | + } | |
37 | + | |
29 | 38 | /* ToDo bounds */ |
30 | 39 | |
31 | - /* ToDo font */ | |
32 | - | |
33 | - public function setTitle($title) | |
40 | + public function getFont() | |
34 | 41 | { |
35 | - $node = $this->getChildInstanceByName(REQUESTOUTPUTPLOTPANEL_TITLE, true); | |
36 | - $node->setValue($title); | |
42 | + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTFONT_NODENAME); | |
43 | + | |
44 | + if (!isset($node)) | |
45 | + { | |
46 | + $node = new RequestOutputPlotFontNodeClass(); | |
47 | + $this->addChild($node); | |
48 | + } | |
49 | + | |
50 | + return $node; | |
37 | 51 | } |
38 | 52 | |
39 | 53 | public function getTitle() |
40 | 54 | { |
41 | - $node = $this->getChildInstanceByName(REQUESTOUTPUTPLOTPANEL_TITLE); | |
42 | - return (($node == NULL) ? "" : $node->getValue()); | |
55 | + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTPANEL_TITLE); | |
56 | + | |
57 | + if (!isset($node)) | |
58 | + { | |
59 | + $node = new RequestOutputPlotTitleNodeClass(); | |
60 | + $this->addChild($node); | |
61 | + } | |
62 | + | |
63 | + return $node; | |
43 | 64 | } |
44 | 65 | |
45 | 66 | public function addPlotElement($type) | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotTitleNodeClass.php
... | ... | @@ -18,18 +18,12 @@ abstract class RequestOutputPlotTitleAlign |
18 | 18 | define ("REQUESTOUTPUTPLOTTITLE_NAME", "title"); |
19 | 19 | define ("REQUESTOUTPUTPLOTTITLE_POSITION", "position"); |
20 | 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 | 21 | /** |
28 | 22 | * @class RequestOutputPlotTitleNodeClass |
29 | 23 | * @brief Definition of a title for a plot request |
30 | 24 | * @details |
31 | 25 | */ |
32 | -class RequestOutputPlotTitleNodeClass extends NodeClass | |
26 | +class RequestOutputPlotTitleNodeClass extends RequestOutputPlotLabelNodeClass | |
33 | 27 | { |
34 | 28 | public function __construct() |
35 | 29 | { |
... | ... | @@ -65,56 +59,6 @@ class RequestOutputPlotTitleNodeClass extends NodeClass |
65 | 59 | { |
66 | 60 | return $this->getAttribute(REQUESTOUTPUTPLOTTITLE_ALIGN); |
67 | 61 | } |
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 | 62 | } |
119 | 63 | |
120 | 64 | ?> |
121 | 65 | \ No newline at end of file | ... | ... |
test/debug_request.php
1 | 1 | <?php |
2 | 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}]}'; | |
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-16T00:00:00","stopDate":"2015-08-17T00: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,"panels":[{"panel-background-color":"#0000FF","panel-title-text":"Coucou xy plot","panel-title-color":"#000000","panel-title-position":"top","panel-title-alignment":"right","panel-title-font-activated":false,"panel-title-font-name":"sans-serif","panel-title-font-size":12,"panel-title-font-bold":false,"panel-title-font-italic":false,"panel-margin-x":0,"panel-margin-y":0,"panel-plot-type":"xyPlot","panel-font-activated":false,"panel-font-name":"sans-serif","panel-font-size":12,"panel-font-bold":false,"panel-font-italic":false,"axes":[{"axis-type":"x","axis-reverse":false,"axis-scale":"linear","axis-range-min":0,"axis-range-max":0,"axis-range-extend":true,"axis-color":"#000000","axis-thickness":1,"axis-tick-position":"outwards","axis-grid-minor":false,"axis-grid-major":false,"axis-legend-text":"","axis-legend-color":"#000000","axis-legend-font-activated":false,"axis-legend-font-name":"sans-serif","axis-legend-font-size":12,"axis-legend-font-bold":false,"axis-legend-font-italic":false},{"axis-type":"y-left","axis-reverse":false,"axis-scale":"linear","axis-range-min":0,"axis-range-max":0,"axis-range-extend":true,"axis-color":"#000000","axis-thickness":1,"axis-tick-position":"outwards","axis-grid-minor":false,"axis-grid-major":false,"axis-legend-text":"","axis-legend-color":"#000000","axis-legend-font-activated":false,"axis-legend-font-name":"sans-serif","axis-legend-font-size":12,"axis-legend-font-bold":false,"axis-legend-font-italic":false},{"axis-type":"y-right","axis-reverse":false,"axis-scale":"linear","axis-range-min":0,"axis-range-max":0,"axis-range-extend":true,"axis-color":"#000000","axis-thickness":1,"axis-tick-position":"outwards","axis-grid-minor":false,"axis-grid-major":false,"axis-legend-text":"","axis-legend-color":"#000000","axis-legend-font-activated":false,"axis-legend-font-name":"sans-serif","axis-legend-font-size":12,"axis-legend-font-bold":false,"axis-legend-font-italic":false},{"axis-type":"color","axis-reverse":false,"axis-scale":"linear","axis-range-min":0,"axis-range-max":0,"axis-range-extend":true,"axis-color":"#000000","axis-thickness":1,"axis-tick-position":"outwards","axis-grid-minor":false,"axis-grid-major":false,"axis-legend-text":"","axis-legend-color":"#000000","axis-legend-font-activated":false,"axis-legend-font-name":"sans-serif","axis-legend-font-size":12,"axis-legend-font-bold":false,"axis-legend-font-italic":false,"axis-color-map":"1","axis-color-minval":"none","axis-color-maxval":"none"}]},{"panel-background-color":"#FF0000","panel-title-text":"","panel-title-color":"#000000","panel-title-position":"bottom","panel-title-alignment":" center","panel-title-font-activated":false,"panel-title-font-name":"sans-serif","panel-title-font-size":12,"panel-title-font-bold":false,"panel-title-font-italic":false,"panel-margin-x":0,"panel-margin-y":0,"panel-plot-type":"timePlot","panel-font-activated":false,"panel-font-name":"sans-serif","panel-font-size":12,"panel-font-bold":false,"panel-font-italic":false,"axes":[{"axis-type":"time","axis-reverse":false,"axis-scale":"linear","axis-range-min":0,"axis-range-max":0,"axis-range-extend":true,"axis-color":"#000000","axis-thickness":1,"axis-tick-position":"outwards","axis-grid-minor":false,"axis-grid-major":false,"axis-legend-text":"","axis-legend-color":"#000000","axis-legend-font-activated":false,"axis-legend-font-name":"sans-serif","axis-legend-font-size":12,"axis-legend-font-bold":false,"axis-legend-font-italic":false,"axis-time-format":"dd/mm/yy"},{"axis-type":"y-left","axis-reverse":false,"axis-scale":"linear","axis-range-min":0,"axis-range-max":0,"axis-range-extend":true,"axis-color":"#000000","axis-thickness":1,"axis-tick-position":"outwards","axis-grid-minor":false,"axis-grid-major":false,"axis-legend-text":"","axis-legend-color":"#000000","axis-legend-font-activated":false,"axis-legend-font-name":"sans-serif","axis-legend-font-size":12,"axis-legend-font-bold":false,"axis-legend-font-italic":false},{"axis-type":"y-right","axis-reverse":false,"axis-scale":"linear","axis-range-min":0,"axis-range-max":0,"axis-range-extend":true,"axis-color":"#000000","axis-thickness":1,"axis-tick-position":"outwards","axis-grid-minor":false,"axis-grid-major":false,"axis-legend-text":"","axis-legend-color":"#000000","axis-legend-font-activated":false,"axis-legend-font-name":"sans-serif","axis-legend-font-size":12,"axis-legend-font-bold":false,"axis-legend-font-italic":false},{"axis-type":"color","axis-reverse":false,"axis-scale":"linear","axis-range-min":0,"axis-range-max":0,"axis-range-extend":true,"axis-color":"#000000","axis-thickness":1,"axis-tick-position":"outwards","axis-grid-minor":false,"axis-grid-major":false,"axis-legend-text":"","axis-legend-color":"#000000","axis-legend-font-activated":false,"axis-legend-font-name":"sans-serif","axis-legend-font-size":12,"axis-legend-font-bold":false,"axis-legend-font-italic":false,"axis-color-map":"1","axis-color-minval":"none","axis-color-maxval":"none"}]}]}]}'; | |
4 | 4 | |
5 | 5 | $debug = array("Debug - Test 1" => $debug_1); |
6 | 6 | ... | ... |