1 // Created on: 1997-01-29
2 // Created by: Robert COUBLANC
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <AIS_DataMapIteratorOfDataMapOfILC.hxx>
19 #include <AIS_DataMapIteratorOfDataMapOfIOStatus.hxx>
20 #include <AIS_GlobalStatus.hxx>
21 #include <AIS_InteractiveContext.hxx>
22 #include <AIS_InteractiveObject.hxx>
23 #include <AIS_LocalContext.hxx>
24 #include <AIS_Selection.hxx>
25 #include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
26 #include <Graphic3d_MapOfStructure.hxx>
27 #include <Graphic3d_Structure.hxx>
28 #include <Graphic3d_StructureManager.hxx>
29 #include <Prs3d_BasicAspect.hxx>
30 #include <Prs3d_LineAspect.hxx>
31 #include <Quantity_Color.hxx>
32 #include <SelectMgr_EntityOwner.hxx>
33 #include <SelectMgr_Filter.hxx>
34 #include <SelectMgr_OrFilter.hxx>
35 #include <SelectMgr_SelectionManager.hxx>
36 #include <Standard_Transient.hxx>
37 #include <StdSelect_ViewerSelector3d.hxx>
38 #include <TCollection_AsciiString.hxx>
39 #include <TCollection_ExtendedString.hxx>
40 #include <TColStd_ListIteratorOfListOfInteger.hxx>
41 #include <TopLoc_Location.hxx>
42 #include <TopoDS_Shape.hxx>
43 #include <V3d_View.hxx>
44 #include <V3d_Viewer.hxx>
46 //=======================================================================
47 //function : OpenLocalContext
49 //=======================================================================
50 Standard_Integer AIS_InteractiveContext::
51 OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
52 const Standard_Boolean AllowShapeDecomposition,
53 const Standard_Boolean AcceptEraseOfTemporary,
54 const Standard_Boolean /*BothViewers*/)
57 // the entities eventually detected just before the context was opened are unhighlighted...
58 if(!IsSelected(myLastPicked)){
59 if(!myLastPicked.IsNull()){
60 const Handle(AIS_InteractiveObject) aLastPickedAIS = Handle(AIS_InteractiveObject)::DownCast (myLastPicked->Selectable());
61 unhighlightGlobal (aLastPickedAIS);
64 if (myCurLocalIndex > 0)
66 myLocalContexts (myCurLocalIndex)->UnhilightLastDetected (myMainVwr);
69 // entities connected to dynamic selection at neutral point are set to 0.
71 myLastinMain.Nullify();
72 myLastPicked.Nullify();
73 myWasLastMain = Standard_True;
75 Standard_DISABLE_DEPRECATION_WARNINGS
76 myCurLocalIndex = HighestIndex() + 1;
77 Standard_ENABLE_DEPRECATION_WARNINGS
79 Handle(AIS_LocalContext) NewLocal= new AIS_LocalContext(this,myCurLocalIndex,
81 AllowShapeDecomposition,
82 AcceptEraseOfTemporary);
83 // the AIS_LocalContext bind itself to myLocalContexts
84 // because procedures performed in AIS_LocalContext constructor
85 // already may access myLocalContexts(myCurLocalIndex) (like methods AIS_LocalContext::IsSelected()).
88 cout<<"\tOpen Local Context No "<<myCurLocalIndex<<endl;
89 if(UseDisplayedObjects){
90 cout<<"\t\tObjects from Neutral Point loaded"<<endl;
91 if(AllowShapeDecomposition)
92 cout<<"\t\tDecomposition Authorized for Loaded Shapes"<<endl;
94 cout<<"\t\tNo Decomposition Authorized for Loaded Shapes"<<endl;
97 cout<<"\t\tNo Objects Were Loaded "<<endl;
99 return myCurLocalIndex;
102 //=======================================================================
103 //function : CloseLocalContext
105 //=======================================================================
107 void AIS_InteractiveContext::CloseLocalContext(const Standard_Integer Index,
108 const Standard_Boolean updateviewer)
111 Standard_Boolean debugmode(Standard_False);
113 debugmode = Standard_True;
116 Standard_Integer GoodIndex = (Index ==-1) ? myCurLocalIndex : Index;
118 if(debugmode) cout<<"Call to CloseLocalContext - Index "<<GoodIndex<<endl;
119 if(!HasOpenedContext()){
120 if(debugmode) cout<<"\t But No Local Context is opened"<<endl;
123 if(!myLocalContexts.IsBound(GoodIndex)) {
124 if(debugmode) cout<<" Attempt to Close a non-existent Local Context"<<endl;
128 // the only open local context is closed...
129 if(myLocalContexts.Extent()==1 && GoodIndex == myCurLocalIndex){
131 myLocalContexts(myCurLocalIndex)->Terminate( updateviewer );
132 myLocalContexts.UnBind(myCurLocalIndex);
135 ResetOriginalState(Standard_False);
137 cout<<"No More Opened Local Context "<<endl;
140 // Otherwise the local context will be still open after the current is closed
142 Handle(StdSelect_ViewerSelector3d) VS = myLocalContexts(GoodIndex)->MainSelector();
143 myLocalContexts(GoodIndex)->Terminate();
144 myLocalContexts.UnBind(GoodIndex);
145 // the current is closed...
146 if(GoodIndex==myCurLocalIndex){
147 Standard_DISABLE_DEPRECATION_WARNINGS
148 myCurLocalIndex = HighestIndex();
149 Standard_ENABLE_DEPRECATION_WARNINGS
152 cout<<"a No Current Local Context WasClosed"<<endl;
154 // restore activated selections of current local context
155 myLocalContexts (myCurLocalIndex)->RestoreActivatedModes();
157 if(debugmode) cout<<"Index Of CurrentLocalContext:"<<myCurLocalIndex<<endl;
162 if(updateviewer) myMainVwr->Update();
165 //=======================================================================
166 //function : CloseAllContexts
168 //=======================================================================
169 Standard_DISABLE_DEPRECATION_WARNINGS
170 void AIS_InteractiveContext::CloseAllContexts(const Standard_Boolean updateviewer)
172 while(!myLocalContexts.IsEmpty()){
173 CloseLocalContext(myCurLocalIndex,Standard_False);
176 ResetOriginalState(Standard_False);
178 if(updateviewer) myMainVwr->Update();
180 Standard_ENABLE_DEPRECATION_WARNINGS
182 //=======================================================================
183 //function : IndexOfCurrentLocal
185 //=======================================================================
187 Standard_Integer AIS_InteractiveContext::IndexOfCurrentLocal() const
189 return myCurLocalIndex;
192 //=======================================================================
193 //function : ClearLocalContext
195 //=======================================================================
197 void AIS_InteractiveContext::ClearLocalContext(const AIS_ClearMode aMode)
199 if (!HasOpenedContext()) return;
200 myLocalContexts(myCurLocalIndex)->Clear(aMode);
204 //=======================================================================
205 //function : HighestIndex
207 //=======================================================================
209 Standard_Integer AIS_InteractiveContext::HighestIndex() const
211 AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
212 Standard_Integer HiInd = 0;
213 for(;It.More();It.Next())
214 HiInd = (It.Key()>HiInd) ? It.Key() : HiInd;
219 //=======================================================================
220 //function : SetSelectionModeActive
222 //=======================================================================
223 void AIS_InteractiveContext::SetSelectionModeActive (const Handle(AIS_InteractiveObject)& theObj,
224 const Standard_Integer theMode,
225 const Standard_Boolean theIsActive,
226 const AIS_SelectionModesConcurrency theActiveFilter,
227 const Standard_Boolean theIsForce)
233 else if (HasOpenedContext())
235 myLocalContexts (myCurLocalIndex)->SetSelectionModeActive (theObj, theMode, theIsActive, theActiveFilter);
239 const Handle(AIS_GlobalStatus)* aStat = myObjects.Seek (theObj);
247 && theActiveFilter == AIS_SelectionModesConcurrency_Single))
249 if ((*aStat)->GraphicStatus() == AIS_DS_Displayed
254 for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStat)->SelectionModes()); aModeIter.More(); aModeIter.Next())
256 mgrSelector->Deactivate (theObj, aModeIter.Value(), myMainSel);
261 mgrSelector->Deactivate (theObj, theMode, myMainSel);
267 (*aStat)->ClearSelectionModes();
271 (*aStat)->RemoveSelectionMode (theMode);
275 else if (theMode == -1)
280 if ((*aStat)->SelectionModes().Size() == 1
281 && (*aStat)->SelectionModes().First() == theMode)
286 if ((*aStat)->GraphicStatus() == AIS_DS_Displayed
289 switch (theActiveFilter)
291 case AIS_SelectionModesConcurrency_Single:
293 for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStat)->SelectionModes()); aModeIter.More(); aModeIter.Next())
295 mgrSelector->Deactivate (theObj, aModeIter.Value(), myMainSel);
297 (*aStat)->ClearSelectionModes();
300 case AIS_SelectionModesConcurrency_GlobalOrLocal:
302 const Standard_Integer aGlobSelMode = theObj->GlobalSelectionMode();
303 TColStd_ListOfInteger aRemovedModes;
304 for (TColStd_ListIteratorOfListOfInteger aModeIter ((*aStat)->SelectionModes()); aModeIter.More(); aModeIter.Next())
306 if ((theMode == aGlobSelMode && aModeIter.Value() != aGlobSelMode)
307 || (theMode != aGlobSelMode && aModeIter.Value() == aGlobSelMode))
309 mgrSelector->Deactivate (theObj, aModeIter.Value(), myMainSel);
310 aRemovedModes.Append (aModeIter.Value());
313 if (aRemovedModes.Size() == (*aStat)->SelectionModes().Size())
315 (*aStat)->ClearSelectionModes();
319 for (TColStd_ListIteratorOfListOfInteger aModeIter (aRemovedModes); aModeIter.More(); aModeIter.Next())
321 (*aStat)->RemoveSelectionMode (aModeIter.Value());
326 case AIS_SelectionModesConcurrency_Multiple:
331 mgrSelector->Activate (theObj, theMode, myMainSel);
333 (*aStat)->AddSelectionMode (theMode);
336 // ============================================================================
337 // function : Activate
339 // ============================================================================
340 void AIS_InteractiveContext::Activate (const Standard_Integer theMode,
341 const Standard_Boolean theIsForce)
343 AIS_ListOfInteractive aDisplayedObjects;
344 DisplayedObjects (aDisplayedObjects);
346 for (AIS_ListIteratorOfListOfInteractive anIter (aDisplayedObjects); anIter.More(); anIter.Next())
348 Load (anIter.Value(), -1, Standard_True);
349 Activate (anIter.Value(), theMode, theIsForce);
354 //=======================================================================
355 //function : LocalSelector
357 //=======================================================================
358 Handle( StdSelect_ViewerSelector3d ) AIS_InteractiveContext::LocalSelector() const
360 if( !HasOpenedContext() )
361 return Handle( StdSelect_ViewerSelector3d )();
363 return myLocalContexts( myCurLocalIndex )->MainSelector();
366 // ============================================================================
367 // function : Deactivate
369 // ============================================================================
370 void AIS_InteractiveContext::Deactivate (const Standard_Integer theMode)
372 AIS_ListOfInteractive aDisplayedObjects;
373 DisplayedObjects (aDisplayedObjects);
375 for (AIS_ListIteratorOfListOfInteractive anIter (aDisplayedObjects); anIter.More(); anIter.Next())
377 Deactivate (anIter.Value(), theMode);
381 // ============================================================================
382 // function : Deactivate
384 // ============================================================================
385 void AIS_InteractiveContext::Deactivate()
387 AIS_ListOfInteractive aDisplayedObjects;
388 DisplayedObjects (aDisplayedObjects);
390 for (AIS_ListIteratorOfListOfInteractive anIter (aDisplayedObjects); anIter.More(); anIter.Next())
392 Deactivate (anIter.Value());
396 //=======================================================================
397 //function : ActivatedModes
399 //=======================================================================
401 void AIS_InteractiveContext::
402 ActivatedModes(const Handle(AIS_InteractiveObject)& anIObj,
403 TColStd_ListOfInteger& theList) const
405 TColStd_ListIteratorOfListOfInteger ItL;
406 if(!HasOpenedContext()){
407 if(myObjects.IsBound(anIObj)){
408 for(ItL.Initialize(myObjects(anIObj)->SelectionModes());
411 theList.Append(ItL.Value());
416 if(myLocalContexts(myCurLocalIndex)->IsIn(anIObj)){
417 for(ItL.Initialize(myLocalContexts(myCurLocalIndex)->SelectionModes(anIObj));
420 theList.Append(ItL.Value());
425 //=======================================================================
426 //function : SetShapeDecomposition
428 //=======================================================================
430 void AIS_InteractiveContext::SetShapeDecomposition(const Handle(AIS_InteractiveObject)& anIObj,
431 const Standard_Boolean StdModeSensitive)
433 if(!HasOpenedContext()) return;
434 myLocalContexts(myCurLocalIndex)->SetShapeDecomposition(anIObj,StdModeSensitive);
437 //=======================================================================
438 //function : SetTemporaryAttributes
440 //=======================================================================
442 void AIS_InteractiveContext::
443 SetTemporaryAttributes(const Handle(AIS_InteractiveObject)& /*anObj*/,
444 const Handle(Prs3d_Drawer)& /*aDrawer*/,
445 const Standard_Boolean /*updateviewer*/)
449 //=======================================================================
450 //function : SubIntensityOn
452 //=======================================================================
453 void AIS_InteractiveContext::
454 SubIntensityOn(const Handle(AIS_InteractiveObject)& anIObj,
455 const Standard_Boolean updateviewer)
457 if(!HasOpenedContext())
459 turnOnSubintensity (anIObj);
463 turnOnSubintensity (anIObj, -1, Standard_False);
464 myLocalContexts(myCurLocalIndex)->SubIntensityOn (anIObj);
470 //=======================================================================
471 //function : SubIntensityOff
473 //=======================================================================
475 void AIS_InteractiveContext::
476 SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj,
477 const Standard_Boolean updateviewer)
479 if(!HasOpenedContext()){
480 if(!myObjects.IsBound(anIObj))
482 const Handle(AIS_GlobalStatus)& GB=myObjects(anIObj);
483 if(!GB->IsSubIntensityOn())
485 GB->SubIntensityOff();
486 Standard_Boolean UpdMain(Standard_False);
488 if(GB->GraphicStatus() == AIS_DS_Displayed)
490 myMainPM->Unhighlight (anIObj);
491 UpdMain = Standard_True;
494 if(IsSelected(anIObj))
495 highlightSelected (anIObj->GlobalSelOwner());
503 const Handle(Prs3d_Drawer)& anObjSelStyle = getSelStyle (anIObj, anIObj->GlobalSelOwner());
504 if(myObjects.IsBound(anIObj)){
505 const Handle(AIS_GlobalStatus)& STAT = myObjects(anIObj);
506 STAT->SubIntensityOff();
507 myMainPM->Unhighlight (anIObj);
508 if (STAT->IsHilighted())
509 HilightWithColor (anIObj, anObjSelStyle, Standard_False);
512 myLocalContexts(myCurLocalIndex)->SubIntensityOff(anIObj);
513 if (IsSelected(anIObj))
514 HilightWithColor (anIObj, anObjSelStyle, Standard_False);
516 if(updateviewer) myMainVwr->Update();
520 //=======================================================================
521 //function : SubIntensityOn
522 //purpose : ALL THE DISPLAYED OBJECTS HAVE SUBINTENSITY...
523 //=======================================================================
524 void AIS_InteractiveContext::SubIntensityOn (const Standard_Boolean theIsToUpdateViewer)
526 if (!HasOpenedContext())
529 turnOnSubintensity();
531 if (theIsToUpdateViewer)
535 //=======================================================================
536 //function : SubIntensityOff
538 //=======================================================================
539 void AIS_InteractiveContext::SubIntensityOff(const Standard_Boolean updateviewer)
541 if(!HasOpenedContext()) return;
543 AIS_DataMapIteratorOfDataMapOfIOStatus It (myObjects);
544 for(;It.More();It.Next()){
545 const Handle(AIS_GlobalStatus)& STAT = It.Value();
546 if(STAT->IsSubIntensityOn())
547 STAT->SubIntensityOff();
548 myMainPM->Unhighlight (It.Key());
551 if(updateviewer) myMainVwr->Update();
554 //=======================================================================
555 //function : AddFilter
557 //=======================================================================
558 void AIS_InteractiveContext::AddFilter(const Handle(SelectMgr_Filter)& aFilter)
560 if(HasOpenedContext())
561 myLocalContexts(myCurLocalIndex)->AddFilter(aFilter);
563 myFilters->Add(aFilter);
566 //=======================================================================
567 //function : ActivateStandardMode
569 //=======================================================================
570 void AIS_InteractiveContext::ActivateStandardMode(const TopAbs_ShapeEnum aStandardActivation)
572 if(!HasOpenedContext()) return;
573 myLocalContexts(myCurLocalIndex)->ActivateStandardMode (aStandardActivation);
576 //=======================================================================
577 //function : DeActivateStandardMode
579 //=======================================================================
580 void AIS_InteractiveContext::DeactivateStandardMode(const TopAbs_ShapeEnum aStandardActivation)
582 if(!HasOpenedContext()) return;
583 myLocalContexts(myCurLocalIndex)->DeactivateStandardMode (aStandardActivation);
586 //=======================================================================
587 //function : RemoveFilter
589 //=======================================================================
590 void AIS_InteractiveContext::RemoveFilter(const Handle(SelectMgr_Filter)& aFilter)
592 if(HasOpenedContext())
593 myLocalContexts(myCurLocalIndex)->RemoveFilter (aFilter);
595 myFilters->Remove(aFilter);
598 //=======================================================================
599 //function : RemoveFilters
601 //=======================================================================
603 void AIS_InteractiveContext::RemoveFilters()
605 if(!HasOpenedContext())
608 myLocalContexts(myCurLocalIndex)->Clear(AIS_CM_Filters);
611 //=======================================================================
612 //function : ActivatedStandardModes
614 //=======================================================================
615 const TColStd_ListOfInteger& AIS_InteractiveContext::ActivatedStandardModes() const
617 return myLocalContexts(myCurLocalIndex)->StandardModes();
620 //=======================================================================
623 //=======================================================================
624 const SelectMgr_ListOfFilter& AIS_InteractiveContext::Filters() const
626 if(HasOpenedContext())
627 return myLocalContexts(myCurLocalIndex)->ListOfFilter();
628 return myFilters->StoredFilters();
631 //=======================================================================
632 //function : DisplayActiveSensitive
634 //=======================================================================
635 void AIS_InteractiveContext::DisplayActiveSensitive(const Handle(V3d_View)& aviou)
637 if(HasOpenedContext())
638 myLocalContexts(myCurLocalIndex)->DisplaySensitive(aviou);
640 myMainSel->DisplaySensitive(aviou);
642 //=======================================================================
643 //function : DisplayActiveSensitive
645 //=======================================================================
647 void AIS_InteractiveContext::DisplayActiveSensitive(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->DisplaySensitive(Sel,anIObj->Transformation(), 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()
739 if(HasOpenedContext()) return 0;
741 Standard_Integer NbStr = PurgeViewer(myMainVwr);
748 //=======================================================================
749 //function : PurgeViewer
751 //=======================================================================
752 Standard_Integer AIS_InteractiveContext::PurgeViewer(const Handle(V3d_Viewer)& Vwr)
754 Handle(Graphic3d_StructureManager) GSM = Vwr->StructureManager();
755 Standard_Integer NbCleared(0);
756 Graphic3d_MapOfStructure SOS;
757 GSM->DisplayedStructures(SOS);
759 Handle(Graphic3d_Structure) G;
760 for(Graphic3d_MapIteratorOfMapOfStructure It(SOS); It.More();It.Next()){
762 Standard_Address Add = G->Owner();
765 G->Clear();// it means that it is not referenced as a presentation of InterfactiveObject...
768 Handle(AIS_InteractiveObject) IO = (AIS_InteractiveObject*)Add;
769 if(!myObjects.IsBound(IO)){
777 //=======================================================================
778 //function : IsImmediateModeOn
780 //=======================================================================
782 Standard_Boolean AIS_InteractiveContext::IsImmediateModeOn() const
784 if(!HasOpenedContext()) return Standard_False;
785 return myLocalContexts(myCurLocalIndex)->IsImmediateModeOn();
788 //=======================================================================
789 //function : BeginImmediateDraw
791 //=======================================================================
793 Standard_Boolean AIS_InteractiveContext::BeginImmediateDraw()
795 return HasOpenedContext()
796 && myLocalContexts (myCurLocalIndex)->BeginImmediateDraw();
799 //=======================================================================
800 //function : ImmediateAdd
802 //=======================================================================
804 Standard_Boolean AIS_InteractiveContext::ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj,
805 const Standard_Integer theMode)
807 return HasOpenedContext()
808 && myLocalContexts (myCurLocalIndex)->ImmediateAdd (theObj, theMode);
811 //=======================================================================
812 //function : EndImmediateDraw
814 //=======================================================================
816 Standard_Boolean AIS_InteractiveContext::EndImmediateDraw (const Handle(V3d_View)& theView)
818 return HasOpenedContext()
819 && myLocalContexts (myCurLocalIndex)->EndImmediateDraw (theView->Viewer());
822 //=======================================================================
823 //function : EndImmediateDraw
825 //=======================================================================
827 Standard_Boolean AIS_InteractiveContext::EndImmediateDraw()
829 if (!HasOpenedContext())
831 return Standard_False;
834 return myLocalContexts (myCurLocalIndex)->EndImmediateDraw (myMainVwr);
838 //=======================================================================
839 //function : ResetOriginalState
841 //=======================================================================
843 void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updateviewer)
845 Standard_Boolean upd_main(Standard_False);
846 TColStd_ListIteratorOfListOfInteger itl;
847 myMainSel->ResetSelectionActivationStatus();
849 for (AIS_DataMapIteratorOfDataMapOfIOStatus it(myObjects);it.More();it.Next()){
850 const Handle(AIS_InteractiveObject)& iobj = it.Key();
851 const Handle(AIS_GlobalStatus)& STAT = it.Value();
852 switch(STAT->GraphicStatus()){
853 case AIS_DS_Displayed:{
854 upd_main = Standard_True;
857 myMainPM->Display (iobj, STAT->DisplayMode());
858 if(STAT->IsHilighted())
860 const Handle(Prs3d_Drawer)& aStyle = STAT->HilightStyle();
861 if (!aStyle.IsNull() && getSelStyle (iobj, iobj->GlobalSelOwner()) != aStyle)
862 HilightWithColor(iobj,aStyle,Standard_False);
865 for(itl.Initialize(STAT->SelectionModes());itl.More();itl.Next()){
867 mgrSelector->Activate(iobj,itl.Value(),myMainSel);
872 EraseGlobal(iobj,Standard_False);