1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +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

@@ -638,18 +638,38 @@ Handle(AIS_Shape) GetAISShapeFromName(const char* name)
//==============================================================================
void ViewerTest::Clear()
{
if ( !a3DView().IsNull() ) {
ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it(GetMapOfAIS());
while ( it.More() ) {
cout << "Remove " << it.Key2() << endl;
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (it.Key1());
TheAISContext()->Remove(anObj,Standard_False);
it.Next();
if (a3DView().IsNull())
{
return;
}
NCollection_Sequence<Handle(AIS_InteractiveObject)> aListRemoved;
for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anObjIter (GetMapOfAIS()); anObjIter.More(); anObjIter.Next())
{
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anObjIter.Key1());
if (anObj->GetContext() != TheAISContext())
{
continue;
}
TheAISContext()->RebuildSelectionStructs();
TheAISContext()->UpdateCurrentViewer();
std::cout << "Remove " << anObjIter.Key2() << std::endl;
TheAISContext()->Remove (anObj, Standard_False);
aListRemoved.Append (anObj);
}
TheAISContext()->RebuildSelectionStructs();
TheAISContext()->UpdateCurrentViewer();
if (aListRemoved.Size() == GetMapOfAIS().Extent())
{
GetMapOfAIS().Clear();
}
else
{
for (NCollection_Sequence<Handle(AIS_InteractiveObject)>::Iterator anObjIter (aListRemoved); anObjIter.More(); anObjIter.Next())
{
GetMapOfAIS().UnBind1 (anObjIter.Value());
}
}
}
//==============================================================================

View File

@@ -1120,6 +1120,7 @@ void ViewerTest::RemoveView (const TCollection_AsciiString& theViewName, const S
// Remove view resources
ViewerTest_myViews.UnBind1(theViewName);
aView->Window()->Unmap();
aView->Remove();
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))