2 // File : VisuGUI_IsoSurfacesDlg.cxx
3 // Created : Wed Aug 01 10:23:06 2001
4 // Author : Laurent CORNABE & Hubert ROLLAND
7 // Copyright : PRINCIPIA
10 #include "VisuGUI_IsoSurfacesDlg.h"
12 #include "QAD_Application.h"
13 #include "QAD_Desktop.h"
18 VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg()
19 : QDialog( QAD_Application::getDesktop(), "VisuGUI_IsoSurfacesDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
21 setCaption( tr( "Iso Surfaces Definition" ) );
22 setSizeGripEnabled( TRUE );
24 QGridLayout* TopLayout = new QGridLayout( this );
25 TopLayout->setSpacing( 6 );
26 TopLayout->setMargin( 11 );
28 QGroupBox* TopGroup = new QGroupBox( this, "TopGroup" );
29 TopGroup->setColumnLayout(0, Qt::Vertical );
30 TopGroup->layout()->setSpacing( 0 );
31 TopGroup->layout()->setMargin( 0 );
32 QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
33 TopGroupLayout->setAlignment( Qt::AlignTop );
34 TopGroupLayout->setSpacing( 6 );
35 TopGroupLayout->setMargin( 11 );
37 QLabel* LabelMin = new QLabel( tr( "Minimum value:" ), TopGroup, "LabelMin" );
38 TopGroupLayout->addWidget( LabelMin, 0, 0 );
39 MinIso = new QAD_SpinBoxDbl( TopGroup, -999.99, 999.99, 0.1 );
40 MinIso->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
41 MinIso->setMinimumSize( 70, 0 );
42 TopGroupLayout->addWidget( MinIso, 0, 1 );
44 QLabel* LabelMax = new QLabel( tr( "Maximum value:" ), TopGroup, "LabelMax" );
45 TopGroupLayout->addWidget( LabelMax, 1, 0 );
46 MaxIso = new QAD_SpinBoxDbl( TopGroup, -999.99, 999.99, 0.1);
47 MaxIso->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
48 MaxIso->setMinimumSize( 70, 0 );
49 TopGroupLayout->addWidget( MaxIso, 1, 1 );
51 QLabel* LabelNbr = new QLabel( tr( "Number of surfaces:" ), TopGroup, "LabelNbr" );
52 TopGroupLayout->addWidget( LabelNbr, 2, 0 );
53 NbrIso = new QSpinBox( 1, 100, 1, TopGroup, "NbrIso" );
54 NbrIso->setValue( 1 );
55 TopGroupLayout->addWidget( NbrIso, 2, 1 );
57 QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
58 GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
59 GroupButtons->setColumnLayout(0, Qt::Vertical );
60 GroupButtons->layout()->setSpacing( 0 );
61 GroupButtons->layout()->setMargin( 0 );
62 QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
63 GroupButtonsLayout->setAlignment( Qt::AlignTop );
64 GroupButtonsLayout->setSpacing( 6 );
65 GroupButtonsLayout->setMargin( 11 );
67 QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
68 buttonOk->setAutoDefault( TRUE );
69 buttonOk->setDefault( TRUE );
70 GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
71 GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
72 QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
73 buttonCancel->setAutoDefault( TRUE );
74 GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
76 TopLayout->addWidget( TopGroup, 0, 0 );
77 TopLayout->addWidget( GroupButtons, 1, 0 );
79 // signals and slots connections
80 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
81 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
87 VisuGUI_IsoSurfacesDlg::~VisuGUI_IsoSurfacesDlg()
92 void VisuGUI_IsoSurfacesDlg::initFromPrsObject(VISU::IsoSurfaces_i* thePrs) {
93 NbrIso->setValue(thePrs->GetNbSurfaces());
94 MinIso->setValue(thePrs->GetRangeMin());
95 MaxIso->setValue(thePrs->GetRangeMax());
99 void VisuGUI_IsoSurfacesDlg::storeToPrsObject(VISU::IsoSurfaces_i* thePrs) {
100 thePrs->SetNbSurfaces(NbrIso->value());
101 thePrs->SetRange(MinIso->value(), MaxIso->value());