1 // File: AIS_InteractiveContext_2.cxx
2 // Created: Wed Jan 29 10:55:05 1997
3 // Author: Robert COUBLANC
4 // <rob@robox.paris1.matra-dtv.fr>
6 #define IMP051001 //GG Adds SetZDetected() and ZDetected() methods
8 #include <AIS_InteractiveContext.jxx>
10 #include <AIS_LocalContext.hxx>
12 #include <AIS_GlobalStatus.hxx>
13 #include <TColStd_ListIteratorOfListOfInteger.hxx>
15 #include <AIS_DataMapIteratorOfDataMapOfIOStatus.hxx>
16 #include <AIS_DataMapIteratorOfDataMapOfILC.hxx>
17 #include <Graphic3d_StructureManager.hxx>
18 #include <Graphic3d_Structure.hxx>
19 #include <Graphic3d_MapOfStructure.hxx>
20 #include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
21 #include <AIS_Selection.hxx>
23 //=======================================================================
24 //function : OpenLocalContext
26 //=======================================================================
28 Standard_Integer AIS_InteractiveContext::
29 OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
30 const Standard_Boolean AllowShapeDecomposition,
31 const Standard_Boolean AcceptEraseOfTemporary,
32 const Standard_Boolean /*BothViewers*/)
35 // the entities eventually detected just before the context was opened are unhighlighted...
36 if(!IsCurrent(myLastPicked)){
37 if(!myLastPicked.IsNull()){
38 Standard_Integer HiMod = myLastPicked->HasHilightMode()?myLastPicked->HilightMode():0;
39 myMainPM->Unhighlight(myLastPicked,HiMod);
42 if(!mylastmoveview.IsNull()){
44 myLocalContexts(myCurLocalIndex)->UnhilightLastDetected(mylastmoveview);
47 // entities connected to dynamic selection at neutral point are set to 0.
49 myLastinMain.Nullify();
50 myLastinColl.Nullify();
51 myLastPicked.Nullify();
52 myWasLastMain = Standard_True;
56 Standard_Integer untilnow = myCurLocalIndex;
58 myCurLocalIndex = HighestIndex() + 1;
60 Handle(AIS_LocalContext) NewLocal= new AIS_LocalContext(this,myCurLocalIndex,
62 AllowShapeDecomposition,
63 AcceptEraseOfTemporary);
64 NewLocal->MainSelector()->Set ((myLocalContexts.Extent() > 0)
65 ? myLocalContexts (untilnow)->MainSelector()->Projector()
66 : myMainSel->Projector());
68 NewLocal->MainSelector()->UpdateConversion();
70 myLocalContexts.Bind(myCurLocalIndex,NewLocal);
73 cout<<"\tOpen Local Context No "<<myCurLocalIndex<<endl;
74 if(UseDisplayedObjects){
75 cout<<"\t\tObjects from Neutral Point loaded"<<endl;
76 if(AllowShapeDecomposition)
77 cout<<"\t\tDecomposition Authorized for Loaded Shapes"<<endl;
79 cout<<"\t\tNo Decomposition Authorized for Loaded Shapes"<<endl;
82 cout<<"\t\tNo Objects Were Loaded "<<endl;
84 return myCurLocalIndex;
87 //=======================================================================
88 //function : CloseLocalContext
90 //=======================================================================
92 void AIS_InteractiveContext::CloseLocalContext(const Standard_Integer Index,
93 const Standard_Boolean updateviewer)
96 Standard_Boolean debugmode(Standard_False);
98 debugmode = Standard_True;
101 Standard_Integer GoodIndex = (Index ==-1) ? myCurLocalIndex : Index;
103 if(debugmode) cout<<"Call to CloseLocalContext - Index "<<GoodIndex<<endl;
104 if(!HasOpenedContext()){
105 if(debugmode) cout<<"\t But No Local Context is opened"<<endl;
108 if(!myLocalContexts.IsBound(GoodIndex)) {
109 if(debugmode) cout<<" Attempt to Close a non-existent Local Context"<<endl;
113 // the only open local context is closed...
114 if(myLocalContexts.Extent()==1 && GoodIndex == myCurLocalIndex){
116 Standard_Boolean updateproj = !(myLocalContexts(myCurLocalIndex)->HasSameProjector(myMainSel->Projector()));
117 myLocalContexts(myCurLocalIndex)->Terminate( updateviewer );
118 myLocalContexts.UnBind(myCurLocalIndex);
121 ResetOriginalState(Standard_False);
123 myMainSel->UpdateConversion();
125 myMainSel->ReactivateProjector();
126 myMainSel->UpdateSort();
129 cout<<"No More Opened Local Context "<<endl;
132 // Otherwise the local context will be still open after the current is closed
134 Handle(StdSelect_ViewerSelector3d) VS = myLocalContexts(GoodIndex)->MainSelector();
135 myLocalContexts(GoodIndex)->Terminate();
136 myLocalContexts.UnBind(GoodIndex);
137 // the current is closed...
138 if(GoodIndex==myCurLocalIndex){
139 myCurLocalIndex = HighestIndex();
140 const Handle(AIS_LocalContext)& LocCtx = myLocalContexts(myCurLocalIndex);
141 if(LocCtx->HasSameProjector(VS->Projector())){
142 LocCtx->MainSelector()->ReactivateProjector();
145 LocCtx->MainSelector()->UpdateConversion();
148 cout<<"a No Current Local Context WasClosed"<<endl;
150 if(debugmode) cout<<"Index Of CurrentLocalContext:"<<myCurLocalIndex<<endl;
155 if(updateviewer) myMainVwr->Update();
158 //=======================================================================
159 //function : CloseAllContexts
161 //=======================================================================
163 void AIS_InteractiveContext::CloseAllContexts(const Standard_Boolean updateviewer)
166 while(!myLocalContexts.IsEmpty()){
167 CloseLocalContext(myCurLocalIndex,Standard_False);
170 ResetOriginalState(Standard_False);
172 myMainSel->UpdateSort();
173 if(!myIsCollClosed && !myCollectorSel.IsNull())
174 myCollectorSel->UpdateSort();
175 if(updateviewer) myMainVwr->Update();
178 //=======================================================================
179 //function : IndexOfCurrentLocal
181 //=======================================================================
183 Standard_Integer AIS_InteractiveContext::IndexOfCurrentLocal() const
185 return myCurLocalIndex;
188 //=======================================================================
189 //function : ClearLocalContext
191 //=======================================================================
193 void AIS_InteractiveContext::ClearLocalContext(const AIS_ClearMode aMode)
195 if (!HasOpenedContext()) return;
196 myLocalContexts(myCurLocalIndex)->Clear(aMode);
200 //=======================================================================
201 //function : HighestIndex
203 //=======================================================================
205 Standard_Integer AIS_InteractiveContext::HighestIndex() const
207 AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
208 Standard_Integer HiInd = 0;
209 for(;It.More();It.Next())
210 HiInd = (It.Key()>HiInd) ? It.Key() : HiInd;
216 //=======================================================================
217 //function : Activate
219 //=======================================================================
221 void AIS_InteractiveContext::
222 Activate(const Handle(AIS_InteractiveObject)& anIObj,
223 const Standard_Integer aMode)
225 if(!HasOpenedContext()){
226 if(!myObjects.IsBound(anIObj)) return;
227 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
228 if(STAT->GraphicStatus()==AIS_DS_Displayed)
229 mgrSelector->Activate(anIObj,aMode,myMainSel);
230 STAT ->AddSelectionMode(aMode);
233 myLocalContexts(myCurLocalIndex)->ActivateMode(anIObj,aMode);
237 //=======================================================================
238 //function : LocalSelector
240 //=======================================================================
241 Handle( StdSelect_ViewerSelector3d ) AIS_InteractiveContext::LocalSelector() const
243 if( !HasOpenedContext() )
244 return Handle( StdSelect_ViewerSelector3d )();
246 return myLocalContexts( myCurLocalIndex )->MainSelector();
250 //=======================================================================
251 //function : DeActivate
253 //=======================================================================
254 void AIS_InteractiveContext::
255 Deactivate(const Handle(AIS_InteractiveObject)& anIObj)
257 if(!HasOpenedContext()){
258 if(!myObjects.IsBound(anIObj)) return;
259 TColStd_ListIteratorOfListOfInteger ItL;
260 for(ItL.Initialize(myObjects(anIObj)->SelectionModes());
263 if(myObjects(anIObj)->GraphicStatus() == AIS_DS_Displayed)
264 mgrSelector->Deactivate(anIObj,ItL.Value(),myMainSel);
266 myObjects(anIObj)->ClearSelectionModes();
269 const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
270 LC->Deactivate(anIObj);
274 //=======================================================================
275 //function : Deactivate
277 //=======================================================================
279 void AIS_InteractiveContext::Deactivate(const Handle(AIS_InteractiveObject)& anIObj,
280 const Standard_Integer aMode)
282 if(!HasOpenedContext()){
283 if(!myObjects.IsBound(anIObj)) return;
284 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
286 if(STAT->GraphicStatus() == AIS_DS_Displayed)
287 mgrSelector->Deactivate(anIObj,aMode,myMainSel);
288 STAT->RemoveSelectionMode(aMode);
291 myLocalContexts(myCurLocalIndex)->DeactivateMode(anIObj,aMode);
295 //=======================================================================
296 //function : ActivatedModes
298 //=======================================================================
300 void AIS_InteractiveContext::
301 ActivatedModes(const Handle(AIS_InteractiveObject)& anIObj,
302 TColStd_ListOfInteger& theList) const
304 TColStd_ListIteratorOfListOfInteger ItL;
305 if(!HasOpenedContext()){
306 if(myObjects.IsBound(anIObj)){
307 for(ItL.Initialize(myObjects(anIObj)->SelectionModes());
310 theList.Append(ItL.Value());
315 if(myLocalContexts(myCurLocalIndex)->IsIn(anIObj)){
316 for(ItL.Initialize(myLocalContexts(myCurLocalIndex)->SelectionModes(anIObj));
319 theList.Append(ItL.Value());
324 //=======================================================================
325 //function : SetShapeDecomposition
327 //=======================================================================
329 void AIS_InteractiveContext::SetShapeDecomposition(const Handle(AIS_InteractiveObject)& anIObj,
330 const Standard_Boolean StdModeSensitive)
332 if(!HasOpenedContext()) return;
333 myLocalContexts(myCurLocalIndex)->SetShapeDecomposition(anIObj,StdModeSensitive);
336 //=======================================================================
337 //function : SetTemporaryAttributes
339 //=======================================================================
341 void AIS_InteractiveContext::
342 SetTemporaryAttributes(const Handle(AIS_InteractiveObject)& /*anObj*/,
343 const Handle(Prs3d_Drawer)& /*aDrawer*/,
344 const Standard_Boolean /*updateviewer*/)
348 //=======================================================================
349 //function : SubIntensityOn
351 //=======================================================================
352 void AIS_InteractiveContext::
353 SubIntensityOn(const Handle(AIS_InteractiveObject)& anIObj,
354 const Standard_Boolean updateviewer)
356 if(!HasOpenedContext()){
357 if(!myObjects.IsBound(anIObj))
359 const Handle(AIS_GlobalStatus)& GB=myObjects(anIObj);
360 if(GB->IsSubIntensityOn())
362 GB->SubIntensityOn();
363 Standard_Boolean UpdMain(Standard_False),UpdColl(Standard_False);
365 for(TColStd_ListIteratorOfListOfInteger It(GB->DisplayedModes());It.More();It.Next()){
366 if(GB->GraphicStatus()==AIS_DS_Displayed){
367 myMainPM->Color(anIObj,mySubIntensity,It.Value());
368 UpdMain = Standard_True;}
369 else if(GB->GraphicStatus()==AIS_DS_Erased){
370 myCollectorPM->Color(anIObj,mySubIntensity,It.Value());
371 UpdColl=Standard_True;
378 myCollectorVwr->Update();
382 if(myObjects.IsBound(anIObj)){
383 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
384 STAT->SubIntensityOn();
385 TColStd_ListIteratorOfListOfInteger ItL;
386 for (ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
387 myMainPM->Color(anIObj,mySubIntensity,ItL.Value());
390 myLocalContexts(myCurLocalIndex)->SubIntensityOn(anIObj);
392 if(updateviewer) myMainVwr->Update();
395 //=======================================================================
396 //function : SubIntensityOff
398 //=======================================================================
400 void AIS_InteractiveContext::
401 SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj,
402 const Standard_Boolean updateviewer)
404 if(!HasOpenedContext()){
405 if(!myObjects.IsBound(anIObj))
407 const Handle(AIS_GlobalStatus)& GB=myObjects(anIObj);
408 if(!GB->IsSubIntensityOn())
410 GB->SubIntensityOff();
411 Standard_Boolean UpdMain(Standard_False),UpdColl(Standard_False);
413 for(TColStd_ListIteratorOfListOfInteger It(GB->DisplayedModes());It.More();It.Next()){
414 if(GB->GraphicStatus()!=AIS_DS_Erased){
415 myMainPM->Unhighlight(anIObj,It.Value());
416 UpdMain = Standard_True;}
418 myCollectorPM->Unhighlight(anIObj,It.Value());
419 UpdColl=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);
432 myCollectorVwr->Update();
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(const Standard_Boolean CollectorToo)
738 if(HasOpenedContext()) return 0;
740 Standard_Integer NbStr = PurgeViewer(myMainVwr);
741 if(!myCollectorVwr.IsNull())
743 NbStr+=PurgeViewer(myCollectorVwr);
744 if(!IsCollectorClosed())
745 myCollectorVwr->Update();
753 //=======================================================================
754 //function : PurgeViewer
756 //=======================================================================
757 Standard_Integer AIS_InteractiveContext::PurgeViewer(const Handle(V3d_Viewer)& Vwr)
759 const Handle(Graphic3d_StructureManager)& GSM = Vwr->Viewer();
760 Standard_Integer NbCleared(0);
761 Graphic3d_MapOfStructure SOS;
762 GSM->DisplayedStructures(SOS);
764 Handle(Graphic3d_Structure) G;
765 for(Graphic3d_MapIteratorOfMapOfStructure It(SOS); It.More();It.Next()){
767 Standard_Address Add = G->Owner();
770 G->Clear();// it means that it is not referenced as a presentation of InterfactiveObject...
773 Handle(AIS_InteractiveObject) IO = (AIS_InteractiveObject*)Add;
774 if(!myObjects.IsBound(IO)){
783 //=======================================================================
784 //function : IsImmediateModeOn
786 //=======================================================================
787 Standard_Boolean AIS_InteractiveContext::IsImmediateModeOn() const
789 if(!HasOpenedContext()) return Standard_False;
790 return myLocalContexts(myCurLocalIndex)->IsImmediateModeOn();
793 Standard_Boolean AIS_InteractiveContext::BeginImmediateDraw()
795 if(HasOpenedContext())
796 return myLocalContexts(myCurLocalIndex)->BeginImmediateDraw();
797 return Standard_False;
800 //=======================================================================
801 //function : ImmediateAdd
803 //=======================================================================
805 Standard_Boolean AIS_InteractiveContext::ImmediateAdd(const Handle(AIS_InteractiveObject)& anIObj,
806 const Standard_Integer AMode)
808 if(HasOpenedContext()){
809 return myLocalContexts(myCurLocalIndex)->ImmediateAdd(anIObj,AMode);}
810 return Standard_False;
813 //=======================================================================
814 //function : ImmediateRemove
816 //=======================================================================
818 Standard_Boolean AIS_InteractiveContext::ImmediateRemove(const Handle(AIS_InteractiveObject)& anIObj,
819 const Standard_Integer aMode)
821 if(HasOpenedContext())
822 return myLocalContexts(myCurLocalIndex)->ImmediateRemove(anIObj,aMode);
823 return Standard_False;
826 //=======================================================================
827 //function : EndImmediateDraw
829 //=======================================================================
831 Standard_Boolean AIS_InteractiveContext::EndImmediateDraw(const Handle(V3d_View)& aView,
832 const Standard_Boolean DoubleBuf)
834 if(HasOpenedContext())
835 return myLocalContexts(myCurLocalIndex)->EndImmediateDraw(aView,DoubleBuf);
836 return Standard_False;
840 //=======================================================================
841 //function : EndImmediateDraw
843 //=======================================================================
845 Standard_Boolean AIS_InteractiveContext::EndImmediateDraw(const Standard_Boolean DoubleBuf)
847 if(HasOpenedContext()){
849 myMainVwr->InitActiveViews();
850 if(myMainVwr->MoreActiveViews()){
851 V = myMainVwr->ActiveView();
853 return myLocalContexts(myCurLocalIndex)->EndImmediateDraw(V,DoubleBuf);
856 return Standard_False;
861 //=======================================================================
862 //function : ResetOriginalState
864 //=======================================================================
866 void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updateviewer)
868 Standard_Boolean upd_main(Standard_False),upd_col(Standard_False);
869 TColStd_ListIteratorOfListOfInteger itl;
871 for (AIS_DataMapIteratorOfDataMapOfIOStatus it(myObjects);it.More();it.Next()){
872 const Handle(AIS_InteractiveObject)& iobj = it.Key();
873 const Handle(AIS_GlobalStatus)& STAT = it.Value();
874 switch(STAT->GraphicStatus()){
875 case AIS_DS_Displayed:{
876 upd_main = Standard_True;
879 for(itl.Initialize(STAT->DisplayedModes());itl.More();itl.Next())
880 myMainPM->Display(iobj,itl.Value());
881 if(STAT->IsHilighted()){
882 if(STAT->HilightColor()!=Quantity_NOC_WHITE)
883 HilightWithColor(iobj,STAT->HilightColor(),Standard_False);
885 Hilight(iobj,Standard_False);
888 for(itl.Initialize(STAT->SelectionModes());itl.More();itl.Next()){
890 mgrSelector->Activate(iobj,itl.Value(),myMainSel);
895 upd_col = Standard_True;
896 EraseGlobal(iobj,Standard_False,Standard_True);
899 case AIS_DS_FullErased:{
900 EraseGlobal(iobj,Standard_False,Standard_False);
911 myCollectorVwr->Update();
916 //=======================================================================
917 //function : SetZDetection
919 //=======================================================================
920 void AIS_InteractiveContext::SetZDetection(const Standard_Boolean aStatus)
922 myZDetectionFlag = aStatus;
925 //=======================================================================
926 //function : ZDetection
928 //=======================================================================
929 Standard_Boolean AIS_InteractiveContext::ZDetection() const
931 return myZDetectionFlag;