]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Merge branch 'BR_v14_rc' of ssh://git.salome-platform.org/modules/hydro into BR_v14_rc
authorasl <asl@opencascade.com>
Tue, 23 Jun 2015 14:38:25 +0000 (17:38 +0300)
committerasl <asl@opencascade.com>
Tue, 23 Jun 2015 14:38:25 +0000 (17:38 +0300)
src/HYDROGUI/HYDROGUI_CalculationOp.cxx
src/HYDROGUI/HYDROGUI_CalculationOp.h
src/HYDROGUI/HYDROGUI_Module.cxx

index ecb496c2191693508f8164b24adea23b82a7192d..93528ff5157f1f55252b815e292ed96926e7480f 100644 (file)
@@ -56,6 +56,8 @@ HYDROGUI_CalculationOp::HYDROGUI_CalculationOp( HYDROGUI_Module* theModule, bool
   myIsEdit( theIsEdit ),
   myActiveViewManager( NULL ),
   myPreviewViewManager( NULL ),
+  myShowGeomObjects( true ),
+  myShowLandCovers( false ),
   myShowZones( false )
 {
   setName( myIsEdit ? tr( "EDIT_CALCULATION" ) : tr( "CREATE_CALCULATION" ) );
@@ -877,6 +879,8 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex )
     if ( !aPanel )
       return;
 
+    setLandCoversVisible( true );
+
     QStringList aList;
     QStringList anEntryList;
     HYDROData_SequenceOfObjects aSeq;
@@ -956,6 +960,9 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex )
 
     QApplication::setOverrideCursor( Qt::WaitCursor );
 
+    setGeomObjectsVisible( false );
+    setLandCoversVisible( false );
+
     QString aNewCaseName = aPanel->getObjectName();
     QString anOldCaseName = myEditedObject->GetName();
     bool isNameChanged = anOldCaseName != aNewCaseName;
@@ -1109,11 +1116,15 @@ void HYDROGUI_CalculationOp::onHideZones( const int theIndex )
 {
   if( theIndex==1 )
   {
+    setGeomObjectsVisible( true );
+
     closePreview( false );
     createPreview( false );
   }
   if( theIndex==2 )
   {
+    setLandCoversVisible( true );
+
     closePreview( false );
     createPreview( true );
 
@@ -1170,6 +1181,30 @@ void HYDROGUI_CalculationOp::setZonesVisible( bool theIsVisible, const bool theL
   }
 }
 
+void HYDROGUI_CalculationOp::setGeomObjectsVisible( bool theIsVisible )
+{
+  myShowGeomObjects = theIsVisible;
+
+  HYDROData_SequenceOfObjects aSeq = myEditedObject->GetGeometryObjects();
+
+  HYDROData_SequenceOfObjects::Iterator anIter( aSeq );
+  for ( ; anIter.More(); anIter.Next() ) {
+    setObjectVisibility( anIter.Value(), theIsVisible );
+  }
+}
+
+void HYDROGUI_CalculationOp::setLandCoversVisible( bool theIsVisible )
+{
+  myShowLandCovers = theIsVisible;
+
+  HYDROData_SequenceOfObjects aSeq = myEditedObject->GetLandCovers();
+
+  HYDROData_SequenceOfObjects::Iterator anIter( aSeq );
+  for ( ; anIter.More(); anIter.Next() ) {
+    setObjectVisibility( anIter.Value(), theIsVisible );
+  }
+}
+
 void HYDROGUI_CalculationOp::AssignDefaultZonesColors( const bool theLandCover )
 {
   HYDROData_SequenceOfObjects aRegions = myEditedObject->GetRegions( theLandCover );
@@ -1303,10 +1338,16 @@ void HYDROGUI_CalculationOp::createPreview( const bool theLandCover )
 {
   LightApp_Application* anApp = module()->getApp();
   HYDROData_SequenceOfObjects aSeq;
-  if ( theLandCover )
-    aSeq = myEditedObject->GetLandCovers();
-  else
-    aSeq = myEditedObject->GetGeometryObjects();
+  if ( theLandCover && myShowLandCovers )
+  {
+    HYDROData_SequenceOfObjects aSeqLC = myEditedObject->GetLandCovers();
+    aSeq.Append( aSeqLC );
+  }
+  else if ( !theLandCover && myShowGeomObjects )
+  {
+    HYDROData_SequenceOfObjects aSeqGO = myEditedObject->GetGeometryObjects();
+    aSeq.Append( aSeqGO );
+  }
 
   Handle(HYDROData_Entity) anEntity;
 
index e40a21a23b3a17bc0a9c999f1dc7ba283109a2fc..4aa6485b2ae6f64438538c37fb6dc8d09db79235 100644 (file)
@@ -155,6 +155,8 @@ private:
   void                            closePreview( bool theRemoveViewManager = true );
   void                            setObjectVisibility( Handle(HYDROData_Entity) theEntity, const bool theIsVisible );
   void                            setZonesVisible( bool theIsVisible, const bool theLandCover );
+  void                            setGeomObjectsVisible( bool theIsVisible );
+  void                            setLandCoversVisible( bool theIsVisible );
   void                            getNamesAndEntries( const HYDROData_SequenceOfObjects& theSeq, 
                                                       QStringList& theNames, QStringList& theEntries ) const;
 
@@ -194,6 +196,8 @@ private:
 private:
   bool                            myIsEdit;
   bool                            myShowZones;
+  bool                            myShowGeomObjects;
+  bool                            myShowLandCovers;
   Handle(HYDROData_CalculationCase) myEditedObject;
 
   SUIT_ViewManager*               myActiveViewManager;
index 9127cb74a747cd7926b26e0583279c62fbf4f614..60ed49748807addbd54781018c0757ef7bb86522 100644 (file)
@@ -781,7 +781,7 @@ void HYDROGUI_Module::createPreferences()
 
   int StricklerTableGroup = addPreference( tr( "PREF_GROUP_STRICKLER_TABLE" ), genTab );
   int defaultStricklerCoef = addPreference( tr( "PREF_DEFAULT_STRICKLER_COEFFICIENT" ), StricklerTableGroup,
-                                            LightApp_Preferences::DblSpin, "HYDRO", "default_strickler_coefficient" );
+                                            LightApp_Preferences::DblSpin, "preferences", "default_strickler_coefficient" );
   setPreferenceProperty( defaultStricklerCoef, "precision", 2 );
   setPreferenceProperty( defaultStricklerCoef, "min", 0.00 );
   setPreferenceProperty( defaultStricklerCoef, "max", 1000000.00 );