From fbbe77e742d90d8e563ec1d9d76bcb89b042785c Mon Sep 17 00:00:00 2001 From: ouv Date: Fri, 25 Mar 2011 15:26:16 +0000 Subject: [PATCH] Issue 0021055: EDF 1602 STUDY: Object browser reactualisation when creating an object --- src/VISUGUI/VisuGUI.cxx | 94 +++++++++++++++++++++++----------- src/VISUGUI/VisuGUI.h | 2 + src/VISUGUI/VisuGUI_Module.cxx | 3 +- 3 files changed, 66 insertions(+), 33 deletions(-) diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index bd549708..a60d3e78 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -259,6 +259,7 @@ VisuGUI SUIT_OverrideCursor wc; QStringList errors; + QStringList anEntryList; for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) { QFileInfo aFileInfo( *it ); @@ -291,6 +292,8 @@ VisuGUI aResult->SetBuildFields( toBuildFields, toBuildMinMax ); aResult->SetBuildGroups( toBuildGroups ); aResult->Build( toBuildAll, toBuildAtOnce ); + if( VISU::Result_i* aCResult = dynamic_cast( VISU::GetServant( aResult ).in() ) ) + anEntryList.append( aCResult->GetEntry().c_str() ); application()->putInfo( anInfo + tr("INF_DONE") ); } } // if ( !toUseBuildProgress ) @@ -317,6 +320,8 @@ VisuGUI } else { UpdateObjBrowser(this); + if( getApp() ) + getApp()->browseObjects( anEntryList ); } } @@ -362,6 +367,7 @@ VisuGUI return; // nothing selected QStringList errors; + QStringList anEntryList; for ( QStringList::ConstIterator it = aFiles.begin(); it != aFiles.end(); ++it ) { QFileInfo aFileInfo( *it ); @@ -374,7 +380,7 @@ VisuGUI QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." ); application()->putInfo( anInfo ); - CORBA::Object_var anObject = + SALOMEDS::SObject_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData(), aFirstStrAsTitle); @@ -383,6 +389,7 @@ VisuGUI arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) ); } else { + anEntryList.append( anObject->GetID() ); application()->putInfo( anInfo + tr("INF_DONE") ); } } @@ -399,6 +406,8 @@ VisuGUI } else { UpdateObjBrowser(this); + if( getApp() ) + getApp()->browseObjects( anEntryList ); } } @@ -519,6 +528,7 @@ VisuGUI SALOME_ListIO aListIO; aSelectionMgr->selectedObjects(aListIO); + QStringList anEntryList; SALOME_ListIteratorOfListIO It (aListIO); QApplication::setOverrideCursor(Qt::WaitCursor); for (; It.More(); It.Next()) { @@ -558,14 +568,15 @@ VisuGUI } } + VISU::Result_var aResult; CORBA::Object_var anObject = VISU::SObjectToObject(aSObject); if (!CORBA::is_nil(anObject)) { SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject); if (!CORBA::is_nil(aMED.in())) - GetVisuGen(this)->ImportMed(aSObject); + aResult = GetVisuGen(this)->ImportMed(aSObject); SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject); if (!CORBA::is_nil(aField.in())) - GetVisuGen(this)->ImportMedField(aField); + aResult = GetVisuGen(this)->ImportMedField(aField); } else { SALOMEDS::SObject_var aSFather = aSObject->GetFather(); SALOMEDS::GenericAttribute_var anAttr; @@ -573,11 +584,17 @@ VisuGUI SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); CORBA::String_var aValue = aName->Value(); if (strcmp(aValue.in(), "MEDFIELD") == 0) - GetVisuGen(this)->ImportMed(aSObject); + aResult = GetVisuGen(this)->ImportMed(aSObject); } + + if( !CORBA::is_nil( aResult ) ) + if( VISU::Result_i* aCResult = dynamic_cast( VISU::GetServant( aResult ).in() ) ) + anEntryList.append( aCResult->GetEntry().c_str() ); } } UpdateObjBrowser(this, true); + if( getApp() ) + getApp()->browseObjects( anEntryList ); QApplication::restoreOverrideCursor(); } @@ -755,8 +772,7 @@ VisuGUI // create mesh presentation and display it in aViewWindow VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow); aViewWindow->highlight(anIO, 1); - if (aPrs) - emit presentationCreated(aPrs); + processPresentationCreated(aPrs); } void @@ -783,8 +799,7 @@ VisuGUI // create mesh presentation and display it in aViewWindow VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow); aViewWindow->highlight(anIO, 1); - if (aPrs) - emit presentationCreated(aPrs); + processPresentationCreated(aPrs); } } @@ -793,8 +808,7 @@ VisuGUI ::OnCreateScalarMap() { Prs3d_i* aPrs = CreatePrs3d(this); - if (aPrs) - emit presentationCreated(aPrs); + processPresentationCreated(aPrs); } @@ -803,8 +817,7 @@ VisuGUI ::OnCreateDeformedShape() { Prs3d_i* aPrs = CreatePrs3d(this); - if (aPrs) - emit presentationCreated(aPrs); + processPresentationCreated(aPrs); } void @@ -812,8 +825,7 @@ VisuGUI ::OnCreateDeformedShapeAndScalarMap() { Prs3d_i* aPrs = CreatePrs3d(this); - if (aPrs) - emit presentationCreated(aPrs); + processPresentationCreated(aPrs); } void @@ -821,8 +833,7 @@ VisuGUI ::OnCreateVectors() { Prs3d_i* aPrs = CreatePrs3d(this); - if (aPrs) - emit presentationCreated(aPrs); + processPresentationCreated(aPrs); } void @@ -830,8 +841,7 @@ VisuGUI ::OnCreateIsoSurfaces() { Prs3d_i* aPrs = CreatePrs3d(this); - if (aPrs) - emit presentationCreated(aPrs); + processPresentationCreated(aPrs); } void @@ -839,8 +849,7 @@ VisuGUI ::OnCreateCutPlanes() { Prs3d_i* aPrs = CreatePrs3d(this); - if (aPrs) - emit presentationCreated(aPrs); + processPresentationCreated(aPrs); } void @@ -848,8 +857,7 @@ VisuGUI ::OnCreateCutLines() { Prs3d_i* aPrs = CreatePrs3d(this); - if (aPrs) - emit presentationCreated(aPrs); + processPresentationCreated(aPrs); } void @@ -857,8 +865,7 @@ VisuGUI ::OnCreateCutSegment() { Prs3d_i* aPrs = CreatePrs3d(this); - if (aPrs) - emit presentationCreated(aPrs); + processPresentationCreated(aPrs); } void @@ -866,8 +873,7 @@ VisuGUI ::OnCreateStreamLines() { Prs3d_i* aPrs = CreatePrs3d(this); - if (aPrs) - emit presentationCreated(aPrs); + processPresentationCreated(aPrs); } void @@ -875,8 +881,7 @@ VisuGUI ::OnCreatePlot3D() { Prs3d_i* aPrs = CreatePrs3d(this); - if (aPrs) - emit presentationCreated(aPrs); + processPresentationCreated(aPrs); } void @@ -884,8 +889,17 @@ VisuGUI ::OnCreatePlot2dView() { CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)); - GetVisuGen( this )->CreateContainer(); + VISU::Container_var aContainer = GetVisuGen( this )->CreateContainer(); UpdateObjBrowser(this); + + if( !CORBA::is_nil( aContainer.in() ) ) { + if( VISU::Container_i* aCContainer = dynamic_cast( VISU::GetServant( aContainer ).in() ) ) { + QStringList anEntryList; + anEntryList.append( aCContainer->GetEntry().c_str() ); + if( getApp() ) + getApp()->browseObjects( anEntryList ); + } + } } void @@ -3727,6 +3741,25 @@ VisuGUI return new VisuGUI_Selection( (SalomeApp_Module*)this ); } +void +VisuGUI +::processPresentationCreated( VISU::Prs3d_i* thePrs ) +{ + if( thePrs ) + { + QString anEntry = thePrs->GetEntry().c_str(); + if( anEntry.isEmpty() ) + if( VISU::ColoredPrs3d_i* aColoredPrs = dynamic_cast( thePrs ) ) + anEntry = aColoredPrs->GetHolderEntry().c_str(); + + QStringList anEntryList( anEntry ); + if( getApp() ) + getApp()->browseObjects( anEntryList ); + + emit presentationCreated( thePrs ); + } +} + //****************************************************************** void VisuGUI::studyActivated() { @@ -4574,8 +4607,7 @@ void VisuGUI::OnPlot3dFromCutPlane() AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos); } - if (aPrs3d) - emit presentationCreated(aPrs3d); + processPresentationCreated(aPrs3d); } } application()->putInfo(QObject::tr("INF_DONE")); diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index 0dd29a45..1d7e3e10 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -213,6 +213,8 @@ protected slots: protected: virtual LightApp_Selection* createSelection() const; + virtual void processPresentationCreated( VISU::Prs3d_i* thePrs ); + void OnTimeAnimation(VISU::Animation::AnimationMode theMode); private: diff --git a/src/VISUGUI/VisuGUI_Module.cxx b/src/VISUGUI/VisuGUI_Module.cxx index 50818adb..7da3b5ea 100644 --- a/src/VISUGUI/VisuGUI_Module.cxx +++ b/src/VISUGUI/VisuGUI_Module.cxx @@ -963,8 +963,7 @@ void VisuGUI_Module::OnCreateGaussPoints() double initialTime = vtkTimerLog::GetCPUTime(); //CreatePrs3d(this, VVTK_Viewer::Type()); Prs3d_i* aPrs = CreatePrs3d(this, SVTK_Viewer::Type()); - if (aPrs) - emit presentationCreated(aPrs); + processPresentationCreated(aPrs); INFOS( "VisuGUI_Module::OnCreateGaussPoints() : Gauss Points created in " << vtkTimerLog::GetCPUTime() - initialTime << " seconds" ); } -- 2.39.2