Commit d7f73bcb7b48da81832058f68b4e42da4d7c4561
1 parent
ab13f26c
Exists in
master
and in
66 other branches
Integration for curve definition
Showing
5 changed files
with
169 additions
and
12 deletions
Show diff stats
src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
... | ... | @@ -524,11 +524,11 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
524 | 524 | { |
525 | 525 | case 'serie' : |
526 | 526 | $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); |
527 | - $this->unmarshallYSerie($paramData->{'param-drawing-object'}, $plotNode, $paramNode, $paramInfo['indexes'], $isScatter && ($paramData->{'param-drawing-object'}->{'serie-xaxis-param'} != ''), $colorSerieId); | |
527 | + $this->unmarshallYSerie($paramData, $plotNode, $paramNode, $paramInfo['indexes'], $isScatter && ($paramData->{'param-drawing-object'}->{'serie-xaxis-param'} != ''), $colorSerieId); | |
528 | 528 | break; |
529 | 529 | case 'spectro' : |
530 | 530 | $paramNode = $plotNode->getParams()->getParamById($paramInfo['id']); |
531 | - $this->unmarshallSpectro($paramData->{'param-drawing-object'}, $plotNode, $paramNode, $paramInfo['indexes']); | |
531 | + $this->unmarshallSpectro($paramData, $plotNode, $paramNode, $paramInfo['indexes']); | |
532 | 532 | break; |
533 | 533 | case 'status-bar' : |
534 | 534 | if (($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTSTATUS_NAME) && !isset($statusPlotNode)) |
... | ... | @@ -592,21 +592,30 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
592 | 592 | } |
593 | 593 | } |
594 | 594 | |
595 | - protected function unmarshallYSerie($paramDrawingData, $plotNode, $paramNode, $indexes, $useXAxis, $colorSerieId) | |
595 | + protected function unmarshallYSerie($paramData, $plotNode, $paramNode, $indexes, $useXAxis, $colorSerieId) | |
596 | 596 | { |
597 | 597 | $serieNodes = array(); |
598 | 598 | |
599 | 599 | if (count($indexes) == 0) |
600 | - $serieNodes[] = $paramNode->addYSerie($paramDrawingData->{'serie-yaxis'}, -1, $useXAxis ? REQUESTOUTPUTPLOTELEMENTXY_XAXISID : '', $colorSerieId); | |
600 | + { | |
601 | + $serieNode = $paramNode->addYSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, -1, $useXAxis ? REQUESTOUTPUTPLOTELEMENTXY_XAXISID : '', $colorSerieId); | |
602 | + $serieNode->setId($paramData->{'id'}); | |
603 | + $serieNodes[] = $serieNode; | |
604 | + } | |
601 | 605 | foreach ($indexes as $index) |
602 | - $serieNodes[] = $paramNode->addYSerie($paramDrawingData->{'serie-yaxis'}, $index, $useXAxis ? REQUESTOUTPUTPLOTELEMENTXY_XAXISID : '', $colorSerieId); | |
603 | - | |
606 | + { | |
607 | + $serieNode = $paramNode->addYSerie($paramData->{'param-drawing-object'}->{'serie-yaxis'}, $index, $useXAxis ? REQUESTOUTPUTPLOTELEMENTXY_XAXISID : '', $colorSerieId); | |
608 | + if (count($indexes) == 1) | |
609 | + $serieNode->setId($paramData->{'id'}); | |
610 | + $serieNodes[] = $serieNode; | |
611 | + } | |
612 | + | |
604 | 613 | foreach ($serieNodes as $serieNode) |
605 | 614 | { |
606 | 615 | //Resampling |
607 | 616 | if ($plotNode->getName() == REQUESTOUTPUTPLOTELEMENTXY_NAME) |
608 | 617 | { |
609 | - switch ($paramDrawingData->{'serie-resampling-mode'}) | |
618 | + switch ($paramData->{'param-drawing-object'}->{'serie-resampling-mode'}) | |
610 | 619 | { |
611 | 620 | case 'yparam' : |
612 | 621 | $serieNode->getResampling()->setType(RequestOutputPlotResamplingTypeEnum::YPARAM); |
... | ... | @@ -617,15 +626,15 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
617 | 626 | } |
618 | 627 | } |
619 | 628 | //Line |
620 | - $this->unmarshallLine($paramDrawingData, 'serie', $serieNode->getLine(), $paramDrawingData->{"serie-lines-activated"} ? RequestOutputPlotLineTypeEnum::LINE : RequestOutputPlotLineTypeEnum::NO); | |
629 | + $this->unmarshallLine($paramData->{'param-drawing-object'}, 'serie', $serieNode->getLine(), $paramData->{'param-drawing-object'}->{"serie-lines-activated"} ? RequestOutputPlotLineTypeEnum::LINE : RequestOutputPlotLineTypeEnum::NO); | |
621 | 630 | //Symbol |
622 | - if (!$paramDrawingData->{"serie-symbols-activated"}) | |
631 | + if (!$paramData->{'param-drawing-object'}->{"serie-symbols-activated"}) | |
623 | 632 | $serieNode->getSymbol()->setType(RequestOutputPlotSymbolTypeEnum::NO); |
624 | 633 | else |
625 | - $this->unmarshallSymbol($paramDrawingData, 'serie-symbols', $serieNode->getSymbol()); | |
634 | + $this->unmarshallSymbol($paramData->{'param-drawing-object'}, 'serie-symbols', $serieNode->getSymbol()); | |
626 | 635 | //Time tick |
627 | - if (isset($paramDrawingData->{'serie-timetick'})) | |
628 | - $this->unmarshallTimeTick($paramDrawingData->{'serie-timetick'}, $serieNode->getTimeTicks()); | |
636 | + if (isset($paramData->{'param-drawing-object'}->{'serie-timetick'})) | |
637 | + $this->unmarshallTimeTick($paramData->{'param-drawing-object'}->{'serie-timetick'}, $serieNode->getTimeTicks()); | |
629 | 638 | } |
630 | 639 | } |
631 | 640 | |
... | ... | @@ -805,6 +814,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
805 | 814 | protected function unmarshallConstant($constantData,$axisNode) |
806 | 815 | { |
807 | 816 | $constantNode = $axisNode->addConstant(); |
817 | + $constantNode->setId($constantData->{'id'}); | |
808 | 818 | |
809 | 819 | //Constant value |
810 | 820 | switch ($axisNode->getName()) |
... | ... | @@ -827,6 +837,8 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
827 | 837 | { |
828 | 838 | foreach ($panelData->{'textObjs'} as $textData) |
829 | 839 | $this->unmarshallTextObject($textData, $addObjectsNode, $isTimePlot); |
840 | + foreach ($panelData->{'curves'} as $curveData) | |
841 | + $this->unmarshallCurveObject($curveData, $addObjectsNode); | |
830 | 842 | } |
831 | 843 | |
832 | 844 | protected function unmarshallTextObject($textData, $addObjectsNode, $isTimePlot) |
... | ... | @@ -884,6 +896,24 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
884 | 896 | $this->unmarshallFont($textData, 'text-font', $textNode->getFont()); |
885 | 897 | } |
886 | 898 | |
899 | + protected function unmarshallCurveObject($curveData, $addObjectsNode) | |
900 | + { | |
901 | + if (($curveData->{'curve-name'} == '') || !isset($curveData->{'curve-serie-id'})) | |
902 | + return; | |
903 | + | |
904 | + $curveNode = $addObjectsNode->addCurveObject(); | |
905 | + | |
906 | + $curveNode->setSerieId($curveData->{'curve-serie-id'}); | |
907 | + | |
908 | + $curveNode->getFunction()->setFunctionName($curveData->{'curve-name'}); | |
909 | + | |
910 | + foreach ($curveData->{'params'} as $paramData) | |
911 | + $curveNode->getFunction()->addAttribute($paramData->{'curve-param-name'}, $paramData->{'curve-param-value'}); | |
912 | + | |
913 | + //Curve options | |
914 | + $this->unmarshallCurve($curveData, "curve-line", $curveNode); | |
915 | + } | |
916 | + | |
887 | 917 | protected function unmarshallTitle($inputData, $keyPrefix, $titleNode) |
888 | 918 | { |
889 | 919 | if ($inputData->{$keyPrefix.'-text'} != '') | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotAdditionalObjectsNodeClass.php
... | ... | @@ -20,6 +20,13 @@ class RequestOutputPlotAdditionalObjectsNodeClass extends NodeClass |
20 | 20 | $this->addChild($node); |
21 | 21 | return $node; |
22 | 22 | } |
23 | + | |
24 | + public function addCurveObject() | |
25 | + { | |
26 | + $node = new RequestOutputPlotCurveObjectNodeClass(); | |
27 | + $this->addChild($node); | |
28 | + return $node; | |
29 | + } | |
23 | 30 | } |
24 | 31 | |
25 | 32 | ?> |
26 | 33 | \ No newline at end of file | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotConstantNodeClass.php
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | |
3 | 3 | define ("REQUESTOUTPUTPLOTCONSTANT_NAME", "constantLine"); |
4 | 4 | define ("REQUESTOUTPUTPLOTCONSTANT_VALUE", "value"); |
5 | +define ("REQUESTOUTPUTPLOTCONSTANT_ID", "id"); | |
5 | 6 | |
6 | 7 | /** |
7 | 8 | * @class RequestOutputPlotConstantNodeClass |
... | ... | @@ -24,6 +25,16 @@ class RequestOutputPlotConstantNodeClass extends RequestOutputPlotCurveNodeClass |
24 | 25 | { |
25 | 26 | return $this->getAttribute(REQUESTOUTPUTPLOTCONSTANT_VALUE); |
26 | 27 | } |
28 | + | |
29 | + public function setId($id) | |
30 | + { | |
31 | + $this->setAttribute(REQUESTOUTPUTPLOTCONSTANT_ID, $id); | |
32 | + } | |
33 | + | |
34 | + public function getId() | |
35 | + { | |
36 | + return $this->getAttribute(REQUESTOUTPUTPLOTCONSTANT_ID); | |
37 | + } | |
27 | 38 | } |
28 | 39 | |
29 | 40 | ?> |
30 | 41 | \ No newline at end of file | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotCurveObjectNodeClass.php
0 โ 100644
... | ... | @@ -0,0 +1,98 @@ |
1 | +<?php | |
2 | + | |
3 | +define ("REQUESTOUTPUTPLOTCURVEOBJECT_NAME", "curvePlot"); | |
4 | +define ("REQUESTOUTPUTPLOTCURVEOBJECT_SERIEID", "serieId"); | |
5 | + | |
6 | +define ("REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_NAME", "function"); | |
7 | +define ("REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_FUNCTIONNAME", "name"); | |
8 | +define ("REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTES", "attributes"); | |
9 | +define ("REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTE", "attribute"); | |
10 | +define ("REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTENAME", "name"); | |
11 | +define ("REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTEVALUE", "value"); | |
12 | + | |
13 | +/** | |
14 | + * @class RequestOutputPlotCurveObjectFunctionNodeClass | |
15 | + * @brief Definition of a function for a curve object element of a plot | |
16 | + * @details | |
17 | + */ | |
18 | +class RequestOutputPlotCurveObjectFunctionNodeClass extends NodeClass | |
19 | +{ | |
20 | + public function __construct() | |
21 | + { | |
22 | + parent::__construct(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_NAME); | |
23 | + } | |
24 | + | |
25 | + public function setFunctionName($name) | |
26 | + { | |
27 | + $this->setAttribute(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_FUNCTIONNAME, $name); | |
28 | + } | |
29 | + | |
30 | + public function getFunctionName() | |
31 | + { | |
32 | + return $this->getAttribute(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_FUNCTIONNAME); | |
33 | + } | |
34 | + | |
35 | + public function getAttributes() | |
36 | + { | |
37 | + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTES); | |
38 | + | |
39 | + if (!isset($node)) | |
40 | + { | |
41 | + $node = new NodeClass(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTES); | |
42 | + $this->addChild($node); | |
43 | + } | |
44 | + | |
45 | + return $node; | |
46 | + } | |
47 | + | |
48 | + public function addAttribute($name, $value) | |
49 | + { | |
50 | + $attributesNode = $this->getAttributes(); | |
51 | + | |
52 | + $node = new NodeClass(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTE); | |
53 | + | |
54 | + $node->setAttribute(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTENAME, $name); | |
55 | + $node->setAttribute(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_ATTRIBUTEVALUE, $value); | |
56 | + | |
57 | + $attributesNode->addChild($node); | |
58 | + return $node; | |
59 | + } | |
60 | +} | |
61 | + | |
62 | +/** | |
63 | + * @class RequestOutputPlotCurveObjectNodeClass | |
64 | + * @brief Definition of a curve object element for a plot | |
65 | + * @details | |
66 | + */ | |
67 | +class RequestOutputPlotCurveObjectNodeClass extends RequestOutputPlotCurveNodeClass | |
68 | +{ | |
69 | + public function __construct() | |
70 | + { | |
71 | + parent::__construct(REQUESTOUTPUTPLOTCURVEOBJECT_NAME); | |
72 | + } | |
73 | + | |
74 | + public function setSerieId($serieId) | |
75 | + { | |
76 | + $this->setAttribute(REQUESTOUTPUTPLOTCURVEOBJECT_SERIEID, $serieId); | |
77 | + } | |
78 | + | |
79 | + public function getSerieId() | |
80 | + { | |
81 | + return $this->getAttribute(REQUESTOUTPUTPLOTCURVEOBJECT_SERIEID); | |
82 | + } | |
83 | + | |
84 | + public function getFunction() | |
85 | + { | |
86 | + $node = $this->getFirstChildByName(REQUESTOUTPUTPLOTCURVEOBJECTFUNCTION_NAME); | |
87 | + | |
88 | + if (!isset($node)) | |
89 | + { | |
90 | + $node = new RequestOutputPlotCurveObjectFunctionNodeClass(); | |
91 | + $this->addChild($node); | |
92 | + } | |
93 | + | |
94 | + return $node; | |
95 | + } | |
96 | +} | |
97 | + | |
98 | +?> | |
0 | 99 | \ No newline at end of file | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotYSerieNodeClass.php
... | ... | @@ -11,6 +11,7 @@ define ("REQUESTOUTPUTPLOTYSERIE_RESAMPLING", "resampling"); |
11 | 11 | define ("REQUESTOUTPUTPLOTYSERIE_LINE", "line"); |
12 | 12 | define ("REQUESTOUTPUTPLOTYSERIE_SYMBOL", "symbol"); |
13 | 13 | define ("REQUESTOUTPUTPLOTYSERIE_TIMETICKS", "timeTick"); |
14 | +define ("REQUESTOUTPUTPLOTYSERIE_ID", "id"); | |
14 | 15 | |
15 | 16 | /** |
16 | 17 | * @class RequestOutputPlotYSerieNodeClass |
... | ... | @@ -115,6 +116,16 @@ class RequestOutputPlotYSerieNodeClass extends NodeClass |
115 | 116 | |
116 | 117 | return $node; |
117 | 118 | } |
119 | + | |
120 | + public function setId($id) | |
121 | + { | |
122 | + $this->setAttribute(REQUESTOUTPUTPLOTYSERIE_ID, $id); | |
123 | + } | |
124 | + | |
125 | + public function getId() | |
126 | + { | |
127 | + return $this->getAttribute(REQUESTOUTPUTPLOTYSERIE_ID); | |
128 | + } | |
118 | 129 | } |
119 | 130 | |
120 | 131 | ?> |
121 | 132 | \ No newline at end of file | ... | ... |