1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include "HYDROGUI_ImmersibleZoneDlg.h"
25 #include "HYDROGUI_Tool.h"
33 HYDROGUI_ImmersibleZoneDlg::HYDROGUI_ImmersibleZoneDlg( HYDROGUI_Module* theModule, const QString& theTitle )
34 : HYDROGUI_InputPanel( theModule, theTitle )
37 myObjectNameGroup = new QGroupBox( tr( "ZONE_NAME" ), mainFrame() );
39 myObjectName = new QLineEdit( myObjectNameGroup );
41 QBoxLayout* aNameLayout = new QHBoxLayout( myObjectNameGroup );
42 aNameLayout->setMargin( 5 );
43 aNameLayout->setSpacing( 5 );
44 aNameLayout->addWidget( new QLabel( tr( "NAME" ), myObjectNameGroup ) );
45 aNameLayout->addWidget( myObjectName );
48 QGroupBox* aParamGroup = new QGroupBox( tr( "ZONE_PARAMETERS" ), mainFrame() );
50 QFrame* aPolylineFrame = new QFrame( aParamGroup );
52 myPolylines = new QComboBox( aPolylineFrame );
53 myPolylines->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
55 QBoxLayout* aPolyLayout = new QHBoxLayout( aPolylineFrame );
56 aPolyLayout->setMargin( 0 );
57 aPolyLayout->setSpacing( 5 );
58 aPolyLayout->addWidget( new QLabel( tr( "ZONE_POLYLINE" ), aPolylineFrame ) );
59 aPolyLayout->addWidget( myPolylines );
61 QBoxLayout* aParamLayout = new QVBoxLayout( aParamGroup );
62 aParamLayout->setMargin( 5 );
63 aParamLayout->setSpacing( 5 );
64 aParamLayout->addWidget( aPolylineFrame );
66 QGroupBox* aBathGroup = new QGroupBox( tr( "ZONE_BATHYMETRY" ), mainFrame() );
68 myBathymetries = new QComboBox( aPolylineFrame );
69 myBathymetries->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
71 QBoxLayout* aBathLayout = new QHBoxLayout( aBathGroup );
72 aBathLayout->setMargin( 5 );
73 aBathLayout->setSpacing( 5 );
74 aBathLayout->addWidget( myBathymetries );
78 addWidget( myObjectNameGroup );
79 addWidget( aParamGroup );
80 addWidget( aBathGroup );
85 // Connect signals and slots
86 connect( myPolylines, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onZoneDefChanged() ) );
89 HYDROGUI_ImmersibleZoneDlg::~HYDROGUI_ImmersibleZoneDlg()
93 void HYDROGUI_ImmersibleZoneDlg::reset()
95 bool isBlocked = blockSignals( true );
97 myObjectName->clear();
100 myBathymetries->clear();
102 blockSignals( isBlocked );
107 void HYDROGUI_ImmersibleZoneDlg::setObjectName( const QString& theName )
109 myObjectName->setText( theName );
112 QString HYDROGUI_ImmersibleZoneDlg::getObjectName() const
114 return myObjectName->text();
117 void HYDROGUI_ImmersibleZoneDlg::setPolylineNames( const QStringList& thePolylines )
119 bool isBlocked = blockSignals( true );
121 myPolylines->clear();
122 myPolylines->addItems( thePolylines );
124 blockSignals( isBlocked );
127 void HYDROGUI_ImmersibleZoneDlg::setPolylineName( const QString& theName )
129 int aNewIdx = myPolylines->findText( theName );
130 if ( aNewIdx != myPolylines->currentIndex() )
132 myPolylines->setCurrentIndex( aNewIdx );
140 QString HYDROGUI_ImmersibleZoneDlg::getPolylineName() const
142 return myPolylines->currentText();
145 void HYDROGUI_ImmersibleZoneDlg::setBathymetryNames( const QStringList& theBathymetries )
147 bool isBlocked = blockSignals( true );
149 myBathymetries->clear();
150 myBathymetries->addItems( theBathymetries );
152 blockSignals( isBlocked );
155 void HYDROGUI_ImmersibleZoneDlg::setBathymetryName( const QString& theName )
157 int aNewIdx = myBathymetries->findText( theName );
158 myBathymetries->setCurrentIndex( aNewIdx );
161 QString HYDROGUI_ImmersibleZoneDlg::getBathymetryName() const
163 return myBathymetries->currentText();
166 void HYDROGUI_ImmersibleZoneDlg::onZoneDefChanged()
168 if ( signalsBlocked() )
171 QString aPolylineName = getPolylineName();
172 emit CreatePreview( aPolylineName );