From: rnv Date: Thu, 19 Nov 2020 00:35:02 +0000 (+0300) Subject: Partial fix for '#16403 EDF 17034 - Hole during meshing visualization' X-Git-Tag: V9_7_0a1~49 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a0b14f92a46d5733c346df9b0f2bb2ee7be538b6;p=modules%2Fsmesh.git Partial fix for '#16403 EDF 17034 - Hole during meshing visualization' --- diff --git a/src/SMESHGUI/SMESHGUI_Displayer.cxx b/src/SMESHGUI/SMESHGUI_Displayer.cxx index adeb2d736..53bb6c4dd 100644 --- a/src/SMESHGUI/SMESHGUI_Displayer.cxx +++ b/src/SMESHGUI/SMESHGUI_Displayer.cxx @@ -46,7 +46,8 @@ SMESHGUI_Displayer::SMESHGUI_Displayer( SalomeApp_Application* app ) : LightApp_Displayer(), - myApp( app ) + myApp( app ), + isNeedFitAll(false) { } @@ -71,6 +72,7 @@ SALOME_Prs* SMESHGUI_Displayer::buildPresentation( const QString& entry, SALOME_ anActor = SMESH::CreateActor( entry.toUtf8().data(), true ); if( anActor ) { + isNeedFitAll = SMESH::NoSmeshActors(); SMESH::DisplayActor( wnd, anActor ); prs = LightApp_Displayer::buildPresentation( entry.toUtf8().data(), aViewFrame ); } @@ -113,3 +115,13 @@ bool SMESHGUI_Displayer::canBeDisplayed( const QString& entry, const QString& vi } return res; } + +void SMESHGUI_Displayer::Display( const QStringList& theList, const bool anUpdateViewer, SALOME_View* theView ) +{ + LightApp_Displayer::Display( theList, anUpdateViewer, theView ); + + if (isNeedFitAll) { + SMESH::FitAll(); + isNeedFitAll = false; + } +} \ No newline at end of file diff --git a/src/SMESHGUI/SMESHGUI_Displayer.h b/src/SMESHGUI/SMESHGUI_Displayer.h index 6a1fce51e..3777cfcad 100644 --- a/src/SMESHGUI/SMESHGUI_Displayer.h +++ b/src/SMESHGUI/SMESHGUI_Displayer.h @@ -42,14 +42,16 @@ public: SMESHGUI_Displayer( SalomeApp_Application* ); ~SMESHGUI_Displayer(); - virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 ); - virtual bool canBeDisplayed( const QString&, const QString& ) const; + virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 ) override; + virtual bool canBeDisplayed( const QString&, const QString& ) const override; + virtual void Display( const QStringList&, const bool = true, SALOME_View* = 0) override; protected: SalomeApp_Study* study() const; private: SalomeApp_Application* myApp; + bool isNeedFitAll; }; #endif // SMESHGUI_DISPLAYER_H diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx index b148effa1..f1ca735ab 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx @@ -726,9 +726,10 @@ namespace SMESH */ //================================================================================ - bool noSmeshActors(SUIT_ViewWindow *theWnd) + bool NoSmeshActors(SUIT_ViewWindow *theWnd) { - if(SVTK_ViewWindow* aViewWindow = GetVtkViewWindow(theWnd)) { + SUIT_ViewWindow* aWnd = ( theWnd == nullptr ) ? GetActiveWindow() : theWnd; + if(SVTK_ViewWindow* aViewWindow = GetVtkViewWindow(aWnd)) { vtkRenderer *aRenderer = aViewWindow->getRenderer(); VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); vtkActorCollection *aCollection = aCopy.GetActors(); @@ -826,7 +827,7 @@ namespace SMESH if ( (aVisualObj = GetVisualObj(theEntry)) && aVisualObj->IsValid()) { if ((anActor = CreateActor(theEntry,true))) { - bool needFitAll = noSmeshActors(theWnd); // fit for the first object only + bool needFitAll = NoSmeshActors(theWnd); // fit for the first object only DisplayActor(theWnd,anActor); anActor->SetVisibility(true); aStudy->setVisibilityState(theEntry, Qtx::ShownState); diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.h b/src/SMESHGUI/SMESHGUI_VTKUtils.h index a88c697a6..b6673afcd 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.h +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.h @@ -222,6 +222,10 @@ SMESHGUI_EXPORT SMESHGUI_EXPORT void UpdateActorsAfterUpdateStudy(); + + SMESHGUI_EXPORT + bool NoSmeshActors(SUIT_ViewWindow *theWnd=nullptr); + }; #endif // SMESHGUI_VTKUTILS_H