Partial fix for '#16403 EDF 17034 - Hole during meshing visualization'

This commit is contained in:
rnv 2020-11-19 03:35:02 +03:00
parent 4a2c77515c
commit a0b14f92a4
4 changed files with 25 additions and 6 deletions

View File

@ -46,7 +46,8 @@
SMESHGUI_Displayer::SMESHGUI_Displayer( SalomeApp_Application* app ) SMESHGUI_Displayer::SMESHGUI_Displayer( SalomeApp_Application* app )
: LightApp_Displayer(), : 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 ); anActor = SMESH::CreateActor( entry.toUtf8().data(), true );
if( anActor ) if( anActor )
{ {
isNeedFitAll = SMESH::NoSmeshActors();
SMESH::DisplayActor( wnd, anActor ); SMESH::DisplayActor( wnd, anActor );
prs = LightApp_Displayer::buildPresentation( entry.toUtf8().data(), aViewFrame ); prs = LightApp_Displayer::buildPresentation( entry.toUtf8().data(), aViewFrame );
} }
@ -113,3 +115,13 @@ bool SMESHGUI_Displayer::canBeDisplayed( const QString& entry, const QString& vi
} }
return res; 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;
}
}

View File

@ -42,14 +42,16 @@ public:
SMESHGUI_Displayer( SalomeApp_Application* ); SMESHGUI_Displayer( SalomeApp_Application* );
~SMESHGUI_Displayer(); ~SMESHGUI_Displayer();
virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 ); virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 ) override;
virtual bool canBeDisplayed( const QString&, const QString& ) const; virtual bool canBeDisplayed( const QString&, const QString& ) const override;
virtual void Display( const QStringList&, const bool = true, SALOME_View* = 0) override;
protected: protected:
SalomeApp_Study* study() const; SalomeApp_Study* study() const;
private: private:
SalomeApp_Application* myApp; SalomeApp_Application* myApp;
bool isNeedFitAll;
}; };
#endif // SMESHGUI_DISPLAYER_H #endif // SMESHGUI_DISPLAYER_H

View File

@ -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(); vtkRenderer *aRenderer = aViewWindow->getRenderer();
VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
vtkActorCollection *aCollection = aCopy.GetActors(); vtkActorCollection *aCollection = aCopy.GetActors();
@ -826,7 +827,7 @@ namespace SMESH
if ( (aVisualObj = GetVisualObj(theEntry)) && aVisualObj->IsValid()) if ( (aVisualObj = GetVisualObj(theEntry)) && aVisualObj->IsValid())
{ {
if ((anActor = CreateActor(theEntry,true))) { 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); DisplayActor(theWnd,anActor);
anActor->SetVisibility(true); anActor->SetVisibility(true);
aStudy->setVisibilityState(theEntry, Qtx::ShownState); aStudy->setVisibilityState(theEntry, Qtx::ShownState);

View File

@ -222,6 +222,10 @@ SMESHGUI_EXPORT
SMESHGUI_EXPORT SMESHGUI_EXPORT
void UpdateActorsAfterUpdateStudy(); void UpdateActorsAfterUpdateStudy();
SMESHGUI_EXPORT
bool NoSmeshActors(SUIT_ViewWindow *theWnd=nullptr);
}; };
#endif // SMESHGUI_VTKUTILS_H #endif // SMESHGUI_VTKUTILS_H