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>
24 static TColStd_ListIteratorOfListOfInteger ItL;
25 //=======================================================================
26 //function : OpenLocalContext
28 //=======================================================================
30 Standard_Integer AIS_InteractiveContext::
31 OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
32 const Standard_Boolean AllowShapeDecomposition,
33 const Standard_Boolean AcceptEraseOfTemporary,
34 const Standard_Boolean /*BothViewers*/)
37 // on dehilighte les eventuelles entitees detectees juste avant l'ouverture
39 if(!IsCurrent(myLastPicked)){
40 if(!myLastPicked.IsNull()){
41 Standard_Integer HiMod = myLastPicked->HasHilightMode()?myLastPicked->HilightMode():0;
42 myMainPM->Unhighlight(myLastPicked,HiMod);
45 if(!mylastmoveview.IsNull()){
47 myLocalContexts(myCurLocalIndex)->UnhilightLastDetected(mylastmoveview);
50 // on met a 0 les entites liees a la selection dynamique au point neutre.
52 myLastinMain.Nullify();
53 myLastinColl.Nullify();
54 myLastPicked.Nullify();
55 myWasLastMain = Standard_True;
59 Standard_Integer untilnow = myCurLocalIndex;
61 myCurLocalIndex = HighestIndex() + 1;
63 Handle(AIS_LocalContext) NewLocal= new AIS_LocalContext(this,myCurLocalIndex,
65 AllowShapeDecomposition,
66 AcceptEraseOfTemporary);
68 // rob 16/04/97 pour les Pbs d'ordres asynchrones
69 if(myLocalContexts.Extent()>0){
70 const Select3D_Projector& Prj = myLocalContexts(untilnow)->MainSelector()->Projector();
71 NewLocal->MainSelector()->Set(Prj);
74 const Select3D_Projector& Prj = myMainSel->Projector();
75 NewLocal->MainSelector()->Set(Prj);
78 NewLocal->MainSelector()->UpdateConversion();
80 myLocalContexts.Bind(myCurLocalIndex,NewLocal);
84 cout<<"\tOpen Local Context No "<<myCurLocalIndex<<endl;
85 if(UseDisplayedObjects){
86 cout<<"\t\tObjects from Neutral Point loaded"<<endl;
87 if(AllowShapeDecomposition)
88 cout<<"\t\tDecomposition Authorized for Loaded Shapes"<<endl;
90 cout<<"\t\tNo Decomposition Authorized for Loaded Shapes"<<endl;
93 cout<<"\t\tNo Objects Were Loaded "<<endl;
95 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 // On va fermer le seul contexte local ouvert...
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->ReactivateProjector();
138 myMainSel->UpdateSort();
141 cout<<"No More Opened Local Context "<<endl;
144 // Sinon on aura encore un contexte local d'ouvert apres la fermeture du courant
146 Handle(StdSelect_ViewerSelector3d) VS = myLocalContexts(GoodIndex)->MainSelector();
147 myLocalContexts(GoodIndex)->Terminate();
148 myLocalContexts.UnBind(GoodIndex);
149 // on ferme le courant...
150 if(GoodIndex==myCurLocalIndex){
151 myCurLocalIndex = HighestIndex();
152 const Handle(AIS_LocalContext)& LocCtx = myLocalContexts(myCurLocalIndex);
153 if(LocCtx->HasSameProjector(VS->Projector())){
154 LocCtx->MainSelector()->ReactivateProjector();
157 LocCtx->MainSelector()->UpdateConversion();
160 cout<<"a No Current Local Context WasClosed"<<endl;
162 if(debugmode) cout<<"Index Of CurrentLocalContext:"<<myCurLocalIndex<<endl;
167 if(updateviewer) myMainVwr->Update();
170 //=======================================================================
171 //function : CloseAllContexts
173 //=======================================================================
175 void AIS_InteractiveContext::CloseAllContexts(const Standard_Boolean updateviewer)
178 while(!myLocalContexts.IsEmpty()){
179 CloseLocalContext(myCurLocalIndex,Standard_False);
182 ResetOriginalState(Standard_False);
184 myMainSel->UpdateSort();
185 if(!myIsCollClosed && !myCollectorSel.IsNull())
186 myCollectorSel->UpdateSort();
187 if(updateviewer) myMainVwr->Update();
190 //=======================================================================
191 //function : IndexOfCurrentLocal
193 //=======================================================================
195 Standard_Integer AIS_InteractiveContext::IndexOfCurrentLocal() const
197 return myCurLocalIndex;
200 //=======================================================================
201 //function : ClearLocalContext
203 //=======================================================================
205 void AIS_InteractiveContext::ClearLocalContext(const AIS_ClearMode aMode)
207 if (!HasOpenedContext()) return;
208 myLocalContexts(myCurLocalIndex)->Clear(aMode);
212 //=======================================================================
213 //function : HighestIndex
215 //=======================================================================
217 Standard_Integer AIS_InteractiveContext::HighestIndex() const
219 AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
220 Standard_Integer HiInd = 0;
221 for(;It.More();It.Next())
222 HiInd = (It.Key()>HiInd) ? It.Key() : HiInd;
228 //=======================================================================
229 //function : Activate
231 //=======================================================================
233 void AIS_InteractiveContext::
234 Activate(const Handle(AIS_InteractiveObject)& anIObj,
235 const Standard_Integer aMode)
237 if(!HasOpenedContext()){
238 if(!myObjects.IsBound(anIObj)) return;
239 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
240 if(STAT->GraphicStatus()==AIS_DS_Displayed)
241 mgrSelector->Activate(anIObj,aMode,myMainSel);
242 STAT ->AddSelectionMode(aMode);
245 myLocalContexts(myCurLocalIndex)->ActivateMode(anIObj,aMode);
249 //=======================================================================
250 //function : LocalSelector
252 //=======================================================================
253 Handle( StdSelect_ViewerSelector3d ) AIS_InteractiveContext::LocalSelector() const
255 if( !HasOpenedContext() )
256 return Handle( StdSelect_ViewerSelector3d )();
258 return myLocalContexts( myCurLocalIndex )->MainSelector();
262 //=======================================================================
263 //function : DeActivate
265 //=======================================================================
266 void AIS_InteractiveContext::
267 Deactivate(const Handle(AIS_InteractiveObject)& anIObj)
269 if(!HasOpenedContext()){
270 if(!myObjects.IsBound(anIObj)) return;
271 for(ItL.Initialize(myObjects(anIObj)->SelectionModes());
274 if(myObjects(anIObj)->GraphicStatus() == AIS_DS_Displayed)
275 mgrSelector->Deactivate(anIObj,ItL.Value(),myMainSel);
277 myObjects(anIObj)->ClearSelectionModes();
280 const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
281 LC->Deactivate(anIObj);
285 //=======================================================================
286 //function : Deactivate
288 //=======================================================================
290 void AIS_InteractiveContext::Deactivate(const Handle(AIS_InteractiveObject)& anIObj,
291 const Standard_Integer aMode)
293 if(!HasOpenedContext()){
294 if(!myObjects.IsBound(anIObj)) return;
295 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
297 if(STAT->GraphicStatus() == AIS_DS_Displayed)
298 mgrSelector->Deactivate(anIObj,aMode,myMainSel);
299 STAT->RemoveSelectionMode(aMode);
302 myLocalContexts(myCurLocalIndex)->DeactivateMode(anIObj,aMode);
306 //=======================================================================
307 //function : ActivatedModes
309 //=======================================================================
311 void AIS_InteractiveContext::
312 ActivatedModes(const Handle(AIS_InteractiveObject)& anIObj,
313 TColStd_ListOfInteger& theList) const
315 if(!HasOpenedContext()){
316 if(myObjects.IsBound(anIObj)){
317 //ItL est une variable statique...
318 for(ItL.Initialize(myObjects(anIObj)->SelectionModes());
321 theList.Append(ItL.Value());
326 if(myLocalContexts(myCurLocalIndex)->IsIn(anIObj)){
327 for(ItL.Initialize(myLocalContexts(myCurLocalIndex)->SelectionModes(anIObj));
330 theList.Append(ItL.Value());
335 //=======================================================================
336 //function : SetShapeDecomposition
338 //=======================================================================
340 void AIS_InteractiveContext::SetShapeDecomposition(const Handle(AIS_InteractiveObject)& anIObj,
341 const Standard_Boolean StdModeSensitive)
343 if(!HasOpenedContext()) return;
344 myLocalContexts(myCurLocalIndex)->SetShapeDecomposition(anIObj,StdModeSensitive);
347 //=======================================================================
348 //function : SetTemporaryAttributes
350 //=======================================================================
352 void AIS_InteractiveContext::
353 SetTemporaryAttributes(const Handle(AIS_InteractiveObject)& /*anObj*/,
354 const Handle(Prs3d_Drawer)& /*aDrawer*/,
355 const Standard_Boolean /*updateviewer*/)
359 //=======================================================================
360 //function : SubIntensityOn
362 //=======================================================================
363 void AIS_InteractiveContext::
364 SubIntensityOn(const Handle(AIS_InteractiveObject)& anIObj,
365 const Standard_Boolean updateviewer)
367 if(!HasOpenedContext()){
368 if(!myObjects.IsBound(anIObj))
370 const Handle(AIS_GlobalStatus)& GB=myObjects(anIObj);
371 if(GB->IsSubIntensityOn())
373 GB->SubIntensityOn();
374 Standard_Boolean UpdMain(Standard_False),UpdColl(Standard_False);
376 for(TColStd_ListIteratorOfListOfInteger It(GB->DisplayedModes());It.More();It.Next()){
377 if(GB->GraphicStatus()==AIS_DS_Displayed){
378 myMainPM->Color(anIObj,mySubIntensity,It.Value());
379 UpdMain = Standard_True;}
380 else if(GB->GraphicStatus()==AIS_DS_Erased){
381 myCollectorPM->Color(anIObj,mySubIntensity,It.Value());
382 UpdColl=Standard_True;
389 myCollectorVwr->Update();
393 if(myObjects.IsBound(anIObj)){
394 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
395 STAT->SubIntensityOn();
396 for (ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
397 myMainPM->Color(anIObj,mySubIntensity,ItL.Value());
400 myLocalContexts(myCurLocalIndex)->SubIntensityOn(anIObj);
402 if(updateviewer) myMainVwr->Update();
405 //=======================================================================
406 //function : SubIntensityOff
408 //=======================================================================
410 void AIS_InteractiveContext::
411 SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj,
412 const Standard_Boolean updateviewer)
414 if(!HasOpenedContext()){
415 if(!myObjects.IsBound(anIObj))
417 const Handle(AIS_GlobalStatus)& GB=myObjects(anIObj);
418 if(!GB->IsSubIntensityOn())
420 GB->SubIntensityOff();
421 Standard_Boolean UpdMain(Standard_False),UpdColl(Standard_False);
423 for(TColStd_ListIteratorOfListOfInteger It(GB->DisplayedModes());It.More();It.Next()){
424 if(GB->GraphicStatus()!=AIS_DS_Erased){
425 myMainPM->Unhighlight(anIObj,It.Value());
426 UpdMain = Standard_True;}
428 myCollectorPM->Unhighlight(anIObj,It.Value());
429 UpdColl=Standard_True;
433 Standard_Integer DM,HM,SM;
434 GetDefModes(anIObj,DM,HM,SM);
435 if(AIS_Selection::IsSelected(anIObj))
436 myMainPM->Highlight(anIObj,HM);
442 myCollectorVwr->Update();
446 if(myObjects.IsBound(anIObj)){
447 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
448 STAT->SubIntensityOff();
449 for (ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
450 myMainPM->Unhighlight(anIObj,ItL.Value());
451 if(STAT->IsHilighted())
455 myLocalContexts(myCurLocalIndex)->SubIntensityOff(anIObj);
456 if(IsSelected(anIObj))
459 if(updateviewer) myMainVwr->Update();
463 //=======================================================================
464 //function : SubIntensityOn
465 //purpose : ALL THE DISPLAYED OBJECTS HAVE SUBINTENSITY...
466 //=======================================================================
468 void AIS_InteractiveContext::SubIntensityOn(const Standard_Boolean updateviewer)
470 if(!HasOpenedContext()) return;
472 AIS_DataMapIteratorOfDataMapOfIOStatus It (myObjects);
473 TColStd_ListIteratorOfListOfInteger ItM;
474 for(;It.More();It.Next()){
475 const Handle(AIS_GlobalStatus)& STAT = It.Value();
476 if(STAT->GraphicStatus()==AIS_DS_Displayed)
478 STAT->SubIntensityOn();
479 for(ItM.Initialize(STAT->DisplayedModes());ItM.More();ItM.Next())
480 {myMainPM->Color(It.Key(),mySubIntensity,ItM.Value());}
483 if(updateviewer) myMainVwr->Update();
486 //=======================================================================
487 //function : SubIntensityOff
489 //=======================================================================
490 void AIS_InteractiveContext::SubIntensityOff(const Standard_Boolean updateviewer)
493 if(!HasOpenedContext()) return;
495 AIS_DataMapIteratorOfDataMapOfIOStatus It (myObjects);
497 for(;It.More();It.Next()){
498 const Handle(AIS_GlobalStatus)& STAT = It.Value();
499 if(STAT->IsSubIntensityOn())
500 STAT->SubIntensityOff();
501 for(ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
502 myMainPM->Unhighlight(It.Key());
505 if(updateviewer) myMainVwr->Update();
508 //=======================================================================
509 //function : AddFilter
511 //=======================================================================
512 void AIS_InteractiveContext::AddFilter(const Handle(SelectMgr_Filter)& aFilter)
514 if(HasOpenedContext())
515 myLocalContexts(myCurLocalIndex)->AddFilter(aFilter);
517 myFilters->Add(aFilter);
520 //=======================================================================
521 //function : ActivateStandardMode
523 //=======================================================================
524 void AIS_InteractiveContext::ActivateStandardMode(const TopAbs_ShapeEnum aStandardActivation)
526 if(!HasOpenedContext()) return;
527 myLocalContexts(myCurLocalIndex)->ActivateStandardMode (aStandardActivation);
530 //=======================================================================
531 //function : DeActivateStandardMode
533 //=======================================================================
534 void AIS_InteractiveContext::DeactivateStandardMode(const TopAbs_ShapeEnum aStandardActivation)
536 if(!HasOpenedContext()) return;
537 myLocalContexts(myCurLocalIndex)->DeactivateStandardMode (aStandardActivation);
540 //=======================================================================
541 //function : RemoveFilter
543 //=======================================================================
544 void AIS_InteractiveContext::RemoveFilter(const Handle(SelectMgr_Filter)& aFilter)
546 if(HasOpenedContext())
547 myLocalContexts(myCurLocalIndex)->RemoveFilter (aFilter);
549 myFilters->Remove(aFilter);
552 //=======================================================================
553 //function : RemoveFilters
555 //=======================================================================
557 void AIS_InteractiveContext::RemoveFilters()
559 if(!HasOpenedContext())
562 myLocalContexts(myCurLocalIndex)->Clear(AIS_CM_Filters);
565 //=======================================================================
566 //function : ActivatedStandardModes
568 //=======================================================================
569 const TColStd_ListOfInteger& AIS_InteractiveContext::ActivatedStandardModes() const
571 return myLocalContexts(myCurLocalIndex)->StandardModes();
574 //=======================================================================
577 //=======================================================================
578 const SelectMgr_ListOfFilter& AIS_InteractiveContext::Filters() const
580 if(HasOpenedContext())
581 return myLocalContexts(myCurLocalIndex)->ListOfFilter();
582 return myFilters->StoredFilters();
585 //=======================================================================
586 //function : DisplayActiveAreas
588 //=======================================================================
589 void AIS_InteractiveContext::DisplayActiveAreas(const Handle(V3d_View)& aviou)
591 if(HasOpenedContext())
592 myLocalContexts(myCurLocalIndex)->DisplayAreas(aviou);
594 myMainSel->DisplayAreas(aviou);
598 //=======================================================================
599 //function : ClearActiveAreas
601 //=======================================================================
602 void AIS_InteractiveContext::ClearActiveAreas(const Handle(V3d_View)& aviou)
604 if(HasOpenedContext())
605 myLocalContexts(myCurLocalIndex)->ClearAreas(aviou);
607 myMainSel->ClearAreas(aviou);
610 //=======================================================================
611 //function : DisplayActiveSensitive
613 //=======================================================================
614 void AIS_InteractiveContext::DisplayActiveSensitive(const Handle(V3d_View)& aviou)
616 if(HasOpenedContext())
617 myLocalContexts(myCurLocalIndex)->DisplaySensitive(aviou);
619 myMainSel->DisplaySensitive(aviou);
621 //=======================================================================
622 //function : DisplayActiveSensitive
624 //=======================================================================
626 void AIS_InteractiveContext::DisplayActiveSensitive(const Handle(AIS_InteractiveObject)& anIObj,
627 const Handle(V3d_View)& aviou)
629 TColStd_ListIteratorOfListOfInteger It;
630 Handle(StdSelect_ViewerSelector3d) VS;
631 if(HasOpenedContext()){
632 const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
633 if(!LC->IsIn(anIObj)) return;
634 It.Initialize(LC->SelectionModes(anIObj));
635 VS = LC->MainSelector();
638 if(!myObjects.IsBound(anIObj)) return;
639 It.Initialize(myObjects(anIObj)->SelectionModes());
644 for(;It.More();It.Next()){
645 const Handle(SelectMgr_Selection)& Sel = anIObj->Selection(It.Value());
646 VS->DisplaySensitive(Sel,aviou,Standard_False);
651 //=======================================================================
652 //function : DisplayActiveAreas
654 //=======================================================================
656 void AIS_InteractiveContext::DisplayActiveAreas(const Handle(AIS_InteractiveObject)& anIObj,
657 const Handle(V3d_View)& aviou)
659 TColStd_ListIteratorOfListOfInteger It;
660 Handle(StdSelect_ViewerSelector3d) VS;
661 if(HasOpenedContext()){
662 const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
663 if(!LC->IsIn(anIObj)) return;
664 It.Initialize(LC->SelectionModes(anIObj));
665 VS = LC->MainSelector();
668 if(!myObjects.IsBound(anIObj)) return;
669 It.Initialize(myObjects(anIObj)->SelectionModes());
674 for(;It.More();It.Next()){
675 const Handle(SelectMgr_Selection)& Sel = anIObj->Selection(It.Value());
676 VS->DisplayAreas(Sel,aviou,Standard_False);
681 //=======================================================================
682 //function : ClearActiveSensitive
684 //=======================================================================
685 void AIS_InteractiveContext::ClearActiveSensitive(const Handle(V3d_View)& aviou)
688 if(HasOpenedContext())
689 myLocalContexts(myCurLocalIndex)->ClearSensitive(aviou);
691 myMainSel->ClearSensitive(aviou);
694 //=======================================================================
695 //function : SetAutomaticHilight
697 //=======================================================================
698 void AIS_InteractiveContext::SetAutomaticHilight(const Standard_Boolean aStatus)
701 if(HasOpenedContext())
702 myLocalContexts(myCurLocalIndex)->SetAutomaticHilight(aStatus);
705 //=======================================================================
706 //function : AutomaticHilight
708 //=======================================================================
709 Standard_Boolean AIS_InteractiveContext::AutomaticHilight() const
711 if(HasOpenedContext())
712 return myLocalContexts(myCurLocalIndex)->AutomaticHilight();
713 return Standard_True;
716 //=======================================================================
717 //function : UseDisplayedObjects
719 //=======================================================================
721 void AIS_InteractiveContext::UseDisplayedObjects()
723 if(HasOpenedContext())
724 myLocalContexts(myCurLocalIndex)->LoadContextObjects();
727 //=======================================================================
728 //function : NotUseDisplayedObjects
730 //=======================================================================
732 void AIS_InteractiveContext::NotUseDisplayedObjects()
734 if(HasOpenedContext())
735 myLocalContexts(myCurLocalIndex)->UnloadContextObjects();
741 //=======================================================================
742 //function : PurgeDisplay
744 //=======================================================================
746 Standard_Integer AIS_InteractiveContext::PurgeDisplay(const Standard_Boolean CollectorToo)
748 if(HasOpenedContext()) return 0;
750 Standard_Integer NbStr = PurgeViewer(myMainVwr);
751 if(!myCollectorVwr.IsNull())
753 NbStr+=PurgeViewer(myCollectorVwr);
754 if(!IsCollectorClosed())
755 myCollectorVwr->Update();
763 //=======================================================================
764 //function : PurgeViewer
766 //=======================================================================
767 Standard_Integer AIS_InteractiveContext::PurgeViewer(const Handle(V3d_Viewer)& Vwr)
769 const Handle(Graphic3d_StructureManager)& GSM = Vwr->Viewer();
770 Standard_Integer NbCleared(0);
771 Graphic3d_MapOfStructure SOS;
772 GSM->DisplayedStructures(SOS);
774 Handle(Graphic3d_Structure) G;
775 for(Graphic3d_MapIteratorOfMapOfStructure It(SOS); It.More();It.Next()){
777 Standard_Address Add = G->Owner();
780 G->Clear();// ca veut dire qu'elle n'est pas reference comme une presentation d'un InterfactiveObject...
783 Handle(AIS_InteractiveObject) IO = (AIS_InteractiveObject*)Add;
784 if(!myObjects.IsBound(IO)){
793 //=======================================================================
794 //function : IsImmediateModeOn
796 //=======================================================================
797 Standard_Boolean AIS_InteractiveContext::IsImmediateModeOn() const
799 if(!HasOpenedContext()) return Standard_False;
800 return myLocalContexts(myCurLocalIndex)->IsImmediateModeOn();
803 Standard_Boolean AIS_InteractiveContext::BeginImmediateDraw()
805 if(HasOpenedContext())
806 return myLocalContexts(myCurLocalIndex)->BeginImmediateDraw();
807 return Standard_False;
810 //=======================================================================
811 //function : ImmediateAdd
813 //=======================================================================
815 Standard_Boolean AIS_InteractiveContext::ImmediateAdd(const Handle(AIS_InteractiveObject)& anIObj,
816 const Standard_Integer AMode)
818 if(HasOpenedContext()){
819 return myLocalContexts(myCurLocalIndex)->ImmediateAdd(anIObj,AMode);}
820 return Standard_False;
823 //=======================================================================
824 //function : ImmediateRemove
826 //=======================================================================
828 Standard_Boolean AIS_InteractiveContext::ImmediateRemove(const Handle(AIS_InteractiveObject)& anIObj,
829 const Standard_Integer aMode)
831 if(HasOpenedContext())
832 return myLocalContexts(myCurLocalIndex)->ImmediateRemove(anIObj,aMode);
833 return Standard_False;
836 //=======================================================================
837 //function : EndImmediateDraw
839 //=======================================================================
841 Standard_Boolean AIS_InteractiveContext::EndImmediateDraw(const Handle(V3d_View)& aView,
842 const Standard_Boolean DoubleBuf)
844 if(HasOpenedContext())
845 return myLocalContexts(myCurLocalIndex)->EndImmediateDraw(aView,DoubleBuf);
846 return Standard_False;
850 //=======================================================================
851 //function : EndImmediateDraw
853 //=======================================================================
855 Standard_Boolean AIS_InteractiveContext::EndImmediateDraw(const Standard_Boolean DoubleBuf)
857 if(HasOpenedContext()){
859 myMainVwr->InitActiveViews();
860 if(myMainVwr->MoreActiveViews()){
861 V = myMainVwr->ActiveView();
863 return myLocalContexts(myCurLocalIndex)->EndImmediateDraw(V,DoubleBuf);
866 return Standard_False;
871 //=======================================================================
872 //function : ResetOriginalState
874 //=======================================================================
876 void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updateviewer)
878 Standard_Boolean upd_main(Standard_False),upd_col(Standard_False);
879 TColStd_ListIteratorOfListOfInteger itl;
881 for (AIS_DataMapIteratorOfDataMapOfIOStatus it(myObjects);it.More();it.Next()){
882 const Handle(AIS_InteractiveObject)& iobj = it.Key();
883 const Handle(AIS_GlobalStatus)& STAT = it.Value();
884 switch(STAT->GraphicStatus()){
885 case AIS_DS_Displayed:{
886 upd_main = Standard_True;
889 for(itl.Initialize(STAT->DisplayedModes());itl.More();itl.Next())
890 myMainPM->Display(iobj,itl.Value());
891 if(STAT->IsHilighted()){
892 if(STAT->HilightColor()!=Quantity_NOC_WHITE)
893 HilightWithColor(iobj,STAT->HilightColor(),Standard_False);
895 Hilight(iobj,Standard_False);
898 for(itl.Initialize(STAT->SelectionModes());itl.More();itl.Next()){
900 mgrSelector->Activate(iobj,itl.Value(),myMainSel);
905 upd_col = Standard_True;
906 EraseGlobal(iobj,Standard_False,Standard_True);
909 case AIS_DS_FullErased:{
910 EraseGlobal(iobj,Standard_False,Standard_False);
921 myCollectorVwr->Update();
926 //=======================================================================
927 //function : SetZDetection
929 //=======================================================================
930 void AIS_InteractiveContext::SetZDetection(const Standard_Boolean aStatus)
932 myZDetectionFlag = aStatus;
935 //=======================================================================
936 //function : ZDetection
938 //=======================================================================
939 Standard_Boolean AIS_InteractiveContext::ZDetection() const
941 return myZDetectionFlag;