]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #578: hide geometry objects and land covers, when panels with constructed region...
authormkr <mkr@opencascade.com>
Tue, 23 Jun 2015 13:01:21 +0000 (16:01 +0300)
committermkr <mkr@opencascade.com>
Tue, 23 Jun 2015 13:01:21 +0000 (16:01 +0300)
src/HYDROGUI/HYDROGUI_CalculationOp.cxx
src/HYDROGUI/HYDROGUI_CalculationOp.h

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;