From: apo Date: Fri, 9 Dec 2005 11:47:01 +0000 (+0000) Subject: To accelerate creation/deletion of the VISU presentations. X-Git-Tag: TG-D5-38-2003_D2005-20-12~44 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9c92f0a35d60fc94320fcfea2604b1f5a4057250;p=modules%2Fvisu.git To accelerate creation/deletion of the VISU presentations. Perfomance of the data model / object browser update functionality was much improved. --- diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 941bf0a0..fab7a980 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -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 diff --git a/src/VISUGUI/VisuGUI_Prs3dTools.h b/src/VISUGUI/VisuGUI_Prs3dTools.h index d9a4b448..1d255f22 100644 --- a/src/VISUGUI/VisuGUI_Prs3dTools.h +++ b/src/VISUGUI/VisuGUI_Prs3dTools.h @@ -180,7 +180,7 @@ namespace VISU return false; } - + //--------------------------------------------------------------- template 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(theModule,theIsCreateView)) diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 6648937d..affe004b 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -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(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) { diff --git a/src/VISUGUI/VisuGUI_Tools.h b/src/VISUGUI/VisuGUI_Tools.h index 3f36c793..677ecdef 100644 --- a/src/VISUGUI/VisuGUI_Tools.h +++ b/src/VISUGUI/VisuGUI_Tools.h @@ -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