Salome HOME
Fit All after was added stream selection and displaying in embedded viewer.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Poly3DDlg.cxx
index 5cbf6235b913fc070108dada2a76b546f6331b93..d6d381adb3a0f8913e6a1233948f1df25fa88df6 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -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();
+}