]> SALOME platform Git repositories - modules/smesh.git/blob - src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx
Salome HOME
3b36976fcbeabef71e4003c65d81272c792fab3c
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MoveNodesDlg.cxx
1 //  SMESH SMESHGUI : GUI for SMESH component
2 //
3 //  Copyright (C) 2003  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.
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 //
22 //
23 //
24 //  File   : SMESHGUI_MoveNodesDlg.cxx
25 //  Author : Nicolas REJNERI
26 //  Module : SMESH
27 //  $Header$
28
29 #include "SMESHGUI_MoveNodesDlg.h"
30 #include <SMESHGUI_SpinBox.h>
31
32 #include <SUIT_ResourceMgr.h>
33
34 #include <SMDSAbs_ElementType.hxx>
35
36 #include <qlayout.h>
37 #include <qbuttongroup.h>
38 #include <qradiobutton.h>
39 #include <qlabel.h>
40
41 //=================================================================================
42 // name    : SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg
43 // Purpose :
44 //=================================================================================
45 SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg()
46 : SMESHGUI_Dialog()
47 {
48   setCaption( tr( "CAPTION" ) );
49
50   QVBoxLayout* main = new QVBoxLayout( mainFrame() );
51
52   QPixmap iconMoveNode( resMgr()->loadPixmap( "SMESH", tr( "ICON_DLG_MOVE_NODE" ) ) );
53   
54   QButtonGroup* aPixGrp = new QButtonGroup(1, Qt::Vertical, tr("MESH_NODE"), mainFrame() );
55   aPixGrp->setExclusive(TRUE);
56   QRadioButton* aRBut = new QRadioButton(aPixGrp);
57   aRBut->setPixmap(iconMoveNode);
58   aRBut->setChecked(TRUE);
59
60   main->addWidget( aPixGrp );
61
62   QGroupBox* anIdGrp = new QGroupBox( 3, Qt::Horizontal, tr( "SMESH_MOVE" ), mainFrame() );
63   createObject( tr( "NODE_ID" ), anIdGrp, 0 );
64   setNameIndication( 0, OneName );
65   setObjectType( 0, prefix( "SMESH element" ) + SMDSAbs_Node, -1 );
66
67   main->addWidget( anIdGrp );
68
69   QGroupBox* aCoordGrp = new QGroupBox(1, Qt::Vertical, tr("SMESH_COORDINATES"), mainFrame() );
70   new QLabel(tr("SMESH_X"), aCoordGrp);
71   myX = new SMESHGUI_SpinBox(aCoordGrp);
72   new QLabel(tr("SMESH_Y"), aCoordGrp);
73   myY = new SMESHGUI_SpinBox(aCoordGrp);
74   new QLabel(tr("SMESH_Z"), aCoordGrp);
75   myZ = new SMESHGUI_SpinBox(aCoordGrp);
76
77   main->addWidget( aCoordGrp );
78
79   myX->RangeStepAndValidator(-999999.999, +999999.999, 25.0, 3);
80   myY->RangeStepAndValidator(-999999.999, +999999.999, 25.0, 3);
81   myZ->RangeStepAndValidator(-999999.999, +999999.999, 25.0, 3); 
82
83   connect( myX, SIGNAL( valueChanged( double ) ), this, SIGNAL( valueChanged() ) );
84   connect( myY, SIGNAL( valueChanged( double ) ), this, SIGNAL( valueChanged() ) );
85   connect( myZ, SIGNAL( valueChanged( double ) ), this, SIGNAL( valueChanged() ) );
86 }
87
88 //=================================================================================
89 // name    : SMESHGUI_MoveNodesDlg::~SMESHGUI_MoveNodesDlg
90 // Purpose :
91 //=================================================================================
92 SMESHGUI_MoveNodesDlg::~SMESHGUI_MoveNodesDlg()
93 {
94 }
95
96 //=================================================================================
97 // name    : SMESHGUI_MoveNodesDlg::setCoords
98 // Purpose :
99 //=================================================================================
100 void SMESHGUI_MoveNodesDlg::setCoords( const double x, const double y, const double z )
101 {
102   myX->setValue( x );
103   myY->setValue( y );
104   myZ->setValue( z );
105 }
106
107 //=================================================================================
108 // name    : SMESHGUI_MoveNodesDlg::coords
109 // Purpose :
110 //=================================================================================
111 void SMESHGUI_MoveNodesDlg::coords( double& x, double& y, double& z ) const
112 {
113   x = myX->value();
114   y = myY->value();
115   z = myZ->value();
116 }