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 // on dehilighte les eventuelles entitees detectees juste avant l'ouverture
37 if(!IsCurrent(myLastPicked)){
38 if(!myLastPicked.IsNull()){
39 Standard_Integer HiMod = myLastPicked->HasHilightMode()?myLastPicked->HilightMode():0;
40 myMainPM->Unhighlight(myLastPicked,HiMod);
43 if(!mylastmoveview.IsNull()){
45 myLocalContexts(myCurLocalIndex)->UnhilightLastDetected(mylastmoveview);
48 // on met a 0 les entites liees a la selection dynamique au point neutre.
50 myLastinMain.Nullify();
51 myLastinColl.Nullify();
52 myLastPicked.Nullify();
53 myWasLastMain = Standard_True;
57 Standard_Integer untilnow = myCurLocalIndex;
59 myCurLocalIndex = HighestIndex() + 1;
61 Handle(AIS_LocalContext) NewLocal= new AIS_LocalContext(this,myCurLocalIndex,
63 AllowShapeDecomposition,
64 AcceptEraseOfTemporary);
65 NewLocal->MainSelector()->Set ((myLocalContexts.Extent() > 0)
66 ? myLocalContexts (untilnow)->MainSelector()->Projector()
67 : myMainSel->Projector());
69 NewLocal->MainSelector()->UpdateConversion();
71 myLocalContexts.Bind(myCurLocalIndex,NewLocal);
74 cout<<"\tOpen Local Context No "<<myCurLocalIndex<<endl;
75 if(UseDisplayedObjects){
76 cout<<"\t\tObjects from Neutral Point loaded"<<endl;
77 if(AllowShapeDecomposition)
78 cout<<"\t\tDecomposition Authorized for Loaded Shapes"<<endl;
80 cout<<"\t\tNo Decomposition Authorized for Loaded Shapes"<<endl;
83 cout<<"\t\tNo Objects Were Loaded "<<endl;
85 return myCurLocalIndex;
88 //=======================================================================
89 //function : CloseLocalContext
91 //=======================================================================
93 void AIS_InteractiveContext::CloseLocalContext(const Standard_Integer Index,
94 const Standard_Boolean updateviewer)
97 Standard_Boolean debugmode(Standard_False);
99 debugmode = Standard_True;
102 Standard_Integer GoodIndex = (Index ==-1) ? myCurLocalIndex : Index;
104 if(debugmode) cout<<"Call to CloseLocalContext - Index "<<GoodIndex<<endl;
105 if(!HasOpenedContext()){
106 if(debugmode) cout<<"\t But No Local Context is opened"<<endl;
109 if(!myLocalContexts.IsBound(GoodIndex)) {
110 if(debugmode) cout<<" Attempt to Close a non-existent Local Context"<<endl;
114 // On va fermer le seul contexte local ouvert...
115 if(myLocalContexts.Extent()==1 && GoodIndex == myCurLocalIndex){
117 Standard_Boolean updateproj = !(myLocalContexts(myCurLocalIndex)->HasSameProjector(myMainSel->Projector()));
118 myLocalContexts(myCurLocalIndex)->Terminate( updateviewer );
119 myLocalContexts.UnBind(myCurLocalIndex);
122 ResetOriginalState(Standard_False);
124 myMainSel->UpdateConversion();
126 myMainSel->ReactivateProjector();
127 myMainSel->UpdateSort();
130 cout<<"No More Opened Local Context "<<endl;
133 // Sinon on aura encore un contexte local d'ouvert apres la fermeture du courant
135 Handle(StdSelect_ViewerSelector3d) VS = myLocalContexts(GoodIndex)->MainSelector();
136 myLocalContexts(GoodIndex)->Terminate();
137 myLocalContexts.UnBind(GoodIndex);
138 // on ferme le courant...
139 if(GoodIndex==myCurLocalIndex){
140 myCurLocalIndex = HighestIndex();
141 const Handle(AIS_LocalContext)& LocCtx = myLocalContexts(myCurLocalIndex);
142 if(LocCtx->HasSameProjector(VS->Projector())){
143 LocCtx->MainSelector()->ReactivateProjector();
146 LocCtx->MainSelector()->UpdateConversion();
149 cout<<"a No Current Local Context WasClosed"<<endl;
151 if(debugmode) cout<<"Index Of CurrentLocalContext:"<<myCurLocalIndex<<endl;
156 if(updateviewer) myMainVwr->Update();
159 //=======================================================================
160 //function : CloseAllContexts
162 //=======================================================================
164 void AIS_InteractiveContext::CloseAllContexts(const Standard_Boolean updateviewer)
167 while(!myLocalContexts.IsEmpty()){
168 CloseLocalContext(myCurLocalIndex,Standard_False);
171 ResetOriginalState(Standard_False);
173 myMainSel->UpdateSort();
174 if(!myIsCollClosed && !myCollectorSel.IsNull())
175 myCollectorSel->UpdateSort();
176 if(updateviewer) myMainVwr->Update();
179 //=======================================================================
180 //function : IndexOfCurrentLocal
182 //=======================================================================
184 Standard_Integer AIS_InteractiveContext::IndexOfCurrentLocal() const
186 return myCurLocalIndex;
189 //=======================================================================
190 //function : ClearLocalContext
192 //=======================================================================
194 void AIS_InteractiveContext::ClearLocalContext(const AIS_ClearMode aMode)
196 if (!HasOpenedContext()) return;
197 myLocalContexts(myCurLocalIndex)->Clear(aMode);
201 //=======================================================================
202 //function : HighestIndex
204 //=======================================================================
206 Standard_Integer AIS_InteractiveContext::HighestIndex() const
208 AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
209 Standard_Integer HiInd = 0;
210 for(;It.More();It.Next())
211 HiInd = (It.Key()>HiInd) ? It.Key() : HiInd;
217 //=======================================================================
218 //function : Activate
220 //=======================================================================
222 void AIS_InteractiveContext::
223 Activate(const Handle(AIS_InteractiveObject)& anIObj,
224 const Standard_Integer aMode)
226 if(!HasOpenedContext()){
227 if(!myObjects.IsBound(anIObj)) return;
228 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
229 if(STAT->GraphicStatus()==AIS_DS_Displayed)
230 mgrSelector->Activate(anIObj,aMode,myMainSel);
231 STAT ->AddSelectionMode(aMode);
234 myLocalContexts(myCurLocalIndex)->ActivateMode(anIObj,aMode);
238 //=======================================================================
239 //function : LocalSelector
241 //=======================================================================
242 Handle( StdSelect_ViewerSelector3d ) AIS_InteractiveContext::LocalSelector() const
244 if( !HasOpenedContext() )
245 return Handle( StdSelect_ViewerSelector3d )();
247 return myLocalContexts( myCurLocalIndex )->MainSelector();
251 //=======================================================================
252 //function : DeActivate
254 //=======================================================================
255 void AIS_InteractiveContext::
256 Deactivate(const Handle(AIS_InteractiveObject)& anIObj)
258 if(!HasOpenedContext()){
259 if(!myObjects.IsBound(anIObj)) return;
260 TColStd_ListIteratorOfListOfInteger ItL;
261 for(ItL.Initialize(myObjects(anIObj)->SelectionModes());
264 if(myObjects(anIObj)->GraphicStatus() == AIS_DS_Displayed)
265 mgrSelector->Deactivate(anIObj,ItL.Value(),myMainSel);
267 myObjects(anIObj)->ClearSelectionModes();
270 const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
271 LC->Deactivate(anIObj);
275 //=======================================================================
276 //function : Deactivate
278 //=======================================================================
280 void AIS_InteractiveContext::Deactivate(const Handle(AIS_InteractiveObject)& anIObj,
281 const Standard_Integer aMode)
283 if(!HasOpenedContext()){
284 if(!myObjects.IsBound(anIObj)) return;
285 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
287 if(STAT->GraphicStatus() == AIS_DS_Displayed)
288 mgrSelector->Deactivate(anIObj,aMode,myMainSel);
289 STAT->RemoveSelectionMode(aMode);
292 myLocalContexts(myCurLocalIndex)->DeactivateMode(anIObj,aMode);
296 //=======================================================================
297 //function : ActivatedModes
299 //=======================================================================
301 void AIS_InteractiveContext::
302 ActivatedModes(const Handle(AIS_InteractiveObject)& anIObj,
303 TColStd_ListOfInteger& theList) const
305 TColStd_ListIteratorOfListOfInteger ItL;
306 if(!HasOpenedContext()){
307 if(myObjects.IsBound(anIObj)){
308 for(ItL.Initialize(myObjects(anIObj)->SelectionModes());
311 theList.Append(ItL.Value());
316 if(myLocalContexts(myCurLocalIndex)->IsIn(anIObj)){
317 for(ItL.Initialize(myLocalContexts(myCurLocalIndex)->SelectionModes(anIObj));
320 theList.Append(ItL.Value());
325 //=======================================================================
326 //function : SetShapeDecomposition
328 //=======================================================================
330 void AIS_InteractiveContext::SetShapeDecomposition(const Handle(AIS_InteractiveObject)& anIObj,
331 const Standard_Boolean StdModeSensitive)
333 if(!HasOpenedContext()) return;
334 myLocalContexts(myCurLocalIndex)->SetShapeDecomposition(anIObj,StdModeSensitive);
337 //=======================================================================
338 //function : SetTemporaryAttributes
340 //=======================================================================
342 void AIS_InteractiveContext::
343 SetTemporaryAttributes(const Handle(AIS_InteractiveObject)& /*anObj*/,
344 const Handle(Prs3d_Drawer)& /*aDrawer*/,
345 const Standard_Boolean /*updateviewer*/)
349 //=======================================================================
350 //function : SubIntensityOn
352 //=======================================================================
353 void AIS_InteractiveContext::
354 SubIntensityOn(const Handle(AIS_InteractiveObject)& anIObj,
355 const Standard_Boolean updateviewer)
357 if(!HasOpenedContext()){
358 if(!myObjects.IsBound(anIObj))
360 const Handle(AIS_GlobalStatus)& GB=myObjects(anIObj);
361 if(GB->IsSubIntensityOn())
363 GB->SubIntensityOn();
364 Standard_Boolean UpdMain(Standard_False),UpdColl(Standard_False);
366 for(TColStd_ListIteratorOfListOfInteger It(GB->DisplayedModes());It.More();It.Next()){
367 if(GB->GraphicStatus()==AIS_DS_Displayed){
368 myMainPM->Color(anIObj,mySubIntensity,It.Value());
369 UpdMain = Standard_True;}
370 else if(GB->GraphicStatus()==AIS_DS_Erased){
371 myCollectorPM->Color(anIObj,mySubIntensity,It.Value());
372 UpdColl=Standard_True;
379 myCollectorVwr->Update();
383 if(myObjects.IsBound(anIObj)){
384 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
385 STAT->SubIntensityOn();
386 TColStd_ListIteratorOfListOfInteger ItL;
387 for (ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
388 myMainPM->Color(anIObj,mySubIntensity,ItL.Value());
391 myLocalContexts(myCurLocalIndex)->SubIntensityOn(anIObj);
393 if(updateviewer) myMainVwr->Update();
396 //=======================================================================
397 //function : SubIntensityOff
399 //=======================================================================
401 void AIS_InteractiveContext::
402 SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj,
403 const Standard_Boolean updateviewer)
405 if(!HasOpenedContext()){
406 if(!myObjects.IsBound(anIObj))
408 const Handle(AIS_GlobalStatus)& GB=myObjects(anIObj);
409 if(!GB->IsSubIntensityOn())
411 GB->SubIntensityOff();
412 Standard_Boolean UpdMain(Standard_False),UpdColl(Standard_False);
414 for(TColStd_ListIteratorOfListOfInteger It(GB->DisplayedModes());It.More();It.Next()){
415 if(GB->GraphicStatus()!=AIS_DS_Erased){
416 myMainPM->Unhighlight(anIObj,It.Value());
417 UpdMain = Standard_True;}
419 myCollectorPM->Unhighlight(anIObj,It.Value());
420 UpdColl=Standard_True;
424 Standard_Integer DM,HM,SM;
425 GetDefModes(anIObj,DM,HM,SM);
426 if(AIS_Selection::IsSelected(anIObj))
427 myMainPM->Highlight(anIObj,HM);
433 myCollectorVwr->Update();
437 if(myObjects.IsBound(anIObj)){
438 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
439 STAT->SubIntensityOff();
440 TColStd_ListIteratorOfListOfInteger ItL;
441 for (ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
442 myMainPM->Unhighlight(anIObj,ItL.Value());
443 if(STAT->IsHilighted())
447 myLocalContexts(myCurLocalIndex)->SubIntensityOff(anIObj);
448 if(IsSelected(anIObj))
451 if(updateviewer) myMainVwr->Update();
455 //=======================================================================
456 //function : SubIntensityOn
457 //purpose : ALL THE DISPLAYED OBJECTS HAVE SUBINTENSITY...
458 //=======================================================================
460 void AIS_InteractiveContext::SubIntensityOn(const Standard_Boolean updateviewer)
462 if(!HasOpenedContext()) return;
464 AIS_DataMapIteratorOfDataMapOfIOStatus It (myObjects);
465 TColStd_ListIteratorOfListOfInteger ItM;
466 for(;It.More();It.Next()){
467 const Handle(AIS_GlobalStatus)& STAT = It.Value();
468 if(STAT->GraphicStatus()==AIS_DS_Displayed)
470 STAT->SubIntensityOn();
471 for(ItM.Initialize(STAT->DisplayedModes());ItM.More();ItM.Next())
472 {myMainPM->Color(It.Key(),mySubIntensity,ItM.Value());}
475 if(updateviewer) myMainVwr->Update();
478 //=======================================================================
479 //function : SubIntensityOff
481 //=======================================================================
482 void AIS_InteractiveContext::SubIntensityOff(const Standard_Boolean updateviewer)
484 if(!HasOpenedContext()) return;
486 AIS_DataMapIteratorOfDataMapOfIOStatus It (myObjects);
487 TColStd_ListIteratorOfListOfInteger ItL;
488 for(;It.More();It.Next()){
489 const Handle(AIS_GlobalStatus)& STAT = It.Value();
490 if(STAT->IsSubIntensityOn())
491 STAT->SubIntensityOff();
492 for(ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
493 myMainPM->Unhighlight(It.Key());
496 if(updateviewer) myMainVwr->Update();
499 //=======================================================================
500 //function : AddFilter
502 //=======================================================================
503 void AIS_InteractiveContext::AddFilter(const Handle(SelectMgr_Filter)& aFilter)
505 if(HasOpenedContext())
506 myLocalContexts(myCurLocalIndex)->AddFilter(aFilter);
508 myFilters->Add(aFilter);
511 //=======================================================================
512 //function : ActivateStandardMode
514 //=======================================================================
515 void AIS_InteractiveContext::ActivateStandardMode(const TopAbs_ShapeEnum aStandardActivation)
517 if(!HasOpenedContext()) return;
518 myLocalContexts(myCurLocalIndex)->ActivateStandardMode (aStandardActivation);
521 //=======================================================================
522 //function : DeActivateStandardMode
524 //=======================================================================
525 void AIS_InteractiveContext::DeactivateStandardMode(const TopAbs_ShapeEnum aStandardActivation)
527 if(!HasOpenedContext()) return;
528 myLocalContexts(myCurLocalIndex)->DeactivateStandardMode (aStandardActivation);
531 //=======================================================================
532 //function : RemoveFilter
534 //=======================================================================
535 void AIS_InteractiveContext::RemoveFilter(const Handle(SelectMgr_Filter)& aFilter)
537 if(HasOpenedContext())
538 myLocalContexts(myCurLocalIndex)->RemoveFilter (aFilter);
540 myFilters->Remove(aFilter);
543 //=======================================================================
544 //function : RemoveFilters
546 //=======================================================================
548 void AIS_InteractiveContext::RemoveFilters()
550 if(!HasOpenedContext())
553 myLocalContexts(myCurLocalIndex)->Clear(AIS_CM_Filters);
556 //=======================================================================
557 //function : ActivatedStandardModes
559 //=======================================================================
560 const TColStd_ListOfInteger& AIS_InteractiveContext::ActivatedStandardModes() const
562 return myLocalContexts(myCurLocalIndex)->StandardModes();
565 //=======================================================================
568 //=======================================================================
569 const SelectMgr_ListOfFilter& AIS_InteractiveContext::Filters() const
571 if(HasOpenedContext())
572 return myLocalContexts(myCurLocalIndex)->ListOfFilter();
573 return myFilters->StoredFilters();
576 //=======================================================================
577 //function : DisplayActiveAreas
579 //=======================================================================
580 void AIS_InteractiveContext::DisplayActiveAreas(const Handle(V3d_View)& aviou)
582 if(HasOpenedContext())
583 myLocalContexts(myCurLocalIndex)->DisplayAreas(aviou);
585 myMainSel->DisplayAreas(aviou);
589 //=======================================================================
590 //function : ClearActiveAreas
592 //=======================================================================
593 void AIS_InteractiveContext::ClearActiveAreas(const Handle(V3d_View)& aviou)
595 if(HasOpenedContext())
596 myLocalContexts(myCurLocalIndex)->ClearAreas(aviou);
598 myMainSel->ClearAreas(aviou);
601 //=======================================================================
602 //function : DisplayActiveSensitive
604 //=======================================================================
605 void AIS_InteractiveContext::DisplayActiveSensitive(const Handle(V3d_View)& aviou)
607 if(HasOpenedContext())
608 myLocalContexts(myCurLocalIndex)->DisplaySensitive(aviou);
610 myMainSel->DisplaySensitive(aviou);
612 //=======================================================================
613 //function : DisplayActiveSensitive
615 //=======================================================================
617 void AIS_InteractiveContext::DisplayActiveSensitive(const Handle(AIS_InteractiveObject)& anIObj,
618 const Handle(V3d_View)& aviou)
620 TColStd_ListIteratorOfListOfInteger It;
621 Handle(StdSelect_ViewerSelector3d) VS;
622 if(HasOpenedContext()){
623 const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
624 if(!LC->IsIn(anIObj)) return;
625 It.Initialize(LC->SelectionModes(anIObj));
626 VS = LC->MainSelector();
629 if(!myObjects.IsBound(anIObj)) return;
630 It.Initialize(myObjects(anIObj)->SelectionModes());
635 for(;It.More();It.Next()){
636 const Handle(SelectMgr_Selection)& Sel = anIObj->Selection(It.Value());
637 VS->DisplaySensitive(Sel,aviou,Standard_False);
642 //=======================================================================
643 //function : DisplayActiveAreas
645 //=======================================================================
647 void AIS_InteractiveContext::DisplayActiveAreas(const Handle(AIS_InteractiveObject)& anIObj,
648 const Handle(V3d_View)& aviou)
650 TColStd_ListIteratorOfListOfInteger It;
651 Handle(StdSelect_ViewerSelector3d) VS;
652 if(HasOpenedContext()){
653 const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
654 if(!LC->IsIn(anIObj)) return;
655 It.Initialize(LC->SelectionModes(anIObj));
656 VS = LC->MainSelector();
659 if(!myObjects.IsBound(anIObj)) return;
660 It.Initialize(myObjects(anIObj)->SelectionModes());
665 for(;It.More();It.Next()){
666 const Handle(SelectMgr_Selection)& Sel = anIObj->Selection(It.Value());
667 VS->DisplayAreas(Sel,aviou,Standard_False);
672 //=======================================================================
673 //function : ClearActiveSensitive
675 //=======================================================================
676 void AIS_InteractiveContext::ClearActiveSensitive(const Handle(V3d_View)& aviou)
679 if(HasOpenedContext())
680 myLocalContexts(myCurLocalIndex)->ClearSensitive(aviou);
682 myMainSel->ClearSensitive(aviou);
685 //=======================================================================
686 //function : SetAutomaticHilight
688 //=======================================================================
689 void AIS_InteractiveContext::SetAutomaticHilight(const Standard_Boolean aStatus)
692 if(HasOpenedContext())
693 myLocalContexts(myCurLocalIndex)->SetAutomaticHilight(aStatus);
696 //=======================================================================
697 //function : AutomaticHilight
699 //=======================================================================
700 Standard_Boolean AIS_InteractiveContext::AutomaticHilight() const
702 if(HasOpenedContext())
703 return myLocalContexts(myCurLocalIndex)->AutomaticHilight();
704 return Standard_True;
707 //=======================================================================
708 //function : UseDisplayedObjects
710 //=======================================================================
712 void AIS_InteractiveContext::UseDisplayedObjects()
714 if(HasOpenedContext())
715 myLocalContexts(myCurLocalIndex)->LoadContextObjects();
718 //=======================================================================
719 //function : NotUseDisplayedObjects
721 //=======================================================================
723 void AIS_InteractiveContext::NotUseDisplayedObjects()
725 if(HasOpenedContext())
726 myLocalContexts(myCurLocalIndex)->UnloadContextObjects();
732 //=======================================================================
733 //function : PurgeDisplay
735 //=======================================================================
737 Standard_Integer AIS_InteractiveContext::PurgeDisplay(const Standard_Boolean CollectorToo)
739 if(HasOpenedContext()) return 0;
741 Standard_Integer NbStr = PurgeViewer(myMainVwr);
742 if(!myCollectorVwr.IsNull())
744 NbStr+=PurgeViewer(myCollectorVwr);
745 if(!IsCollectorClosed())
746 myCollectorVwr->Update();
754 //=======================================================================
755 //function : PurgeViewer
757 //=======================================================================
758 Standard_Integer AIS_InteractiveContext::PurgeViewer(const Handle(V3d_Viewer)& Vwr)
760 const Handle(Graphic3d_StructureManager)& GSM = Vwr->Viewer();
761 Standard_Integer NbCleared(0);
762 Graphic3d_MapOfStructure SOS;
763 GSM->DisplayedStructures(SOS);
765 Handle(Graphic3d_Structure) G;
766 for(Graphic3d_MapIteratorOfMapOfStructure It(SOS); It.More();It.Next()){
768 Standard_Address Add = G->Owner();
771 G->Clear();// ca veut dire qu'elle n'est pas reference comme une presentation d'un InterfactiveObject...
774 Handle(AIS_InteractiveObject) IO = (AIS_InteractiveObject*)Add;
775 if(!myObjects.IsBound(IO)){
784 //=======================================================================
785 //function : IsImmediateModeOn
787 //=======================================================================
788 Standard_Boolean AIS_InteractiveContext::IsImmediateModeOn() const
790 if(!HasOpenedContext()) return Standard_False;
791 return myLocalContexts(myCurLocalIndex)->IsImmediateModeOn();
794 Standard_Boolean AIS_InteractiveContext::BeginImmediateDraw()
796 if(HasOpenedContext())
797 return myLocalContexts(myCurLocalIndex)->BeginImmediateDraw();
798 return Standard_False;
801 //=======================================================================
802 //function : ImmediateAdd
804 //=======================================================================
806 Standard_Boolean AIS_InteractiveContext::ImmediateAdd(const Handle(AIS_InteractiveObject)& anIObj,
807 const Standard_Integer AMode)
809 if(HasOpenedContext()){
810 return myLocalContexts(myCurLocalIndex)->ImmediateAdd(anIObj,AMode);}
811 return Standard_False;
814 //=======================================================================
815 //function : ImmediateRemove
817 //=======================================================================
819 Standard_Boolean AIS_InteractiveContext::ImmediateRemove(const Handle(AIS_InteractiveObject)& anIObj,
820 const Standard_Integer aMode)
822 if(HasOpenedContext())
823 return myLocalContexts(myCurLocalIndex)->ImmediateRemove(anIObj,aMode);
824 return Standard_False;
827 //=======================================================================
828 //function : EndImmediateDraw
830 //=======================================================================
832 Standard_Boolean AIS_InteractiveContext::EndImmediateDraw(const Handle(V3d_View)& aView,
833 const Standard_Boolean DoubleBuf)
835 if(HasOpenedContext())
836 return myLocalContexts(myCurLocalIndex)->EndImmediateDraw(aView,DoubleBuf);
837 return Standard_False;
841 //=======================================================================
842 //function : EndImmediateDraw
844 //=======================================================================
846 Standard_Boolean AIS_InteractiveContext::EndImmediateDraw(const Standard_Boolean DoubleBuf)
848 if(HasOpenedContext()){
850 myMainVwr->InitActiveViews();
851 if(myMainVwr->MoreActiveViews()){
852 V = myMainVwr->ActiveView();
854 return myLocalContexts(myCurLocalIndex)->EndImmediateDraw(V,DoubleBuf);
857 return Standard_False;
862 //=======================================================================
863 //function : ResetOriginalState
865 //=======================================================================
867 void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updateviewer)
869 Standard_Boolean upd_main(Standard_False),upd_col(Standard_False);
870 TColStd_ListIteratorOfListOfInteger itl;
872 for (AIS_DataMapIteratorOfDataMapOfIOStatus it(myObjects);it.More();it.Next()){
873 const Handle(AIS_InteractiveObject)& iobj = it.Key();
874 const Handle(AIS_GlobalStatus)& STAT = it.Value();
875 switch(STAT->GraphicStatus()){
876 case AIS_DS_Displayed:{
877 upd_main = Standard_True;
880 for(itl.Initialize(STAT->DisplayedModes());itl.More();itl.Next())
881 myMainPM->Display(iobj,itl.Value());
882 if(STAT->IsHilighted()){
883 if(STAT->HilightColor()!=Quantity_NOC_WHITE)
884 HilightWithColor(iobj,STAT->HilightColor(),Standard_False);
886 Hilight(iobj,Standard_False);
889 for(itl.Initialize(STAT->SelectionModes());itl.More();itl.Next()){
891 mgrSelector->Activate(iobj,itl.Value(),myMainSel);
896 upd_col = Standard_True;
897 EraseGlobal(iobj,Standard_False,Standard_True);
900 case AIS_DS_FullErased:{
901 EraseGlobal(iobj,Standard_False,Standard_False);
912 myCollectorVwr->Update();
917 //=======================================================================
918 //function : SetZDetection
920 //=======================================================================
921 void AIS_InteractiveContext::SetZDetection(const Standard_Boolean aStatus)
923 myZDetectionFlag = aStatus;
926 //=======================================================================
927 //function : ZDetection
929 //=======================================================================
930 Standard_Boolean AIS_InteractiveContext::ZDetection() const
932 return myZDetectionFlag;