mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-05 18:16:23 +03:00
0026945: Visualization - selection does not work after closing one of local contexts in stack
- added method to restore selection of local context; - activated standard modes are added to local status now; - test case for issue #26945
This commit is contained in:
parent
16420da1d4
commit
325e442bce
@ -148,7 +148,10 @@ void AIS_InteractiveContext::CloseLocalContext(const Standard_Integer Index,
|
|||||||
}
|
}
|
||||||
else if(debugmode)
|
else if(debugmode)
|
||||||
cout<<"a No Current Local Context WasClosed"<<endl;
|
cout<<"a No Current Local Context WasClosed"<<endl;
|
||||||
|
|
||||||
|
// restore activated selections of current local context
|
||||||
|
myLocalContexts (myCurLocalIndex)->RestoreActivatedModes();
|
||||||
|
|
||||||
if(debugmode) cout<<"Index Of CurrentLocalContext:"<<myCurLocalIndex<<endl;
|
if(debugmode) cout<<"Index Of CurrentLocalContext:"<<myCurLocalIndex<<endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -534,6 +534,7 @@ void AIS_LocalContext::ActivateStandardMode(const TopAbs_ShapeEnum aType)
|
|||||||
myCTX->SelectionManager()->Activate(ItM.Key(),
|
myCTX->SelectionManager()->Activate(ItM.Key(),
|
||||||
IMode,
|
IMode,
|
||||||
myMainVS);
|
myMainVS);
|
||||||
|
ItM.Value()->AddSelectionMode (IMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -356,6 +356,10 @@ public:
|
|||||||
|
|
||||||
Standard_EXPORT Handle(SelectMgr_EntityOwner) FindSelectedOwnerFromShape (const TopoDS_Shape& aShape) const;
|
Standard_EXPORT Handle(SelectMgr_EntityOwner) FindSelectedOwnerFromShape (const TopoDS_Shape& aShape) const;
|
||||||
|
|
||||||
|
//! Iterates through all interactive objects of local context and activates selection modes
|
||||||
|
//! stored in local status
|
||||||
|
Standard_EXPORT void RestoreActivatedModes() const;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1565,3 +1565,19 @@ Handle(AIS_InteractiveObject) AIS_LocalContext::DetectedCurrentObject() const
|
|||||||
{
|
{
|
||||||
return MoreDetected() ? myAISDetectedSeq(myAISCurDetected) : NULL;
|
return MoreDetected() ? myAISDetectedSeq(myAISCurDetected) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : RestoreActivatedModes
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void AIS_LocalContext::RestoreActivatedModes() const
|
||||||
|
{
|
||||||
|
for (AIS_DataMapOfSelStat::Iterator anIter (myActiveObjects); anIter.More(); anIter.Next())
|
||||||
|
{
|
||||||
|
const TColStd_ListOfInteger& anActivatedModes = anIter.Value()->SelectionModes();
|
||||||
|
for (TColStd_ListIteratorOfListOfInteger aModesIter (anActivatedModes); aModesIter.More(); aModesIter.Next())
|
||||||
|
{
|
||||||
|
mySM->Activate (anIter.Key(), aModesIter.Value(), myMainVS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -4737,6 +4737,60 @@ static Standard_Integer BUC26658 (Draw_Interpretor& theDI,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : OCC26945_open
|
||||||
|
//purpose : Opens local context and activates given standard selection mode
|
||||||
|
//=======================================================================
|
||||||
|
static Standard_Integer OCC26945_open (Draw_Interpretor& theDI, Standard_Integer theArgc, const char** theArgv)
|
||||||
|
{
|
||||||
|
const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
|
||||||
|
if (aCtx.IsNull())
|
||||||
|
{
|
||||||
|
std::cout << "No interactive context. Use 'vinit' command before " << theArgv[0] << "\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (theArgc < 2)
|
||||||
|
{
|
||||||
|
std::cout << "Not enough arguments. See usage:\n";
|
||||||
|
theDI.PrintHelp (theArgv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TopAbs_ShapeEnum aSelType = AIS_Shape::SelectionType (Draw::Atoi (theArgv[1]));
|
||||||
|
Standard_Integer aLocalCtxIdx = aCtx->OpenLocalContext();
|
||||||
|
aCtx->ActivateStandardMode (aSelType);
|
||||||
|
theDI << aLocalCtxIdx;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : OCC26945_close
|
||||||
|
//purpose : Closes local context with the id given
|
||||||
|
//=======================================================================
|
||||||
|
static Standard_Integer OCC26945_close (Draw_Interpretor& theDI, Standard_Integer theArgc, const char** theArgv)
|
||||||
|
{
|
||||||
|
const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
|
||||||
|
if (aCtx.IsNull())
|
||||||
|
{
|
||||||
|
std::cout << "No interactive context. Use 'vinit' command before " << theArgv[0] << "\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (theArgc < 2)
|
||||||
|
{
|
||||||
|
std::cout << "Not enough arguments. See usage:\n";
|
||||||
|
theDI.PrintHelp (theArgv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Standard_Integer aCtxToClose = Draw::Atoi (theArgv[1]);
|
||||||
|
aCtx->CloseLocalContext (aCtxToClose);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void QABugs::Commands_19(Draw_Interpretor& theCommands) {
|
void QABugs::Commands_19(Draw_Interpretor& theCommands) {
|
||||||
const char *group = "QABugs";
|
const char *group = "QABugs";
|
||||||
|
|
||||||
@ -4833,6 +4887,15 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) {
|
|||||||
theCommands.Add ("OCC26746", "OCC26746 torus [toler NbCheckedPoints] ", __FILE__, OCC26746, group);
|
theCommands.Add ("OCC26746", "OCC26746 torus [toler NbCheckedPoints] ", __FILE__, OCC26746, group);
|
||||||
|
|
||||||
theCommands.Add ("BUC26658", "BUC26658 unexpected selection in the context using a selection filter", __FILE__, BUC26658, group);
|
theCommands.Add ("BUC26658", "BUC26658 unexpected selection in the context using a selection filter", __FILE__, BUC26658, group);
|
||||||
|
theCommands.Add ("OCC26945_open",
|
||||||
|
"OCC26945 selectionModeToActivate"
|
||||||
|
"\n\t\t: Opens a new local context with selectionModeToActivate activated."
|
||||||
|
"\n\t\t: Prints the ID of newely opened local context in case of success.",
|
||||||
|
__FILE__, OCC26945_open, group);
|
||||||
|
theCommands.Add ("OCC26945_close",
|
||||||
|
"OCC26945 localCtxToClose"
|
||||||
|
"\n\t\t: Closes local context with the ID localCtxToClose",
|
||||||
|
__FILE__, OCC26945_close, group);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
71
tests/bugs/vis/bug26945
Normal file
71
tests/bugs/vis/bug26945
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "CR26945"
|
||||||
|
puts "Visualization - selection does not work after closing one of local contexts in stack"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
pload VISUALIZATION MODELING QAcommands
|
||||||
|
|
||||||
|
vinit
|
||||||
|
vclear
|
||||||
|
|
||||||
|
box b 1 1 1
|
||||||
|
vdisplay b
|
||||||
|
vfit
|
||||||
|
vaspects b -setWidth 2
|
||||||
|
|
||||||
|
set edge_x 380
|
||||||
|
set edge_y 281
|
||||||
|
set vert_x 379
|
||||||
|
set vert_y 305
|
||||||
|
set pick_face_x 250
|
||||||
|
set pick_face_y 300
|
||||||
|
set pick_vert_x 380
|
||||||
|
set pick_vert_y 309
|
||||||
|
|
||||||
|
# open local ctx with face selection enabled
|
||||||
|
OCC26945_open 4
|
||||||
|
vmoveto $pick_face_x $pick_face_y
|
||||||
|
if {[vreadpixel $edge_x $edge_y name] != "CYAN1 1"} {
|
||||||
|
puts "ERROR: Can not select face in local context 1"
|
||||||
|
}
|
||||||
|
|
||||||
|
vmoveto 0 0
|
||||||
|
|
||||||
|
# open local ctx with vertex selection enabled
|
||||||
|
set aVertIdx [OCC26945_open 1]
|
||||||
|
vmoveto $pick_vert_x $pick_vert_y
|
||||||
|
if {[vreadpixel $vert_x $vert_y name] != "CYAN1 1"} {
|
||||||
|
puts "ERROR: Can not select vertex in local context 2"
|
||||||
|
}
|
||||||
|
|
||||||
|
vmoveto 0 0
|
||||||
|
|
||||||
|
# open local ctx with edge selection enabled
|
||||||
|
set anEdgeIdx [OCC26945_open 2]
|
||||||
|
vmoveto $edge_x $edge_y
|
||||||
|
if {[vreadpixel $edge_x $edge_y name] != "CYAN1 1"} {
|
||||||
|
puts "ERROR: Can not select edge in local context 3"
|
||||||
|
}
|
||||||
|
|
||||||
|
vmoveto 0 0
|
||||||
|
|
||||||
|
# close local ctx with vertex selection enabled.
|
||||||
|
# edge selection should be active.
|
||||||
|
OCC26945_close $aVertIdx
|
||||||
|
vmoveto $edge_x $edge_y
|
||||||
|
if {[vreadpixel $edge_x $edge_y name] != "CYAN1 1"} {
|
||||||
|
puts "ERROR: Can not select edge after closing local context 2"
|
||||||
|
}
|
||||||
|
|
||||||
|
vmoveto 0 0
|
||||||
|
|
||||||
|
# close local ctx with edge selection enabled.
|
||||||
|
# face selection should be active.
|
||||||
|
OCC26945_close $anEdgeIdx
|
||||||
|
vmoveto $pick_face_x $pick_face_y
|
||||||
|
if {[vreadpixel $edge_x $edge_y name] != "CYAN1 1"} {
|
||||||
|
puts "ERROR: Can not select face after closing local context 3"
|
||||||
|
}
|
||||||
|
|
||||||
|
set only_screen 1
|
Loading…
x
Reference in New Issue
Block a user