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 )
: 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;
}
}

View File

@ -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

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();
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);

View File

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