1 // Created on: 1995-02-13
2 // Created by: Mister rmi
3 // Copyright (c) 1995-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.
17 #include <SelectMgr_SelectionManager.ixx>
18 #include <SelectMgr_ViewerSelector.hxx>
19 #include <SelectMgr_Selection.hxx>
20 #include <SelectMgr_SequenceOfSelector.hxx>
21 #include <TColStd_MapIteratorOfMapOfTransient.hxx>
22 #include <TColStd_MapIteratorOfMapOfTransient.hxx>
23 #include <TCollection_AsciiString.hxx>
24 #include <TColStd_ListOfInteger.hxx>
25 #include <TColStd_ListIteratorOfListOfInteger.hxx>
26 #include <SelectMgr_DataMapIteratorOfDataMapOfObjectSelectors.hxx>
27 #include <OSD_Environment.hxx>
30 static Standard_Boolean SelectDebugModeOnSM()
32 static Standard_Integer isDebugMode( -1 );
33 if ( isDebugMode < 0 ) {
35 OSD_Environment selectdb("SELECTIONDEBUG");
36 if ( selectdb.Value().IsEmpty() )
39 return ( isDebugMode != 0 );
42 static Standard_Integer SMSearch(const SelectMgr_SequenceOfSelector& seq,
43 const Handle(SelectMgr_ViewerSelector)& theSel)
45 Standard_Integer ifound=0;
46 for (Standard_Integer i=1;i<=seq.Length()&& ifound==0;i++)
47 {if(theSel==seq.Value(i)) ifound=i;}
52 //==================================================
55 //==================================================
57 SelectMgr_SelectionManager::SelectMgr_SelectionManager()
61 //==================================================
64 //==================================================
65 void SelectMgr_SelectionManager::
66 Add (const Handle(SelectMgr_ViewerSelector)& aViewSel)
68 myselectors.Add(aViewSel);
73 //==================================================
76 //==================================================
77 void SelectMgr_SelectionManager::
78 Remove (const Handle(SelectMgr_ViewerSelector)& aViewSel)
80 SelectMgr_DataMapIteratorOfDataMapOfObjectSelectors It(mylocal);
81 for(;It.More();It.Next())
83 SelectMgr_SequenceOfSelector& theviews =mylocal.ChangeFind(It.Key());
84 Standard_Integer rank = SMSearch(theviews,aViewSel);
85 if(rank!=0 && rank<=theviews.Length()) theviews.Remove(rank);
87 if(myselectors.Contains(aViewSel)) myselectors.Remove(aViewSel);
90 //==================================================
93 //==================================================
94 Standard_Boolean SelectMgr_SelectionManager::
95 Contains (const Handle(SelectMgr_ViewerSelector)& aViewSel) const
96 {return myselectors.Contains(aViewSel);}
98 //==================================================
101 //==================================================
102 Standard_Boolean SelectMgr_SelectionManager::
103 Contains (const Handle(SelectMgr_SelectableObject)& aSelObj) const
104 {if (myglobal.Contains(aSelObj)) return Standard_True;
105 if (mylocal.IsBound(aSelObj)) return Standard_True;
106 return Standard_False;
111 //==================================================
114 //==================================================
116 void SelectMgr_SelectionManager::
117 Load (const Handle(SelectMgr_SelectableObject)& anObject,
118 const Standard_Integer amode)
120 if(!myglobal.Contains(anObject))
121 myglobal.Add(anObject);
123 LoadMode (anObject,amode);
127 //==================================================
130 //==================================================
131 void SelectMgr_SelectionManager::
132 Load (const Handle(SelectMgr_SelectableObject)& anObject,
133 const Handle(SelectMgr_ViewerSelector)& aview,
134 const Standard_Integer amode)
136 if(!myselectors.Contains(aview)) myselectors.Add(aview);
138 LoadMode (anObject,amode);
141 if (mylocal.IsBound(anObject)){
142 SelectMgr_SequenceOfSelector& theviews = mylocal.ChangeFind(anObject);
143 if (SMSearch(theviews,aview)==0) theviews.Append(aview);
146 if(!myglobal.Contains(anObject)){
147 SelectMgr_SequenceOfSelector newviews;
148 newviews.Append(aview);
149 mylocal.Bind(anObject,newviews);
155 //==================================================
158 //==================================================
160 void SelectMgr_SelectionManager::
161 Remove(const Handle(SelectMgr_SelectableObject)& anObject)
164 if(myglobal.Contains(anObject)) {
165 TColStd_MapIteratorOfMapOfTransient It(myselectors);
166 for(;It.More();It.Next())
168 Handle(SelectMgr_ViewerSelector) curview =
169 Handle(SelectMgr_ViewerSelector)::DownCast(It.Key());
170 if(curview->Contains(anObject)){
171 for(anObject->Init();anObject->More();anObject->Next())
173 curview->Remove(anObject->CurrentSelection());
178 myglobal.Remove(anObject);
181 else if(mylocal.IsBound(anObject)) {
182 SelectMgr_SequenceOfSelector& seq = mylocal.ChangeFind (anObject);
183 for (Standard_Integer i=1;i<=seq.Length();i++) {
184 Handle(SelectMgr_ViewerSelector) curview =
185 Handle(SelectMgr_ViewerSelector)::DownCast(seq(i));
186 if(curview->Contains(anObject)){
187 for(anObject->Init();anObject->More();anObject->Next())
189 curview->Remove(anObject->CurrentSelection());
194 mylocal.UnBind(anObject);
198 //==================================================
201 //==================================================
203 void SelectMgr_SelectionManager::
204 Remove(const Handle(SelectMgr_SelectableObject)& anObject,
205 const Handle(SelectMgr_ViewerSelector)& aVS)
207 if(aVS->Contains(anObject)) {
208 for(anObject->Init();anObject->More();anObject->Next()){
209 aVS->Remove(anObject->CurrentSelection());
213 if(mylocal.IsBound(anObject)) {
214 SelectMgr_SequenceOfSelector& seq = mylocal.ChangeFind (anObject);
215 Standard_Boolean NotFound (Standard_True);
216 for (Standard_Integer i=1;i<=seq.Length()&&NotFound;i++) {
219 NotFound =Standard_False;
223 mylocal.UnBind(anObject);
228 //==================================================
229 // Function: Activate
231 //==================================================
233 void SelectMgr_SelectionManager::
234 Activate(const Handle(SelectMgr_SelectableObject)& anObject,
235 const Standard_Integer aMode,
236 const Standard_Boolean AutomaticProj)
238 if(aMode==-1) return;
239 // Standard_Boolean global = Standard_False;
240 if(!anObject->HasSelection(aMode)) LoadMode(anObject,aMode);
243 if(myglobal.Contains(anObject)) {
244 TColStd_MapIteratorOfMapOfTransient It(myselectors);
246 for(;It.More();It.Next()){
247 Handle(SelectMgr_ViewerSelector) curview =
248 Handle(SelectMgr_ViewerSelector)::DownCast(It.Key());
249 Activate(anObject,aMode,curview,AutomaticProj);
253 else if(mylocal.IsBound(anObject)) {
254 SelectMgr_SequenceOfSelector& seq = mylocal.ChangeFind (anObject);
255 for (Standard_Integer i=1;i<=seq.Length();i++) {
256 Handle(SelectMgr_ViewerSelector) curview =
257 Handle(SelectMgr_ViewerSelector)::DownCast(seq(i));
258 // ATTENTION : si la selection est a remettre a jour, on le fait la ....
259 const Handle(SelectMgr_Selection)& Sel = anObject->Selection(aMode);
261 switch(Sel->UpdateStatus()){
262 case SelectMgr_TOU_Full:
263 anObject->UpdateSelection(aMode); // pas de break expres...
264 case SelectMgr_TOU_Partial:
266 if(anObject->HasTransformation())
267 anObject->UpdateTransformation(Sel);
268 Sel->UpdateStatus(SelectMgr_TOU_None);
275 curview->Activate(Sel,AutomaticProj);
281 //==================================================
282 // Function: Activate
284 //==================================================
286 void SelectMgr_SelectionManager::
287 Activate(const Handle(SelectMgr_SelectableObject)& anObject,
288 const Standard_Integer aMode,
289 const Handle(SelectMgr_ViewerSelector)& aViewSel,
290 const Standard_Boolean AutomaticProj)
292 if(aMode==-1) return;
294 if(!myselectors.Contains(aViewSel)) return;
296 if (!anObject->HasSelection(aMode)) LoadMode(anObject,aMode);
298 const Handle(SelectMgr_Selection)& Sel = anObject->Selection(aMode);
300 switch(Sel->UpdateStatus()){
301 case SelectMgr_TOU_Full:
302 anObject->UpdateSelection(aMode);
303 case SelectMgr_TOU_Partial:
305 if(anObject->HasTransformation())
306 anObject->UpdateTransformation(Sel);
312 Sel->UpdateStatus(SelectMgr_TOU_None);
314 if (myglobal.Contains(anObject))
315 aViewSel->Activate (anObject->Selection(aMode));
318 if (mylocal.IsBound(anObject)) {
319 if (SMSearch(mylocal.Find(anObject),aViewSel)==0)
320 (mylocal.ChangeFind (anObject)).Append(aViewSel);
321 aViewSel->Activate (anObject->Selection(aMode),AutomaticProj);
326 //==================================================
327 // Function: Deactivate
329 //==================================================
331 void SelectMgr_SelectionManager::
332 Deactivate(const Handle(SelectMgr_SelectableObject)& anObject)
334 Standard_Boolean global = Standard_False;
335 if(myglobal.Contains(anObject)) global = Standard_True;
336 TColStd_MapIteratorOfMapOfTransient It(myselectors);
337 Handle(SelectMgr_ViewerSelector) curview;
338 for(;It.More();It.Next()){
339 curview = Handle(SelectMgr_ViewerSelector)::DownCast(It.Key());
340 if (global || mylocal.IsBound (anObject)) {
341 for (anObject->Init();anObject->More();anObject->Next())
342 {curview->Deactivate(anObject->CurrentSelection());}
349 //==================================================
350 // Function: Deactivate
352 //==================================================
354 void SelectMgr_SelectionManager::
355 Deactivate(const Handle(SelectMgr_SelectableObject)& anObject,
356 const Standard_Integer amode)
359 Standard_Boolean global = Standard_False;
360 if(myglobal.Contains(anObject)) global = Standard_True;
361 TColStd_MapIteratorOfMapOfTransient It(myselectors);
362 Handle(SelectMgr_ViewerSelector) curview;
363 for(;It.More();It.Next()){
364 curview = Handle(SelectMgr_ViewerSelector)::DownCast(It.Key());
365 if (global || mylocal.IsBound(anObject)) {
366 if(anObject->HasSelection(amode))
367 curview->Deactivate(anObject->Selection(amode));
373 //==================================================
374 // Function: Deactivate
376 //==================================================
378 void SelectMgr_SelectionManager::
379 Deactivate(const Handle(SelectMgr_SelectableObject)& anObject,
380 const Standard_Integer aMode,
381 const Handle(SelectMgr_ViewerSelector)& aViewSel)
383 if(myselectors.Contains(aViewSel))
385 if(myglobal.Contains(anObject)|| mylocal.IsBound(anObject))
386 if(anObject->HasSelection(aMode))
387 aViewSel->Deactivate (anObject->Selection(aMode));
391 //==================================================
392 // Function: Deactivate
394 //==================================================
396 void SelectMgr_SelectionManager::
397 Deactivate(const Handle(SelectMgr_SelectableObject)& anObject,
398 const Handle(SelectMgr_ViewerSelector)& aViewSel)
401 if(myselectors.Contains(aViewSel))
403 if(myglobal.Contains(anObject)|| mylocal.IsBound(anObject)) {
404 for (anObject->Init();anObject->More();anObject->Next())
405 {aViewSel->Deactivate(anObject->CurrentSelection());}}
412 //==================================================
415 //==================================================
416 void SelectMgr_SelectionManager::
417 Sleep (const Handle(SelectMgr_ViewerSelector)& aViewSel)
419 if (myselectors.Contains(aViewSel))
423 void SelectMgr_SelectionManager::
424 Sleep (const Handle(SelectMgr_SelectableObject)& anObject)
427 if(myglobal.Contains(anObject)){
428 for( TColStd_MapIteratorOfMapOfTransient It(myselectors);
430 Handle(SelectMgr_ViewerSelector)::DownCast(It.Key())->Sleep(anObject);
432 else if(mylocal.IsBound(anObject)){
433 const SelectMgr_SequenceOfSelector & VSeq = mylocal(anObject);
434 for (Standard_Integer I=1;I<=VSeq.Length();I++)
435 VSeq(I)->Sleep(anObject);
441 //=======================================================================
444 //=======================================================================
445 void SelectMgr_SelectionManager::
446 Sleep(const Handle(SelectMgr_SelectableObject)& anObject,
447 const Handle(SelectMgr_ViewerSelector)& aViewSel)
449 if(!myselectors.Contains(aViewSel)) return;
451 if(!myglobal.Contains(anObject)){
452 if(!mylocal.IsBound(anObject))
454 if(SMSearch(mylocal(anObject),aViewSel)==0)
457 aViewSel->Sleep(anObject);
462 //==================================================
465 //==================================================
466 void SelectMgr_SelectionManager::
467 Awake (const Handle(SelectMgr_ViewerSelector)& aViewSel,
468 const Standard_Boolean AutomaticProj)
470 if (myselectors.Contains(aViewSel))
471 aViewSel->Awake(AutomaticProj);
475 //=======================================================================
478 //=======================================================================
479 void SelectMgr_SelectionManager::Awake (const Handle(SelectMgr_SelectableObject)& anObject,
480 const Standard_Boolean AutomaticProj)
482 if(myglobal.Contains(anObject)){
483 for( TColStd_MapIteratorOfMapOfTransient It(myselectors);
485 Handle(SelectMgr_ViewerSelector)::DownCast( It.Key())->Awake(anObject,AutomaticProj);
487 else if(mylocal.IsBound(anObject)){
488 const SelectMgr_SequenceOfSelector & VSeq = mylocal(anObject);
489 for (Standard_Integer I=1;I<=VSeq.Length();I++)
490 VSeq(I)->Awake(anObject,AutomaticProj);
494 //=======================================================================
497 //=======================================================================
498 void SelectMgr_SelectionManager::Awake (const Handle(SelectMgr_SelectableObject)& anObject,
499 const Handle(SelectMgr_ViewerSelector)& aViewSel,
500 const Standard_Boolean AutomaticProj)
502 if(!myselectors.Contains(aViewSel)) return;
504 if(!myglobal.Contains(anObject)){
505 if(!mylocal.IsBound(anObject))
507 if(SMSearch(mylocal(anObject),aViewSel)==0)
510 aViewSel->Awake(anObject,AutomaticProj);
515 //=======================================================================
516 //function : IsActivated
518 //=======================================================================
519 Standard_Boolean SelectMgr_SelectionManager::IsActivated(const Handle(SelectMgr_SelectableObject)& anObject) const
521 for(anObject->Init();anObject->More();anObject->Next()){
522 if(IsActivated(anObject,anObject->CurrentSelection()->Mode()))
523 return Standard_True;
525 return Standard_False;
527 //=======================================================================
528 //function : IsActivated
530 //=======================================================================
531 Standard_Boolean SelectMgr_SelectionManager::IsActivated(const Handle(SelectMgr_SelectableObject)& anObject,
532 const Standard_Integer aMode) const
534 if(!anObject->HasSelection(aMode)) return Standard_False;
535 if (!(myglobal.Contains(anObject) || mylocal.IsBound(anObject)))
536 return Standard_False;
538 Handle(Standard_Transient) Tr;
539 const Handle(SelectMgr_Selection)& Sel = anObject->Selection(aMode);
540 for(TColStd_MapIteratorOfMapOfTransient It(myselectors);It.More();It.Next()){
542 Handle(SelectMgr_ViewerSelector) VS = *((Handle(SelectMgr_ViewerSelector)*)&Tr);
543 if(VS->Status(Sel)==SelectMgr_SOS_Activated)
544 return Standard_True;
546 return Standard_False;
550 //=======================================================================
551 //function : IsActivated
553 //=======================================================================
554 Standard_Boolean SelectMgr_SelectionManager::IsActivated(const Handle(SelectMgr_SelectableObject)& anObject,
555 const Handle(SelectMgr_ViewerSelector)& VS,
556 const Standard_Integer aMode) const
558 if(!anObject->HasSelection(aMode))
559 return Standard_False;
560 if(!myselectors.Contains(VS))
561 return Standard_False;
562 if (!(myglobal.Contains(anObject) || mylocal.IsBound(anObject)))
563 return Standard_False;
564 const Handle(SelectMgr_Selection)& Sel = anObject->Selection(aMode);
565 return (VS->Status(Sel)==SelectMgr_SOS_Activated);
568 //==================================================
571 //==================================================
572 void SelectMgr_SelectionManager::
573 RecomputeSelection (const Handle(SelectMgr_SelectableObject)& anObject,
574 const Standard_Boolean ForceUpdate,
575 const Standard_Integer aMode)
577 if( SelectDebugModeOnSM() ) cout<<"===>SelectMgr_SelectionManager::Update"<<endl;
580 if( SelectDebugModeOnSM() ) cout<<"\t Global Recalculation of selections"<<endl;
582 anObject->UpdateSelection();
583 anObject->UpdateTransformation();
585 else if(anObject->HasSelection(aMode)){
586 anObject->UpdateSelection(aMode);
587 anObject->UpdateTransformation();
591 // objet is not known to SMgr.
592 if (!(myglobal.Contains(anObject) || mylocal.IsBound(anObject))){
593 if( SelectDebugModeOnSM() ) {cout<<"\t Object not loaded in the SelectionManager"<<endl;
594 cout<<"\t eventual selections are flagged"<<endl;}
596 for(anObject->Init();anObject->More();anObject->Next()){
597 if( SelectDebugModeOnSM() ) cout<<"\t\t Mode "<<anObject->CurrentSelection()->Mode()<<" ";
598 anObject->CurrentSelection()->UpdateStatus(SelectMgr_TOU_Full);
600 if( SelectDebugModeOnSM() )
603 else if (anObject->HasSelection(aMode))
604 anObject->Selection(aMode)->UpdateStatus(SelectMgr_TOU_Full);
607 // recalculate whatever is required
608 // and set flag on top...
610 TColStd_MapIteratorOfMapOfTransient It;
611 Handle(Standard_Transient) Tr;
612 Standard_Boolean Found;
613 // object selections are parsed
615 for(anObject->Init();anObject->More();anObject->Next()){
616 const Handle(SelectMgr_Selection)& Sel = anObject->CurrentSelection();
617 Sel->UpdateStatus(SelectMgr_TOU_Full);
618 Standard_Integer curmode = Sel->Mode();
619 Found = Standard_False;
621 // parsing of selections ...
622 for(It.Initialize(myselectors);It.More();It.Next()){
624 Handle(SelectMgr_ViewerSelector) VS = *((Handle(SelectMgr_ViewerSelector)*)&Tr);
625 if(VS->Status(Sel)==SelectMgr_SOS_Activated){
626 Found = Standard_True;
627 switch(Sel->UpdateStatus()){
628 case SelectMgr_TOU_Full:
629 anObject->UpdateSelection(curmode); // no break on purpose...
630 case SelectMgr_TOU_Partial:
631 anObject->UpdateTransformation(Sel);
638 Sel->UpdateStatus(SelectMgr_TOU_None);
646 //=======================================================================
648 //purpose : Selections are recalculated if they are flagged
649 // "TO RECALCULATE" and activated in one of selectors.
650 // If ForceUpdate = True, and they are "TO RECALCULATE"
651 // This is done without caring for the state of activation.
652 //=======================================================================
653 void SelectMgr_SelectionManager::Update(const Handle(SelectMgr_SelectableObject)& anObject,
654 const Standard_Boolean ForceUpdate)
656 PrsMgr_ListOfPresentableObjectsIter anIter (anObject->Children());
657 for (; anIter.More(); anIter.Next())
659 const Handle(SelectMgr_SelectableObject) aSelectable = Handle(SelectMgr_SelectableObject)::DownCast (anIter.Value());
661 if (!aSelectable.IsNull())
663 Update (aSelectable, ForceUpdate);
667 Standard_Boolean wasrecomputed;
669 for(anObject->Init();anObject->More();anObject->Next()){
670 const Handle(SelectMgr_Selection)& Sel = anObject->CurrentSelection();
671 wasrecomputed = Standard_False;
673 switch(Sel->UpdateStatus()){
674 case SelectMgr_TOU_Full:
675 anObject->UpdateSelection(Sel->Mode()); // no break on purpose...
676 case SelectMgr_TOU_Partial:
677 anObject->UpdateTransformation(Sel);
678 wasrecomputed = Standard_True;
683 Sel->UpdateStatus(SelectMgr_TOU_None);
686 // it is checked which selectors are concerned by the selection
687 // to redo projections if necessary.
688 Handle(Standard_Transient) Tr;
689 for(TColStd_MapIteratorOfMapOfTransient It(myselectors);It.More();It.Next()){
691 Handle(SelectMgr_ViewerSelector) VS = *((Handle(SelectMgr_ViewerSelector)*)&Tr);
692 if(VS->Status(Sel)==SelectMgr_SOS_Activated)
693 switch(Sel->UpdateStatus()){
694 case SelectMgr_TOU_Full:
695 anObject->UpdateSelection(Sel->Mode()); // no break on purpose...
696 case SelectMgr_TOU_Partial:
697 anObject->UpdateTransformation(Sel);
698 wasrecomputed = Standard_True;
705 Sel->UpdateStatus(SelectMgr_TOU_None);
711 //==================================================
713 // Purpose : Attention, it is required to know what is done...
714 //==================================================
715 void SelectMgr_SelectionManager::
716 Update(const Handle(SelectMgr_SelectableObject)& anObject,
717 const Handle(SelectMgr_ViewerSelector)& aViewSel,
718 const Standard_Boolean ForceUpdate)
720 if( SelectDebugModeOnSM() ) cout<<"==>SelectMgr_SelectionManager::Update(obj,VS)"<<endl;
721 if(!myselectors.Contains(aViewSel)) return;
723 Standard_Boolean okay = myglobal.Contains(anObject);
725 okay = (mylocal.IsBound(anObject) && (SMSearch(mylocal.Find(anObject),aViewSel)!=0)) ;
730 Standard_Boolean wasrecomputed;
731 for(anObject->Init();anObject->More();anObject->Next()){
732 const Handle(SelectMgr_Selection)& Sel = anObject->CurrentSelection();
733 wasrecomputed = Standard_False;
735 switch(Sel->UpdateStatus()){
736 case SelectMgr_TOU_Full:
737 anObject->UpdateSelection(Sel->Mode()); // no break on purpose...
738 case SelectMgr_TOU_Partial:
739 anObject->UpdateTransformation(Sel);
740 wasrecomputed = Standard_True;
745 Sel->UpdateStatus(SelectMgr_TOU_None);
748 if(aViewSel->Status(Sel) == SelectMgr_SOS_Activated){
749 switch(Sel->UpdateStatus()){
750 case SelectMgr_TOU_Full:
751 anObject->UpdateSelection(Sel->Mode());
752 case SelectMgr_TOU_Partial:
753 if(anObject->HasTransformation())
754 anObject->UpdateTransformation(Sel);
755 wasrecomputed = Standard_True;
761 aViewSel->Convert(Sel);
762 Sel->UpdateStatus(SelectMgr_TOU_None);
767 //==================================================
770 //==================================================
771 TCollection_AsciiString SelectMgr_SelectionManager::
773 TCollection_AsciiString theMgrStatus("\t\t\tStatus of the SelectManager :;\n\t\t\t============================\n");
775 TCollection_AsciiString nbview (myselectors.Extent()),nbglobal(myglobal.Extent());
777 theMgrStatus += "\t Number of ViewerSelectors: ";
778 theMgrStatus += nbview + "\n\t Number of global objects : " + nbglobal+"\n";
779 theMgrStatus = theMgrStatus+"\t Number of local objects : " + TCollection_AsciiString (mylocal.Extent())+" \n";
784 //==================================================
787 //==================================================
790 TCollection_AsciiString SelectMgr_SelectionManager::
791 Status(const Handle(SelectMgr_SelectableObject)& anObject) const
793 TCollection_AsciiString TheStatus("\t\tStatus of object:");
795 if(myglobal.Contains(anObject))
796 {TheStatus += "GLOBAL (available for all viewers in the SelectionManager)\n";}
797 else if (mylocal.IsBound(anObject))TheStatus +="LOCAL:\n\t\t";
798 TColStd_MapIteratorOfMapOfTransient It(myselectors);
799 Standard_Integer iv = 0;
800 // Standard_Boolean FirstTime=Standard_True;
801 for(;It.More();It.Next()){
802 const Handle(SelectMgr_ViewerSelector)& curview =
803 Handle(SelectMgr_ViewerSelector)::DownCast(It.Key());
805 TheStatus = TheStatus + "status in the ViewerSelector :"+TCollection_AsciiString(iv)+"\n\t\t";
806 TheStatus+=curview->Status(anObject);
807 TheStatus+="\n\t\t----------------------\n\t\t";
814 //==================================================
815 // Function: LoadMode
816 // Purpose : Private Method
817 //==================================================
820 void SelectMgr_SelectionManager
821 ::LoadMode (const Handle(SelectMgr_SelectableObject)& anObject,
822 const Standard_Integer amode)
824 if(amode==-1) return;
825 if(!anObject->HasSelection(amode))
827 Handle(SelectMgr_Selection) NewSel = new SelectMgr_Selection(amode);
828 anObject->AddSelection (NewSel,amode);
833 //=======================================================================
834 //function : SetUpdateMode
836 //=======================================================================
838 void SelectMgr_SelectionManager::
839 SetUpdateMode(const Handle(SelectMgr_SelectableObject)& anObject,
840 const SelectMgr_TypeOfUpdate aType)
842 for(anObject->Init();anObject->More();anObject->Next())
843 anObject->CurrentSelection()->UpdateStatus(aType);
847 void SelectMgr_SelectionManager::
848 SetUpdateMode(const Handle(SelectMgr_SelectableObject)& anObject,
849 const Standard_Integer aMode,
850 const SelectMgr_TypeOfUpdate aType)
852 if(anObject->HasSelection(aMode))
853 anObject->Selection(aMode)->UpdateStatus(aType);