{
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);
+ }
+ }
+}
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) {
const char *group = "QABugs";
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 ("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;
}
--- /dev/null
+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