+void XGUI_Displayer::activateObjects(const QIntList& theModes)
+{
+ // In order to avoid doblications of selection modes
+ myActiveSelectionModes.clear();
+ foreach (int aMode, theModes) {
+ if (!myActiveSelectionModes.contains(aMode))
+ myActiveSelectionModes.append(aMode);
+ }
+ Handle(AIS_InteractiveContext) aContext = AISContext();
+ // Open local context if there is no one
+ if (!aContext->HasOpenedContext())
+ return;
+
+ //aContext->UseDisplayedObjects();
+ //myUseExternalObjects = true;
+
+ AIS_ListOfInteractive aPrsList;
+ aContext->DisplayedObjects(aPrsList, true);
+ //Deactivate trihedron which can be activated in local selector
+
+ Handle(AIS_Trihedron) aTrihedron;
+ AIS_ListIteratorOfListOfInteractive aLIt(aPrsList);
+ Handle(AIS_InteractiveObject) anAISIO;
+ for(aLIt.Initialize(aPrsList); aLIt.More(); aLIt.Next()){
+ anAISIO = aLIt.Value();
+ aTrihedron = Handle(AIS_Trihedron)::DownCast(anAISIO);
+ if (!aTrihedron.IsNull()) {
+ aContext->Deactivate(aTrihedron);
+ } else {
+ //aContext->Load(anAISIO, -1, true);
+ // In order to clear active modes list
+ aContext->Deactivate(anAISIO);
+ if (myActiveSelectionModes.size() == 0)
+ aContext->Activate(anAISIO);
+ else {
+ foreach(int aMode, myActiveSelectionModes) {
+ aContext->Activate(anAISIO, aMode);
+ }
+ }
+ }
+ }
+}
+
+
+void XGUI_Displayer::deactivateObjects()
+{
+ myActiveSelectionModes.clear();
+ Handle(AIS_InteractiveContext) aContext = AISContext();
+ // Open local context if there is no one
+ if (!aContext->HasOpenedContext())
+ return;
+
+ aContext->NotUseDisplayedObjects();
+ AIS_ListOfInteractive aPrsList;
+ aContext->DisplayedObjects(aPrsList);
+
+ AIS_ListIteratorOfListOfInteractive aLIt;
+ Handle(AIS_Trihedron) aTrihedron;
+ Handle(AIS_InteractiveObject) anAISIO;
+ for(aLIt.Initialize(aPrsList); aLIt.More(); aLIt.Next()){
+ anAISIO = aLIt.Value();
+ aTrihedron = Handle(AIS_Trihedron)::DownCast(anAISIO);
+ if (!aTrihedron.IsNull()) {
+ aContext->Deactivate(aTrihedron);
+ } else {
+ //aContext->Load(anAISIO, -1, true);
+ aContext->Deactivate(anAISIO);
+ //aContext->Activate(anAISIO);
+ }
+ }
+}
+