]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Fix for the bug #56: Show, Show only, Hide for Region and Zone under Region.
authorrkv <rkv@opencascade.com>
Fri, 15 Nov 2013 11:33:04 +0000 (11:33 +0000)
committerrkv <rkv@opencascade.com>
Fri, 15 Nov 2013 11:33:04 +0000 (11:33 +0000)
src/HYDROGUI/CMakeLists.txt
src/HYDROGUI/HYDROGUI_CalculationOp.cxx
src/HYDROGUI/HYDROGUI_Displayer.cxx
src/HYDROGUI/HYDROGUI_Displayer.h
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx
src/HYDROGUI/HYDROGUI_OCCDisplayer.h
src/HYDROGUI/HYDROGUI_Shape.cxx
src/HYDROGUI/HYDROGUI_ShowHideOp.cxx
src/HYDROGUI/HYDROGUI_Tool.cxx

index e8bcaaf8fd6b2f1f60e053778a503e963ec6dfa2..7813790f88b5ee4a611e95730b395e355413f0a2 100644 (file)
@@ -3,6 +3,7 @@ include(../../CMake/UseQT4EXT.cmake)
 
 set(PROJECT_HEADERS 
     HYDROGUI.h
+    HYDROGUI_AbstractDisplayer.h
     HYDROGUI_AISCurve.h
     HYDROGUI_CalculationDlg.h
     HYDROGUI_CalculationOp.h
@@ -59,6 +60,7 @@ QT4_WRAP_CPP(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
 
 set(PROJECT_SOURCES 
     HYDROGUI_AISCurve.cxx
+    HYDROGUI_AbstractDisplayer.cxx
     HYDROGUI_CalculationDlg.cxx
     HYDROGUI_CalculationOp.cxx
     HYDROGUI_ColorWidget.cxx
index e04ec0be635f3dc65bb940e5fede3282815bf512..50575d886987d8e2e769299f6847a81291f0f3b6 100644 (file)
@@ -505,7 +505,7 @@ bool HYDROGUI_CalculationOp::processApply( int&     theUpdateFlags,
   if ( !aPanel )
     return false;
 
-  theUpdateFlags = UF_Model;
+  theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced;
 
   return true;
 }
index c28de63f9e4b7cf0926fc03c70b5148b00a24961..d42b31423cc094855c8bf18a243f2a7626bf62de 100644 (file)
@@ -34,7 +34,7 @@
 #include <GraphicsView_ViewPort.h>
 
 HYDROGUI_Displayer::HYDROGUI_Displayer( HYDROGUI_Module* theModule )
-: myModule( theModule )
+: HYDROGUI_AbstractDisplayer( theModule )
 {
 }
 
@@ -45,7 +45,7 @@ HYDROGUI_Displayer::~HYDROGUI_Displayer()
 void HYDROGUI_Displayer::SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
                                       const int theViewerId )
 {
-  GraphicsView_Viewer* aViewer = myModule->getViewer( theViewerId );
+  GraphicsView_Viewer* aViewer = module()->getViewer( theViewerId );
   if( !aViewer )
     return;
 
@@ -65,18 +65,9 @@ void HYDROGUI_Displayer::SetToUpdate( const HYDROData_SequenceOfObjects& theObjs
   }
 }
 
-void HYDROGUI_Displayer::UpdateAll( const int theViewerId,
-                                    const bool theIsInit,
-                                    const bool theIsForced )
-{
-  if( theIsInit )
-    EraseAll( theViewerId );
-  DisplayAll( theViewerId, theIsForced );
-}
-
 void HYDROGUI_Displayer::EraseAll( const int theViewerId )
 {
-  GraphicsView_Viewer* aViewer = myModule->getViewer( theViewerId );
+  GraphicsView_Viewer* aViewer = module()->getViewer( theViewerId );
   if( !aViewer )
     return;
 
@@ -95,43 +86,10 @@ void HYDROGUI_Displayer::EraseAll( const int theViewerId )
   }
 }
 
-void HYDROGUI_Displayer::DisplayAll( const int theViewerId,
-                                     const bool theIsForced )
-{
-  HYDROData_SequenceOfObjects aSeq;
-  HYDROGUI_Tool::GetPrsSubObjects( myModule, aSeq );
-  Update( aSeq, theViewerId, theIsForced );
-}
-
-void HYDROGUI_Displayer::Update( const HYDROData_SequenceOfObjects& theObjs,
-                                 const int theViewerId,
-                                 const bool theIsForced )
-{
-  // First of all, kill all bad presentations
-  purgeObjects( theViewerId );
-
-  // Now dig in the data model
-  HYDROData_SequenceOfObjects anObjectsToErase, anObjectsToDisplay;
-
-  for( int i = 1, n = theObjs.Length(); i <= n; i++ )
-  {
-    const Handle(HYDROData_Entity)& anObj = theObjs.Value( i );
-    if( anObj.IsNull() )
-      anObjectsToErase.Append( anObj );
-    else
-      anObjectsToDisplay.Append( anObj );
-  }
-
-  if( anObjectsToErase.Length() )
-    Erase( anObjectsToErase, theViewerId );
-  if( anObjectsToDisplay.Length() )
-    Display( anObjectsToDisplay, theViewerId, theIsForced );
-}
-
 void HYDROGUI_Displayer::Erase( const HYDROData_SequenceOfObjects& theObjs,
                                 const int theViewerId )
 {
-  GraphicsView_Viewer* aViewer = myModule->getViewer( theViewerId );
+  GraphicsView_Viewer* aViewer = module()->getViewer( theViewerId );
   if( !aViewer )
     return;
 
@@ -139,7 +97,7 @@ void HYDROGUI_Displayer::Erase( const HYDROData_SequenceOfObjects& theObjs,
   if( !aViewPort )
     return;
 
-  HYDROGUI_DataModel* aModel = (HYDROGUI_DataModel*)myModule->dataModel();
+  HYDROGUI_DataModel* aModel = (HYDROGUI_DataModel*)module()->dataModel();
   if( aModel ) 
   {
     GraphicsView_ObjectList anObjectList = HYDROGUI_Tool::GetPrsList( aViewPort );
@@ -160,7 +118,7 @@ void HYDROGUI_Displayer::Display( const HYDROData_SequenceOfObjects& theObjs,
                                   const int theViewerId,
                                   const bool theIsForced )
 {
-  GraphicsView_Viewer* aViewer = myModule->getViewer( theViewerId );
+  GraphicsView_Viewer* aViewer = module()->getViewer( theViewerId );
   if( !aViewer )
     return;
 
@@ -190,7 +148,7 @@ void HYDROGUI_Displayer::Display( const HYDROData_SequenceOfObjects& theObjs,
 
     if( aPrs )
     {
-      bool anIsVisible = myModule->isObjectVisible( (size_t)aViewer, anObj );
+      bool anIsVisible = module()->isObjectVisible( (size_t)aViewer, anObj );
       aPrs->setVisible( anIsVisible );
     }
   }
@@ -201,7 +159,7 @@ void HYDROGUI_Displayer::Display( const HYDROData_SequenceOfObjects& theObjs,
 
 void HYDROGUI_Displayer::purgeObjects( const int theViewerId )
 {
-  GraphicsView_Viewer* aViewer = myModule->getViewer( theViewerId );
+  GraphicsView_Viewer* aViewer = module()->getViewer( theViewerId );
   if( !aViewer )
     return;
 
index bc01eb9017ca8a7593da0964df54945c01345136..17e23c9ab520fecbeb6ad22cb3f9ecac9d361e4a 100644 (file)
 #ifndef HYDROGUI_DISPLAYER_H
 #define HYDROGUI_DISPLAYER_H
 
-#include <HYDROData_Entity.h>
+#include "HYDROGUI_AbstractDisplayer.h"
 
 #include <QMap>
 
-class HYDROGUI_Module;
 class HYDROGUI_PrsDriver;
 
 class GraphicsView_Viewer;
@@ -36,7 +35,7 @@ class GraphicsView_Viewer;
  * \class HYDROGUI_DataModel
  * \brief Class intended to create, display and update the presentations.
  */
-class HYDROGUI_Displayer
+class HYDROGUI_Displayer : public HYDROGUI_AbstractDisplayer
 {
 public:
   /**
@@ -59,16 +58,6 @@ public:
   void                            SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
                                                const int theViewerId );
 
-  /**
-   * \brief Update all objects in the viewer.
-   * \param theViewerId viewer identifier
-   * \param theIsInit flag used for initial update
-   * \param theIsForced flag used to update all objects, including the unchanged ones
-   */
-  void                            UpdateAll( const int theViewerId,
-                                             const bool theIsInit,
-                                             const bool theIsForced );
-
 protected:
   /**
    * \brief Erase all viewer objects.
@@ -76,24 +65,6 @@ protected:
    */
   void                            EraseAll( const int theViewerId );
 
-  /**
-   * \brief Update and display all objects in the viewer.
-   * \param theViewerId viewer identifier
-   * \param theIsForced flag used to update all objects, including the unchanged ones
-   */
-  void                            DisplayAll( const int theViewerId,
-                                              const bool theIsForced );
-
-  /**
-   * \brief Update the specified viewer objects.
-   * \param theObjs sequence of objects to update
-   * \param theViewerId viewer identifier
-   * \param theIsForced flag used to update all objects, including the unchanged ones
-   */
-  void                            Update( const HYDROData_SequenceOfObjects& theObjs,
-                                          const int theViewerId,
-                                          const bool theIsForced );
-
   /**
    * \brief Erase the specified viewer objects.
    * \param theObjs sequence of objects to erase
@@ -112,13 +83,13 @@ protected:
                                            const int theViewerId,
                                            const bool theIsForced );
 
-private:
   /**
    * \brief Purge all invalid objects in the viewer.
    * \param theViewerId viewer identifier
    */
   void                            purgeObjects( const int theViewerId );
 
+private:
   /**
    * \brief Get the presentation driver for the specified data object.
    * \param theObj data object
@@ -126,8 +97,6 @@ private:
   HYDROGUI_PrsDriver*             getDriver( const Handle(HYDROData_Entity)& theObj );
 
 private:
-  HYDROGUI_Module*                myModule;
-
   typedef QMap< ObjectKind, HYDROGUI_PrsDriver* > PrsDriversMap;
   PrsDriversMap                   myPrsDriversMap;
 };
index b36585e22f5de3e928030780271e0b060830d6c4..06129f95d9ecbcd973fc321ece4e66c748ea716e 100644 (file)
@@ -62,6 +62,7 @@
 
 #include <SALOME_Event.h>
 
+#include <SUIT_DataBrowser.h>
 #include <SUIT_Desktop.h>
 #include <SUIT_Study.h>
 #include <SUIT_ViewManager.h>
@@ -185,7 +186,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
 {
   HYDROGUI_DataModel* aModel = getDataModel();
 
-  bool anIsObjectBrowser = theClient == "ObjectBrowser";
+  bool anIsObjectBrowser = theClient == getApp()->objectBrowser()->popupClientType();
   bool anIsGraphicsView = theClient == GraphicsView_Viewer::Type();
   bool anIsOCCView = theClient == OCCViewer_Viewer::Type();
   if( !anIsObjectBrowser && !anIsGraphicsView && !anIsOCCView )
@@ -208,6 +209,8 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
   bool anIsCalculation = false;
   bool anIsImmersibleZone = false;
   bool anIsVisualState = false;
+  bool anIsRegion = false;
+  bool anIsZone = false;
 
   // check the selected data model objects
   HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( this );
@@ -243,7 +246,10 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
                 anIsSplittedImage = true;
             }
           }
-          anIsMustBeUpdatedImage = anImage->IsMustBeUpdated();
+          if ( anImage->IsMustBeUpdated() )
+          {
+            anIsMustBeUpdatedImage = true;
+          }
         }
       }
       else if( anObject->GetKind() == KIND_POLYLINE )
@@ -254,6 +260,10 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
         anIsImmersibleZone = true;
       else if( anObject->GetKind() == KIND_VISUAL_STATE )
         anIsVisualState = true;
+      else if( anObject->GetKind() == KIND_REGION )
+        anIsRegion = true;
+      else if( anObject->GetKind() == KIND_ZONE )
+        anIsZone = true;
     }
   }
 
@@ -288,80 +298,80 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
     }
   }
 
-  if( anIsSelectedDataObjects && anIsMustBeUpdatedImage )
+  if( anIsSelectedDataObjects )
   {
-    theMenu->addAction( action( UpdateImageId ) );
-    theMenu->addSeparator();
-  }
+    if ( anIsMustBeUpdatedImage )
+    {
+      theMenu->addAction( action( UpdateImageId ) );
+      theMenu->addSeparator();
+    }
 
-  if( anIsSelectedDataObjects && aSeq.Length() == 1 )
-  {
-    if( anIsImage )
+    if( aSeq.Length() == 1 )
     {
-      if( anIsImportedImage )
-        theMenu->addAction( action( EditImportedImageId ) );
-      else if( anIsImageHasRefs )
+      if( anIsImage )
       {
-        if( anIsFusedImage )
-          theMenu->addAction( action( EditFusedImageId ) );
-        else if( anIsCutImage )
-          theMenu->addAction( action( EditCutImageId ) );
-        else if( anIsSplittedImage )
-          theMenu->addAction( action( EditSplittedImageId ) );
-      }
+        if( anIsImportedImage )
+          theMenu->addAction( action( EditImportedImageId ) );
+        else if( anIsImageHasRefs )
+        {
+          if( anIsFusedImage )
+            theMenu->addAction( action( EditFusedImageId ) );
+          else if( anIsCutImage )
+            theMenu->addAction( action( EditCutImageId ) );
+          else if( anIsSplittedImage )
+            theMenu->addAction( action( EditSplittedImageId ) );
+        }
 
-      theMenu->addAction( action( ObserveImageId ) );
-      theMenu->addAction( action( ExportImageId ) );
-      theMenu->addSeparator();
+        theMenu->addAction( action( ObserveImageId ) );
+        theMenu->addAction( action( ExportImageId ) );
+        theMenu->addSeparator();
+
+        if( anIsImageHasRefs )
+        {
+          theMenu->addAction( action( RemoveImageRefsId ) );
+          theMenu->addSeparator();
+        }
 
-      if( anIsImageHasRefs )
+        theMenu->addAction( action( FuseImagesId ) );
+        theMenu->addAction( action( CutImagesId ) );
+        theMenu->addAction( action( SplitImageId ) );
+        theMenu->addSeparator();
+      }
+      else if( anIsPolyline )
       {
-        theMenu->addAction( action( RemoveImageRefsId ) );
+        theMenu->addAction( action( EditPolylineId ) );
+        theMenu->addSeparator();
+      }
+      else if( anIsCalculation )
+      {
+        theMenu->addAction( action( EditCalculationId ) );
+        theMenu->addSeparator();
+      }
+      else if( anIsImmersibleZone )
+      {
+        theMenu->addAction( action( EditImmersibleZoneId ) );
+        theMenu->addSeparator();
+      }
+      else if( anIsVisualState && anIsObjectBrowser )
+      {
+        theMenu->addAction( action( SaveVisualStateId ) );
+        theMenu->addAction( action( LoadVisualStateId ) );
         theMenu->addSeparator();
       }
-
-      theMenu->addAction( action( FuseImagesId ) );
-      theMenu->addAction( action( CutImagesId ) );
-      theMenu->addAction( action( SplitImageId ) );
-      theMenu->addSeparator();
-    }
-    else if( anIsPolyline )
-    {
-      theMenu->addAction( action( EditPolylineId ) );
-      theMenu->addSeparator();
-    }
-    else if( anIsCalculation )
-    {
-      theMenu->addAction( action( EditCalculationId ) );
-      theMenu->addSeparator();
-    }
-    else if( anIsImmersibleZone )
-    {
-      theMenu->addAction( action( EditImmersibleZoneId ) );
-      theMenu->addSeparator();
-    }
-    else if( anIsVisualState && anIsObjectBrowser )
-    {
-      theMenu->addAction( action( SaveVisualStateId ) );
-      theMenu->addAction( action( LoadVisualStateId ) );
-      theMenu->addSeparator();
     }
-  }
 
-  if( anIsSelectedDataObjects )
-  {
     theMenu->addAction( action( DeleteId ) );
     theMenu->addSeparator();
-  }
 
-  if( anIsSelectedDataObjects && ( anIsImage || anIsPolyline || anIsImmersibleZone ) )
-  {
-    if( anIsHiddenInSelection )
-      theMenu->addAction( action( ShowId ) );
-    theMenu->addAction( action( ShowOnlyId ) );
-    if( anIsVisibleInSelection )
-      theMenu->addAction( action( HideId ) );
-    theMenu->addSeparator();
+    if( anIsImage || anIsPolyline || anIsImmersibleZone || anIsZone || anIsRegion )
+    {
+      if( anIsHiddenInSelection )
+        theMenu->addAction( action( ShowId ) );
+      theMenu->addAction( action( ShowOnlyId ) );
+      if( anIsVisibleInSelection )
+        theMenu->addAction( action( HideId ) );
+      theMenu->addSeparator();
+    }
   }
 
   if( anIsObjectBrowser || anIsGraphicsView || anIsOCCView )
index d1655f3c411ba05c8726579c0b87e5d4a8951283..61a78ac4c5f580df2af36282b7284e01303c2a61 100644 (file)
 #include <OCCViewer_ViewModel.h>
 #include <OCCViewer_ViewWindow.h>
 
-#include <QApplication>
-
 HYDROGUI_OCCDisplayer::HYDROGUI_OCCDisplayer( HYDROGUI_Module* theModule )
-: myModule( theModule )
+: HYDROGUI_AbstractDisplayer( theModule )
 {
 }
 
@@ -49,7 +47,7 @@ HYDROGUI_OCCDisplayer::~HYDROGUI_OCCDisplayer()
 void HYDROGUI_OCCDisplayer::SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
                                          const int                          theViewerId )
 {
-  OCCViewer_Viewer* aViewer = myModule->getOCCViewer( theViewerId );
+  OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId );
   if( !aViewer )
     return;
 
@@ -59,7 +57,7 @@ void HYDROGUI_OCCDisplayer::SetToUpdate( const HYDROData_SequenceOfObjects& theO
     if( anObj.IsNull() )
       continue;
 
-    HYDROGUI_Shape* anObjShape = myModule->getObjectShape( (size_t)aViewer, anObj );
+    HYDROGUI_Shape* anObjShape = module()->getObjectShape( (size_t)aViewer, anObj );
     if ( !anObjShape )
       continue;
     
@@ -67,62 +65,19 @@ void HYDROGUI_OCCDisplayer::SetToUpdate( const HYDROData_SequenceOfObjects& theO
   }
 }
 
-void HYDROGUI_OCCDisplayer::UpdateAll( const int  theViewerId,
-                                       const bool theIsInit,
-                                       const bool theIsForced )
-{
-  if ( theIsInit )
-    EraseAll( theViewerId );
-
-  DisplayAll( theViewerId, theIsForced );
-}
-
 void HYDROGUI_OCCDisplayer::EraseAll( const int theViewerId )
 {
-  OCCViewer_Viewer* aViewer = myModule->getOCCViewer( theViewerId );
+  OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId );
   if( !aViewer )
     return;
 
-  myModule->removeViewShapes( (size_t)aViewer );
-}
-
-void HYDROGUI_OCCDisplayer::DisplayAll( const int  theViewerId,
-                                        const bool theIsForced )
-{
-  HYDROData_SequenceOfObjects aSeq;
-  HYDROGUI_Tool::GetPrsSubObjects( myModule, aSeq );
-  Update( aSeq, theViewerId, theIsForced );
-}
-
-void HYDROGUI_OCCDisplayer::Update( const HYDROData_SequenceOfObjects& theObjs,
-                                    const int                          theViewerId,
-                                    const bool                         theIsForced )
-{
-  // First of all, kill all bad presentations
-  purgeObjects( theViewerId );
-
-  // Now dig in the data model
-  HYDROData_SequenceOfObjects anObjectsToErase, anObjectsToDisplay;
-
-  for( int i = 1, n = theObjs.Length(); i <= n; i++ )
-  {
-    const Handle(HYDROData_Entity)& anObj = theObjs.Value( i );
-    if( anObj.IsNull() )
-      anObjectsToErase.Append( anObj );
-    else
-      anObjectsToDisplay.Append( anObj );
-  }
-
-  if( anObjectsToErase.Length() )
-    Erase( anObjectsToErase, theViewerId );
-  if( anObjectsToDisplay.Length() )
-    Display( anObjectsToDisplay, theViewerId, theIsForced );
+  module()->removeViewShapes( (size_t)aViewer );
 }
 
 void HYDROGUI_OCCDisplayer::Erase( const HYDROData_SequenceOfObjects& theObjs,
                                    const int                          theViewerId )
 {
-  OCCViewer_Viewer* aViewer = myModule->getOCCViewer( theViewerId );
+  OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId );
   if( !aViewer )
     return;
 
@@ -132,7 +87,7 @@ void HYDROGUI_OCCDisplayer::Erase( const HYDROData_SequenceOfObjects& theObjs,
     if( anObj.IsNull() )
       continue;
 
-    myModule->removeObjectShape( (size_t)aViewer, anObj );
+    module()->removeObjectShape( (size_t)aViewer, anObj );
   }
 }
 
@@ -153,7 +108,7 @@ HYDROGUI_Shape* HYDROGUI_OCCDisplayer::createShape( const int
     return aResShape;
 
   aResShape = new HYDROGUI_Shape( theContext, theObject );
-  myModule->setObjectShape( theViewerId, theObject, aResShape );
+  module()->setObjectShape( theViewerId, theObject, aResShape );
 
   return aResShape;
 }
@@ -162,7 +117,7 @@ void HYDROGUI_OCCDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs,
                                      const int                          theViewerId,
                                      const bool                         theIsForced )
 {
-  OCCViewer_Viewer* aViewer = myModule->getOCCViewer( theViewerId );
+  OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId );
   if( !aViewer )
     return;
 
@@ -176,7 +131,7 @@ void HYDROGUI_OCCDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs,
     if ( anObj.IsNull() || anObj->IsRemoved() )
       continue;
 
-    HYDROGUI_Shape* anObjShape = myModule->getObjectShape( (size_t)aViewer, anObj );
+    HYDROGUI_Shape* anObjShape = module()->getObjectShape( (size_t)aViewer, anObj );
 
     if ( !anObjShape || anObjShape->getIsToUpdate() || theIsForced )
     {
@@ -189,7 +144,7 @@ void HYDROGUI_OCCDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs,
 
     if ( anObjShape )
     {
-      bool anIsVisible = myModule->isObjectVisible( (size_t)aViewer, anObj );
+      bool anIsVisible = module()->isObjectVisible( (size_t)aViewer, anObj );
       anObjShape->setVisible( anIsVisible, false );
     }
   }
@@ -202,7 +157,6 @@ void HYDROGUI_OCCDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs,
       ::qobject_cast<OCCViewer_ViewWindow*>( aViewManager->getActiveView() );
     if ( aViewWindow )
     {
-      //RKV: QApplication::processEvents(); //Process the draw events for viewer
       aViewWindow->onFitAll();
     }
   }
@@ -210,7 +164,7 @@ void HYDROGUI_OCCDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs,
 
 void HYDROGUI_OCCDisplayer::purgeObjects( const int theViewerId )
 {
-  OCCViewer_Viewer* aViewer = myModule->getOCCViewer( theViewerId );
+  OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId );
   if( !aViewer )
     return;
 
@@ -231,7 +185,7 @@ void HYDROGUI_OCCDisplayer::purgeObjects( const int theViewerId )
     Handle(HYDROData_Entity) anOwnerObj = 
       Handle(HYDROData_Entity)::DownCast( aPrsObj->GetOwner() );
     if ( !anOwnerObj.IsNull() && anOwnerObj->IsRemoved() )
-      myModule->removeObjectShape( (size_t)aViewer, anOwnerObj );
+      module()->removeObjectShape( (size_t)aViewer, anOwnerObj );
   }
 }
 
index f8d1ea13b14c7aea5d6611a92b892a0da426e3d3..410ee7766d4dde7c09eb13e7baf4e0dde2247896 100644 (file)
@@ -23,9 +23,8 @@
 #ifndef HYDROGUI_OCCDISPLAYER_H
 #define HYDROGUI_OCCDISPLAYER_H
 
-#include <HYDROData_Entity.h>
+#include "HYDROGUI_AbstractDisplayer.h"
 
-class HYDROGUI_Module;
 class HYDROGUI_Shape;
 class Handle(AIS_InteractiveContext);
 
@@ -33,7 +32,7 @@ class Handle(AIS_InteractiveContext);
  * \class HYDROGUI_OCCDisplayer
  * \brief Class intended to create, display and update the presentations on OCC viewer.
  */
-class HYDROGUI_OCCDisplayer
+class HYDROGUI_OCCDisplayer : public HYDROGUI_AbstractDisplayer
 {
 public:
   /**
@@ -56,16 +55,6 @@ public:
   void                            SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
                                                const int theViewerId );
 
-  /**
-   * \brief Update all objects in the viewer.
-   * \param theViewerId viewer identifier
-   * \param theIsInit flag used for initial update
-   * \param theIsForced flag used to update all objects, including the unchanged ones
-   */
-  void                            UpdateAll( const int theViewerId,
-                                             const bool theIsInit,
-                                             const bool theIsForced );
-
 protected:
   /**
    * \brief Erase all viewer objects.
@@ -73,24 +62,6 @@ protected:
    */
   void                            EraseAll( const int theViewerId );
 
-  /**
-   * \brief Update and display all objects in the viewer.
-   * \param theViewerId viewer identifier
-   * \param theIsForced flag used to update all objects, including the unchanged ones
-   */
-  void                            DisplayAll( const int theViewerId,
-                                              const bool theIsForced );
-
-  /**
-   * \brief Update the specified viewer objects.
-   * \param theObjs sequence of objects to update
-   * \param theViewerId viewer identifier
-   * \param theIsForced flag used to update all objects, including the unchanged ones
-   */
-  void                            Update( const HYDROData_SequenceOfObjects& theObjs,
-                                          const int theViewerId,
-                                          const bool theIsForced );
-
   /**
    * \brief Erase the specified viewer objects.
    * \param theObjs sequence of objects to erase
@@ -109,13 +80,13 @@ protected:
                                            const int theViewerId,
                                            const bool theIsForced );
 
-private:
   /**
    * \brief Purge all invalid objects in the viewer.
    * \param theViewerId viewer identifier
    */
   void                            purgeObjects( const int theViewerId );
 
+private:
   /**
    * \brief Creates new OCC shape.
    * \param theViewerId viewer identifier
@@ -126,10 +97,6 @@ private:
   HYDROGUI_Shape*                 createShape( const int                             theViewerId,
                                                const Handle(AIS_InteractiveContext)& theContext,
                                                const Handle(HYDROData_Entity)&       theObject );
-
-private:
-  HYDROGUI_Module*                myModule;
-
 };
 
 #endif
index 41cf8299ea3382dd0c9e3ac40d3942dc5de3bc96..361a420cc42f5e1fb5e8b14256476b42e262708b 100644 (file)
@@ -131,11 +131,6 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer )
 
       setWire( aPolylineWire, false, false );
     }
-    else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Region) ) )
-    {
-      Handle(HYDROData_Region) aRegion =
-        Handle(HYDROData_Region)::DownCast( myObject );
-    }
     else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Zone) ) )
     {
       Handle(HYDROData_Zone) aZone =
index 0fefdfae2fc3ba43046a7cf061cb8b22f856eb7b..543fe3bcd3ebdab8ed667e223c007bb7aec73427 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <HYDROData_Iterator.h>
 #include <HYDROData_Entity.h>
+#include <HYDROData_Region.h>
 
 #include <LightApp_Application.h>
 
@@ -84,11 +85,30 @@ void HYDROGUI_ShowHideOp::startOperation()
     HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( module() );
 
     bool aVisibility = myId == ShowId || myId == ShowOnlyId;
+    Handle( HYDROData_Entity ) anObject;
     for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
     {
-      Handle(HYDROData_Entity) anObject = aSeq.Value( anIndex );
+      anObject = aSeq.Value( anIndex );
       if( !anObject.IsNull() )
+      {
         module()->setObjectVisible( aViewId, anObject, aVisibility );
+        if ( anObject->GetKind() == KIND_REGION )
+        {
+          Handle( HYDROData_Region ) aRegion = Handle( HYDROData_Region )::DownCast( anObject );
+          if ( !aRegion.IsNull() )
+          {
+            HYDROData_SequenceOfObjects aZonesSeq = aRegion->GetZones();
+            for( Standard_Integer aZoneIdx = 1, aNbZones = aZonesSeq.Length(); aZoneIdx <= aNbZones; aZoneIdx++ )
+            {
+              anObject = aZonesSeq.Value( aZoneIdx );
+              if( !anObject.IsNull() )
+              {
+                module()->setObjectVisible( aViewId, anObject, aVisibility );
+              }
+            }
+          }
+        }
+      }
     }
   }
 
index 54a1e9fda28d0553f5dc24913da6d4c3c31ccd58..51ce9f1d1d6c5fd1045b6014dc4cec39e71d1775 100644 (file)
@@ -200,31 +200,22 @@ void HYDROGUI_Tool::GetPrsSubObjects( HYDROGUI_Module* theModule,
                                       HYDROData_SequenceOfObjects& theSeq )
 {
   Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() );
-  if( aDocument.IsNull() )
-    return;
-
-  HYDROData_Iterator anIterator( aDocument, KIND_IMAGE );
-  for( ; anIterator.More(); anIterator.Next() )
-  {
-    Handle(HYDROData_Entity) anObject = anIterator.Current();
-    if( !anObject.IsNull() )
-      theSeq.Append( anObject );
-  }
-
-  anIterator = HYDROData_Iterator( aDocument, KIND_POLYLINE );
-  for( ; anIterator.More(); anIterator.Next() )
+  if( !aDocument.IsNull() )
   {
-    Handle(HYDROData_Entity) anObject = anIterator.Current();
-    if( !anObject.IsNull() )
-      theSeq.Append( anObject );
-  }
-
-  anIterator = HYDROData_Iterator( aDocument, KIND_IMMERSIBLE_ZONE );
-  for( ; anIterator.More(); anIterator.Next() )
-  {
-    Handle(HYDROData_Entity) anObject = anIterator.Current();
-    if( !anObject.IsNull() )
-      theSeq.Append( anObject );
+    HYDROData_Iterator anIterator( aDocument );
+    for( ; anIterator.More(); anIterator.Next() )
+    {
+      Handle(HYDROData_Entity) anObject = anIterator.Current();
+      if( !anObject.IsNull() && ( 
+        ( anObject->GetKind() == KIND_IMAGE ) ||
+        ( anObject->GetKind() == KIND_POLYLINE ) ||
+        ( anObject->GetKind() == KIND_IMMERSIBLE_ZONE ) ||
+        ( anObject->GetKind() == KIND_REGION ) ||
+        ( anObject->GetKind() == KIND_ZONE ) ) )
+      {
+        theSeq.Append( anObject );
+      }
+    }
   }
 }