Salome HOME
Merge branch 'master' into abn/qtesting
[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 std::string
30 WidgetPresentationParameters::getField()
31 {
32   return this->ui.comboBoxField->currentText().toStdString();
33 }
34
35 std::string
36 WidgetPresentationParameters::getScalarBarRange()
37 {
38   return this->ui.comboBoxScalarBarRange->currentText().toStdString();
39 }
40
41 double
42 WidgetPresentationParameters::getScalarBarTimestep()
43 {
44   return this->ui.doubleSpinBoxTimeStep->value();
45 }
46
47 double
48 WidgetPresentationParameters::getScalarBarMinVal()
49 {
50   return this->ui.doubleSpinBoxMinVal->value();
51 }
52
53 double
54 WidgetPresentationParameters::getScalarBarMaxVal()
55 {
56   return this->ui.doubleSpinBoxMaxVal->value();
57 }
58
59 MEDCALC::MEDPresentationColorMap
60 WidgetPresentationParameters::getColorMap()
61 {
62   QString colorMap = this->ui.comboBoxColorMap->currentText();
63   if (colorMap == tr("LAB_BLUE_TO_RED")) {
64     return MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW;
65   }
66   else if (colorMap == tr("LAB_COOL_TO_WARM")) {
67     return MEDCALC::COLOR_MAP_COOL_TO_WARM;
68   }
69   // Should not happen
70   STDLOG("Strange!! No matching color map found - returning blue to red.");
71   return MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW;
72 }