Commit 00119293f1fced579002bd3f4de4c2ce829ac019
Exists in
FER_TFCat
Merge branch 'DAS2' into FER_TFCat
Showing
5 changed files
with
139 additions
and
11 deletions
Show diff stats
src/InputOutput/IHMImpl/ParamInfo/IHMInputOutputParamInfoClass.php
... | ... | @@ -368,6 +368,9 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface |
368 | 368 | if (isset($colorAxis)) { |
369 | 369 | $result_data['axes']['color'] = array(); |
370 | 370 | $this->unmarshallAxisData($colorAxis, $result_data['axes']['color']); |
371 | + $colorMapIndex = $colorAxis->getColorMapIndex(); | |
372 | + if (!empty($colorMapIndex)) | |
373 | + $result_data['axes']['color']['axis-color-map'] = $colorAxis->getColorMapIndex(); | |
371 | 374 | } |
372 | 375 | |
373 | 376 | $xAxis = $axesNode->getDigitalAxis(RequestOutputPlotAxisTypeEnum::XAXIS, 'xaxis_id'); | ... | ... |
src/InputOutput/IHMImpl/Params/IHMInputOutputParamsAbstractClass.php
... | ... | @@ -67,13 +67,18 @@ abstract class IHMInputOutputParamsAbstractClass implements InputOutputInterface |
67 | 67 | $requestNodes = $this->paramsData->getRequestNodes(); |
68 | 68 | $timesNode = $requestNodes[$requestIndex]->getTimesNode(); |
69 | 69 | |
70 | + | |
71 | + | |
70 | 72 | switch ($input->timesrc) |
71 | 73 | { |
72 | 74 | case "TimeTable" : |
73 | - if (($ttFileIndex >= 0) && ($ttFileIndex >= count($input->timeTables))) | |
74 | - $ttFileIndex = 0; | |
75 | - if($ttFileIndex < 0) | |
76 | - $ttFileIndex = count($input->timeTables) -1; | |
75 | + if ($ttIntIndex >= 0) { | |
76 | + if (($ttFileIndex >= 0) && ($ttFileIndex >= count($input->timeTables))) | |
77 | + $ttFileIndex = 0; | |
78 | + if($ttFileIndex < 0) | |
79 | + $ttFileIndex = count($input->timeTables) -1; | |
80 | + } | |
81 | + | |
77 | 82 | $crtIndex = 0; |
78 | 83 | foreach ($input->timeTables as $tt) |
79 | 84 | { | ... | ... |
src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
... | ... | @@ -343,7 +343,6 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
343 | 343 | $statusPlotNode->setColorMap($panelData->{'panel-status-colormap'}); |
344 | 344 | } |
345 | 345 | } |
346 | - | |
347 | 346 | //Axes |
348 | 347 | foreach ($panelData->{'axes'} as $axisData) |
349 | 348 | $this->unmarshallAxis($axisData, $panelData->{'constants'}, $plotNode); |
... | ... | @@ -2039,12 +2038,119 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
2039 | 2038 | $axis->{"axis-legend-font-bold"} = TRUE; |
2040 | 2039 | } |
2041 | 2040 | |
2041 | + private function setPanelTitleStyle($panel){ | |
2042 | + $panel->{"panel-title-font-activated"} = TRUE; | |
2043 | + $panel->{"panel-title-font-size"} = 12; | |
2044 | + $panel->{"panel-title-font-bold"} = TRUE; | |
2045 | + } | |
2046 | + | |
2047 | + private function setHistoXAxis($crtXAxis, $input) | |
2048 | + { | |
2049 | + $crtXAxis->{"id"} = 'xaxis_id'; | |
2050 | + $crtXAxis->{"axis-type"} = "x"; | |
2051 | + $crtXAxis->{'axis-range-max'} = $input->{'histo1d-xmax'}; | |
2052 | + $crtXAxis->{'axis-range-min'} = $input->{'histo1d-xmin'}; | |
2053 | + $crtXAxis->{"axis-scale"} = $input->scale_abscisse; | |
2054 | + } | |
2055 | + | |
2056 | + | |
2057 | + private function unmarshallPlotFunctionHisto($input, $plotInput) | |
2058 | + { | |
2059 | + $panels = []; | |
2060 | + | |
2061 | + foreach ($plotInput->{'panels'} as $input_panel) { | |
2062 | + if ($input->{'panelId'} == $input_panel->{'id'}) { | |
2063 | + // Clone the input panel to avoid modifying the original object | |
2064 | + $panel = clone ($input_panel); | |
2065 | + | |
2066 | + // Set the panel type to 'histoPlot' | |
2067 | + $panel->{'panel-plot-type'} = 'histoPlot'; | |
2068 | + | |
2069 | + // Apply panel title style | |
2070 | + $this->setPanelTitleStyle($panel); | |
2071 | + | |
2072 | + // Initialize 'params' as an empty array | |
2073 | + $panel->{"params"} = []; | |
2074 | + | |
2075 | + foreach ($input_panel->{'params'} as $param) { | |
2076 | + $crtParam = clone ($param); | |
2077 | + | |
2078 | + // Check if 'spectro-yaxis' exists, if so, throw an exception | |
2079 | + if (isset($crtParam->{'param-drawing-object'}->{'spectro-yaxis'})) { | |
2080 | + throw new Exception('Cannot apply Histogram 1D on Spectro.'); | |
2081 | + } else { | |
2082 | + // If not, set 'histo1d-color' based on 'serie-lines-color' | |
2083 | + $crtParam->{'param-drawing-object'}->{'histo1d-color'} = $param->{'param-drawing-object'}->{'serie-lines-color'}; | |
2084 | + } | |
2085 | + | |
2086 | + // Set other parameters | |
2087 | + $crtParam->{'param-drawing-type'} = 'histogram1d'; | |
2088 | + $crtParam->{'param-drawing-object'}->{'histo1d-xbinnumber'} = $input->{'histo1d-xbinnumber'}; | |
2089 | + $crtParam->{'param-drawing-object'}->{'histo1d-function'} = $input->{'histo1d-function'}; | |
2090 | + | |
2091 | + // Add the modified parameter to the 'params' array | |
2092 | + $panel->{"params"}[] = $crtParam; | |
2093 | + } | |
2094 | + | |
2095 | + // Find and clone the X-axis | |
2096 | + $crtXAxis = NULL; | |
2097 | + foreach ($panel->{'axes'} as $axis) { | |
2098 | + if ("time" == $axis->{'id'}) { | |
2099 | + $crtXAxis = clone ($axis); | |
2100 | + $this->setHistoXAxis($crtXAxis, $input); | |
2101 | + break; | |
2102 | + } | |
2103 | + } | |
2104 | + | |
2105 | + // Find and clone the Y-axis | |
2106 | + $firstParam = $panel->{"params"}[0]; | |
2107 | + $crtYAxis = NULL; | |
2108 | + foreach ($panel->{'axes'} as $axis) { | |
2109 | + if ($firstParam->{'param-drawing-object'}->{'serie-yaxis'} == $axis->{'id'}) { | |
2110 | + $crtYAxis = clone ($axis); | |
2111 | + $crtYAxis->{"axis-scale"} = $input->scale_ordonnee; | |
2112 | + break; | |
2113 | + } | |
2114 | + } | |
2115 | + | |
2116 | + // Throw an exception if Y-axis is not found | |
2117 | + if (!$crtYAxis) { | |
2118 | + throw new Exception('Cannot retrieve y Axis for Plot Function/Histogram.'); | |
2119 | + } | |
2120 | + | |
2121 | + // Find and clone the color Z-axis | |
2122 | + $crtColorAxis = NULL; | |
2123 | + foreach ($panel->{'axes'} as $axis) { | |
2124 | + if ($axis->{'id'} == 'color') { | |
2125 | + $crtColorAxis = clone ($axis); | |
2126 | + break; | |
2127 | + } | |
2128 | + } | |
2129 | + | |
2130 | + // Assign the axes to the panel | |
2131 | + $panel->{"axes"} = []; | |
2132 | + $panel->{"axes"}[] = $crtXAxis; | |
2133 | + $panel->{"axes"}[] = $crtYAxis; | |
2134 | + $panel->{"axes"}[] = $crtColorAxis; | |
2135 | + | |
2136 | + // Add the modified panel to the panels array | |
2137 | + $panels[] = $panel; | |
2138 | + break; // Exit the loop after finding the matching panel | |
2139 | + } | |
2140 | + } | |
2141 | + | |
2142 | + // Update the panels in the plotInput object | |
2143 | + $plotInput->{'panels'} = $panels; | |
2144 | + | |
2145 | + return $plotInput; | |
2146 | + } | |
2147 | + | |
2042 | 2148 | private function unmarshallPlotFunction($input, $plotInput) |
2043 | 2149 | { |
2150 | + $histoPlotName = "histoPlot"; | |
2044 | 2151 | date_default_timezone_set('UTC'); |
2045 | 2152 | $plotInput->{"startDate"} =$input->starttime; |
2046 | 2153 | $plotInput->{"stopDate"} = $input->stoptime; |
2047 | - $plotInput->{"file-prefix"} = RequestOutPutPlotElementPlotFunctionNodeClass::REQUESTOUTPUTPLOTELEMENT_PLOTFUNCTION_NAME; | |
2048 | 2154 | $plotInput->{"interactive-preview"} = true; |
2049 | 2155 | $plotInput->{"file-format"} = "PNG"; |
2050 | 2156 | $plotInput->{"file-output"} = "INTERACTIVE"; |
... | ... | @@ -2055,6 +2161,15 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
2055 | 2161 | "layout-panel-spacing" => 0.05 |
2056 | 2162 | ); |
2057 | 2163 | |
2164 | + $plotInput->{"file-prefix"} = RequestOutPutPlotElementPlotFunctionNodeClass::REQUESTOUTPUTPLOTELEMENT_PLOTFUNCTION_NAME; | |
2165 | + if ($input->type == $histoPlotName){ | |
2166 | + //$plotInput->{"file-prefix"} = $histoPlotName; | |
2167 | + return $this->unmarshallPlotFunctionHisto($input, $plotInput); | |
2168 | + }/*else{ | |
2169 | + $plotInput->{"file-prefix"} = RequestOutPutPlotElementPlotFunctionNodeClass::REQUESTOUTPUTPLOTELEMENT_PLOTFUNCTION_NAME; | |
2170 | + }*/ | |
2171 | + | |
2172 | + | |
2058 | 2173 | $panels = []; |
2059 | 2174 | |
2060 | 2175 | foreach ($plotInput->{'panels'} as $input_panel) { |
... | ... | @@ -2068,9 +2183,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
2068 | 2183 | $scale_abscisse = $input->scale_abscisse; |
2069 | 2184 | $scale_ordonnee = $input->scale_ordonnee; |
2070 | 2185 | $panel->{'panel-plot-type'} = RequestOutPutPlotElementPlotFunctionNodeClass::REQUESTOUTPUTPLOTELEMENT_PLOTFUNCTION_NAME; |
2071 | - $panel->{"panel-title-font-activated"} = TRUE; | |
2072 | - $panel->{"panel-title-font-size"} = 12; | |
2073 | - $panel->{"panel-title-font-bold"} = TRUE; | |
2186 | + $this->setPanelTitleStyle($panel); | |
2074 | 2187 | |
2075 | 2188 | /** |
2076 | 2189 | * @var object $crtParam |
... | ... | @@ -2204,5 +2317,4 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass |
2204 | 2317 | $plotInput->{'panels'} = $panels; |
2205 | 2318 | return $plotInput; |
2206 | 2319 | } |
2207 | - | |
2208 | 2320 | } | ... | ... |
src/Request/ParamInfoRequestClass.php
... | ... | @@ -155,6 +155,9 @@ class ParamInfoRequestClass extends RequestAbstractClass |
155 | 155 | 'channels' => array(), |
156 | 156 | 'minmax' => array() |
157 | 157 | ); |
158 | + if ($tableNode->getAttribute("mainDim") === "true") { | |
159 | + $tableResult['mainDim'] = TRUE; | |
160 | + } | |
158 | 161 | |
159 | 162 | if (!$tableResult['variable']) { |
160 | 163 | $channelNodes = $tableNode->getElementsByTagName("channel"); | ... | ... |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotColorAxisNodeClass.php
... | ... | @@ -26,6 +26,11 @@ class RequestOutputPlotColorAxisNodeClass extends RequestOutputPlotAxisElementNo |
26 | 26 | { |
27 | 27 | $this->setAttribute(REQUESTOUTPUTPLOTCOLORAXIS_MAPINDEX, $mapIndex); |
28 | 28 | } |
29 | + | |
30 | + public function getColorMapIndex() | |
31 | + { | |
32 | + return $this->getAttribute(REQUESTOUTPUTPLOTCOLORAXIS_MAPINDEX); | |
33 | + } | |
29 | 34 | |
30 | 35 | public function setMinValColor($minValColor) |
31 | 36 | { |
... | ... | @@ -56,4 +61,4 @@ class RequestOutputPlotColorAxisNodeClass extends RequestOutputPlotAxisElementNo |
56 | 61 | } |
57 | 62 | } |
58 | 63 | |
59 | -?> | |
60 | 64 | \ No newline at end of file |
65 | +?> | ... | ... |