]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Debug correction for display/erase annotation in manager, update visible icon in...
authornds <natalia.ermolaeva@opencascade.com>
Tue, 1 Nov 2016 07:23:38 +0000 (10:23 +0300)
committernds <natalia.ermolaeva@opencascade.com>
Tue, 1 Nov 2016 07:23:38 +0000 (10:23 +0300)
src/GEOMGUI/GEOMGUI_AnnotationMgr.h
src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx
src/GEOMGUI/GEOMGUI_TextTreeWdg.h
src/GEOMGUI/GEOM_Displayer.cxx
src/GEOMGUI/GeometryGUI.cxx
src/GEOMGUI/GeometryGUI.h

index 459b395f3ba69d5d1a78fae69402cba3607ee4d9..1d26e70c633473077d33378247acf9fe0e6c1687 100755 (executable)
@@ -54,8 +54,8 @@ public:
   void Display( const QString& theEntry, const int theIndex, SALOME_View* theView = 0 );
   void Erase( const QString& theEntry, const int theIndex, SALOME_View* theView = 0 );
 
-  void DisplayVisibleAnnotations( const QString& theEntry, SALOME_View* theView );
-  void EraseVisibleAnnotations( const QString& theEntry, SALOME_View* theView );
+  void DisplayVisibleAnnotations( const QString& theEntry, SALOME_View* theView = 0 );
+  void EraseVisibleAnnotations( const QString& theEntry, SALOME_View* theView = 0 );
 
   void RemoveView( SALOME_View* theView);
 
index 4eb3457d03f7e758534a78b80c281f4d1d603fd3..881e9dbb8c3f249bfb4d13b33271b3f359599587 100644 (file)
@@ -198,8 +198,6 @@ GEOMGUI_TextTreeWdg::GEOMGUI_TextTreeWdg( SalomeApp_Application* app )
   connect( this, SIGNAL( customContextMenuRequested(const QPoint&) ),
            this, SLOT( showContextMenu(const QPoint&) ) );
 
-  connect( myStudy, SIGNAL( objVisibilityChanged( QString, Qtx::VisibilityState ) ),
-           this, SLOT( onUpdateVisibilityColumn( QString, Qtx::VisibilityState ) ) );
   connect( app->objectBrowser(), SIGNAL( updated() ), this, SLOT( updateTree() ) );
 
   GeometryGUI* aGeomGUI = dynamic_cast<GeometryGUI*>( app->module( "Geometry" ) );
@@ -462,7 +460,7 @@ QTreeWidgetItem* GEOMGUI_TextTreeWdg::itemFromEntry( const BranchType& theBranch
 // function : onUpdateVisibilityColumn
 // purpose  : Update visible state of icons of entry items.
 //=================================================================================
-void GEOMGUI_TextTreeWdg::onUpdateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState )
+void GEOMGUI_TextTreeWdg::updateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState )
 {
   // dimension property branch
   updateVisibilityColumn( DimensionShape, theEntry, theState );
index 1eb3aa7e3a241f4c6fc7b8dc5e8ea00021714543..abbb99b6c2c680bc25d669c56d7708fa2a4b70ca 100644 (file)
@@ -67,6 +67,7 @@ public:
                                                         QTreeWidgetItem* theWidgetItem,
                                                         const bool theVisibility );
   void                          updateVisibility( SALOME_View* theView );
+  void                          updateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState );
 
 protected:
   void                          createActions();
@@ -80,7 +81,6 @@ public slots:
 
 private slots:
   void                          onItemClicked(QTreeWidgetItem*, int );
-  void                          onUpdateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState );
   void                          setVisibility( QTreeWidgetItem* theItem, bool visibility );
   void                          showContextMenu( const QPoint& pos );
 
index 2727281fcd5c0fc8adad9cb394b3a69dc6d3b4f1..1e7d726903aa1d9c943828b531881f5e7d3f6807 100755 (executable)
@@ -2159,12 +2159,6 @@ void GEOM_Displayer::BeforeDisplay( SALOME_View* v, const SALOME_OCCPrs* )
 void GEOM_Displayer::AfterDisplay( SALOME_View* v, const SALOME_OCCPrs* p )
 {
   UpdateColorScale(false,false);
-  // visualize annotations for displayed presentation
-  SUIT_Session* session = SUIT_Session::session();
-  SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
-  GeometryGUI* aModule = dynamic_cast<GeometryGUI*>( anApp->activeModule() );
-  if ( aModule )
-    aModule->GetAnnotationMgr()->DisplayVisibleAnnotations(QString(p->GetEntry()), v);
 }
 
 void GEOM_Displayer::BeforeErase( SALOME_View* v, const SALOME_OCCPrs* p )
@@ -2177,13 +2171,6 @@ void GEOM_Displayer::AfterErase( SALOME_View* v, const SALOME_OCCPrs* p )
 {
   LightApp_Displayer::AfterErase( v, p );
   UpdateColorScale(false,false);
-
-  // hide annotations for erased presentation
-  //SUIT_Session* session = SUIT_Session::session();
-  //SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
-  //GeometryGUI* aModule = dynamic_cast<GeometryGUI*>( anApp->activeModule() );
-  //if ( aModule )
-  //  aModule->GetAnnotationMgr()->EraseVisibleAnnotations(QString(p->GetEntry()), v);
 }
 
 //=================================================================
index a1f8677dd2667579f9fca9ecd964f36bab3b9187..e9d676bd0820fdf9142ad72bdbe76bf6573efc22 100644 (file)
@@ -1828,6 +1828,11 @@ bool GeometryGUI::activateModule( SUIT_Study* study )
 
   connect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
           this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
+  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
+  if ( appStudy )
+    connect( appStudy, SIGNAL( objVisibilityChanged( QString, Qtx::VisibilityState ) ),
+           this, SLOT( onUpdateVisibilityColumn( QString, Qtx::VisibilityState ) ) );
+
 
   // Reset actions accelerator keys
   action(GEOMOp::OpDelete)->setEnabled( true ); // Delete: Key_Delete
@@ -1880,7 +1885,6 @@ bool GeometryGUI::activateModule( SUIT_Study* study )
   // 0020836 (Basic vectors and origin)
   SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
   if ( aResourceMgr->booleanValue( "Geometry", "auto_create_base_objects", false ) ) {
-    SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
     if ( appStudy ) {
       _PTR(Study) studyDS = appStudy->studyDS();
       if ( studyDS ) {
@@ -1910,6 +1914,10 @@ bool GeometryGUI::deactivateModule( SUIT_Study* study )
 
   disconnect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
              this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
+  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
+  if ( appStudy )
+    disconnect( appStudy, SIGNAL( objVisibilityChanged( QString, Qtx::VisibilityState ) ),
+                this, SLOT( onUpdateVisibilityColumn( QString, Qtx::VisibilityState ) ) );
 
   LightApp_SelectionMgr* selMrg = getApp()->selectionMgr();
 
@@ -1980,6 +1988,18 @@ void GeometryGUI::onWindowActivated( SUIT_ViewWindow* win )
   }
 }
 
+void GeometryGUI::onUpdateVisibilityColumn( QString theEntry,
+                                            Qtx::VisibilityState theState )
+{
+  if ( myTextTreeWdg )
+    myTextTreeWdg->updateVisibilityColumn( theEntry, theState );
+
+  if ( theState == Qtx::ShownState )
+    GetAnnotationMgr()->DisplayVisibleAnnotations( theEntry );
+  else
+    GetAnnotationMgr()->EraseVisibleAnnotations( theEntry );
+}
+
 void GeometryGUI::windows( QMap<int, int>& mappa ) const
 {
   mappa.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
index b736f666b108712aa8dcc6dda00d2e461bd4fea5..f334ba3b9dbb923f38605339b50ac17a0bee3075 100644 (file)
@@ -36,6 +36,7 @@
 #include <GEOM_Client.hxx>
 #include <SALOME_InteractiveObject.hxx>
 #include <SALOMEDSClient.hxx>
+#include <Qtx.h>
 
 #include "GEOMGUI.h"
 #include "GEOMPluginGUI.h"
@@ -170,6 +171,9 @@ protected slots:
 private slots:
   void                        OnGUIEvent();
   void                        onWindowActivated( SUIT_ViewWindow* );
+  void                        onUpdateVisibilityColumn( QString theEntry,
+                                                        Qtx::VisibilityState theState );
+
   void                        onViewAboutToShow();
   void                        OnSetMaterial( const QString& );
   void                        updateMaterials();