]> SALOME platform Git repositories - modules/visu.git/blob - src/VISUGUI/VisuGUI_MagnitudeDlg.cxx
Salome HOME
28c0f1afa21d7f8d5cb31e8fc60f6351b14ed463
[modules/visu.git] / src / VISUGUI / VisuGUI_MagnitudeDlg.cxx
1 //  VISU VISUGUI : GUI of VISU 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   : VisuGUI_MagnitudeDlg.cxx
25 //  Author : Laurent CORNABE & Hubert ROLLAND 
26 //  Module : VISU
27 //  $Header$
28
29 using namespace std;
30 #include "VisuGUI_MagnitudeDlg.h"
31 #include <qlayout.h>
32 #include "QAD_Application.h"
33 #include "QAD_Desktop.h"
34
35 /*!
36   Constructor
37 */
38 VisuGUI_MagnitudeDlg::VisuGUI_MagnitudeDlg()
39     : QDialog( QAD_Application::getDesktop(), "VisuGUI_MagnitudeDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
40 {
41   setCaption( tr( "Deformed Shape" ) );
42   setSizeGripEnabled( TRUE );
43
44   QGridLayout* TopLayout = new QGridLayout( this ); 
45   TopLayout->setSpacing( 6 );
46   TopLayout->setMargin( 11 );
47   
48   QGroupBox* TopGroup = new QGroupBox( this, "TopGroup" );
49   TopGroup->setColumnLayout(0, Qt::Vertical );
50   TopGroup->layout()->setSpacing( 0 );
51   TopGroup->layout()->setMargin( 0 );
52   QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
53   TopGroupLayout->setAlignment( Qt::AlignTop );
54   TopGroupLayout->setSpacing( 6 );
55   TopGroupLayout->setMargin( 11 );
56
57   QLabel* ScaleLabel = new QLabel( tr( "Scale Factor:" ), TopGroup, "ScaleLabel" );
58   TopGroupLayout->addWidget( ScaleLabel, 0, 0 );
59
60   ScalFact = new QAD_SpinBoxDbl( TopGroup, 0, 1.0E+38, 0.1, 5);
61   ScalFact->setValue( 0.1 );
62   TopGroupLayout->addWidget( ScalFact, 0, 1 );
63
64   UseMagn = new QCheckBox( tr( "Magnitude coloring" ), TopGroup, "UseMagn" );
65   UseMagn->setChecked( true );
66   TopGroupLayout->addMultiCellWidget( UseMagn, 1, 1, 0, 1 );
67   //if (!enableUM)
68   //  UseMagn->hide();
69
70   QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
71   GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
72   GroupButtons->setColumnLayout(0, Qt::Vertical );
73   GroupButtons->layout()->setSpacing( 0 );
74   GroupButtons->layout()->setMargin( 0 );
75   QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
76   GroupButtonsLayout->setAlignment( Qt::AlignTop );
77   GroupButtonsLayout->setSpacing( 6 );
78   GroupButtonsLayout->setMargin( 11 );
79
80   QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
81   buttonOk->setAutoDefault( TRUE );
82   buttonOk->setDefault( TRUE );
83   GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
84   GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
85   QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
86   buttonCancel->setAutoDefault( TRUE );
87   GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
88   
89   TopLayout->addWidget( TopGroup,     0, 0 );
90   TopLayout->addWidget( GroupButtons, 1, 0 );
91
92   // signals and slots connections
93   connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
94   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
95 }
96
97 /*!
98   Destructor
99 */
100 VisuGUI_MagnitudeDlg::~VisuGUI_MagnitudeDlg()
101 {
102 }
103
104
105 void VisuGUI_MagnitudeDlg::initFromPrsObject(VISU::DeformedShape_i* thePrs) {
106   setFactor(thePrs->GetScale());
107   UseMagn->setChecked(thePrs->isColored());
108 }
109
110
111 void VisuGUI_MagnitudeDlg::storeToPrsObject(VISU::DeformedShape_i* thePrs) {
112   thePrs->SetScale(getFactor());
113   thePrs->setColored(isColored());
114 }
115