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

0029262: Visualization - AIS_InteractiveContext::Load() does not register Object in the Viewer

AIS_InteractiveContext::Load() now loads the object regardless specified selection mode and decomposition flag.
AIS_InteractiveContext::Load() and ::KeepTemporary() now register object in the Viewer
in the same way as ::Display() does.

Draw Harness command vdisplay has been extended with new flag -erased to load object into context in erased state.
This commit is contained in:
kgv
2017-10-25 17:27:23 +03:00
parent c3b64127f1
commit 23f3b6e741
3 changed files with 45 additions and 17 deletions

View File

@@ -456,6 +456,10 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
{ {
Erase (theIObj, theToUpdateViewer); Erase (theIObj, theToUpdateViewer);
Load (theIObj, theSelectionMode, theToAllowDecomposition); Load (theIObj, theSelectionMode, theToAllowDecomposition);
if (Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (theIObj))
{
(*aStatusPtr)->SetDisplayMode (theDispMode);
}
return; return;
} }
@@ -483,7 +487,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
{ {
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode); Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
myObjects.Bind (theIObj, aStatus); myObjects.Bind (theIObj, aStatus);
Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->StructureManager()->RegisterObject (theIObj); myMainVwr->StructureManager()->RegisterObject (theIObj);
myMainPM->Display(theIObj, theDispMode); myMainPM->Display(theIObj, theDispMode);
if (theSelectionMode != -1) if (theSelectionMode != -1)
{ {
@@ -566,23 +570,20 @@ void AIS_InteractiveContext::Load (const Handle(AIS_InteractiveObject)& theIObj,
return; return;
} }
if (theSelMode == -1 if (!myObjects.IsBound (theIObj))
&& !theToAllowDecomposition)
{ {
if (!myObjects.IsBound (theIObj)) Standard_Integer aDispMode, aHiMod, aSelModeDef;
{ GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef);
Standard_Integer aDispMode, aHiMod, aSelModeDef; Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Erased, aDispMode, theSelMode != -1 ? theSelMode : aSelModeDef);
GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef); myObjects.Bind (theIObj, aStatus);
Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Erased, aDispMode, aSelModeDef); myMainVwr->StructureManager()->RegisterObject (theIObj);
myObjects.Bind (theIObj, aStatus); }
}
// Register theIObj in the selection manager to prepare further activation of selection // Register theIObj in the selection manager to prepare further activation of selection
const Handle(SelectMgr_SelectableObject)& anObj = theIObj; // to avoid ambiguity const Handle(SelectMgr_SelectableObject)& anObj = theIObj; // to avoid ambiguity
if (!mgrSelector->Contains (anObj)) if (!mgrSelector->Contains (anObj))
{ {
mgrSelector->Load (theIObj); mgrSelector->Load (theIObj);
}
} }
} }
@@ -791,6 +792,7 @@ Standard_Boolean AIS_InteractiveContext::KeepTemporary(const Handle(AIS_Interact
Standard_False); Standard_False);
// GS->SubIntensityOn(); // GS->SubIntensityOn();
myObjects.Bind(anIObj,GS); myObjects.Bind(anIObj,GS);
myMainVwr->StructureManager()->RegisterObject (anIObj);
mgrSelector->Load(anIObj); mgrSelector->Load(anIObj);
mgrSelector->Activate(anIObj,SM,myMainSel); mgrSelector->Activate(anIObj,SM,myMainSel);

View File

@@ -3816,6 +3816,11 @@ static int VDisplay2 (Draw_Interpretor& theDI,
{ {
isWerthSpecific = Standard_True; isWerthSpecific = Standard_True;
} }
else if (aNameCase == "-erased"
|| aNameCase == "-load")
{
aDispStatus = AIS_DS_Erased;
}
else else
{ {
aNamesOfDisplayIO.Append (aName); aNamesOfDisplayIO.Append (aName);
@@ -5531,7 +5536,7 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
"\n\t\t: [offsetX offsetY]]]" "\n\t\t: [offsetX offsetY]]]"
"\n\t\t: [-dispMode mode] [-highMode mode]" "\n\t\t: [-dispMode mode] [-highMode mode]"
"\n\t\t: [-layer index] [-top|-topmost|-overlay|-underlay]" "\n\t\t: [-layer index] [-top|-topmost|-overlay|-underlay]"
"\n\t\t: [-redisplay]" "\n\t\t: [-redisplay] [-erased]"
"\n\t\t: name1 [name2] ... [name n]" "\n\t\t: name1 [name2] ... [name n]"
"\n\t\t: Displays named objects." "\n\t\t: Displays named objects."
"\n\t\t: Option -local enables displaying of objects in local" "\n\t\t: Option -local enables displaying of objects in local"
@@ -5540,6 +5545,7 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
"\n\t\t: -noupdate Suppresses viewer redraw call." "\n\t\t: -noupdate Suppresses viewer redraw call."
"\n\t\t: -mutable Enables optimizations for mutable objects." "\n\t\t: -mutable Enables optimizations for mutable objects."
"\n\t\t: -neutral Draws objects in main viewer." "\n\t\t: -neutral Draws objects in main viewer."
"\n\t\t: -erased Loads the object into context, but does not display it."
"\n\t\t: -layer Sets z-layer for objects." "\n\t\t: -layer Sets z-layer for objects."
"\n\t\t: Alternatively -overlay|-underlay|-top|-topmost" "\n\t\t: Alternatively -overlay|-underlay|-top|-topmost"
"\n\t\t: options can be used for the default z-layers." "\n\t\t: options can be used for the default z-layers."

20
tests/bugs/vis/bug29262 Normal file
View File

@@ -0,0 +1,20 @@
puts "========"
puts "0029262: Visualization - AIS_InteractiveContext::Load() does not register Object in the Viewer"
puts "========"
puts ""
pload MODELING VISUALIZATION
vclear
vclose ALL
vinit View1
vinit View2
box b 1 2 3
vdisplay -dispMode 1 -inview -erased b
vdisplay b
vfit
if { [vreadpixel 200 200 rgb name] != "DARKGOLDENROD3" } { puts "Error: object is not displayed in Shaded mode" }
vdump $imagedir/${casename}_view2.png
vactivate View1
if { [vreadpixel 200 200 rgb name] != "BLACK" } { puts "Error: object view affinity is ignored" }
vdump $imagedir/${casename}_view1.png