1 // Created on: 1997-01-29
2 // Created by: Robert COUBLANC
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and / or modify it
9 // under the terms of the GNU Lesser General Public version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #define IMP051001 //GG Adds SetZDetected() and ZDetected() methods
19 #include <AIS_InteractiveContext.jxx>
21 #include <AIS_LocalContext.hxx>
23 #include <AIS_GlobalStatus.hxx>
24 #include <TColStd_ListIteratorOfListOfInteger.hxx>
26 #include <AIS_DataMapIteratorOfDataMapOfIOStatus.hxx>
27 #include <AIS_DataMapIteratorOfDataMapOfILC.hxx>
28 #include <Graphic3d_StructureManager.hxx>
29 #include <Graphic3d_Structure.hxx>
30 #include <Graphic3d_MapOfStructure.hxx>
31 #include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
32 #include <AIS_Selection.hxx>
34 //=======================================================================
35 //function : OpenLocalContext
37 //=======================================================================
39 Standard_Integer AIS_InteractiveContext::
40 OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
41 const Standard_Boolean AllowShapeDecomposition,
42 const Standard_Boolean AcceptEraseOfTemporary,
43 const Standard_Boolean /*BothViewers*/)
46 // the entities eventually detected just before the context was opened are unhighlighted...
47 if(!IsCurrent(myLastPicked)){
48 if(!myLastPicked.IsNull()){
49 Standard_Integer HiMod = myLastPicked->HasHilightMode()?myLastPicked->HilightMode():0;
50 myMainPM->Unhighlight(myLastPicked,HiMod);
53 if(!mylastmoveview.IsNull()){
55 myLocalContexts(myCurLocalIndex)->UnhilightLastDetected(mylastmoveview);
58 // entities connected to dynamic selection at neutral point are set to 0.
60 myLastinMain.Nullify();
61 myLastPicked.Nullify();
62 myWasLastMain = Standard_True;
66 Standard_Integer untilnow = myCurLocalIndex;
68 myCurLocalIndex = HighestIndex() + 1;
70 Handle(AIS_LocalContext) NewLocal= new AIS_LocalContext(this,myCurLocalIndex,
72 AllowShapeDecomposition,
73 AcceptEraseOfTemporary);
74 // the AIS_LocalContext bind itself to myLocalContexts
75 // because procedures performed in AIS_LocalContext constructor
76 // already may access myLocalContexts(myCurLocalIndex) (like methods AIS_LocalContext::IsSelected()).
77 //myLocalContexts.Bind (myCurLocalIndex, NewLocal);
78 NewLocal->MainSelector()->Set ((myLocalContexts.Extent() > 1)
79 ? myLocalContexts (untilnow)->MainSelector()->Projector()
80 : myMainSel->Projector());
82 NewLocal->MainSelector()->UpdateConversion();
85 cout<<"\tOpen Local Context No "<<myCurLocalIndex<<endl;
86 if(UseDisplayedObjects){
87 cout<<"\t\tObjects from Neutral Point loaded"<<endl;
88 if(AllowShapeDecomposition)
89 cout<<"\t\tDecomposition Authorized for Loaded Shapes"<<endl;
91 cout<<"\t\tNo Decomposition Authorized for Loaded Shapes"<<endl;
94 cout<<"\t\tNo Objects Were Loaded "<<endl;
96 return myCurLocalIndex;
99 //=======================================================================
100 //function : CloseLocalContext
102 //=======================================================================
104 void AIS_InteractiveContext::CloseLocalContext(const Standard_Integer Index,
105 const Standard_Boolean updateviewer)
108 Standard_Boolean debugmode(Standard_False);
110 debugmode = Standard_True;
113 Standard_Integer GoodIndex = (Index ==-1) ? myCurLocalIndex : Index;
115 if(debugmode) cout<<"Call to CloseLocalContext - Index "<<GoodIndex<<endl;
116 if(!HasOpenedContext()){
117 if(debugmode) cout<<"\t But No Local Context is opened"<<endl;
120 if(!myLocalContexts.IsBound(GoodIndex)) {
121 if(debugmode) cout<<" Attempt to Close a non-existent Local Context"<<endl;
125 // the only open local context is closed...
126 if(myLocalContexts.Extent()==1 && GoodIndex == myCurLocalIndex){
128 Standard_Boolean updateproj = !(myLocalContexts(myCurLocalIndex)->HasSameProjector(myMainSel->Projector()));
129 myLocalContexts(myCurLocalIndex)->Terminate( updateviewer );
130 myLocalContexts.UnBind(myCurLocalIndex);
133 ResetOriginalState(Standard_False);
135 myMainSel->UpdateConversion();
137 myMainSel->UpdateSort();
140 cout<<"No More Opened Local Context "<<endl;
143 // Otherwise the local context will be still open after the current is closed
145 Handle(StdSelect_ViewerSelector3d) VS = myLocalContexts(GoodIndex)->MainSelector();
146 myLocalContexts(GoodIndex)->Terminate();
147 myLocalContexts.UnBind(GoodIndex);
148 // the current is closed...
149 if(GoodIndex==myCurLocalIndex){
150 myCurLocalIndex = HighestIndex();
151 const Handle(AIS_LocalContext)& LocCtx = myLocalContexts(myCurLocalIndex);
152 if (!LocCtx->HasSameProjector (VS->Projector()))
154 LocCtx->MainSelector()->UpdateConversion();
158 cout<<"a No Current Local Context WasClosed"<<endl;
160 if(debugmode) cout<<"Index Of CurrentLocalContext:"<<myCurLocalIndex<<endl;
165 if(updateviewer) myMainVwr->Update();
168 //=======================================================================
169 //function : CloseAllContexts
171 //=======================================================================
173 void AIS_InteractiveContext::CloseAllContexts(const Standard_Boolean updateviewer)
176 while(!myLocalContexts.IsEmpty()){
177 CloseLocalContext(myCurLocalIndex,Standard_False);
180 ResetOriginalState(Standard_False);
182 myMainSel->UpdateSort();
183 if(updateviewer) myMainVwr->Update();
186 //=======================================================================
187 //function : IndexOfCurrentLocal
189 //=======================================================================
191 Standard_Integer AIS_InteractiveContext::IndexOfCurrentLocal() const
193 return myCurLocalIndex;
196 //=======================================================================
197 //function : ClearLocalContext
199 //=======================================================================
201 void AIS_InteractiveContext::ClearLocalContext(const AIS_ClearMode aMode)
203 if (!HasOpenedContext()) return;
204 myLocalContexts(myCurLocalIndex)->Clear(aMode);
208 //=======================================================================
209 //function : HighestIndex
211 //=======================================================================
213 Standard_Integer AIS_InteractiveContext::HighestIndex() const
215 AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
216 Standard_Integer HiInd = 0;
217 for(;It.More();It.Next())
218 HiInd = (It.Key()>HiInd) ? It.Key() : HiInd;
224 //=======================================================================
225 //function : Activate
227 //=======================================================================
229 void AIS_InteractiveContext::
230 Activate(const Handle(AIS_InteractiveObject)& anIObj,
231 const Standard_Integer aMode)
233 if(!HasOpenedContext()){
234 if(!myObjects.IsBound(anIObj)) return;
235 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
236 if(STAT->GraphicStatus()==AIS_DS_Displayed)
237 mgrSelector->Activate(anIObj,aMode,myMainSel);
238 STAT ->AddSelectionMode(aMode);
241 myLocalContexts(myCurLocalIndex)->ActivateMode(anIObj,aMode);
245 //=======================================================================
246 //function : LocalSelector
248 //=======================================================================
249 Handle( StdSelect_ViewerSelector3d ) AIS_InteractiveContext::LocalSelector() const
251 if( !HasOpenedContext() )
252 return Handle( StdSelect_ViewerSelector3d )();
254 return myLocalContexts( myCurLocalIndex )->MainSelector();
258 //=======================================================================
259 //function : DeActivate
261 //=======================================================================
262 void AIS_InteractiveContext::
263 Deactivate(const Handle(AIS_InteractiveObject)& anIObj)
265 if(!HasOpenedContext()){
266 if(!myObjects.IsBound(anIObj)) return;
267 TColStd_ListIteratorOfListOfInteger ItL;
268 for(ItL.Initialize(myObjects(anIObj)->SelectionModes());
271 if(myObjects(anIObj)->GraphicStatus() == AIS_DS_Displayed)
272 mgrSelector->Deactivate(anIObj,ItL.Value(),myMainSel);
274 myObjects(anIObj)->ClearSelectionModes();
277 const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
278 LC->Deactivate(anIObj);
282 //=======================================================================
283 //function : Deactivate
285 //=======================================================================
287 void AIS_InteractiveContext::Deactivate(const Handle(AIS_InteractiveObject)& anIObj,
288 const Standard_Integer aMode)
290 if(!HasOpenedContext()){
291 if(!myObjects.IsBound(anIObj)) return;
292 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
294 if(STAT->GraphicStatus() == AIS_DS_Displayed)
295 mgrSelector->Deactivate(anIObj,aMode,myMainSel);
296 STAT->RemoveSelectionMode(aMode);
299 myLocalContexts(myCurLocalIndex)->DeactivateMode(anIObj,aMode);
303 //=======================================================================
304 //function : ActivatedModes
306 //=======================================================================
308 void AIS_InteractiveContext::
309 ActivatedModes(const Handle(AIS_InteractiveObject)& anIObj,
310 TColStd_ListOfInteger& theList) const
312 TColStd_ListIteratorOfListOfInteger ItL;
313 if(!HasOpenedContext()){
314 if(myObjects.IsBound(anIObj)){
315 for(ItL.Initialize(myObjects(anIObj)->SelectionModes());
318 theList.Append(ItL.Value());
323 if(myLocalContexts(myCurLocalIndex)->IsIn(anIObj)){
324 for(ItL.Initialize(myLocalContexts(myCurLocalIndex)->SelectionModes(anIObj));
327 theList.Append(ItL.Value());
332 //=======================================================================
333 //function : SetShapeDecomposition
335 //=======================================================================
337 void AIS_InteractiveContext::SetShapeDecomposition(const Handle(AIS_InteractiveObject)& anIObj,
338 const Standard_Boolean StdModeSensitive)
340 if(!HasOpenedContext()) return;
341 myLocalContexts(myCurLocalIndex)->SetShapeDecomposition(anIObj,StdModeSensitive);
344 //=======================================================================
345 //function : SetTemporaryAttributes
347 //=======================================================================
349 void AIS_InteractiveContext::
350 SetTemporaryAttributes(const Handle(AIS_InteractiveObject)& /*anObj*/,
351 const Handle(Prs3d_Drawer)& /*aDrawer*/,
352 const Standard_Boolean /*updateviewer*/)
356 //=======================================================================
357 //function : SubIntensityOn
359 //=======================================================================
360 void AIS_InteractiveContext::
361 SubIntensityOn(const Handle(AIS_InteractiveObject)& anIObj,
362 const Standard_Boolean updateviewer)
364 if(!HasOpenedContext()){
365 if(!myObjects.IsBound(anIObj))
367 const Handle(AIS_GlobalStatus)& GB=myObjects(anIObj);
368 if(GB->IsSubIntensityOn())
370 GB->SubIntensityOn();
371 Standard_Boolean UpdMain(Standard_False);
373 for(TColStd_ListIteratorOfListOfInteger It(GB->DisplayedModes());It.More();It.Next()){
374 if (GB->GraphicStatus()==AIS_DS_Displayed)
376 myMainPM->Color(anIObj,mySubIntensity,It.Value());
377 UpdMain = Standard_True;
386 if(myObjects.IsBound(anIObj)){
387 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
388 STAT->SubIntensityOn();
389 TColStd_ListIteratorOfListOfInteger ItL;
390 for (ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
391 myMainPM->Color(anIObj,mySubIntensity,ItL.Value());
394 myLocalContexts(myCurLocalIndex)->SubIntensityOn(anIObj);
396 if(updateviewer) myMainVwr->Update();
399 //=======================================================================
400 //function : SubIntensityOff
402 //=======================================================================
404 void AIS_InteractiveContext::
405 SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj,
406 const Standard_Boolean updateviewer)
408 if(!HasOpenedContext()){
409 if(!myObjects.IsBound(anIObj))
411 const Handle(AIS_GlobalStatus)& GB=myObjects(anIObj);
412 if(!GB->IsSubIntensityOn())
414 GB->SubIntensityOff();
415 Standard_Boolean UpdMain(Standard_False);
417 for(TColStd_ListIteratorOfListOfInteger It(GB->DisplayedModes());It.More();It.Next()){
418 if(GB->GraphicStatus()==AIS_DS_Displayed)
420 myMainPM->Unhighlight(anIObj,It.Value());
421 UpdMain = Standard_True;
425 Standard_Integer DM,HM,SM;
426 GetDefModes(anIObj,DM,HM,SM);
427 if(AIS_Selection::IsSelected(anIObj))
428 myMainPM->Highlight(anIObj,HM);
436 if(myObjects.IsBound(anIObj)){
437 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
438 STAT->SubIntensityOff();
439 TColStd_ListIteratorOfListOfInteger ItL;
440 for (ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
441 myMainPM->Unhighlight(anIObj,ItL.Value());
442 if(STAT->IsHilighted())
446 myLocalContexts(myCurLocalIndex)->SubIntensityOff(anIObj);
447 if(IsSelected(anIObj))
450 if(updateviewer) myMainVwr->Update();
454 //=======================================================================
455 //function : SubIntensityOn
456 //purpose : ALL THE DISPLAYED OBJECTS HAVE SUBINTENSITY...
457 //=======================================================================
459 void AIS_InteractiveContext::SubIntensityOn(const Standard_Boolean updateviewer)
461 if(!HasOpenedContext()) return;
463 AIS_DataMapIteratorOfDataMapOfIOStatus It (myObjects);
464 TColStd_ListIteratorOfListOfInteger ItM;
465 for(;It.More();It.Next()){
466 const Handle(AIS_GlobalStatus)& STAT = It.Value();
467 if(STAT->GraphicStatus()==AIS_DS_Displayed)
469 STAT->SubIntensityOn();
470 for(ItM.Initialize(STAT->DisplayedModes());ItM.More();ItM.Next())
471 {myMainPM->Color(It.Key(),mySubIntensity,ItM.Value());}
474 if(updateviewer) myMainVwr->Update();
477 //=======================================================================
478 //function : SubIntensityOff
480 //=======================================================================
481 void AIS_InteractiveContext::SubIntensityOff(const Standard_Boolean updateviewer)
483 if(!HasOpenedContext()) return;
485 AIS_DataMapIteratorOfDataMapOfIOStatus It (myObjects);
486 TColStd_ListIteratorOfListOfInteger ItL;
487 for(;It.More();It.Next()){
488 const Handle(AIS_GlobalStatus)& STAT = It.Value();
489 if(STAT->IsSubIntensityOn())
490 STAT->SubIntensityOff();
491 for(ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
492 myMainPM->Unhighlight(It.Key());
495 if(updateviewer) myMainVwr->Update();
498 //=======================================================================
499 //function : AddFilter
501 //=======================================================================
502 void AIS_InteractiveContext::AddFilter(const Handle(SelectMgr_Filter)& aFilter)
504 if(HasOpenedContext())
505 myLocalContexts(myCurLocalIndex)->AddFilter(aFilter);
507 myFilters->Add(aFilter);
510 //=======================================================================
511 //function : ActivateStandardMode
513 //=======================================================================
514 void AIS_InteractiveContext::ActivateStandardMode(const TopAbs_ShapeEnum aStandardActivation)
516 if(!HasOpenedContext()) return;
517 myLocalContexts(myCurLocalIndex)->ActivateStandardMode (aStandardActivation);
520 //=======================================================================
521 //function : DeActivateStandardMode
523 //=======================================================================
524 void AIS_InteractiveContext::DeactivateStandardMode(const TopAbs_ShapeEnum aStandardActivation)
526 if(!HasOpenedContext()) return;
527 myLocalContexts(myCurLocalIndex)->DeactivateStandardMode (aStandardActivation);
530 //=======================================================================
531 //function : RemoveFilter
533 //=======================================================================
534 void AIS_InteractiveContext::RemoveFilter(const Handle(SelectMgr_Filter)& aFilter)
536 if(HasOpenedContext())
537 myLocalContexts(myCurLocalIndex)->RemoveFilter (aFilter);
539 myFilters->Remove(aFilter);
542 //=======================================================================
543 //function : RemoveFilters
545 //=======================================================================
547 void AIS_InteractiveContext::RemoveFilters()
549 if(!HasOpenedContext())
552 myLocalContexts(myCurLocalIndex)->Clear(AIS_CM_Filters);
555 //=======================================================================
556 //function : ActivatedStandardModes
558 //=======================================================================
559 const TColStd_ListOfInteger& AIS_InteractiveContext::ActivatedStandardModes() const
561 return myLocalContexts(myCurLocalIndex)->StandardModes();
564 //=======================================================================
567 //=======================================================================
568 const SelectMgr_ListOfFilter& AIS_InteractiveContext::Filters() const
570 if(HasOpenedContext())
571 return myLocalContexts(myCurLocalIndex)->ListOfFilter();
572 return myFilters->StoredFilters();
575 //=======================================================================
576 //function : DisplayActiveAreas
578 //=======================================================================
579 void AIS_InteractiveContext::DisplayActiveAreas(const Handle(V3d_View)& aviou)
581 if(HasOpenedContext())
582 myLocalContexts(myCurLocalIndex)->DisplayAreas(aviou);
584 myMainSel->DisplayAreas(aviou);
588 //=======================================================================
589 //function : ClearActiveAreas
591 //=======================================================================
592 void AIS_InteractiveContext::ClearActiveAreas(const Handle(V3d_View)& aviou)
594 if(HasOpenedContext())
595 myLocalContexts(myCurLocalIndex)->ClearAreas(aviou);
597 myMainSel->ClearAreas(aviou);
600 //=======================================================================
601 //function : DisplayActiveSensitive
603 //=======================================================================
604 void AIS_InteractiveContext::DisplayActiveSensitive(const Handle(V3d_View)& aviou)
606 if(HasOpenedContext())
607 myLocalContexts(myCurLocalIndex)->DisplaySensitive(aviou);
609 myMainSel->DisplaySensitive(aviou);
611 //=======================================================================
612 //function : DisplayActiveSensitive
614 //=======================================================================
616 void AIS_InteractiveContext::DisplayActiveSensitive(const Handle(AIS_InteractiveObject)& anIObj,
617 const Handle(V3d_View)& aviou)
619 TColStd_ListIteratorOfListOfInteger It;
620 Handle(StdSelect_ViewerSelector3d) VS;
621 if(HasOpenedContext()){
622 const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
623 if(!LC->IsIn(anIObj)) return;
624 It.Initialize(LC->SelectionModes(anIObj));
625 VS = LC->MainSelector();
628 if(!myObjects.IsBound(anIObj)) return;
629 It.Initialize(myObjects(anIObj)->SelectionModes());
634 for(;It.More();It.Next()){
635 const Handle(SelectMgr_Selection)& Sel = anIObj->Selection(It.Value());
636 VS->DisplaySensitive(Sel,aviou,Standard_False);
641 //=======================================================================
642 //function : DisplayActiveAreas
644 //=======================================================================
646 void AIS_InteractiveContext::DisplayActiveAreas(const Handle(AIS_InteractiveObject)& anIObj,
647 const Handle(V3d_View)& aviou)
649 TColStd_ListIteratorOfListOfInteger It;
650 Handle(StdSelect_ViewerSelector3d) VS;
651 if(HasOpenedContext()){
652 const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
653 if(!LC->IsIn(anIObj)) return;
654 It.Initialize(LC->SelectionModes(anIObj));
655 VS = LC->MainSelector();
658 if(!myObjects.IsBound(anIObj)) return;
659 It.Initialize(myObjects(anIObj)->SelectionModes());
664 for(;It.More();It.Next()){
665 const Handle(SelectMgr_Selection)& Sel = anIObj->Selection(It.Value());
666 VS->DisplayAreas(Sel,aviou,Standard_False);
671 //=======================================================================
672 //function : ClearActiveSensitive
674 //=======================================================================
675 void AIS_InteractiveContext::ClearActiveSensitive(const Handle(V3d_View)& aviou)
678 if(HasOpenedContext())
679 myLocalContexts(myCurLocalIndex)->ClearSensitive(aviou);
681 myMainSel->ClearSensitive(aviou);
684 //=======================================================================
685 //function : SetAutomaticHilight
687 //=======================================================================
688 void AIS_InteractiveContext::SetAutomaticHilight(const Standard_Boolean aStatus)
691 if(HasOpenedContext())
692 myLocalContexts(myCurLocalIndex)->SetAutomaticHilight(aStatus);
695 //=======================================================================
696 //function : AutomaticHilight
698 //=======================================================================
699 Standard_Boolean AIS_InteractiveContext::AutomaticHilight() const
701 if(HasOpenedContext())
702 return myLocalContexts(myCurLocalIndex)->AutomaticHilight();
703 return Standard_True;
706 //=======================================================================
707 //function : UseDisplayedObjects
709 //=======================================================================
711 void AIS_InteractiveContext::UseDisplayedObjects()
713 if(HasOpenedContext())
714 myLocalContexts(myCurLocalIndex)->LoadContextObjects();
717 //=======================================================================
718 //function : NotUseDisplayedObjects
720 //=======================================================================
722 void AIS_InteractiveContext::NotUseDisplayedObjects()
724 if(HasOpenedContext())
725 myLocalContexts(myCurLocalIndex)->UnloadContextObjects();
731 //=======================================================================
732 //function : PurgeDisplay
734 //=======================================================================
736 Standard_Integer AIS_InteractiveContext::PurgeDisplay()
738 if(HasOpenedContext()) return 0;
740 Standard_Integer NbStr = PurgeViewer(myMainVwr);
747 //=======================================================================
748 //function : PurgeViewer
750 //=======================================================================
751 Standard_Integer AIS_InteractiveContext::PurgeViewer(const Handle(V3d_Viewer)& Vwr)
753 const Handle(Graphic3d_StructureManager)& GSM = Vwr->Viewer();
754 Standard_Integer NbCleared(0);
755 Graphic3d_MapOfStructure SOS;
756 GSM->DisplayedStructures(SOS);
758 Handle(Graphic3d_Structure) G;
759 for(Graphic3d_MapIteratorOfMapOfStructure It(SOS); It.More();It.Next()){
761 Standard_Address Add = G->Owner();
764 G->Clear();// it means that it is not referenced as a presentation of InterfactiveObject...
767 Handle(AIS_InteractiveObject) IO = (AIS_InteractiveObject*)Add;
768 if(!myObjects.IsBound(IO)){
777 //=======================================================================
778 //function : IsImmediateModeOn
780 //=======================================================================
781 Standard_Boolean AIS_InteractiveContext::IsImmediateModeOn() const
783 if(!HasOpenedContext()) return Standard_False;
784 return myLocalContexts(myCurLocalIndex)->IsImmediateModeOn();
787 Standard_Boolean AIS_InteractiveContext::BeginImmediateDraw()
789 if(HasOpenedContext())
790 return myLocalContexts(myCurLocalIndex)->BeginImmediateDraw();
791 return Standard_False;
794 //=======================================================================
795 //function : ImmediateAdd
797 //=======================================================================
799 Standard_Boolean AIS_InteractiveContext::ImmediateAdd(const Handle(AIS_InteractiveObject)& anIObj,
800 const Standard_Integer AMode)
802 if(HasOpenedContext()){
803 return myLocalContexts(myCurLocalIndex)->ImmediateAdd(anIObj,AMode);}
804 return Standard_False;
807 //=======================================================================
808 //function : ImmediateRemove
810 //=======================================================================
812 Standard_Boolean AIS_InteractiveContext::ImmediateRemove(const Handle(AIS_InteractiveObject)& anIObj,
813 const Standard_Integer aMode)
815 if(HasOpenedContext())
816 return myLocalContexts(myCurLocalIndex)->ImmediateRemove(anIObj,aMode);
817 return Standard_False;
820 //=======================================================================
821 //function : EndImmediateDraw
823 //=======================================================================
825 Standard_Boolean AIS_InteractiveContext::EndImmediateDraw(const Handle(V3d_View)& aView,
826 const Standard_Boolean DoubleBuf)
828 if(HasOpenedContext())
829 return myLocalContexts(myCurLocalIndex)->EndImmediateDraw(aView,DoubleBuf);
830 return Standard_False;
834 //=======================================================================
835 //function : EndImmediateDraw
837 //=======================================================================
839 Standard_Boolean AIS_InteractiveContext::EndImmediateDraw(const Standard_Boolean DoubleBuf)
841 if(HasOpenedContext()){
843 myMainVwr->InitActiveViews();
844 if(myMainVwr->MoreActiveViews()){
845 V = myMainVwr->ActiveView();
847 return myLocalContexts(myCurLocalIndex)->EndImmediateDraw(V,DoubleBuf);
850 return Standard_False;
855 //=======================================================================
856 //function : ResetOriginalState
858 //=======================================================================
860 void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updateviewer)
862 Standard_Boolean upd_main(Standard_False);
863 TColStd_ListIteratorOfListOfInteger itl;
865 for (AIS_DataMapIteratorOfDataMapOfIOStatus it(myObjects);it.More();it.Next()){
866 const Handle(AIS_InteractiveObject)& iobj = it.Key();
867 const Handle(AIS_GlobalStatus)& STAT = it.Value();
868 switch(STAT->GraphicStatus()){
869 case AIS_DS_Displayed:{
870 upd_main = Standard_True;
873 for(itl.Initialize(STAT->DisplayedModes());itl.More();itl.Next())
874 myMainPM->Display(iobj,itl.Value());
875 if(STAT->IsHilighted()){
876 if(STAT->HilightColor()!=Quantity_NOC_WHITE)
877 HilightWithColor(iobj,STAT->HilightColor(),Standard_False);
879 Hilight(iobj,Standard_False);
882 for(itl.Initialize(STAT->SelectionModes());itl.More();itl.Next()){
884 mgrSelector->Activate(iobj,itl.Value(),myMainSel);
889 EraseGlobal(iobj,Standard_False);
903 //=======================================================================
904 //function : SetZDetection
906 //=======================================================================
907 void AIS_InteractiveContext::SetZDetection(const Standard_Boolean aStatus)
909 myZDetectionFlag = aStatus;
912 //=======================================================================
913 //function : ZDetection
915 //=======================================================================
916 Standard_Boolean AIS_InteractiveContext::ZDetection() const
918 return myZDetectionFlag;