-void deactivateObject(Handle(AIS_InteractiveContext) theContext,
- Handle(AIS_InteractiveObject) theObject
-#ifdef VINSPECTOR
- , VInspectorAPI_CallBack* theCallBack
-#endif
- )
-{
- if (!theObject.IsNull()) {
- theContext->Deactivate(theObject);
- #ifdef VINSPECTOR
- if (theCallBack) theCallBack->Deactivate(theObject);
- #endif
- }
-}
-
-void XGUI_Displayer::deactivateTrihedron(const bool theUpdateViewer) const
-{
- Handle(AIS_InteractiveObject) aTrihedron = getTrihedron();
- Handle(AIS_InteractiveContext) aContext = AISContext();
- if (!aTrihedron.IsNull() && aContext->IsDisplayed(aTrihedron)) {
- Handle(AIS_Trihedron) aTrie = Handle(AIS_Trihedron)::DownCast(aTrihedron);
- deactivateObject(aContext, aTrie
- #ifdef VINSPECTOR
- , getCallBack()
- #endif
- );
-
- /// #1136 hidden axis are selected in sketch
- deactivateObject(aContext, aTrie->XAxis()
- #ifdef VINSPECTOR
- , getCallBack()
- #endif
- );
- deactivateObject(aContext, aTrie->YAxis()
- #ifdef VINSPECTOR
- , getCallBack()
- #endif
- );
- deactivateObject(aContext, aTrie->Axis()
- #ifdef VINSPECTOR
- , getCallBack()
- #endif
- );
- deactivateObject(aContext, aTrie->Position()
- #ifdef VINSPECTOR
- , getCallBack()
- #endif
- );
-
- deactivateObject(aContext, aTrie->XYPlane()
- #ifdef VINSPECTOR
- , getCallBack()
- #endif
- );
- deactivateObject(aContext, aTrie->XZPlane()
- #ifdef VINSPECTOR
- , getCallBack()
- #endif
- );
- deactivateObject(aContext, aTrie->YZPlane()
- #ifdef VINSPECTOR
- , getCallBack()
- #endif
- );
-
- if (theUpdateViewer)
- updateViewer();
- }
-}
-
-Handle(AIS_InteractiveObject) XGUI_Displayer::getTrihedron() const
-{
- return myWorkshop->viewer()->trihedron();
-}
-
-/*void XGUI_Displayer::openLocalContext()
-{
- Handle(AIS_InteractiveContext) aContext = AISContext();
- // Open local context if there is no one
- if (!aContext.IsNull() && !aContext->HasOpenedContext()) {
- // Preserve selected objects
- //AIS_ListOfInteractive aAisList;
- //for (aContext->InitCurrent(); aContext->MoreCurrent(); aContext->NextCurrent())
- // aAisList.Append(aContext->Current());
-
- // get the filters from the global context and append them to the local context
- // a list of filters in the global context is not cleared and should be cleared here
- SelectMgr_ListOfFilter aFilters;
- aFilters.Assign(aContext->Filters());
- // it is important to remove the filters in the global context, because there is a code
- // in the closeLocalContex, which restore the global context filters
- aContext->RemoveFilters();
-
- //aContext->ClearCurrents();
- aContext->OpenLocalContext();
- //deactivateTrihedron();
- //aContext->NotUseDisplayedObjects();
-
- //myUseExternalObjects = false;
-
- SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
- for (;aIt.More(); aIt.Next()) {
- aContext->AddFilter(aIt.Value());
- }
- // Restore selection
- //AIS_ListIteratorOfListOfInteractive aIt2(aAisList);
- //for(; aIt2.More(); aIt2.Next()) {
- // aContext->SetSelected(aIt2.Value(), false);
- //}
- }
-}*/
-
-/*void XGUI_Displayer::closeLocalContexts(const bool theUpdateViewer)
-{
- Handle(AIS_InteractiveContext) aContext = AISContext();
- if (!aContext.IsNull() && aContext->HasOpenedContext()) {
- // Preserve selected objects
- //AIS_ListOfInteractive aAisList;
- //for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected())
- // aAisList.Append(aContext->SelectedInteractive());
-
- // get the filters from the local context and append them to the global context
- // a list of filters in the local context is cleared
- SelectMgr_ListOfFilter aFilters;
- aFilters.Assign(aContext->Filters());
-
- //aContext->ClearSelected();
- aContext->CloseAllContexts(false);
-
- // From the moment when the AIS_DS_Displayed flag is used in the Display of AIS object,
- // this code is obsolete. It is temporaty commented and should be removed after
- // the test campaign.
- // Redisplay all object if they were displayed in localContext
- /*Handle(AIS_InteractiveObject) aAISIO;
- foreach (AISObjectPtr aAIS, myResult2AISObjectMap) {
- aAISIO = aAIS->impl<Handle(AIS_InteractiveObject)>();
- if (aContext->DisplayStatus(aAISIO) != AIS_DS_Displayed) {
- aContext->Display(aAISIO, false);
- aContext->SetDisplayMode(aAISIO, Shading, false);
- }
- }*+/
-
- // Append the filters from the local selection in the global selection context
- SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
- for (;aIt.More(); aIt.Next()) {
- Handle(SelectMgr_Filter) aFilter = aIt.Value();
- aContext->AddFilter(aFilter);
- }
-
- if (theUpdateViewer)
- updateViewer();
- //myUseExternalObjects = false;
-
- // Restore selection
- //AIS_ListIteratorOfListOfInteractive aIt2(aAisList);
- //for(; aIt2.More(); aIt2.Next()) {
- // if (aContext->IsDisplayed(aIt2.Value()))
- // aContext->SetCurrentObject(aIt2.Value(), false);
- //}
- }
-}*/