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 under
9 // the terms of the GNU Lesser General Public License 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 #include <AIS_InteractiveContext.jxx>
19 #include <AIS_LocalContext.hxx>
21 #include <AIS_GlobalStatus.hxx>
22 #include <TColStd_ListIteratorOfListOfInteger.hxx>
24 #include <AIS_DataMapIteratorOfDataMapOfIOStatus.hxx>
25 #include <AIS_DataMapIteratorOfDataMapOfILC.hxx>
26 #include <Graphic3d_StructureManager.hxx>
27 #include <Graphic3d_Structure.hxx>
28 #include <Graphic3d_MapOfStructure.hxx>
29 #include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
30 #include <AIS_Selection.hxx>
32 //=======================================================================
33 //function : OpenLocalContext
35 //=======================================================================
37 Standard_Integer AIS_InteractiveContext::
38 OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
39 const Standard_Boolean AllowShapeDecomposition,
40 const Standard_Boolean AcceptEraseOfTemporary,
41 const Standard_Boolean /*BothViewers*/)
44 // the entities eventually detected just before the context was opened are unhighlighted...
45 if(!IsCurrent(myLastPicked)){
46 if(!myLastPicked.IsNull()){
47 Standard_Integer HiMod = myLastPicked->HasHilightMode()?myLastPicked->HilightMode():0;
48 myMainPM->Unhighlight(myLastPicked,HiMod);
51 if(!mylastmoveview.IsNull()){
53 myLocalContexts(myCurLocalIndex)->UnhilightLastDetected(mylastmoveview);
56 // entities connected to dynamic selection at neutral point are set to 0.
58 myLastinMain.Nullify();
59 myLastPicked.Nullify();
60 myWasLastMain = Standard_True;
64 Standard_Integer untilnow = myCurLocalIndex;
66 myCurLocalIndex = HighestIndex() + 1;
68 Handle(AIS_LocalContext) NewLocal= new AIS_LocalContext(this,myCurLocalIndex,
70 AllowShapeDecomposition,
71 AcceptEraseOfTemporary);
72 // the AIS_LocalContext bind itself to myLocalContexts
73 // because procedures performed in AIS_LocalContext constructor
74 // already may access myLocalContexts(myCurLocalIndex) (like methods AIS_LocalContext::IsSelected()).
75 //myLocalContexts.Bind (myCurLocalIndex, NewLocal);
76 NewLocal->MainSelector()->Set ((myLocalContexts.Extent() > 1)
77 ? myLocalContexts (untilnow)->MainSelector()->Projector()
78 : myMainSel->Projector());
80 NewLocal->MainSelector()->UpdateConversion();
83 cout<<"\tOpen Local Context No "<<myCurLocalIndex<<endl;
84 if(UseDisplayedObjects){
85 cout<<"\t\tObjects from Neutral Point loaded"<<endl;
86 if(AllowShapeDecomposition)
87 cout<<"\t\tDecomposition Authorized for Loaded Shapes"<<endl;
89 cout<<"\t\tNo Decomposition Authorized for Loaded Shapes"<<endl;
92 cout<<"\t\tNo Objects Were Loaded "<<endl;
94 return myCurLocalIndex;
97 //=======================================================================
98 //function : CloseLocalContext
100 //=======================================================================
102 void AIS_InteractiveContext::CloseLocalContext(const Standard_Integer Index,
103 const Standard_Boolean updateviewer)
106 Standard_Boolean debugmode(Standard_False);
108 debugmode = Standard_True;
111 Standard_Integer GoodIndex = (Index ==-1) ? myCurLocalIndex : Index;
113 if(debugmode) cout<<"Call to CloseLocalContext - Index "<<GoodIndex<<endl;
114 if(!HasOpenedContext()){
115 if(debugmode) cout<<"\t But No Local Context is opened"<<endl;
118 if(!myLocalContexts.IsBound(GoodIndex)) {
119 if(debugmode) cout<<" Attempt to Close a non-existent Local Context"<<endl;
123 // the only open local context is closed...
124 if(myLocalContexts.Extent()==1 && GoodIndex == myCurLocalIndex){
126 Standard_Boolean updateproj = !(myLocalContexts(myCurLocalIndex)->HasSameProjector(myMainSel->Projector()));
127 myLocalContexts(myCurLocalIndex)->Terminate( updateviewer );
128 myLocalContexts.UnBind(myCurLocalIndex);
131 ResetOriginalState(Standard_False);
133 myMainSel->UpdateConversion();
135 myMainSel->UpdateSort();
138 cout<<"No More Opened Local Context "<<endl;
141 // Otherwise the local context will be still open after the current is closed
143 Handle(StdSelect_ViewerSelector3d) VS = myLocalContexts(GoodIndex)->MainSelector();
144 myLocalContexts(GoodIndex)->Terminate();
145 myLocalContexts.UnBind(GoodIndex);
146 // the current is closed...
147 if(GoodIndex==myCurLocalIndex){
148 myCurLocalIndex = HighestIndex();
149 const Handle(AIS_LocalContext)& LocCtx = myLocalContexts(myCurLocalIndex);
150 if (!LocCtx->HasSameProjector (VS->Projector()))
152 LocCtx->MainSelector()->UpdateConversion();
156 cout<<"a No Current Local Context WasClosed"<<endl;
158 if(debugmode) cout<<"Index Of CurrentLocalContext:"<<myCurLocalIndex<<endl;
163 if(updateviewer) myMainVwr->Update();
166 //=======================================================================
167 //function : CloseAllContexts
169 //=======================================================================
171 void AIS_InteractiveContext::CloseAllContexts(const Standard_Boolean updateviewer)
174 while(!myLocalContexts.IsEmpty()){
175 CloseLocalContext(myCurLocalIndex,Standard_False);
178 ResetOriginalState(Standard_False);
180 myMainSel->UpdateSort();
181 if(updateviewer) myMainVwr->Update();
184 //=======================================================================
185 //function : IndexOfCurrentLocal
187 //=======================================================================
189 Standard_Integer AIS_InteractiveContext::IndexOfCurrentLocal() const
191 return myCurLocalIndex;
194 //=======================================================================
195 //function : ClearLocalContext
197 //=======================================================================
199 void AIS_InteractiveContext::ClearLocalContext(const AIS_ClearMode aMode)
201 if (!HasOpenedContext()) return;
202 myLocalContexts(myCurLocalIndex)->Clear(aMode);
206 //=======================================================================
207 //function : HighestIndex
209 //=======================================================================
211 Standard_Integer AIS_InteractiveContext::HighestIndex() const
213 AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
214 Standard_Integer HiInd = 0;
215 for(;It.More();It.Next())
216 HiInd = (It.Key()>HiInd) ? It.Key() : HiInd;
222 //=======================================================================
223 //function : Activate
225 //=======================================================================
227 void AIS_InteractiveContext::
228 Activate(const Handle(AIS_InteractiveObject)& anIObj,
229 const Standard_Integer aMode)
231 if(!HasOpenedContext()){
232 if(!myObjects.IsBound(anIObj)) return;
233 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
234 if(STAT->GraphicStatus()==AIS_DS_Displayed)
235 mgrSelector->Activate(anIObj,aMode,myMainSel);
236 STAT ->AddSelectionMode(aMode);
239 myLocalContexts(myCurLocalIndex)->ActivateMode(anIObj,aMode);
243 //=======================================================================
244 //function : LocalSelector
246 //=======================================================================
247 Handle( StdSelect_ViewerSelector3d ) AIS_InteractiveContext::LocalSelector() const
249 if( !HasOpenedContext() )
250 return Handle( StdSelect_ViewerSelector3d )();
252 return myLocalContexts( myCurLocalIndex )->MainSelector();
256 //=======================================================================
257 //function : DeActivate
259 //=======================================================================
260 void AIS_InteractiveContext::
261 Deactivate(const Handle(AIS_InteractiveObject)& anIObj)
263 if(!HasOpenedContext()){
264 if(!myObjects.IsBound(anIObj)) return;
265 TColStd_ListIteratorOfListOfInteger ItL;
266 for(ItL.Initialize(myObjects(anIObj)->SelectionModes());
269 if(myObjects(anIObj)->GraphicStatus() == AIS_DS_Displayed)
270 mgrSelector->Deactivate(anIObj,ItL.Value(),myMainSel);
272 myObjects(anIObj)->ClearSelectionModes();
275 const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
276 LC->Deactivate(anIObj);
280 //=======================================================================
281 //function : Deactivate
283 //=======================================================================
285 void AIS_InteractiveContext::Deactivate(const Handle(AIS_InteractiveObject)& anIObj,
286 const Standard_Integer aMode)
288 if(!HasOpenedContext()){
289 if(!myObjects.IsBound(anIObj)) return;
290 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
292 if(STAT->GraphicStatus() == AIS_DS_Displayed)
293 mgrSelector->Deactivate(anIObj,aMode,myMainSel);
294 STAT->RemoveSelectionMode(aMode);
297 myLocalContexts(myCurLocalIndex)->DeactivateMode(anIObj,aMode);
301 //=======================================================================
302 //function : ActivatedModes
304 //=======================================================================
306 void AIS_InteractiveContext::
307 ActivatedModes(const Handle(AIS_InteractiveObject)& anIObj,
308 TColStd_ListOfInteger& theList) const
310 TColStd_ListIteratorOfListOfInteger ItL;
311 if(!HasOpenedContext()){
312 if(myObjects.IsBound(anIObj)){
313 for(ItL.Initialize(myObjects(anIObj)->SelectionModes());
316 theList.Append(ItL.Value());
321 if(myLocalContexts(myCurLocalIndex)->IsIn(anIObj)){
322 for(ItL.Initialize(myLocalContexts(myCurLocalIndex)->SelectionModes(anIObj));
325 theList.Append(ItL.Value());
330 //=======================================================================
331 //function : SetShapeDecomposition
333 //=======================================================================
335 void AIS_InteractiveContext::SetShapeDecomposition(const Handle(AIS_InteractiveObject)& anIObj,
336 const Standard_Boolean StdModeSensitive)
338 if(!HasOpenedContext()) return;
339 myLocalContexts(myCurLocalIndex)->SetShapeDecomposition(anIObj,StdModeSensitive);
342 //=======================================================================
343 //function : SetTemporaryAttributes
345 //=======================================================================
347 void AIS_InteractiveContext::
348 SetTemporaryAttributes(const Handle(AIS_InteractiveObject)& /*anObj*/,
349 const Handle(Prs3d_Drawer)& /*aDrawer*/,
350 const Standard_Boolean /*updateviewer*/)
354 //=======================================================================
355 //function : SubIntensityOn
357 //=======================================================================
358 void AIS_InteractiveContext::
359 SubIntensityOn(const Handle(AIS_InteractiveObject)& anIObj,
360 const Standard_Boolean updateviewer)
362 if(!HasOpenedContext()){
363 if(!myObjects.IsBound(anIObj))
365 const Handle(AIS_GlobalStatus)& GB=myObjects(anIObj);
366 if(GB->IsSubIntensityOn())
368 GB->SubIntensityOn();
369 Standard_Boolean UpdMain(Standard_False);
371 for(TColStd_ListIteratorOfListOfInteger It(GB->DisplayedModes());It.More();It.Next()){
372 if (GB->GraphicStatus()==AIS_DS_Displayed)
374 myMainPM->Color(anIObj,mySubIntensity,It.Value());
375 UpdMain = Standard_True;
384 if(myObjects.IsBound(anIObj)){
385 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
386 STAT->SubIntensityOn();
387 TColStd_ListIteratorOfListOfInteger ItL;
388 for (ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
389 myMainPM->Color(anIObj,mySubIntensity,ItL.Value());
392 myLocalContexts(myCurLocalIndex)->SubIntensityOn(anIObj);
394 if(updateviewer) myMainVwr->Update();
397 //=======================================================================
398 //function : SubIntensityOff
400 //=======================================================================
402 void AIS_InteractiveContext::
403 SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj,
404 const Standard_Boolean updateviewer)
406 if(!HasOpenedContext()){
407 if(!myObjects.IsBound(anIObj))
409 const Handle(AIS_GlobalStatus)& GB=myObjects(anIObj);
410 if(!GB->IsSubIntensityOn())
412 GB->SubIntensityOff();
413 Standard_Boolean UpdMain(Standard_False);
415 for(TColStd_ListIteratorOfListOfInteger It(GB->DisplayedModes());It.More();It.Next()){
416 if(GB->GraphicStatus()==AIS_DS_Displayed)
418 myMainPM->Unhighlight(anIObj,It.Value());
419 UpdMain = Standard_True;
423 Standard_Integer DM,HM,SM;
424 GetDefModes(anIObj,DM,HM,SM);
425 if(AIS_Selection::IsSelected(anIObj))
426 myMainPM->Highlight(anIObj,HM);
434 if(myObjects.IsBound(anIObj)){
435 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
436 STAT->SubIntensityOff();
437 TColStd_ListIteratorOfListOfInteger ItL;
438 for (ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
439 myMainPM->Unhighlight(anIObj,ItL.Value());
440 if(STAT->IsHilighted())
444 myLocalContexts(myCurLocalIndex)->SubIntensityOff(anIObj);
445 if(IsSelected(anIObj))
448 if(updateviewer) myMainVwr->Update();
452 //=======================================================================
453 //function : SubIntensityOn
454 //purpose : ALL THE DISPLAYED OBJECTS HAVE SUBINTENSITY...
455 //=======================================================================
457 void AIS_InteractiveContext::SubIntensityOn(const Standard_Boolean updateviewer)
459 if(!HasOpenedContext()) return;
461 AIS_DataMapIteratorOfDataMapOfIOStatus It (myObjects);
462 TColStd_ListIteratorOfListOfInteger ItM;
463 for(;It.More();It.Next()){
464 const Handle(AIS_GlobalStatus)& STAT = It.Value();
465 if(STAT->GraphicStatus()==AIS_DS_Displayed)
467 STAT->SubIntensityOn();
468 for(ItM.Initialize(STAT->DisplayedModes());ItM.More();ItM.Next())
469 {myMainPM->Color(It.Key(),mySubIntensity,ItM.Value());}
472 if(updateviewer) myMainVwr->Update();
475 //=======================================================================
476 //function : SubIntensityOff
478 //=======================================================================
479 void AIS_InteractiveContext::SubIntensityOff(const Standard_Boolean updateviewer)
481 if(!HasOpenedContext()) return;
483 AIS_DataMapIteratorOfDataMapOfIOStatus It (myObjects);
484 TColStd_ListIteratorOfListOfInteger ItL;
485 for(;It.More();It.Next()){
486 const Handle(AIS_GlobalStatus)& STAT = It.Value();
487 if(STAT->IsSubIntensityOn())
488 STAT->SubIntensityOff();
489 for(ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
490 myMainPM->Unhighlight(It.Key());
493 if(updateviewer) myMainVwr->Update();
496 //=======================================================================
497 //function : AddFilter
499 //=======================================================================
500 void AIS_InteractiveContext::AddFilter(const Handle(SelectMgr_Filter)& aFilter)
502 if(HasOpenedContext())
503 myLocalContexts(myCurLocalIndex)->AddFilter(aFilter);
505 myFilters->Add(aFilter);
508 //=======================================================================
509 //function : ActivateStandardMode
511 //=======================================================================
512 void AIS_InteractiveContext::ActivateStandardMode(const TopAbs_ShapeEnum aStandardActivation)
514 if(!HasOpenedContext()) return;
515 myLocalContexts(myCurLocalIndex)->ActivateStandardMode (aStandardActivation);
518 //=======================================================================
519 //function : DeActivateStandardMode
521 //=======================================================================
522 void AIS_InteractiveContext::DeactivateStandardMode(const TopAbs_ShapeEnum aStandardActivation)
524 if(!HasOpenedContext()) return;
525 myLocalContexts(myCurLocalIndex)->DeactivateStandardMode (aStandardActivation);
528 //=======================================================================
529 //function : RemoveFilter
531 //=======================================================================
532 void AIS_InteractiveContext::RemoveFilter(const Handle(SelectMgr_Filter)& aFilter)
534 if(HasOpenedContext())
535 myLocalContexts(myCurLocalIndex)->RemoveFilter (aFilter);
537 myFilters->Remove(aFilter);
540 //=======================================================================
541 //function : RemoveFilters
543 //=======================================================================
545 void AIS_InteractiveContext::RemoveFilters()
547 if(!HasOpenedContext())
550 myLocalContexts(myCurLocalIndex)->Clear(AIS_CM_Filters);
553 //=======================================================================
554 //function : ActivatedStandardModes
556 //=======================================================================
557 const TColStd_ListOfInteger& AIS_InteractiveContext::ActivatedStandardModes() const
559 return myLocalContexts(myCurLocalIndex)->StandardModes();
562 //=======================================================================
565 //=======================================================================
566 const SelectMgr_ListOfFilter& AIS_InteractiveContext::Filters() const
568 if(HasOpenedContext())
569 return myLocalContexts(myCurLocalIndex)->ListOfFilter();
570 return myFilters->StoredFilters();
573 //=======================================================================
574 //function : DisplayActiveAreas
576 //=======================================================================
577 void AIS_InteractiveContext::DisplayActiveAreas(const Handle(V3d_View)& aviou)
579 if(HasOpenedContext())
580 myLocalContexts(myCurLocalIndex)->DisplayAreas(aviou);
582 myMainSel->DisplayAreas(aviou);
586 //=======================================================================
587 //function : ClearActiveAreas
589 //=======================================================================
590 void AIS_InteractiveContext::ClearActiveAreas(const Handle(V3d_View)& aviou)
592 if(HasOpenedContext())
593 myLocalContexts(myCurLocalIndex)->ClearAreas(aviou);
595 myMainSel->ClearAreas(aviou);
598 //=======================================================================
599 //function : DisplayActiveSensitive
601 //=======================================================================
602 void AIS_InteractiveContext::DisplayActiveSensitive(const Handle(V3d_View)& aviou)
604 if(HasOpenedContext())
605 myLocalContexts(myCurLocalIndex)->DisplaySensitive(aviou);
607 myMainSel->DisplaySensitive(aviou);
609 //=======================================================================
610 //function : DisplayActiveSensitive
612 //=======================================================================
614 void AIS_InteractiveContext::DisplayActiveSensitive(const Handle(AIS_InteractiveObject)& anIObj,
615 const Handle(V3d_View)& aviou)
617 TColStd_ListIteratorOfListOfInteger It;
618 Handle(StdSelect_ViewerSelector3d) VS;
619 if(HasOpenedContext()){
620 const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
621 if(!LC->IsIn(anIObj)) return;
622 It.Initialize(LC->SelectionModes(anIObj));
623 VS = LC->MainSelector();
626 if(!myObjects.IsBound(anIObj)) return;
627 It.Initialize(myObjects(anIObj)->SelectionModes());
632 for(;It.More();It.Next()){
633 const Handle(SelectMgr_Selection)& Sel = anIObj->Selection(It.Value());
634 VS->DisplaySensitive(Sel,aviou,Standard_False);
639 //=======================================================================
640 //function : DisplayActiveAreas
642 //=======================================================================
644 void AIS_InteractiveContext::DisplayActiveAreas(const Handle(AIS_InteractiveObject)& anIObj,
645 const Handle(V3d_View)& aviou)
647 TColStd_ListIteratorOfListOfInteger It;
648 Handle(StdSelect_ViewerSelector3d) VS;
649 if(HasOpenedContext()){
650 const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
651 if(!LC->IsIn(anIObj)) return;
652 It.Initialize(LC->SelectionModes(anIObj));
653 VS = LC->MainSelector();
656 if(!myObjects.IsBound(anIObj)) return;
657 It.Initialize(myObjects(anIObj)->SelectionModes());
662 for(;It.More();It.Next()){
663 const Handle(SelectMgr_Selection)& Sel = anIObj->Selection(It.Value());
664 VS->DisplayAreas(Sel,aviou,Standard_False);
669 //=======================================================================
670 //function : ClearActiveSensitive
672 //=======================================================================
673 void AIS_InteractiveContext::ClearActiveSensitive(const Handle(V3d_View)& aviou)
676 if(HasOpenedContext())
677 myLocalContexts(myCurLocalIndex)->ClearSensitive(aviou);
679 myMainSel->ClearSensitive(aviou);
682 //=======================================================================
683 //function : SetAutomaticHilight
685 //=======================================================================
686 void AIS_InteractiveContext::SetAutomaticHilight(const Standard_Boolean aStatus)
689 if(HasOpenedContext())
690 myLocalContexts(myCurLocalIndex)->SetAutomaticHilight(aStatus);
693 //=======================================================================
694 //function : AutomaticHilight
696 //=======================================================================
697 Standard_Boolean AIS_InteractiveContext::AutomaticHilight() const
699 if(HasOpenedContext())
700 return myLocalContexts(myCurLocalIndex)->AutomaticHilight();
701 return Standard_True;
704 //=======================================================================
705 //function : UseDisplayedObjects
707 //=======================================================================
709 void AIS_InteractiveContext::UseDisplayedObjects()
711 if(HasOpenedContext())
712 myLocalContexts(myCurLocalIndex)->LoadContextObjects();
715 //=======================================================================
716 //function : NotUseDisplayedObjects
718 //=======================================================================
720 void AIS_InteractiveContext::NotUseDisplayedObjects()
722 if(HasOpenedContext())
723 myLocalContexts(myCurLocalIndex)->UnloadContextObjects();
729 //=======================================================================
730 //function : PurgeDisplay
732 //=======================================================================
734 Standard_Integer AIS_InteractiveContext::PurgeDisplay()
736 if(HasOpenedContext()) return 0;
738 Standard_Integer NbStr = PurgeViewer(myMainVwr);
745 //=======================================================================
746 //function : PurgeViewer
748 //=======================================================================
749 Standard_Integer AIS_InteractiveContext::PurgeViewer(const Handle(V3d_Viewer)& Vwr)
751 const Handle(Graphic3d_StructureManager)& GSM = Vwr->Viewer();
752 Standard_Integer NbCleared(0);
753 Graphic3d_MapOfStructure SOS;
754 GSM->DisplayedStructures(SOS);
756 Handle(Graphic3d_Structure) G;
757 for(Graphic3d_MapIteratorOfMapOfStructure It(SOS); It.More();It.Next()){
759 Standard_Address Add = G->Owner();
762 G->Clear();// it means that it is not referenced as a presentation of InterfactiveObject...
765 Handle(AIS_InteractiveObject) IO = (AIS_InteractiveObject*)Add;
766 if(!myObjects.IsBound(IO)){
774 //=======================================================================
775 //function : IsImmediateModeOn
777 //=======================================================================
779 Standard_Boolean AIS_InteractiveContext::IsImmediateModeOn() const
781 if(!HasOpenedContext()) return Standard_False;
782 return myLocalContexts(myCurLocalIndex)->IsImmediateModeOn();
785 //=======================================================================
786 //function : BeginImmediateDraw
788 //=======================================================================
790 Standard_Boolean AIS_InteractiveContext::BeginImmediateDraw()
792 return HasOpenedContext()
793 && myLocalContexts (myCurLocalIndex)->BeginImmediateDraw();
796 //=======================================================================
797 //function : ImmediateAdd
799 //=======================================================================
801 Standard_Boolean AIS_InteractiveContext::ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj,
802 const Standard_Integer theMode)
804 return HasOpenedContext()
805 && myLocalContexts (myCurLocalIndex)->ImmediateAdd (theObj, theMode);
808 //=======================================================================
809 //function : EndImmediateDraw
811 //=======================================================================
813 Standard_Boolean AIS_InteractiveContext::EndImmediateDraw (const Handle(V3d_View)& theView)
815 return HasOpenedContext()
816 && myLocalContexts (myCurLocalIndex)->EndImmediateDraw (theView);
819 //=======================================================================
820 //function : EndImmediateDraw
822 //=======================================================================
824 Standard_Boolean AIS_InteractiveContext::EndImmediateDraw()
826 if (!HasOpenedContext())
828 return Standard_False;
831 myMainVwr->InitActiveViews();
832 if (!myMainVwr->MoreActiveViews())
834 return Standard_False;
837 Handle(V3d_View) aView = myMainVwr->ActiveView();
838 return myLocalContexts (myCurLocalIndex)->EndImmediateDraw (aView);
842 //=======================================================================
843 //function : ResetOriginalState
845 //=======================================================================
847 void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updateviewer)
849 Standard_Boolean upd_main(Standard_False);
850 TColStd_ListIteratorOfListOfInteger itl;
852 for (AIS_DataMapIteratorOfDataMapOfIOStatus it(myObjects);it.More();it.Next()){
853 const Handle(AIS_InteractiveObject)& iobj = it.Key();
854 const Handle(AIS_GlobalStatus)& STAT = it.Value();
855 switch(STAT->GraphicStatus()){
856 case AIS_DS_Displayed:{
857 upd_main = Standard_True;
860 for(itl.Initialize(STAT->DisplayedModes());itl.More();itl.Next())
861 myMainPM->Display(iobj,itl.Value());
862 if(STAT->IsHilighted()){
863 if(STAT->HilightColor()!=Quantity_NOC_WHITE)
864 HilightWithColor(iobj,STAT->HilightColor(),Standard_False);
866 Hilight(iobj,Standard_False);
869 for(itl.Initialize(STAT->SelectionModes());itl.More();itl.Next()){
871 mgrSelector->Activate(iobj,itl.Value(),myMainSel);
876 EraseGlobal(iobj,Standard_False);
889 //=======================================================================
890 //function : SetZDetection
892 //=======================================================================
893 void AIS_InteractiveContext::SetZDetection(const Standard_Boolean aStatus)
895 myZDetectionFlag = aStatus;
898 //=======================================================================
899 //function : ZDetection
901 //=======================================================================
902 Standard_Boolean AIS_InteractiveContext::ZDetection() const
904 return myZDetectionFlag;