]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To accelerate creation/deletion of the VISU presentations.
authorapo <apo@opencascade.com>
Fri, 9 Dec 2005 11:47:01 +0000 (11:47 +0000)
committerapo <apo@opencascade.com>
Fri, 9 Dec 2005 11:47:01 +0000 (11:47 +0000)
Perfomance of the data model / object browser update functionality was much improved.

src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI_Prs3dTools.h
src/VISUGUI/VisuGUI_Tools.cxx
src/VISUGUI/VisuGUI_Tools.h

index 941bf0a05ecd9f1347b962fc1ef61fe40bc4e42c..fab7a980cbc91e1f1ee206dfb50edb060aaa0271 100644 (file)
@@ -1124,14 +1124,12 @@ OnDeleteObjects()
     _PTR(SObject) aSObject = aCStudy->FindObjectID(entries[i]);
     if (aSObject) {
       DeleteSObject(this, aCStudy, aSObject);
+      UpdateObjBrowser(this, true, aSObject);
     }
   }
 
   // Finish transaction
   aStudyBuilder->CommitCommand();
-
-  //GetActiveStudy()->unHighlightAll();
-  UpdateObjBrowser(this, true);
 }
 
 void
index d9a4b448c0b3c172d9bb38068ad30b58b7f7d555..1d255f2277d8f15369fc2ebc797f58f231d03362 100644 (file)
@@ -180,7 +180,7 @@ namespace VISU
     return false;
   }
   
-  
+
   //---------------------------------------------------------------
   template<class TPrs3d_i, class TViewer, class TDlg, int IsDlgModal>
   inline
@@ -200,7 +200,7 @@ namespace VISU
       return;
     
     theModule->application()->putInfo(QObject::tr("INF_DONE"));
-    UpdateObjBrowser(theModule);
+    UpdateObjBrowser(theModule,true,aTimeStampSObj);
     
     typedef typename TViewer::TViewWindow TView;
     if(TView* aView = GetViewWindow<TViewer>(theModule,theIsCreateView))
index 6648937ddfa8c8f671b42aa6b7b8468f4103ff7c..affe004b73b772588a7ee9b3943a3f8f640efbc9 100644 (file)
@@ -41,6 +41,9 @@
 #include "SalomeApp_Module.h"
 #include "SalomeApp_Study.h"
 #include "SalomeApp_Application.h"
+
+#include "OB_Browser.h"
+#include "LightApp_DataObject.h"
 #include "LightApp_SelectionMgr.h"
 
 #include "SALOME_ListIO.hxx"
@@ -106,6 +109,45 @@ namespace VISU
     return false;
   }
 
+  void
+  UpdateObjBrowser(SalomeApp_Module* theModule,
+                  bool theIsUpdateDataModel,
+                  _PTR(SObject) theSObject)
+  {
+    LightApp_DataObject* aDataObject = NULL;
+    if(theSObject){
+      std::string anEntry = theSObject->GetID();
+      SalomeApp_Application* anApp = theModule->getApp();
+      OB_Browser* aBrowser = anApp->objectBrowser();
+      DataObjectList aList = aBrowser->getSelected();
+      DataObjectListIterator anIter(aList);
+      while(SUIT_DataObject* anObject = anIter.current()){
+       aDataObject = dynamic_cast<LightApp_DataObject*>(anObject);
+       if(aDataObject){
+         if(anEntry == aDataObject->entry().latin1()){
+           break;
+         }
+       }
+       ++anIter;
+      }
+    }
+    theModule->updateObjBrowser(theIsUpdateDataModel,aDataObject);
+    theModule->getApp()->updateActions();
+  }
+
+  bool
+  IsSObjectTable( _PTR(SObject) theSObject )
+  {
+    if ( theSObject ) {
+      _PTR(GenericAttribute) anAttr;
+      if (theSObject->FindAttribute( anAttr, "AttributeTableOfInteger" ))
+       return true;
+      if (theSObject->FindAttribute( anAttr, "AttributeTableOfReal" ))
+       return true;
+    }
+    return false;
+  }
+
   VISU_Gen_i*
   GetVisuGen(const CAM_Module* theModule)
   {
index 3f36c793a6b84df9a6df761feca81280e182f9cc..677ecdef303892c091f6bf601d32f8a7cc828f9d 100644 (file)
@@ -32,9 +32,6 @@
 
 #include "VISUConfig.hh"
 
-#include "SalomeApp_Module.h"
-#include "SalomeApp_Application.h"
-
 #include "SALOMEDSClient_Study.hxx"
 
 #include "SALOMEconfig.h"
@@ -49,6 +46,7 @@ class SPlot2d_Curve;
 class Plot2d_ViewFrame;
 class CAM_Module;
 class LightApp_SelectionMgr;
+class SalomeApp_Module;
 class SalomeApp_Study;
 
 namespace VISU {
@@ -67,8 +65,9 @@ namespace VISU {
   bool                                 IsStudyLocked( _PTR(Study) theStudy );
   bool                                 CheckLock( _PTR(Study) theStudy );
 
-  inline void                          UpdateObjBrowser(SalomeApp_Module* theModule,
-                                                       bool updateDataModel = true);
+  void                                 UpdateObjBrowser(SalomeApp_Module* theModule,
+                                                       bool theIsUpdateDataModel = true,
+                                                       _PTR(SObject) theSObject = _PTR(SObject)());
 
   VISU_Gen_i*                          GetVisuGen(const CAM_Module* theModule);
   SALOME_MED::MED_Gen_var              GetMEDEngine();
@@ -121,7 +120,7 @@ namespace VISU {
   VISU::Result_i*                      CheckResult(const SalomeApp_Module* theModule,
                                                   _PTR(SObject) theSource,
                                                   VISU::Result_var& theResult);
-  inline bool                          IsSObjectTable(_PTR(SObject) theSObject);
+  bool                                 IsSObjectTable(_PTR(SObject) theSObject);
 
   // Views
   SUIT_ViewWindow*                     GetActiveView(const SalomeApp_Module* theModule,
@@ -196,23 +195,4 @@ namespace VISU {
                                            _PTR(SObject) theObject);
 }
 
-bool VISU::IsSObjectTable( _PTR(SObject) theSObject )
-{
-  if ( theSObject ) {
-    _PTR(GenericAttribute) anAttr;
-    if (theSObject->FindAttribute( anAttr, "AttributeTableOfInteger" ))
-      return true;
-    if (theSObject->FindAttribute( anAttr, "AttributeTableOfReal" ))
-      return true;
-  }
-  return false;
-}
-
-void VISU::UpdateObjBrowser(SalomeApp_Module* theModule,
-                           bool updateDataModel)
-{
-  theModule->updateObjBrowser(updateDataModel);
-  theModule->getApp()->updateActions();
-}
-
 #endif