1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0028890: Visualization - After closing all views and then display the view again, just the first view has object(s) displayed

DeviceLost flag has been moved from Graphic3d_GraphicDriver to Graphic3d_StructureManager,
so that all Viewers sharing the same Driver instance are properly invalidated.

Fixed clearing of objects by vclear command in case of multiple Viewers.
This commit is contained in:
kgv
2017-07-07 17:06:09 +03:00
committed by bugmaster
parent 336a63f042
commit 851dacdbb9
16 changed files with 137 additions and 83 deletions

View File

@@ -23,8 +23,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_GraphicDriver,Standard_Transient)
// purpose :
// =======================================================================
Graphic3d_GraphicDriver::Graphic3d_GraphicDriver (const Handle(Aspect_DisplayConnection)& theDisp)
: myDisplayConnection (theDisp),
myDeviceLostFlag (Standard_False)
: myDisplayConnection (theDisp)
{
//
}
@@ -38,24 +37,6 @@ const Handle(Aspect_DisplayConnection)& Graphic3d_GraphicDriver::GetDisplayConne
return myDisplayConnection;
}
// =======================================================================
// function : IsDeviceLost
// purpose :
// =======================================================================
Standard_Boolean Graphic3d_GraphicDriver::IsDeviceLost() const
{
return myDeviceLostFlag;
}
// =======================================================================
// function : ResetDeviceLostFlag
// purpose :
// =======================================================================
void Graphic3d_GraphicDriver::ResetDeviceLostFlag()
{
myDeviceLostFlag = Standard_False;
}
// =======================================================================
// function : NewIdentification
// purpose :

View File

@@ -138,10 +138,6 @@ public:
//! returns Handle to display connection
Standard_EXPORT const Handle(Aspect_DisplayConnection)& GetDisplayConnection() const;
Standard_EXPORT Standard_Boolean IsDeviceLost() const;
Standard_EXPORT void ResetDeviceLostFlag();
//! Returns a new identification number for a new structure.
Standard_EXPORT Standard_Integer NewIdentification();
@@ -152,28 +148,15 @@ public:
DEFINE_STANDARD_RTTIEXT(Graphic3d_GraphicDriver,Standard_Transient)
protected:
//! Initializes the Driver
Standard_EXPORT Graphic3d_GraphicDriver(const Handle(Aspect_DisplayConnection)& theDisp);
protected:
Handle(Aspect_DisplayConnection) myDisplayConnection;
Standard_Boolean myDeviceLostFlag;
Aspect_GenId myStructGenId;
private:
};
#endif // _Graphic3d_GraphicDriver_HeaderFile

View File

@@ -30,7 +30,8 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_StructureManager,Standard_Transient)
// ========================================================================
Graphic3d_StructureManager::Graphic3d_StructureManager (const Handle(Graphic3d_GraphicDriver)& theDriver)
: myViewGenId (0, 31),
myGraphicDriver (theDriver)
myGraphicDriver (theDriver),
myDeviceLostFlag (Standard_False)
{
//
}
@@ -149,9 +150,10 @@ const Handle(Graphic3d_GraphicDriver)& Graphic3d_StructureManager::GraphicDriver
void Graphic3d_StructureManager::RecomputeStructures()
{
myDeviceLostFlag = Standard_False;
// Go through all unique structures including child (connected) ones and ensure that they are computed.
Graphic3d_MapOfStructure aStructNetwork;
for (Graphic3d_MapIteratorOfMapOfStructure anIter(myDisplayedStructure); anIter.More(); anIter.Next())
{
Handle(Graphic3d_Structure) aStructure = anIter.Key();

View File

@@ -38,10 +38,6 @@ typedef NCollection_IndexedMap<Graphic3d_CView*> Graphic3d_IndexedMapOfView;
class Graphic3d_GraphicDriver;
class Graphic3d_Structure;
class Graphic3d_DataStructureManager;
class Standard_Transient;
class Graphic3d_StructureManager;
DEFINE_STANDARD_HANDLE(Graphic3d_StructureManager, Standard_Transient)
//! This class allows the definition of a manager to
//! which the graphic objects are associated.
@@ -51,6 +47,8 @@ DEFINE_STANDARD_HANDLE(Graphic3d_StructureManager, Standard_Transient)
//! Destroy, Highlight, Visible
class Graphic3d_StructureManager : public Standard_Transient
{
friend class Graphic3d_Structure;
DEFINE_STANDARD_RTTIEXT(Graphic3d_StructureManager, Standard_Transient)
public:
//! Initializes the ViewManager.
@@ -144,6 +142,8 @@ public:
//! Suppresses the highlighting on all the structures in <me>.
Standard_EXPORT virtual void UnHighlight();
//! Recomputes all structures in the manager.
//! Resets Device Lost flag.
Standard_EXPORT void RecomputeStructures();
//! Recomputes all structures from theStructures.
@@ -155,9 +155,11 @@ public:
Standard_EXPORT Handle(Graphic3d_ViewAffinity) ObjectAffinity (const Handle(Standard_Transient)& theObject) const;
friend class Graphic3d_Structure;
//! Returns TRUE if Device Lost flag has been set and presentation data should be reuploaded onto graphics driver.
Standard_Boolean IsDeviceLost() const { return myDeviceLostFlag; }
DEFINE_STANDARD_RTTIEXT(Graphic3d_StructureManager,Standard_Transient)
//! Sets Device Lost flag.
void SetDeviceLost() { myDeviceLostFlag = Standard_True; }
protected:
@@ -174,6 +176,9 @@ protected:
Graphic3d_MapOfObject myRegisteredObjects;
Handle(Graphic3d_GraphicDriver) myGraphicDriver;
Graphic3d_IndexedMapOfView myDefinedViews;
Standard_Boolean myDeviceLostFlag;
};
DEFINE_STANDARD_HANDLE(Graphic3d_StructureManager, Standard_Transient)
#endif // _Graphic3d_StructureManager_HeaderFile