Salome HOME
table de Strickler complete
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_LocalCSDlg.cxx
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #include <HYDROGUI_LocalCSDlg.h>
20 #include <QtxDoubleSpinBox.h>
21 #include <QLayout>
22 #include <QLabel>
23
24 const double RANGE = 1E+10;
25 const double STEP = 1.00;
26 const double PREC = 2;
27
28 HYDROGUI_LocalCSDlg::HYDROGUI_LocalCSDlg( HYDROGUI_Module* theModule, const QString& theTitle )
29 : HYDROGUI_InputPanel( theModule, theTitle )
30 {
31   QFrame* aFrame = new QFrame( mainFrame() );
32   addWidget( aFrame, 1 );
33
34   QGridLayout* aLayout = new QGridLayout( aFrame );
35   aLayout->setMargin( 5 );
36   aLayout->setSpacing( 5 );
37
38   myLX = new QtxDoubleSpinBox( 0, RANGE, STEP, PREC, PREC, aFrame );
39   myLX->setValue( 0.0 );
40   myLY = new QtxDoubleSpinBox( 0, RANGE, STEP, PREC, PREC, aFrame );
41   myLY->setValue( 0.0 );
42
43   aLayout->addWidget( new QLabel( tr( "LX" ), aFrame ), 0, 0 );
44   aLayout->addWidget( myLX, 0, 1 );
45   aLayout->addWidget( new QLabel( tr( "LY" ), aFrame ), 1, 0 );
46   aLayout->addWidget( myLY, 1, 1 );
47   aLayout->setColumnStretch( 0, 0 );
48   aLayout->setColumnStretch( 1, 1 );
49   aLayout->setRowStretch( 2, 1 );
50 }
51
52 HYDROGUI_LocalCSDlg::~HYDROGUI_LocalCSDlg()
53 {
54 }
55
56 double HYDROGUI_LocalCSDlg::GetLocalX() const
57 {
58   return myLX->value();
59 }
60
61 double HYDROGUI_LocalCSDlg::GetLocalY() const
62 {
63   return myLY->value();
64 }
65
66 void HYDROGUI_LocalCSDlg::SetLocalCS( double theLX, double theLY )
67 {
68   myLX->setValue( theLX );
69   myLY->setValue( theLY );
70 }
71