Salome HOME
Minor bug fix on WidgetPresentationParameters
[modules/med.git] / src / MEDCalc / gui / dialogs / WidgetPresentationParameters.cxx
1 // Copyright (C) 2016  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "WidgetPresentationParameters.hxx"
21 #include <Basics_Utils.hxx>
22
23 WidgetPresentationParameters::WidgetPresentationParameters(QWidget* parent)
24   : QWidget(parent)
25 {
26   ui.setupUi(this); // To be done first
27 }
28
29 MEDCALC::MEDPresentationViewMode
30 WidgetPresentationParameters::getViewMode() {
31   QString viewMode = this->ui.comboBoxViewMode->currentText();
32   if (viewMode == tr("LAB_VIEW_MODE_REPLACE")) {
33     return MEDCALC::VIEW_MODE_REPLACE;
34   }
35   else if (viewMode == tr("LAB_VIEW_MODE_OVERLAP")) {
36     return MEDCALC::VIEW_MODE_OVERLAP;
37   }
38   else if (viewMode == tr("LAB_VIEW_MODE_NEW_LAYOUT")) {
39     return MEDCALC::VIEW_MODE_NEW_LAYOUT;
40   }
41   else if (viewMode == tr("LAB_VIEW_MODE_SPLIT_VIEW")) {
42     return MEDCALC::VIEW_MODE_SPLIT_VIEW;
43   }
44   // Should not happen
45   STDLOG("Strange!! No matching view mode found - returning VIEW_MODE_REPLACE.");
46   return MEDCALC::VIEW_MODE_REPLACE;
47 }
48
49 std::string
50 WidgetPresentationParameters::getField()
51 {
52   return this->ui.comboBoxField->currentText().toStdString();
53 }
54
55 std::string
56 WidgetPresentationParameters::getScalarBarRange()
57 {
58   return this->ui.comboBoxScalarBarRange->currentText().toStdString();
59 }
60
61 double
62 WidgetPresentationParameters::getScalarBarTimestep()
63 {
64   return this->ui.doubleSpinBoxTimeStep->value();
65 }
66
67 double
68 WidgetPresentationParameters::getScalarBarMinVal()
69 {
70   return this->ui.doubleSpinBoxMinVal->value();
71 }
72
73 double
74 WidgetPresentationParameters::getScalarBarMaxVal()
75 {
76   return this->ui.doubleSpinBoxMaxVal->value();
77 }
78
79 MEDCALC::MEDPresentationColorMap
80 WidgetPresentationParameters::getColorMap()
81 {
82   QString colorMap = this->ui.comboBoxColorMap->currentText();
83   if (colorMap == tr("LAB_BLUE_TO_RED")) {
84     return MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW;
85   }
86   else if (colorMap == tr("LAB_COOL_TO_WARM")) {
87     return MEDCALC::COLOR_MAP_COOL_TO_WARM;
88   }
89   // Should not happen
90   STDLOG("Strange!! No matching color map found - returning blue to red.");
91   return MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW;
92 }