1 // Created on: 1995-02-15
2 // Created by: Roberc Coublanc
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.
18 // ROB JAN/07/98 : Improve Storage of detected entities
19 // AGV OCT/23/03 : Optimize the method SortResult() (OCC4201)
21 #include <BVH_Tree.hxx>
23 #include <OSD_Environment.hxx>
24 #include <Precision.hxx>
25 #include <SelectMgr_ViewerSelector.hxx>
26 #include <SelectMgr_CompareResults.hxx>
27 #include <SelectBasics_EntityOwner.hxx>
28 #include <SelectBasics_SensitiveEntity.hxx>
29 #include <SelectBasics_PickResult.hxx>
30 #include <SelectMgr_EntityOwner.hxx>
31 #include <SelectMgr_SortCriterion.hxx>
32 #include <SelectMgr_SensitiveEntitySet.hxx>
33 #include <SortTools_QuickSortOfInteger.hxx>
34 #include <TColStd_Array1OfInteger.hxx>
35 #include <TCollection_AsciiString.hxx>
36 #include <TColStd_HArray1OfInteger.hxx>
37 #include <TColStd_ListOfInteger.hxx>
39 IMPLEMENT_STANDARD_HANDLE (SelectMgr_ViewerSelector, MMgt_TShared)
40 IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_ViewerSelector, MMgt_TShared)
42 static Standard_Boolean SelectDebugModeOnVS()
44 static Standard_Integer isDebugMode( -1 );
45 if ( isDebugMode < 0 ) {
47 OSD_Environment selectdb("SELDEBUGMODE");
48 if ( selectdb.Value().IsEmpty() )
51 return ( isDebugMode != 0 );
54 SelectMgr_ToleranceMap::SelectMgr_ToleranceMap()
59 SelectMgr_ToleranceMap::~SelectMgr_ToleranceMap()
64 void SelectMgr_ToleranceMap::Add (const Standard_Real& theTolerance)
66 if (myTolerances.IsBound (theTolerance))
68 Standard_Integer& aFreq = myTolerances.ChangeFind (theTolerance);
71 if (theTolerance == myLargestKey)
74 Standard_Integer aMaxFreq = myTolerances.Find (myLargestKey);
75 if (aFreq >= aMaxFreq)
77 myLargestKey = aFreq == aMaxFreq ? Max (myLargestKey, theTolerance) : theTolerance;
82 if (myTolerances.IsEmpty())
84 myTolerances.Bind (theTolerance, 1);
85 myLargestKey = theTolerance;
89 myTolerances.Bind (theTolerance, 1);
90 Standard_Integer aMaxFreq = myTolerances.Find (myLargestKey);
93 myLargestKey = aMaxFreq == 1 ? Max (myLargestKey, theTolerance) : theTolerance;
98 void SelectMgr_ToleranceMap::Decrement (const Standard_Real& theTolerance)
100 if (myTolerances.IsBound (theTolerance))
102 Standard_Integer& aFreq = myTolerances.ChangeFind (theTolerance);
105 if (theTolerance == myLargestKey)
107 Standard_Integer aMaxFreq = aFreq;
108 for (NCollection_DataMap<Standard_Real, Standard_Integer>::Iterator anIter (myTolerances); anIter.More(); anIter.Next())
110 if (aMaxFreq <= anIter.Value() && myLargestKey != anIter.Key())
112 aMaxFreq = anIter.Value();
113 myLargestKey = anIter.Key();
120 Standard_Real SelectMgr_ToleranceMap::Largest()
125 //==================================================
126 // Function: Initialize
128 //==================================================
129 SelectMgr_ViewerSelector::SelectMgr_ViewerSelector():
130 preferclosest(Standard_True),
132 myToUpdateTolerance (Standard_True),
134 myIsLeftChildQueuedFirst (Standard_False),
137 mySelectableObjects = new SelectMgr_SelectableObjectSet();
141 //==================================================
142 // Function: Activate
144 //==================================================
145 void SelectMgr_ViewerSelector::Activate (const Handle(SelectMgr_Selection)& theSelection)
147 for (theSelection->Init(); theSelection->More(); theSelection->Next())
149 theSelection->Sensitive()->SetActiveForSelection();
152 theSelection->SetSelectionState (SelectMgr_SOS_Activated);
154 myTolerances.Add (theSelection->Sensitivity());
155 mytolerance = myTolerances.Largest();
156 myToUpdateTolerance = Standard_True;
160 //==================================================
161 // Function: Deactivate
163 //==================================================
164 void SelectMgr_ViewerSelector::Deactivate (const Handle(SelectMgr_Selection)& theSelection)
166 for (theSelection->Init(); theSelection->More(); theSelection->Next())
168 theSelection->Sensitive()->ResetSelectionActiveStatus();
171 theSelection->SetSelectionState (SelectMgr_SOS_Deactivated);
173 myTolerances.Decrement (theSelection->Sensitivity());
174 mytolerance = myTolerances.Largest();
175 myToUpdateTolerance = Standard_True;
178 //==================================================
181 //==================================================
182 void SelectMgr_ViewerSelector::Clear()
185 myMapOfDetected.Clear();
188 //=======================================================================
189 // function: checkOverlap
190 // purpose : Internal function that checks if a particular sensitive
191 // entity theEntity overlaps current selecting volume precisely
192 //=======================================================================
193 void SelectMgr_ViewerSelector::checkOverlap (const Handle(SelectBasics_SensitiveEntity)& theEntity,
194 const Standard_Integer theEntityIdx,
195 SelectMgr_SelectingVolumeManager& theMgr)
197 const Handle(SelectMgr_EntityOwner)& anOwner =
198 Handle(SelectMgr_EntityOwner)::DownCast (theEntity->OwnerId());
200 SelectBasics_PickResult aPickResult;
201 if (theEntity->Matches (theMgr, aPickResult))
203 if (!anOwner.IsNull())
205 Standard_Boolean isPointSelection =
206 theMgr.GetActiveSelectionType() == SelectMgr_SelectingVolumeManager::Point;
207 if (HasDepthClipping (anOwner) && isPointSelection)
209 Standard_Boolean isClipped = theMgr.IsClipped (anOwner->Selectable()->GetClipPlanes(),
210 aPickResult.Depth());
215 Standard_Integer aPriority = anOwner->Priority();
217 SelectMgr_SortCriterion aCriterion (aPriority, aPickResult.Depth(), aPickResult.DistToGeomCenter(), theEntity->SensitivityFactor() / 33, preferclosest);
218 if (mystored.Contains (anOwner))
220 if (theMgr.GetActiveSelectionType() != 1)
222 SelectMgr_SortCriterion& aPrevCriterion = mystored.ChangeFromKey (anOwner);
223 if (aCriterion > aPrevCriterion)
225 aPrevCriterion = aCriterion;
226 myMapOfDetected.ChangeFind (anOwner) = theEntityIdx;
232 mystored.Add (anOwner, aCriterion);
233 myMapOfDetected.Bind (anOwner, theEntityIdx);
239 //=======================================================================
240 // function: traverseObject
241 // purpose : Internal function that checks if there is possible overlap
242 // between some entity of selectable object theObject and
243 // current selecting volume
244 //=======================================================================
245 void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_SelectableObject)& theObject)
247 NCollection_Handle<SelectMgr_SensitiveEntitySet>& anEntitySet =
248 myMapOfObjectSensitives.ChangeFind (theObject);
250 if (anEntitySet->Size() == 0)
253 const NCollection_Handle<BVH_Tree<Standard_Real, 3> >& aSensitivesTree = anEntitySet->BVH();
255 SelectMgr_SelectingVolumeManager aMgr = theObject->HasTransformation() ?
256 mySelectingVolumeMgr.Transform (theObject->InversedTransformation()) : mySelectingVolumeMgr;
258 Standard_Integer aNode = 0; // a root node
259 if (!aMgr.Overlaps (aSensitivesTree->MinPoint (0),
260 aSensitivesTree->MaxPoint (0)))
264 Standard_Integer aStack[32];
265 Standard_Integer aHead = -1;
268 if (!aSensitivesTree->IsOuter (aNode))
270 const Standard_Integer aLeftChildIdx = aSensitivesTree->LeftChild (aNode);
271 const Standard_Integer aRightChildIdx = aSensitivesTree->RightChild (aNode);
272 const Standard_Boolean isLeftChildIn = aMgr.Overlaps (aSensitivesTree->MinPoint (aLeftChildIdx),
273 aSensitivesTree->MaxPoint (aLeftChildIdx));
274 const Standard_Boolean isRightChildIn = aMgr.Overlaps (aSensitivesTree->MinPoint (aRightChildIdx),
275 aSensitivesTree->MaxPoint (aRightChildIdx));
279 aNode = aLeftChildIdx;
281 aStack[aHead] = aRightChildIdx;
283 else if (isLeftChildIn
286 aNode = isLeftChildIn ? aLeftChildIdx : aRightChildIdx;
295 aNode = aStack[aHead];
301 Standard_Integer aStartIdx = aSensitivesTree->BegPrimitive (aNode);
302 Standard_Integer anEndIdx = aSensitivesTree->EndPrimitive (aNode);
303 for (Standard_Integer anIdx = aStartIdx; anIdx <= anEndIdx; ++anIdx)
305 const Handle(SelectMgr_SensitiveEntity)& aSensitive =
306 anEntitySet->GetSensitiveById (anIdx);
307 if (aSensitive->IsActiveForSelection())
309 checkOverlap (aSensitive->BaseSensitive(), anIdx, aMgr);
317 aNode = aStack[aHead];
323 //=======================================================================
324 // function: TraverseSensitives
325 // purpose : Traverses BVH containing all added selectable objects and
326 // finds candidates for further search of overlap
327 //=======================================================================
328 void SelectMgr_ViewerSelector::TraverseSensitives()
331 myMapOfDetected.Clear();
333 if (mySelectableObjects->Size() == 0)
336 const NCollection_Handle<BVH_Tree<Standard_Real, 3> >& anObjectsTree = mySelectableObjects->BVH();
338 Standard_Integer aNode = 0;
339 if (!mySelectingVolumeMgr.Overlaps (anObjectsTree->MinPoint (0),
340 anObjectsTree->MaxPoint (0)))
344 Standard_Integer aStack[32];
345 Standard_Integer aHead = -1;
348 if (!anObjectsTree->IsOuter (aNode))
350 const Standard_Integer aLeftChildIdx = anObjectsTree->LeftChild (aNode);
351 const Standard_Integer aRightChildIdx = anObjectsTree->RightChild (aNode);
352 const Standard_Boolean isLeftChildIn =
353 mySelectingVolumeMgr.Overlaps (anObjectsTree->MinPoint (aLeftChildIdx),
354 anObjectsTree->MaxPoint (aLeftChildIdx));
355 const Standard_Boolean isRightChildIn =
356 mySelectingVolumeMgr.Overlaps (anObjectsTree->MinPoint (aRightChildIdx),
357 anObjectsTree->MaxPoint (aRightChildIdx));
361 aNode = aLeftChildIdx;
363 aStack[aHead] = aRightChildIdx;
365 else if (isLeftChildIn
368 aNode = isLeftChildIn ? aLeftChildIdx : aRightChildIdx;
377 aNode = aStack[aHead];
383 Standard_Integer aStartIdx = anObjectsTree->BegPrimitive (aNode);
384 Standard_Integer anEndIdx = anObjectsTree->EndPrimitive (aNode);
385 for (Standard_Integer anIdx = aStartIdx; anIdx <= anEndIdx; ++anIdx)
387 traverseObject (mySelectableObjects->GetObjectById (anIdx));
394 aNode = aStack[aHead];
401 if (SelectDebugModeOnVS())
403 cout<<"\tSelectMgr_VS:: Resultat du move"<<endl;
404 cout<<"\tNb Detectes :"<<mystored.Extent()<<endl;
406 for(Standard_Integer i=1; i<=mystored.Extent(); i++)
408 const SelectMgr_SortCriterion& Crit = mystored (myIndexes->Value(i));
409 cout << "\t" << i << " - Prior" << Crit.Priority()
410 << " - prof :" << Crit.Depth()
411 << " - Dist. :" << Crit.MinDist() << endl;
416 //==================================================
419 //==================================================
420 Handle(SelectMgr_EntityOwner) SelectMgr_ViewerSelector
423 Standard_Integer RankInMap = myIndexes->Value (myCurRank);
424 const Handle(SelectBasics_EntityOwner)& toto = mystored.FindKey(RankInMap);
425 Handle(SelectMgr_EntityOwner) Ownr = *((Handle(SelectMgr_EntityOwner)*) &toto);
431 //=======================================================================
434 //=======================================================================
435 Standard_Boolean SelectMgr_ViewerSelector::More()
437 if(mystored.Extent()==0) return Standard_False;
438 if(myCurRank==0) return Standard_False;
439 return myCurRank <= myIndexes->Length();
442 //==================================================
443 // Function: OnePicked
444 // Purpose : only the best one is chosen
445 // depend on priority and mindist...
446 //==================================================
448 Handle(SelectMgr_EntityOwner) SelectMgr_ViewerSelector
454 Standard_Integer RankInMap = myIndexes->Value (myIndexes->Lower());
455 const Handle(SelectBasics_EntityOwner)& toto = mystored.FindKey(RankInMap);
456 Handle(SelectMgr_EntityOwner) Ownr = *((Handle(SelectMgr_EntityOwner)*) &toto);
460 Handle (SelectMgr_EntityOwner) NullObj; //returns a null Handle if there was not successfull pick...
465 //=======================================================================
466 //function : NbPicked
468 //=======================================================================
470 Standard_Integer SelectMgr_ViewerSelector::NbPicked() const
472 return mystored.Extent();
474 //=======================================================================
477 //=======================================================================
478 Handle(SelectMgr_EntityOwner) SelectMgr_ViewerSelector::Picked(const Standard_Integer aRank) const
481 Handle(SelectMgr_EntityOwner) anOwner;
482 if (aRank < 1 || aRank > NbPicked())
484 Standard_Integer anOwnerIdx = myIndexes->Value (aRank);
487 const Handle(SelectBasics_EntityOwner)& aStoredOwner = mystored.FindKey (anOwnerIdx);
488 anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aStoredOwner);
492 //===================================================
494 // INTERNAL METHODS ....
496 //==================================================
498 //==================================================
499 // Function: Contains
501 //==================================================
502 Standard_Boolean SelectMgr_ViewerSelector::Contains (const Handle(SelectMgr_SelectableObject)& theObject) const
504 return mySelectableObjects->Contains (theObject);
507 //==================================================
508 // Function: ActiveModes
509 // Purpose : return all the modes with a given state for an object
510 //==================================================
511 Standard_Boolean SelectMgr_ViewerSelector::Modes (const Handle(SelectMgr_SelectableObject)& theSelectableObject,
512 TColStd_ListOfInteger& theModeList,
513 const SelectMgr_StateOfSelection theWantedState) const
515 Standard_Boolean hasActivatedStates = mySelectableObjects->Contains (theSelectableObject);
516 for (theSelectableObject->Init(); theSelectableObject->More(); theSelectableObject->Next())
518 if (theWantedState == SelectMgr_SOS_Any)
520 theModeList.Append (theSelectableObject->CurrentSelection()->Mode());
522 else if (theWantedState == theSelectableObject->CurrentSelection()->GetSelectionState())
524 theModeList.Append (theSelectableObject->CurrentSelection()->Mode());
528 return hasActivatedStates;
531 //==================================================
532 // Function: IsActive
534 //==================================================
535 Standard_Boolean SelectMgr_ViewerSelector::IsActive (const Handle(SelectMgr_SelectableObject)& theSelectableObject,
536 const Standard_Integer theMode) const
538 if (!mySelectableObjects->Contains (theSelectableObject))
539 return Standard_False;
541 for (theSelectableObject->Init(); theSelectableObject->More(); theSelectableObject->Next())
543 if (theMode == theSelectableObject->CurrentSelection()->Mode())
545 return theSelectableObject->CurrentSelection()->GetSelectionState() == SelectMgr_SOS_Activated;
549 return Standard_False;
552 //==================================================
553 // Function: IsInside
555 //==================================================
556 Standard_Boolean SelectMgr_ViewerSelector::IsInside (const Handle(SelectMgr_SelectableObject)& theSelectableObject,
557 const Standard_Integer theMode) const
559 if (!mySelectableObjects->Contains (theSelectableObject))
560 return Standard_False;
562 for (theSelectableObject->Init(); theSelectableObject->More(); theSelectableObject->Next())
564 if (theMode == theSelectableObject->CurrentSelection()->Mode())
566 return theSelectableObject->CurrentSelection()->GetSelectionState() != SelectMgr_SOS_Unknown;
570 return Standard_False;
574 //=======================================================================
577 //=======================================================================
579 SelectMgr_StateOfSelection SelectMgr_ViewerSelector::Status (const Handle(SelectMgr_Selection)& theSelection) const
581 return theSelection->GetSelectionState();
584 //==================================================
586 // Purpose : gives Information about selectors
587 //==================================================
589 TCollection_AsciiString SelectMgr_ViewerSelector::Status (const Handle(SelectMgr_SelectableObject)& theSelectableObject) const
591 TCollection_AsciiString aStatus ("Status Object :\n\t");
593 for (theSelectableObject->Init(); theSelectableObject->More(); theSelectableObject->Next())
595 if (theSelectableObject->CurrentSelection()->GetSelectionState() != SelectMgr_SOS_Unknown)
597 aStatus = aStatus + "Mode " +
598 TCollection_AsciiString (theSelectableObject->CurrentSelection()->Mode()) +
600 if (theSelectableObject->CurrentSelection()->GetSelectionState() == SelectMgr_SOS_Activated)
602 aStatus = aStatus + " Active \n\t";
606 aStatus = aStatus + " Inactive \n\t";
611 if (mySelectableObjects->Contains (theSelectableObject))
613 aStatus = aStatus + "Not Present in the selector\n\n";
619 //=======================================================================
620 //function : SortResult
621 //purpose : there is a certain number of entities ranged by criteria
622 // (depth, size, priority, mouse distance from borders or
623 // CDG of the detected primitive. Parsing :
624 // maximum priorities .
625 // then a reasonable compromise between depth and distance...
626 // finally the ranges are stored in myindexes depending on the parsing.
627 // so, it is possible to only read
628 //=======================================================================
629 void SelectMgr_ViewerSelector::SortResult()
631 if(mystored.IsEmpty()) return;
633 const Standard_Integer anExtent = mystored.Extent();
634 if(myIndexes.IsNull() || anExtent != myIndexes->Length())
635 myIndexes = new TColStd_HArray1OfInteger (1, anExtent);
638 TColStd_Array1OfInteger& thearr = myIndexes->ChangeArray1();
640 // indices from 1 to N are loaded
642 for (I=1; I <= anExtent; I++)
645 SortTools_QuickSortOfInteger::Sort (thearr,
646 SelectMgr_CompareResults(mystored));
649 //=======================================================================
650 //function : HasDepthClipping
652 //=======================================================================
653 Standard_Boolean SelectMgr_ViewerSelector::HasDepthClipping (const Handle(SelectMgr_EntityOwner)& /*theOwner*/) const
655 return Standard_False;
658 //=======================================================================
659 // function : AddSelectableObject
660 // purpose : Adds new object to the map of selectable objects
661 //=======================================================================
662 void SelectMgr_ViewerSelector::AddSelectableObject (const Handle(SelectMgr_SelectableObject)& theObject)
664 if (!myMapOfObjectSensitives.IsBound (theObject))
666 mySelectableObjects->Append (theObject);
667 NCollection_Handle<SelectMgr_SensitiveEntitySet> anEntitySet = new SelectMgr_SensitiveEntitySet();
668 myMapOfObjectSensitives.Bind (theObject, anEntitySet);
672 //=======================================================================
673 // function : AddSelectionToObject
674 // purpose : Adds new selection to the object and builds its BVH tree
675 //=======================================================================
676 void SelectMgr_ViewerSelector::AddSelectionToObject (const Handle(SelectMgr_SelectableObject)& theObject,
677 const Handle(SelectMgr_Selection)& theSelection)
679 if (myMapOfObjectSensitives.IsBound (theObject))
681 NCollection_Handle<SelectMgr_SensitiveEntitySet>& anEntitySet =
682 myMapOfObjectSensitives.ChangeFind (theObject);
683 anEntitySet->Append (theSelection);
688 AddSelectableObject (theObject);
689 AddSelectionToObject (theObject, theSelection);
693 //=======================================================================
694 // function : RemoveSelectableObject
695 // purpose : Removes selectable object from map of selectable ones
696 //=======================================================================
697 void SelectMgr_ViewerSelector::RemoveSelectableObject (const Handle(SelectMgr_SelectableObject)& theObject)
699 if (myMapOfObjectSensitives.IsBound (theObject))
701 myMapOfObjectSensitives.UnBind (theObject);
702 mySelectableObjects->Remove (theObject);
706 //=======================================================================
707 // function : RemoveSelectionOfObject
708 // purpose : Removes selection of the object and marks its BVH tree
710 //=======================================================================
711 void SelectMgr_ViewerSelector::RemoveSelectionOfObject (const Handle(SelectMgr_SelectableObject)& theObject,
712 const Handle(SelectMgr_Selection)& theSelection)
714 if (myMapOfObjectSensitives.IsBound (theObject))
716 NCollection_Handle<SelectMgr_SensitiveEntitySet>& anEntitySet =
717 myMapOfObjectSensitives.ChangeFind (theObject);
718 anEntitySet->Remove (theSelection);
722 //=======================================================================
723 // function : RebuildObjectsTree
724 // purpose : Marks BVH of selectable objects for rebuild
725 //=======================================================================
726 void SelectMgr_ViewerSelector::RebuildObjectsTree (const Standard_Boolean theIsForce)
728 mySelectableObjects->MarkDirty();
732 mySelectableObjects->BVH();
736 //=======================================================================
737 // function : RebuildSensitivesTree
738 // purpose : Marks BVH of sensitive entities of particular selectable
739 // object for rebuild
740 //=======================================================================
741 void SelectMgr_ViewerSelector::RebuildSensitivesTree (const Handle(SelectMgr_SelectableObject)& theObject,
742 const Standard_Boolean theIsForce)
744 if (!mySelectableObjects->Contains (theObject))
747 NCollection_Handle<SelectMgr_SensitiveEntitySet>& anEntitySet = myMapOfObjectSensitives.ChangeFind (theObject);
748 anEntitySet->MarkDirty();
756 //=======================================================================
757 // function : resetSelectionActivationStatus
758 // purpose : Marks all added sensitive entities of all objects as
760 //=======================================================================
761 void SelectMgr_ViewerSelector::resetSelectionActivationStatus()
763 SelectMgr_MapOfObjectSensitivesIterator aSensitivesIter (myMapOfObjectSensitives);
764 for ( ; aSensitivesIter.More(); aSensitivesIter.Next())
766 NCollection_Handle<SelectMgr_SensitiveEntitySet>& anEntitySet =
767 aSensitivesIter.ChangeValue();
768 Standard_Integer anEntitiesNb = anEntitySet->Size();
769 for (Standard_Integer anIdx = 0; anIdx < anEntitiesNb; ++anIdx)
771 anEntitySet->GetSensitiveById (anIdx)->ResetSelectionActiveStatus();
776 //=======================================================================
777 // function : DetectedEntity
778 // purpose : Returns sensitive entity that was detected during the
779 // previous run of selection algorithm
780 //=======================================================================
781 const Handle(SelectBasics_SensitiveEntity)& SelectMgr_ViewerSelector::DetectedEntity() const
783 const Handle(SelectMgr_EntityOwner)& anOwner = myDetectedIter.Key();
784 const Handle(SelectMgr_SelectableObject)& anObject = anOwner->Selectable();
785 const NCollection_Handle<SelectMgr_SensitiveEntitySet>& anEntitySet =
786 myMapOfObjectSensitives.Find (anObject);
788 return anEntitySet->GetSensitiveById (myDetectedIter.Value())->BaseSensitive();
791 //=======================================================================
792 // function : ActiveOwners
793 // purpose : Returns the list of active entity owners
794 //=======================================================================
795 NCollection_List<Handle(SelectBasics_EntityOwner)> SelectMgr_ViewerSelector::ActiveOwners() const
797 NCollection_List<Handle(SelectBasics_EntityOwner)> anActiveOwners;
798 for (SelectMgr_MapOfObjectSensitivesIterator anIter (myMapOfObjectSensitives); anIter.More(); anIter.Next())
800 const NCollection_Handle<SelectMgr_SensitiveEntitySet>& anEntitySet = anIter.Value();
801 Standard_Integer anEntitiesNb = anEntitySet->Size();
802 for (Standard_Integer anIdx = 0; anIdx < anEntitiesNb; ++anIdx)
804 if (anEntitySet->GetSensitiveById (anIdx)->IsActiveForSelection())
806 anActiveOwners.Append (anEntitySet->GetSensitiveById (anIdx)->BaseSensitive()->OwnerId());
811 return anActiveOwners;