1 // Created on: 1997-01-29
2 // Created by: Robert COUBLANC
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
22 #define IMP051001 //GG Adds SetZDetected() and ZDetected() methods
24 #include <AIS_InteractiveContext.jxx>
26 #include <AIS_LocalContext.hxx>
28 #include <AIS_GlobalStatus.hxx>
29 #include <TColStd_ListIteratorOfListOfInteger.hxx>
31 #include <AIS_DataMapIteratorOfDataMapOfIOStatus.hxx>
32 #include <AIS_DataMapIteratorOfDataMapOfILC.hxx>
33 #include <Graphic3d_StructureManager.hxx>
34 #include <Graphic3d_Structure.hxx>
35 #include <Graphic3d_MapOfStructure.hxx>
36 #include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
37 #include <AIS_Selection.hxx>
39 //=======================================================================
40 //function : OpenLocalContext
42 //=======================================================================
44 Standard_Integer AIS_InteractiveContext::
45 OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
46 const Standard_Boolean AllowShapeDecomposition,
47 const Standard_Boolean AcceptEraseOfTemporary,
48 const Standard_Boolean /*BothViewers*/)
51 // the entities eventually detected just before the context was opened are unhighlighted...
52 if(!IsCurrent(myLastPicked)){
53 if(!myLastPicked.IsNull()){
54 Standard_Integer HiMod = myLastPicked->HasHilightMode()?myLastPicked->HilightMode():0;
55 myMainPM->Unhighlight(myLastPicked,HiMod);
58 if(!mylastmoveview.IsNull()){
60 myLocalContexts(myCurLocalIndex)->UnhilightLastDetected(mylastmoveview);
63 // entities connected to dynamic selection at neutral point are set to 0.
65 myLastinMain.Nullify();
66 myLastPicked.Nullify();
67 myWasLastMain = Standard_True;
71 Standard_Integer untilnow = myCurLocalIndex;
73 myCurLocalIndex = HighestIndex() + 1;
75 Handle(AIS_LocalContext) NewLocal= new AIS_LocalContext(this,myCurLocalIndex,
77 AllowShapeDecomposition,
78 AcceptEraseOfTemporary);
79 // the AIS_LocalContext bind itself to myLocalContexts
80 // because procedures performed in AIS_LocalContext constructor
81 // already may access myLocalContexts(myCurLocalIndex) (like methods AIS_LocalContext::IsSelected()).
82 //myLocalContexts.Bind (myCurLocalIndex, NewLocal);
83 NewLocal->MainSelector()->Set ((myLocalContexts.Extent() > 1)
84 ? myLocalContexts (untilnow)->MainSelector()->Projector()
85 : myMainSel->Projector());
87 NewLocal->MainSelector()->UpdateConversion();
90 cout<<"\tOpen Local Context No "<<myCurLocalIndex<<endl;
91 if(UseDisplayedObjects){
92 cout<<"\t\tObjects from Neutral Point loaded"<<endl;
93 if(AllowShapeDecomposition)
94 cout<<"\t\tDecomposition Authorized for Loaded Shapes"<<endl;
96 cout<<"\t\tNo Decomposition Authorized for Loaded Shapes"<<endl;
99 cout<<"\t\tNo Objects Were Loaded "<<endl;
101 return myCurLocalIndex;
104 //=======================================================================
105 //function : CloseLocalContext
107 //=======================================================================
109 void AIS_InteractiveContext::CloseLocalContext(const Standard_Integer Index,
110 const Standard_Boolean updateviewer)
113 Standard_Boolean debugmode(Standard_False);
115 debugmode = Standard_True;
118 Standard_Integer GoodIndex = (Index ==-1) ? myCurLocalIndex : Index;
120 if(debugmode) cout<<"Call to CloseLocalContext - Index "<<GoodIndex<<endl;
121 if(!HasOpenedContext()){
122 if(debugmode) cout<<"\t But No Local Context is opened"<<endl;
125 if(!myLocalContexts.IsBound(GoodIndex)) {
126 if(debugmode) cout<<" Attempt to Close a non-existent Local Context"<<endl;
130 // the only open local context is closed...
131 if(myLocalContexts.Extent()==1 && GoodIndex == myCurLocalIndex){
133 Standard_Boolean updateproj = !(myLocalContexts(myCurLocalIndex)->HasSameProjector(myMainSel->Projector()));
134 myLocalContexts(myCurLocalIndex)->Terminate( updateviewer );
135 myLocalContexts.UnBind(myCurLocalIndex);
138 ResetOriginalState(Standard_False);
140 myMainSel->UpdateConversion();
142 myMainSel->UpdateSort();
145 cout<<"No More Opened Local Context "<<endl;
148 // Otherwise the local context will be still open after the current is closed
150 Handle(StdSelect_ViewerSelector3d) VS = myLocalContexts(GoodIndex)->MainSelector();
151 myLocalContexts(GoodIndex)->Terminate();
152 myLocalContexts.UnBind(GoodIndex);
153 // the current is closed...
154 if(GoodIndex==myCurLocalIndex){
155 myCurLocalIndex = HighestIndex();
156 const Handle(AIS_LocalContext)& LocCtx = myLocalContexts(myCurLocalIndex);
157 if (!LocCtx->HasSameProjector (VS->Projector()))
159 LocCtx->MainSelector()->UpdateConversion();
163 cout<<"a No Current Local Context WasClosed"<<endl;
165 if(debugmode) cout<<"Index Of CurrentLocalContext:"<<myCurLocalIndex<<endl;
170 if(updateviewer) myMainVwr->Update();
173 //=======================================================================
174 //function : CloseAllContexts
176 //=======================================================================
178 void AIS_InteractiveContext::CloseAllContexts(const Standard_Boolean updateviewer)
181 while(!myLocalContexts.IsEmpty()){
182 CloseLocalContext(myCurLocalIndex,Standard_False);
185 ResetOriginalState(Standard_False);
187 myMainSel->UpdateSort();
188 if(updateviewer) myMainVwr->Update();
191 //=======================================================================
192 //function : IndexOfCurrentLocal
194 //=======================================================================
196 Standard_Integer AIS_InteractiveContext::IndexOfCurrentLocal() const
198 return myCurLocalIndex;
201 //=======================================================================
202 //function : ClearLocalContext
204 //=======================================================================
206 void AIS_InteractiveContext::ClearLocalContext(const AIS_ClearMode aMode)
208 if (!HasOpenedContext()) return;
209 myLocalContexts(myCurLocalIndex)->Clear(aMode);
213 //=======================================================================
214 //function : HighestIndex
216 //=======================================================================
218 Standard_Integer AIS_InteractiveContext::HighestIndex() const
220 AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
221 Standard_Integer HiInd = 0;
222 for(;It.More();It.Next())
223 HiInd = (It.Key()>HiInd) ? It.Key() : HiInd;
229 //=======================================================================
230 //function : Activate
232 //=======================================================================
234 void AIS_InteractiveContext::
235 Activate(const Handle(AIS_InteractiveObject)& anIObj,
236 const Standard_Integer aMode)
238 if(!HasOpenedContext()){
239 if(!myObjects.IsBound(anIObj)) return;
240 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
241 if(STAT->GraphicStatus()==AIS_DS_Displayed)
242 mgrSelector->Activate(anIObj,aMode,myMainSel);
243 STAT ->AddSelectionMode(aMode);
246 myLocalContexts(myCurLocalIndex)->ActivateMode(anIObj,aMode);
250 //=======================================================================
251 //function : LocalSelector
253 //=======================================================================
254 Handle( StdSelect_ViewerSelector3d ) AIS_InteractiveContext::LocalSelector() const
256 if( !HasOpenedContext() )
257 return Handle( StdSelect_ViewerSelector3d )();
259 return myLocalContexts( myCurLocalIndex )->MainSelector();
263 //=======================================================================
264 //function : DeActivate
266 //=======================================================================
267 void AIS_InteractiveContext::
268 Deactivate(const Handle(AIS_InteractiveObject)& anIObj)
270 if(!HasOpenedContext()){
271 if(!myObjects.IsBound(anIObj)) return;
272 TColStd_ListIteratorOfListOfInteger ItL;
273 for(ItL.Initialize(myObjects(anIObj)->SelectionModes());
276 if(myObjects(anIObj)->GraphicStatus() == AIS_DS_Displayed)
277 mgrSelector->Deactivate(anIObj,ItL.Value(),myMainSel);
279 myObjects(anIObj)->ClearSelectionModes();
282 const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
283 LC->Deactivate(anIObj);
287 //=======================================================================
288 //function : Deactivate
290 //=======================================================================
292 void AIS_InteractiveContext::Deactivate(const Handle(AIS_InteractiveObject)& anIObj,
293 const Standard_Integer aMode)
295 if(!HasOpenedContext()){
296 if(!myObjects.IsBound(anIObj)) return;
297 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
299 if(STAT->GraphicStatus() == AIS_DS_Displayed)
300 mgrSelector->Deactivate(anIObj,aMode,myMainSel);
301 STAT->RemoveSelectionMode(aMode);
304 myLocalContexts(myCurLocalIndex)->DeactivateMode(anIObj,aMode);
308 //=======================================================================
309 //function : ActivatedModes
311 //=======================================================================
313 void AIS_InteractiveContext::
314 ActivatedModes(const Handle(AIS_InteractiveObject)& anIObj,
315 TColStd_ListOfInteger& theList) const
317 TColStd_ListIteratorOfListOfInteger ItL;
318 if(!HasOpenedContext()){
319 if(myObjects.IsBound(anIObj)){
320 for(ItL.Initialize(myObjects(anIObj)->SelectionModes());
323 theList.Append(ItL.Value());
328 if(myLocalContexts(myCurLocalIndex)->IsIn(anIObj)){
329 for(ItL.Initialize(myLocalContexts(myCurLocalIndex)->SelectionModes(anIObj));
332 theList.Append(ItL.Value());
337 //=======================================================================
338 //function : SetShapeDecomposition
340 //=======================================================================
342 void AIS_InteractiveContext::SetShapeDecomposition(const Handle(AIS_InteractiveObject)& anIObj,
343 const Standard_Boolean StdModeSensitive)
345 if(!HasOpenedContext()) return;
346 myLocalContexts(myCurLocalIndex)->SetShapeDecomposition(anIObj,StdModeSensitive);
349 //=======================================================================
350 //function : SetTemporaryAttributes
352 //=======================================================================
354 void AIS_InteractiveContext::
355 SetTemporaryAttributes(const Handle(AIS_InteractiveObject)& /*anObj*/,
356 const Handle(Prs3d_Drawer)& /*aDrawer*/,
357 const Standard_Boolean /*updateviewer*/)
361 //=======================================================================
362 //function : SubIntensityOn
364 //=======================================================================
365 void AIS_InteractiveContext::
366 SubIntensityOn(const Handle(AIS_InteractiveObject)& anIObj,
367 const Standard_Boolean updateviewer)
369 if(!HasOpenedContext()){
370 if(!myObjects.IsBound(anIObj))
372 const Handle(AIS_GlobalStatus)& GB=myObjects(anIObj);
373 if(GB->IsSubIntensityOn())
375 GB->SubIntensityOn();
376 Standard_Boolean UpdMain(Standard_False);
378 for(TColStd_ListIteratorOfListOfInteger It(GB->DisplayedModes());It.More();It.Next()){
379 if (GB->GraphicStatus()==AIS_DS_Displayed)
381 myMainPM->Color(anIObj,mySubIntensity,It.Value());
382 UpdMain = Standard_True;
391 if(myObjects.IsBound(anIObj)){
392 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
393 STAT->SubIntensityOn();
394 TColStd_ListIteratorOfListOfInteger ItL;
395 for (ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
396 myMainPM->Color(anIObj,mySubIntensity,ItL.Value());
399 myLocalContexts(myCurLocalIndex)->SubIntensityOn(anIObj);
401 if(updateviewer) myMainVwr->Update();
404 //=======================================================================
405 //function : SubIntensityOff
407 //=======================================================================
409 void AIS_InteractiveContext::
410 SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj,
411 const Standard_Boolean updateviewer)
413 if(!HasOpenedContext()){
414 if(!myObjects.IsBound(anIObj))
416 const Handle(AIS_GlobalStatus)& GB=myObjects(anIObj);
417 if(!GB->IsSubIntensityOn())
419 GB->SubIntensityOff();
420 Standard_Boolean UpdMain(Standard_False);
422 for(TColStd_ListIteratorOfListOfInteger It(GB->DisplayedModes());It.More();It.Next()){
423 if(GB->GraphicStatus()==AIS_DS_Displayed)
425 myMainPM->Unhighlight(anIObj,It.Value());
426 UpdMain = Standard_True;
430 Standard_Integer DM,HM,SM;
431 GetDefModes(anIObj,DM,HM,SM);
432 if(AIS_Selection::IsSelected(anIObj))
433 myMainPM->Highlight(anIObj,HM);
441 if(myObjects.IsBound(anIObj)){
442 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
443 STAT->SubIntensityOff();
444 TColStd_ListIteratorOfListOfInteger ItL;
445 for (ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
446 myMainPM->Unhighlight(anIObj,ItL.Value());
447 if(STAT->IsHilighted())
451 myLocalContexts(myCurLocalIndex)->SubIntensityOff(anIObj);
452 if(IsSelected(anIObj))
455 if(updateviewer) myMainVwr->Update();
459 //=======================================================================
460 //function : SubIntensityOn
461 //purpose : ALL THE DISPLAYED OBJECTS HAVE SUBINTENSITY...
462 //=======================================================================
464 void AIS_InteractiveContext::SubIntensityOn(const Standard_Boolean updateviewer)
466 if(!HasOpenedContext()) return;
468 AIS_DataMapIteratorOfDataMapOfIOStatus It (myObjects);
469 TColStd_ListIteratorOfListOfInteger ItM;
470 for(;It.More();It.Next()){
471 const Handle(AIS_GlobalStatus)& STAT = It.Value();
472 if(STAT->GraphicStatus()==AIS_DS_Displayed)
474 STAT->SubIntensityOn();
475 for(ItM.Initialize(STAT->DisplayedModes());ItM.More();ItM.Next())
476 {myMainPM->Color(It.Key(),mySubIntensity,ItM.Value());}
479 if(updateviewer) myMainVwr->Update();
482 //=======================================================================
483 //function : SubIntensityOff
485 //=======================================================================
486 void AIS_InteractiveContext::SubIntensityOff(const Standard_Boolean updateviewer)
488 if(!HasOpenedContext()) return;
490 AIS_DataMapIteratorOfDataMapOfIOStatus It (myObjects);
491 TColStd_ListIteratorOfListOfInteger ItL;
492 for(;It.More();It.Next()){
493 const Handle(AIS_GlobalStatus)& STAT = It.Value();
494 if(STAT->IsSubIntensityOn())
495 STAT->SubIntensityOff();
496 for(ItL.Initialize(STAT->DisplayedModes());ItL.More();ItL.Next())
497 myMainPM->Unhighlight(It.Key());
500 if(updateviewer) myMainVwr->Update();
503 //=======================================================================
504 //function : AddFilter
506 //=======================================================================
507 void AIS_InteractiveContext::AddFilter(const Handle(SelectMgr_Filter)& aFilter)
509 if(HasOpenedContext())
510 myLocalContexts(myCurLocalIndex)->AddFilter(aFilter);
512 myFilters->Add(aFilter);
515 //=======================================================================
516 //function : ActivateStandardMode
518 //=======================================================================
519 void AIS_InteractiveContext::ActivateStandardMode(const TopAbs_ShapeEnum aStandardActivation)
521 if(!HasOpenedContext()) return;
522 myLocalContexts(myCurLocalIndex)->ActivateStandardMode (aStandardActivation);
525 //=======================================================================
526 //function : DeActivateStandardMode
528 //=======================================================================
529 void AIS_InteractiveContext::DeactivateStandardMode(const TopAbs_ShapeEnum aStandardActivation)
531 if(!HasOpenedContext()) return;
532 myLocalContexts(myCurLocalIndex)->DeactivateStandardMode (aStandardActivation);
535 //=======================================================================
536 //function : RemoveFilter
538 //=======================================================================
539 void AIS_InteractiveContext::RemoveFilter(const Handle(SelectMgr_Filter)& aFilter)
541 if(HasOpenedContext())
542 myLocalContexts(myCurLocalIndex)->RemoveFilter (aFilter);
544 myFilters->Remove(aFilter);
547 //=======================================================================
548 //function : RemoveFilters
550 //=======================================================================
552 void AIS_InteractiveContext::RemoveFilters()
554 if(!HasOpenedContext())
557 myLocalContexts(myCurLocalIndex)->Clear(AIS_CM_Filters);
560 //=======================================================================
561 //function : ActivatedStandardModes
563 //=======================================================================
564 const TColStd_ListOfInteger& AIS_InteractiveContext::ActivatedStandardModes() const
566 return myLocalContexts(myCurLocalIndex)->StandardModes();
569 //=======================================================================
572 //=======================================================================
573 const SelectMgr_ListOfFilter& AIS_InteractiveContext::Filters() const
575 if(HasOpenedContext())
576 return myLocalContexts(myCurLocalIndex)->ListOfFilter();
577 return myFilters->StoredFilters();
580 //=======================================================================
581 //function : DisplayActiveAreas
583 //=======================================================================
584 void AIS_InteractiveContext::DisplayActiveAreas(const Handle(V3d_View)& aviou)
586 if(HasOpenedContext())
587 myLocalContexts(myCurLocalIndex)->DisplayAreas(aviou);
589 myMainSel->DisplayAreas(aviou);
593 //=======================================================================
594 //function : ClearActiveAreas
596 //=======================================================================
597 void AIS_InteractiveContext::ClearActiveAreas(const Handle(V3d_View)& aviou)
599 if(HasOpenedContext())
600 myLocalContexts(myCurLocalIndex)->ClearAreas(aviou);
602 myMainSel->ClearAreas(aviou);
605 //=======================================================================
606 //function : DisplayActiveSensitive
608 //=======================================================================
609 void AIS_InteractiveContext::DisplayActiveSensitive(const Handle(V3d_View)& aviou)
611 if(HasOpenedContext())
612 myLocalContexts(myCurLocalIndex)->DisplaySensitive(aviou);
614 myMainSel->DisplaySensitive(aviou);
616 //=======================================================================
617 //function : DisplayActiveSensitive
619 //=======================================================================
621 void AIS_InteractiveContext::DisplayActiveSensitive(const Handle(AIS_InteractiveObject)& anIObj,
622 const Handle(V3d_View)& aviou)
624 TColStd_ListIteratorOfListOfInteger It;
625 Handle(StdSelect_ViewerSelector3d) VS;
626 if(HasOpenedContext()){
627 const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
628 if(!LC->IsIn(anIObj)) return;
629 It.Initialize(LC->SelectionModes(anIObj));
630 VS = LC->MainSelector();
633 if(!myObjects.IsBound(anIObj)) return;
634 It.Initialize(myObjects(anIObj)->SelectionModes());
639 for(;It.More();It.Next()){
640 const Handle(SelectMgr_Selection)& Sel = anIObj->Selection(It.Value());
641 VS->DisplaySensitive(Sel,aviou,Standard_False);
646 //=======================================================================
647 //function : DisplayActiveAreas
649 //=======================================================================
651 void AIS_InteractiveContext::DisplayActiveAreas(const Handle(AIS_InteractiveObject)& anIObj,
652 const Handle(V3d_View)& aviou)
654 TColStd_ListIteratorOfListOfInteger It;
655 Handle(StdSelect_ViewerSelector3d) VS;
656 if(HasOpenedContext()){
657 const Handle(AIS_LocalContext)& LC = myLocalContexts(myCurLocalIndex);
658 if(!LC->IsIn(anIObj)) return;
659 It.Initialize(LC->SelectionModes(anIObj));
660 VS = LC->MainSelector();
663 if(!myObjects.IsBound(anIObj)) return;
664 It.Initialize(myObjects(anIObj)->SelectionModes());
669 for(;It.More();It.Next()){
670 const Handle(SelectMgr_Selection)& Sel = anIObj->Selection(It.Value());
671 VS->DisplayAreas(Sel,aviou,Standard_False);
676 //=======================================================================
677 //function : ClearActiveSensitive
679 //=======================================================================
680 void AIS_InteractiveContext::ClearActiveSensitive(const Handle(V3d_View)& aviou)
683 if(HasOpenedContext())
684 myLocalContexts(myCurLocalIndex)->ClearSensitive(aviou);
686 myMainSel->ClearSensitive(aviou);
689 //=======================================================================
690 //function : SetAutomaticHilight
692 //=======================================================================
693 void AIS_InteractiveContext::SetAutomaticHilight(const Standard_Boolean aStatus)
696 if(HasOpenedContext())
697 myLocalContexts(myCurLocalIndex)->SetAutomaticHilight(aStatus);
700 //=======================================================================
701 //function : AutomaticHilight
703 //=======================================================================
704 Standard_Boolean AIS_InteractiveContext::AutomaticHilight() const
706 if(HasOpenedContext())
707 return myLocalContexts(myCurLocalIndex)->AutomaticHilight();
708 return Standard_True;
711 //=======================================================================
712 //function : UseDisplayedObjects
714 //=======================================================================
716 void AIS_InteractiveContext::UseDisplayedObjects()
718 if(HasOpenedContext())
719 myLocalContexts(myCurLocalIndex)->LoadContextObjects();
722 //=======================================================================
723 //function : NotUseDisplayedObjects
725 //=======================================================================
727 void AIS_InteractiveContext::NotUseDisplayedObjects()
729 if(HasOpenedContext())
730 myLocalContexts(myCurLocalIndex)->UnloadContextObjects();
736 //=======================================================================
737 //function : PurgeDisplay
739 //=======================================================================
741 Standard_Integer AIS_InteractiveContext::PurgeDisplay()
743 if(HasOpenedContext()) return 0;
745 Standard_Integer NbStr = PurgeViewer(myMainVwr);
752 //=======================================================================
753 //function : PurgeViewer
755 //=======================================================================
756 Standard_Integer AIS_InteractiveContext::PurgeViewer(const Handle(V3d_Viewer)& Vwr)
758 const Handle(Graphic3d_StructureManager)& GSM = Vwr->Viewer();
759 Standard_Integer NbCleared(0);
760 Graphic3d_MapOfStructure SOS;
761 GSM->DisplayedStructures(SOS);
763 Handle(Graphic3d_Structure) G;
764 for(Graphic3d_MapIteratorOfMapOfStructure It(SOS); It.More();It.Next()){
766 Standard_Address Add = G->Owner();
769 G->Clear();// it means that it is not referenced as a presentation of InterfactiveObject...
772 Handle(AIS_InteractiveObject) IO = (AIS_InteractiveObject*)Add;
773 if(!myObjects.IsBound(IO)){
782 //=======================================================================
783 //function : IsImmediateModeOn
785 //=======================================================================
786 Standard_Boolean AIS_InteractiveContext::IsImmediateModeOn() const
788 if(!HasOpenedContext()) return Standard_False;
789 return myLocalContexts(myCurLocalIndex)->IsImmediateModeOn();
792 Standard_Boolean AIS_InteractiveContext::BeginImmediateDraw()
794 if(HasOpenedContext())
795 return myLocalContexts(myCurLocalIndex)->BeginImmediateDraw();
796 return Standard_False;
799 //=======================================================================
800 //function : ImmediateAdd
802 //=======================================================================
804 Standard_Boolean AIS_InteractiveContext::ImmediateAdd(const Handle(AIS_InteractiveObject)& anIObj,
805 const Standard_Integer AMode)
807 if(HasOpenedContext()){
808 return myLocalContexts(myCurLocalIndex)->ImmediateAdd(anIObj,AMode);}
809 return Standard_False;
812 //=======================================================================
813 //function : ImmediateRemove
815 //=======================================================================
817 Standard_Boolean AIS_InteractiveContext::ImmediateRemove(const Handle(AIS_InteractiveObject)& anIObj,
818 const Standard_Integer aMode)
820 if(HasOpenedContext())
821 return myLocalContexts(myCurLocalIndex)->ImmediateRemove(anIObj,aMode);
822 return Standard_False;
825 //=======================================================================
826 //function : EndImmediateDraw
828 //=======================================================================
830 Standard_Boolean AIS_InteractiveContext::EndImmediateDraw(const Handle(V3d_View)& aView,
831 const Standard_Boolean DoubleBuf)
833 if(HasOpenedContext())
834 return myLocalContexts(myCurLocalIndex)->EndImmediateDraw(aView,DoubleBuf);
835 return Standard_False;
839 //=======================================================================
840 //function : EndImmediateDraw
842 //=======================================================================
844 Standard_Boolean AIS_InteractiveContext::EndImmediateDraw(const Standard_Boolean DoubleBuf)
846 if(HasOpenedContext()){
848 myMainVwr->InitActiveViews();
849 if(myMainVwr->MoreActiveViews()){
850 V = myMainVwr->ActiveView();
852 return myLocalContexts(myCurLocalIndex)->EndImmediateDraw(V,DoubleBuf);
855 return Standard_False;
860 //=======================================================================
861 //function : ResetOriginalState
863 //=======================================================================
865 void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updateviewer)
867 Standard_Boolean upd_main(Standard_False);
868 TColStd_ListIteratorOfListOfInteger itl;
870 for (AIS_DataMapIteratorOfDataMapOfIOStatus it(myObjects);it.More();it.Next()){
871 const Handle(AIS_InteractiveObject)& iobj = it.Key();
872 const Handle(AIS_GlobalStatus)& STAT = it.Value();
873 switch(STAT->GraphicStatus()){
874 case AIS_DS_Displayed:{
875 upd_main = Standard_True;
878 for(itl.Initialize(STAT->DisplayedModes());itl.More();itl.Next())
879 myMainPM->Display(iobj,itl.Value());
880 if(STAT->IsHilighted()){
881 if(STAT->HilightColor()!=Quantity_NOC_WHITE)
882 HilightWithColor(iobj,STAT->HilightColor(),Standard_False);
884 Hilight(iobj,Standard_False);
887 for(itl.Initialize(STAT->SelectionModes());itl.More();itl.Next()){
889 mgrSelector->Activate(iobj,itl.Value(),myMainSel);
894 EraseGlobal(iobj,Standard_False);
908 //=======================================================================
909 //function : SetZDetection
911 //=======================================================================
912 void AIS_InteractiveContext::SetZDetection(const Standard_Boolean aStatus)
914 myZDetectionFlag = aStatus;
917 //=======================================================================
918 //function : ZDetection
920 //=======================================================================
921 Standard_Boolean AIS_InteractiveContext::ZDetection() const
923 return myZDetectionFlag;