mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-06-30 12:14:08 +03:00
0025528: Visualization - Exception on removing an interactive object from a local context
AIS_LocalContext::Remove() corrected to unbind the argument from myActiveObjects at the very end. Also some code clean up applied (e.g. duplicated AddOrRemoveSelected() call removed, formatting corrected).
This commit is contained in:
parent
c35f2ea77d
commit
4ece81d4a9
@ -445,65 +445,67 @@ void AIS_LocalContext::Deactivate(const Handle(AIS_InteractiveObject)& aSelectab
|
|||||||
|
|
||||||
Standard_Boolean AIS_LocalContext::Remove(const Handle(AIS_InteractiveObject)& aSelectable)
|
Standard_Boolean AIS_LocalContext::Remove(const Handle(AIS_InteractiveObject)& aSelectable)
|
||||||
{
|
{
|
||||||
if(!myActiveObjects.IsBound(aSelectable)) return Standard_False;
|
if(!myActiveObjects.IsBound (aSelectable))
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsSelected (aSelectable))
|
||||||
|
{
|
||||||
|
AddOrRemoveSelected (aSelectable, Standard_False);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Handle(AIS_LocalStatus)& Att = myActiveObjects (aSelectable);
|
||||||
|
|
||||||
if(IsSelected(aSelectable))
|
|
||||||
AddOrRemoveSelected(aSelectable,Standard_False);
|
|
||||||
|
|
||||||
const Handle(AIS_LocalStatus)& Att = myActiveObjects(aSelectable);
|
|
||||||
|
|
||||||
TColStd_ListIteratorOfListOfInteger It;
|
TColStd_ListIteratorOfListOfInteger It;
|
||||||
// it is checked which were the temporary attributes
|
|
||||||
// and they are set to 0
|
|
||||||
|
|
||||||
// desactivate standard modes
|
// Deactivate standard modes
|
||||||
if(Att->Decomposed()){
|
if (Att->Decomposed())
|
||||||
for(It.Initialize(myListOfStandardMode);It.More();It.Next()){
|
{
|
||||||
mySM->Deactivate(aSelectable,It.Value(),myMainVS);
|
for (It.Initialize (myListOfStandardMode); It.More(); It.Next())
|
||||||
|
{
|
||||||
|
mySM->Deactivate (aSelectable, It.Value(), myMainVS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if object or temporary presentations...
|
|
||||||
if(Att->IsTemporary())
|
|
||||||
{
|
|
||||||
if(Att->IsSubIntensityOn())
|
|
||||||
myMainPM->Unhighlight(aSelectable,Att->HilightMode());
|
|
||||||
|
|
||||||
// remove if bug on clear correct...
|
|
||||||
myMainPM->Erase(aSelectable,Att->DisplayMode());
|
|
||||||
myMainPM->Clear(aSelectable,Att->DisplayMode());
|
|
||||||
if(myMainPM->IsDisplayed(aSelectable,Att->HilightMode()))
|
|
||||||
myMainPM->Erase(aSelectable,Att->HilightMode());
|
|
||||||
// myMainPM->Clear(aSelectable,Att->HilightMode());
|
|
||||||
}
|
|
||||||
// if below intensity
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(Att->IsSubIntensityOn())
|
|
||||||
myCTX->SubIntensityOff(aSelectable);
|
|
||||||
}
|
|
||||||
// desactivate stored proper modes
|
|
||||||
for(It.Initialize(Att->SelectionModes());It.More();It.Next()){
|
|
||||||
mySM->Deactivate(aSelectable,It.Value(),myMainVS);
|
|
||||||
}
|
|
||||||
// pop : si je laisses cela plantes dans les elements de construction
|
|
||||||
// alors a toi de jouer ROB
|
|
||||||
// RemoveSelected(aSelectable);
|
|
||||||
|
|
||||||
if(IsSelected(aSelectable))
|
// If object or temporary presentations
|
||||||
AddOrRemoveSelected(aSelectable);
|
if (Att->IsTemporary())
|
||||||
myActiveObjects.UnBind(aSelectable);
|
{
|
||||||
|
if (Att->IsSubIntensityOn())
|
||||||
|
{
|
||||||
|
myMainPM->Unhighlight (aSelectable, Att->HilightMode());
|
||||||
|
}
|
||||||
|
|
||||||
|
myMainPM->Erase (aSelectable, Att->DisplayMode());
|
||||||
|
myMainPM->Clear (aSelectable, Att->DisplayMode());
|
||||||
|
if (myMainPM->IsDisplayed (aSelectable, Att->HilightMode()))
|
||||||
|
{
|
||||||
|
myMainPM->Erase (aSelectable, Att->HilightMode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If subintensity used
|
||||||
|
else if (Att->IsSubIntensityOn())
|
||||||
|
{
|
||||||
|
myCTX->SubIntensityOff (aSelectable);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deactivate stored selection modes
|
||||||
|
for (It.Initialize (Att->SelectionModes()); It.More(); It.Next())
|
||||||
|
{
|
||||||
|
mySM->Deactivate (aSelectable, It.Value(), myMainVS);
|
||||||
|
}
|
||||||
|
|
||||||
// Remove the interactive object from selection manager
|
// Remove the interactive object from selection manager
|
||||||
if (mySM->Contains (aSelectable))
|
if (mySM->Contains (aSelectable))
|
||||||
{
|
{
|
||||||
mySM->Remove (aSelectable);
|
mySM->Remove (aSelectable);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateSort();
|
UpdateSort();
|
||||||
|
|
||||||
ClearOutdatedSelection (aSelectable, Standard_True);
|
ClearOutdatedSelection (aSelectable, Standard_True);
|
||||||
|
|
||||||
|
// This should be done at the very end because most methods use
|
||||||
|
// myActiveObjects even during clean-up
|
||||||
|
myActiveObjects.UnBind (aSelectable);
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
25
tests/bugs/vis/bug25528
Normal file
25
tests/bugs/vis/bug25528
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC25528"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
####################################################################################
|
||||||
|
# Visualization - Exception on removing an interactive object from
|
||||||
|
# a local context
|
||||||
|
# vremove -local <obj_name> crashes if there is an opened local context
|
||||||
|
####################################################################################
|
||||||
|
|
||||||
|
pload ALL
|
||||||
|
box b 1 2 3
|
||||||
|
vinit
|
||||||
|
vdisplay b
|
||||||
|
vfit
|
||||||
|
|
||||||
|
# opening a local context for local selection
|
||||||
|
vselmode b 4 1
|
||||||
|
# Select a face just to simulate the scenario used in a real application
|
||||||
|
vselect 200 200
|
||||||
|
# This line should not lead to exception
|
||||||
|
vremove -local b
|
||||||
|
|
||||||
|
# Screenshot should be empty (box removed successfully)
|
||||||
|
vdump ${imagedir}/${casename}.png
|
Loading…
x
Reference in New Issue
Block a user