#include <Standard_Type.hxx>
#include <TopLoc_Location.hxx>
+IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_SelectableObject,PrsMgr_PresentableObject)
+
static Standard_Integer Search (const SelectMgr_SequenceOfSelection& seq,
const Handle (SelectMgr_Selection)& theSel)
{
// Purpose :
//==================================================
-SelectMgr_SelectableObject::SelectMgr_SelectableObject( const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d):
- PrsMgr_PresentableObject (aTypeOfPresentation3d),
+SelectMgr_SelectableObject::SelectMgr_SelectableObject (const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d)
+: PrsMgr_PresentableObject (aTypeOfPresentation3d),
myDrawer (new Prs3d_Drawer()),
myHilightDrawer (new Prs3d_Drawer()),
myAssemblyOwner (NULL),
- myAutoHilight (Standard_True)
+ myAutoHilight (Standard_True),
+ myGlobalSelMode (0)
{
InitDefaultHilightAttributes (myHilightDrawer);
myHilightDrawer->Link (myDrawer);
//==================================================
-// Function:
+// Function: HasSelection
// Purpose :
//==================================================
-
-Standard_Boolean SelectMgr_SelectableObject
-::HasSelection(const Standard_Integer aMode) const
+Standard_Boolean SelectMgr_SelectableObject::HasSelection (const Standard_Integer theMode) const
{
- Standard_Boolean Found=Standard_False;
- for (Standard_Integer I=1;I<= myselections.Length() && !Found;I++)
- { if(((myselections.Value(I))->Mode())==aMode)
- return Standard_True;
- }
+ for (Standard_Integer aSelIdx = 1; aSelIdx <= myselections.Length(); ++aSelIdx)
+ {
+ if (((myselections.Value (aSelIdx))->Mode()) == theMode)
+ return Standard_True;
+ }
return Standard_False;
}
return aBnd;
}
+
+//=======================================================================
+//function : GlobalSelOwner
+//purpose : Returns entity owner corresponding to selection of the object as a whole
+//=======================================================================
+Handle(SelectMgr_EntityOwner) SelectMgr_SelectableObject::GlobalSelOwner() const
+{
+ Handle(SelectMgr_EntityOwner) anOwner;
+
+ if (!HasSelection (myGlobalSelMode))
+ return anOwner;
+
+ const Handle(SelectMgr_Selection)& aGlobalSel = Selection (myGlobalSelMode);
+ if (aGlobalSel->IsEmpty())
+ return anOwner;
+
+ aGlobalSel->Init();
+ anOwner =
+ Handle(SelectMgr_EntityOwner)::DownCast (aGlobalSel->Sensitive()->BaseSensitive()->OwnerId());
+
+ return anOwner;
+}