Salome HOME
Final version of "Profile interpolation".
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_TranslateObstacleDlg.cxx
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #include "HYDROGUI_TranslateObstacleDlg.h"
24
25 #include <QtxDoubleSpinBox.h>
26
27 #include <QLabel>
28 #include <QLineEdit>
29 #include <QGroupBox>
30 #include <QGridLayout>
31
32 #include <limits>
33
34 HYDROGUI_TranslateObstacleDlg::HYDROGUI_TranslateObstacleDlg( HYDROGUI_Module* theModule, const QString& theTitle )
35 : HYDROGUI_InputPanel( theModule, theTitle )
36 {
37   // Obstacle name
38   QGroupBox* aNameGroup = new QGroupBox( tr( "OBSTACLE_NAME" ), this );
39
40   QLabel* aNameLabel = new QLabel( tr( "NAME" ), aNameGroup );
41   myName = new QLineEdit( aNameGroup );
42   myName->setEnabled( false );
43   
44   QBoxLayout* aNameLayout = new QHBoxLayout( aNameGroup );
45   aNameLayout->setMargin( 5 );
46   aNameLayout->setSpacing( 5 );
47   aNameLayout->addWidget( aNameLabel );
48   aNameLayout->addWidget( myName );
49
50   // Translation arguments
51   QGroupBox* anArgGroup = new QGroupBox( tr( "TRANSLATION_ARGUMENTS" ), this );
52
53   QLabel* aDxLabel = new QLabel( tr( "DX" ), anArgGroup );
54   myDxSpin = new QtxDoubleSpinBox( -1e+15, +1e+15, 10, anArgGroup );
55
56   QLabel* aDyLabel = new QLabel( tr( "DY" ), anArgGroup );
57   myDySpin = new QtxDoubleSpinBox( -1e+15, +1e+15, 10, anArgGroup );
58
59   QLabel* aDzLabel = new QLabel( tr( "DZ" ), anArgGroup );
60   myDzSpin = new QtxDoubleSpinBox( -1e+15, +1e+15, 10, anArgGroup );
61
62   QGridLayout* anArgLayout = new QGridLayout( anArgGroup );
63   anArgLayout->setMargin( 5 );
64   anArgLayout->setSpacing( 5 );
65   
66   anArgLayout->addWidget( aDxLabel, 0, 0 );
67   anArgLayout->addWidget( myDxSpin, 0, 1 );
68   anArgLayout->addWidget( aDyLabel, 1, 0 );
69   anArgLayout->addWidget( myDySpin, 1, 1 );
70   anArgLayout->addWidget( aDzLabel, 2, 0 );
71   anArgLayout->addWidget( myDzSpin, 2, 1 );
72
73   // Layout
74   addWidget( aNameGroup );
75   addWidget( anArgGroup );
76   addStretch();
77
78   // Connect signals and slots
79   connect( myDxSpin, SIGNAL( valueChanged( double ) ), this, SIGNAL( argumentsChanged() ) );
80   connect( myDySpin, SIGNAL( valueChanged( double ) ), this, SIGNAL( argumentsChanged() ) );
81   connect( myDzSpin, SIGNAL( valueChanged( double ) ), this, SIGNAL( argumentsChanged() ) );
82 }
83
84 HYDROGUI_TranslateObstacleDlg::~HYDROGUI_TranslateObstacleDlg()
85 {
86 }
87
88 void HYDROGUI_TranslateObstacleDlg::reset()
89 {
90   myName->clear();
91
92   myDxSpin->setValue( 0 );
93   myDySpin->setValue( 0 );
94   myDzSpin->setValue( 0 );
95 }
96
97 void HYDROGUI_TranslateObstacleDlg::setName( const QString& theName )
98 {
99   myName->setText( theName );
100 }
101
102 double HYDROGUI_TranslateObstacleDlg::getDx() const
103 {
104   return myDxSpin->value();
105 }
106
107 double HYDROGUI_TranslateObstacleDlg::getDy() const
108 {
109   return myDySpin->value();
110 }
111
112 double HYDROGUI_TranslateObstacleDlg::getDz() const
113 {
114   return myDzSpin->value();
115 }