Salome HOME
Import of shapefile - bug fixes; #refs 614
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_LandCoverDlg.cxx
index 39baff788ec10b4c479af0c938047929c86eb3a2..a0c027becebd8e882c7fa6ff8e10ccf2aa416d93 100644 (file)
@@ -45,7 +45,7 @@ HYDROGUI_LandCoverDlg::HYDROGUI_LandCoverDlg( HYDROGUI_Module* theModule, const
   // Include/Exclude buttons
   QFrame* aBtnsFrame = new QFrame( myPolylineFrame );
   QVBoxLayout* aBtnsLayout = new QVBoxLayout( aBtnsFrame );
-  aBtnsLayout->setMargin( 5 );
+  aBtnsLayout->setMargin( 0 );
   aBtnsLayout->setSpacing( 5 );
   aBtnsFrame->setLayout( aBtnsLayout );
   QPushButton* anAddBtn = new QPushButton( tr("INCLUDE"), aBtnsFrame );
@@ -57,8 +57,8 @@ HYDROGUI_LandCoverDlg::HYDROGUI_LandCoverDlg( HYDROGUI_Module* theModule, const
   aBtnsLayout->addStretch( 1 );
 
   QGridLayout* aPolyLayout = new QGridLayout( myPolylineFrame );
-  aPolyLayout->setMargin( 5 );
-  aPolyLayout->setSpacing( 5 );
+  aPolyLayout->setMargin( 0 );
+  aPolyLayout->setSpacing( 10 );
   aPolyLayout->addWidget( new QLabel( tr( "LAND_COVER_POLYLINES" ), myPolylineFrame ), 0, 0, 1, 2 );
   aPolyLayout->addWidget( aBtnsFrame, 1, 0, 1, 1 );
   aPolyLayout->addWidget( myPolylines, 1, 1, 1, 1 );
@@ -101,23 +101,33 @@ void HYDROGUI_LandCoverDlg::reset()
   onZoneDefChanged();
 }
 
-void HYDROGUI_LandCoverDlg::includePolylines( const HYDROGUI_ListModel::Object2VisibleList& theSelectedPolylines )
+bool HYDROGUI_LandCoverDlg::includePolylines( const HYDROGUI_ListModel::Object2VisibleList& theSelectedPolylines )
 {
   QStringList anIncludedPolylinesNames = myPolylines->getAllNames();
 
+  bool aSetOfPolylinesChanged = false;
   foreach ( const HYDROGUI_ListModel::Object2Visible& aSelectedPolyline, theSelectedPolylines )
   {
     if ( !anIncludedPolylinesNames.contains( aSelectedPolyline.first->GetName() ) )
+    {
       myPolylines->addObject( aSelectedPolyline );
+      aSetOfPolylinesChanged = true;
+    }
   }
   myPolylines->setOrderingEnabled( myPolylines->getObjects().count() > 1 );
+
+  return aSetOfPolylinesChanged;
 }
 
-void HYDROGUI_LandCoverDlg::excludePolylines( const HYDROGUI_ListModel::Object2VisibleList& theSelectedPolylines )
+bool HYDROGUI_LandCoverDlg::excludePolylines( const HYDROGUI_ListModel::Object2VisibleList& theSelectedPolylines )
 {
+  bool aSetOfPolylinesChanged = !theSelectedPolylines.isEmpty();
+
   foreach ( const HYDROGUI_ListModel::Object2Visible& aSelectedPolyline, theSelectedPolylines )
     myPolylines->removeObjectByName( aSelectedPolyline.first->GetName() );
   myPolylines->setOrderingEnabled( myPolylines->getObjects().count() > 1 );
+
+  return aSetOfPolylinesChanged;
 }
 
 QStringList HYDROGUI_LandCoverDlg::getPolylineNames() const