namespace
{
- TopoDS_Shape AIS_myDummyShape;
-}
-
-static Standard_Integer GetHiMod(const Handle(AIS_InteractiveObject)& IO)
-{
- return IO->HasHilightMode() ? IO->HilightMode():0;
-}
-
-//=======================================================================
-//function : getHiStyle
-//purpose :
-//=======================================================================
-const Handle(Graphic3d_HighlightStyle)& AIS_LocalContext::getHiStyle (const Handle(SelectMgr_SelectableObject)& theObj) const
-{
- const Handle(Prs3d_Drawer)& aHiDrawer = theObj->HilightAttributes();
- return !aHiDrawer.IsNull() && aHiDrawer->HasOwnHighlightStyle()
- ? aHiDrawer->HighlightStyle() : myCTX->HighlightStyle();
-}
-
-//=======================================================================
-//function : getSelStyle
-//purpose :
-//=======================================================================
-const Handle(Graphic3d_HighlightStyle)& AIS_LocalContext::getSelStyle (const Handle(AIS_InteractiveObject)& theObj) const
-{
- const Handle(Prs3d_Drawer)& aHiDrawer = theObj->HilightAttributes();
- return !aHiDrawer.IsNull() && aHiDrawer->HasOwnSelectionStyle()
- ? aHiDrawer->SelectionStyle() : myCTX->SelectionStyle();
+ TopoDS_Shape AIS_LocalContext_myDummyShape;
}
//==================================================
return;
}
- const Standard_Integer aHilightMode = GetHiMod (Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable()));
+ const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
+ const Handle(Prs3d_Drawer)& aHiStyle = myCTX->getHiStyle (anObj, theOwner);
+ const Standard_Integer aHiMode = myCTX->getHilightMode (anObj, aHiStyle, -1);
myMainPM->BeginImmediateDraw();
- theOwner->HilightWithColor (myMainPM, getHiStyle (theOwner->Selectable()), aHilightMode);
+ theOwner->HilightWithColor (myMainPM, aHiStyle, aHiMode);
myMainPM->EndImmediateDraw (theView->Viewer());
}
return;
}
- const Handle(AIS_InteractiveObject)& anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
- const Standard_Integer aHilightMode = GetHiMod (anObj);
+ const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
if (IsSelected (theOwner))
{
if (theOwner->IsAutoHilight())
{
- theOwner->HilightWithColor (myMainPM, getSelStyle (anObj), aHilightMode);
+ const Handle(Prs3d_Drawer)& aSelStyle = myCTX->getSelStyle (anObj, theOwner);
+ const Standard_Integer aHiMode = myCTX->getHilightMode (anObj, aSelStyle, -1);
+ theOwner->HilightWithColor (myMainPM, aSelStyle, aHiMode);
}
}
else
{
- theOwner->Unhilight (myMainPM, aHilightMode);
+ theOwner->Unhilight (myMainPM);
}
}
if (anOwner->IsAutoHilight())
{
Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast(aSelObj);
- const Standard_Integer aHighMode = GetHiMod (anIO);
- anOwner->HilightWithColor (myMainPM, getSelStyle (anIO), aHighMode);
+ const Handle(Prs3d_Drawer)& aSelStyle = myCTX->getSelStyle (anIO, anOwner);
+ const Standard_Integer aHiMode = myCTX->getHilightMode (anIO, aSelStyle, -1);
+ anOwner->HilightWithColor (myMainPM, aSelStyle, aHiMode);
continue;
}
Handle(SelectMgr_SelectableObject) aSelObj = anOwner->Selectable();
Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (aSelObj);
anObjMap.Add (aSelObj);
- Standard_Integer aHighMode = GetHiMod (anIO);
- anOwner->Unhilight (myMainPM, aHighMode);
+ anOwner->Unhilight (myMainPM);
}
for (NCollection_Map<Handle(SelectMgr_SelectableObject)>::Iterator aMapIter (anObjMap);
Handle(SelectMgr_EntityOwner) EO = FindSelectedOwnerFromIO(anIObj);
if(EO.IsNull()){
- //check if in selection number 0 there is an owner that can be triturated...
- if(anIObj->HasSelection(0)){
- const Handle(SelectMgr_Selection)& SIOBJ = anIObj->Selection(0);
- SIOBJ->Init();
- if(SIOBJ->More()){
- Handle(SelectBasics_EntityOwner) BO = SIOBJ->Sensitive()->BaseSensitive()->OwnerId();
- EO = Handle(SelectMgr_EntityOwner)::DownCast (BO);
- }
+ //check if global selection there is an owner that can be triturated...
+ if (anIObj->HasSelection (anIObj->GlobalSelectionMode()))
+ {
+ EO = anIObj->GlobalSelOwner();
}
if(EO.IsNull())
EO = new SelectMgr_EntityOwner((const Handle(SelectMgr_SelectableObject)&)anIObj);
if (EO.IsNull())
{
- if(anIObj->HasSelection(0))
+ if(anIObj->HasSelection (anIObj->GlobalSelectionMode()))
{
- const Handle(SelectMgr_Selection)& SIOBJ = anIObj->Selection(0);
- SIOBJ->Init();
- if(SIOBJ->More()){
- Handle(SelectBasics_EntityOwner) BO = SIOBJ->Sensitive()->BaseSensitive()->OwnerId();
- EO = Handle(SelectMgr_EntityOwner)::DownCast (BO);
- }
+ EO = anIObj->GlobalSelOwner();
}
if(EO.IsNull())
{
if(mylastindex != 0)
{
Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(myMapOfOwner->FindKey (mylastindex));
- if(BROwnr.IsNull()) return AIS_myDummyShape;
+ if(BROwnr.IsNull()) return AIS_LocalContext_myDummyShape;
return BROwnr->Shape();
}
- return AIS_myDummyShape;
+ return AIS_LocalContext_myDummyShape;
}
//=======================================================================
//purpose :
//=======================================================================
Standard_Boolean AIS_LocalContext::UnhilightLastDetected (const Handle(V3d_View)& theView)
+{
+ return UnhilightLastDetected (theView->Viewer());
+}
+
+//=======================================================================
+//function : UnhilightLastDetected
+//purpose :
+//=======================================================================
+Standard_Boolean AIS_LocalContext::UnhilightLastDetected (const Handle(V3d_Viewer)& theViewer)
{
if (!IsValidIndex (mylastindex))
{
myMainPM->BeginImmediateDraw();
const Handle(SelectMgr_EntityOwner)& anOwner = myMapOfOwner->FindKey (mylastindex);
- const Standard_Integer aHilightMode = anOwner->HasSelectable()
- ? GetHiMod (Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable()))
- : 0;
-
- myMapOfOwner->FindKey (mylastindex)->Unhilight (myMainPM, aHilightMode);
- myMainPM->EndImmediateDraw (theView->Viewer());
+ anOwner->Unhilight (myMainPM);
+ myMainPM->EndImmediateDraw (theViewer);
mylastindex = 0;
return Standard_True;
}
if (aCurrentShape.IsNull())
{
- return AIS_myDummyShape;
+ return AIS_LocalContext_myDummyShape;
}
return aCurrentShape->Shape();