Salome HOME
Merge branch 'V7_dev'
[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
22 WidgetPresentationParameters::WidgetPresentationParameters(QWidget* parent)
23   : QWidget(parent)
24 {
25   ui.setupUi(this); // To be done first
26 }
27
28 MEDCALC::MEDPresentationViewMode
29 WidgetPresentationParameters::getViewMode() {
30   QString viewMode = this->ui.comboBoxViewMode->currentText();
31   if (viewMode == tr("LAB_VIEW_MODE_REPLACE")) {
32     return MEDCALC::VIEW_MODE_REPLACE;
33   }
34   else if (viewMode == tr("LAB_VIEW_MODE_OVERLAP")) {
35     return MEDCALC::VIEW_MODE_OVERLAP;
36   }
37   else if (viewMode == tr("LAB_VIEW_MODE_NEW_LAYOUT")) {
38     return MEDCALC::VIEW_MODE_NEW_LAYOUT;
39   }
40   else if (viewMode == tr("LAB_VIEW_MODE_SPLIT_VIEW")) {
41     return MEDCALC::VIEW_MODE_SPLIT_VIEW;
42   }
43 }
44
45 std::string
46 WidgetPresentationParameters::getField()
47 {
48   return this->ui.comboBoxField->currentText().toStdString();
49 }
50
51 std::string
52 WidgetPresentationParameters::getScalarBarRange()
53 {
54   return this->ui.comboBoxScalarBarRange->currentText().toStdString();
55 }
56
57 double
58 WidgetPresentationParameters::getScalarBarTimestep()
59 {
60   return this->ui.doubleSpinBoxTimeStep->value();
61 }
62
63 double
64 WidgetPresentationParameters::getScalarBarMinVal()
65 {
66   return this->ui.doubleSpinBoxMinVal->value();
67 }
68
69 double
70 WidgetPresentationParameters::getScalarBarMaxVal()
71 {
72   return this->ui.doubleSpinBoxMaxVal->value();
73 }
74
75 MEDCALC::MEDPresentationColorMap
76 WidgetPresentationParameters::getColorMap()
77 {
78   QString colorMap = this->ui.comboBoxColorMap->currentText();
79   if (colorMap == tr("LAB_BLUE_TO_RED")) {
80     return MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW;
81   }
82   else if (colorMap == tr("LAB_COOL_TO_WARM")) {
83     return MEDCALC::COLOR_MAP_COOL_TO_WARM;
84   }
85 }