Salome HOME
Exlude the user input during process events by application (Bug #325).
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Poly3DDlg.cxx
index 5cbf6235b913fc070108dada2a76b546f6331b93..36ec02cddd642ae4dd9b9a465480c477ff7d75d0 100644 (file)
@@ -49,19 +49,24 @@ HYDROGUI_Poly3DDlg::HYDROGUI_Poly3DDlg( HYDROGUI_Module* theModule, const QStrin
   // Parameters
   QGroupBox* aParamGroup = new QGroupBox( tr( "PARAMETERS" ) );
 
-  myProfileLabel = new QLabel( tr( "PROFILE" ), aParamGroup );
-  myProfile = new HYDROGUI_ObjSelector( theModule, KIND_PROFILE, aParamGroup );
-
   myPolylineLabel = new QLabel( tr( "POLYLINE" ), aParamGroup );
   myPolyline = new HYDROGUI_ObjSelector( theModule, KIND_POLYLINEXY, aParamGroup );
 
+  myProfileLabel = new QLabel( tr( "PROFILE" ), aParamGroup );
+  myProfile = new HYDROGUI_ObjSelector( theModule, KIND_PROFILE, aParamGroup );
+  
+  myBathLabel = new QLabel( tr( "BATH" ), aParamGroup );
+  myBath = new HYDROGUI_ObjSelector( theModule, KIND_BATHYMETRY, aParamGroup );
+
   QGridLayout* aParamLayout = new QGridLayout( aParamGroup );
   aParamLayout->setMargin( 5 );
   aParamLayout->setSpacing( 5 );
-  aParamLayout->addWidget( myProfileLabel,   0, 0 );
-  aParamLayout->addWidget( myProfile,        0, 1 );
-  aParamLayout->addWidget( myPolylineLabel,  1, 0 );
-  aParamLayout->addWidget( myPolyline,       1, 1 );
+  aParamLayout->addWidget( myPolylineLabel,  0, 0 );
+  aParamLayout->addWidget( myPolyline,       0, 1 );
+  aParamLayout->addWidget( myProfileLabel,   1, 0 );
+  aParamLayout->addWidget( myProfile,        1, 1 );
+  aParamLayout->addWidget( myBathLabel,      2, 0 );
+  aParamLayout->addWidget( myBath,           2, 1 );
 
   // Common
   addWidget( aNameGroup );
@@ -69,6 +74,9 @@ HYDROGUI_Poly3DDlg::HYDROGUI_Poly3DDlg( HYDROGUI_Module* theModule, const QStrin
   addStretch();
 
   setMode( myIsEdit );
+
+  connect( myProfile, SIGNAL( selectionChanged() ), this, SLOT( OnSelectionChanged() ) );
+  connect( myBath, SIGNAL( selectionChanged() ), this, SLOT( OnSelectionChanged() ) );
 }
 
 HYDROGUI_Poly3DDlg::~HYDROGUI_Poly3DDlg()
@@ -97,19 +105,23 @@ QString HYDROGUI_Poly3DDlg::getResultName() const
   return myName->text();
 }
 
-void HYDROGUI_Poly3DDlg::setSelectedObjects( const QString& theName1,
-                                             const QString& theName2 )
+void HYDROGUI_Poly3DDlg::setSelectedObjects( const QString& theNamePoly,
+                                             const QString& theNameProfile,
+                                             const QString& theNameBath )
 {
-  myProfile->SetName( theName1 );
-  myPolyline->SetName( theName2 );
+  myPolyline->SetName( theNamePoly );
+  myProfile->SetName( theNameProfile );
+  myBath->SetName( theNameBath );
 }
 
-bool HYDROGUI_Poly3DDlg::getSelectedObjects( QString& theName1,
-                                             QString& theName2 ) const
+bool HYDROGUI_Poly3DDlg::getSelectedObjects( QString& theNamePoly,
+                                             QString& theNameProfile,
+                                             QString& theNameBath ) const
 {
-  theName1 = myProfile->GetName();
-  theName2 = myPolyline->GetName();
-  return !theName1.isEmpty() && !theName2.isEmpty();
+  theNamePoly = myPolyline->GetName();
+  theNameProfile = myProfile->GetName();
+  theNameBath = myBath->GetName();
+  return !theNamePoly.isEmpty() && ( !theNameProfile.isEmpty() || !theNameBath.isEmpty() );
 }
 
 void HYDROGUI_Poly3DDlg::setPreselectedObject( const QString& theName )
@@ -118,3 +130,11 @@ void HYDROGUI_Poly3DDlg::setPreselectedObject( const QString& theName )
   myPolyline->SetChecked( true );
   myPolyline->SetName( QString() );
 }
+
+void HYDROGUI_Poly3DDlg::OnSelectionChanged()
+{
+  if( sender()==myProfile && !myProfile->GetName().isEmpty() )
+    myBath->Clear();
+  if( sender()==myBath && !myBath->GetName().isEmpty() )
+    myProfile->Clear();
+}